:root {
  --bg0: #07060d;
  --bg1: #0b0717;
  --panel: rgba(16, 14, 26, 0.7);
  --panel2: rgba(16, 14, 26, 0.45);
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.6);
  --muted2: rgba(255, 255, 255, 0.42);
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --danger: #ef4444;
  --success: #2ecc71;
  --warning: #f5a524;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 50% -120px, rgba(59, 130, 246, 0.35), transparent 60%),
    radial-gradient(900px 500px at 10% 0%, rgba(96, 165, 250, 0.22), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  color: var(--text);
  overflow: hidden;
}

.topbar-search {
  width: min(340px, 36vw);
}

.quick-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.quick-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
}

.platform-strip {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 2px 10px;
}

.platform-card {
  width: 132px;
  height: 116px;
  flex: 0 0 auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: 0.15s;
  outline: none;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.platform-card:hover {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.06);
}

.platform-card:focus-visible {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.platform-card.selected {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.platform-card.dragging {
  opacity: 0.55;
}

.platform-card.drop-target {
  border-color: rgba(74, 123, 167, 0.85);
  box-shadow: 0 0 0 4px rgba(58, 107, 143, 0.18);
}

.platform-thumb {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(74, 123, 167, 0.28);
  background: rgba(58, 107, 143, 0.18);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.platform-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.platform-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.platform-name {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-select {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: 0.15s;
  display: inline-grid;
  place-items: center;
}

.platform-select:hover {
  border-color: rgba(74, 123, 167, 0.7);
  background: rgba(20, 25, 40, 0.45);
}

.platform-select.selected {
  border-color: rgba(74, 123, 167, 0.9);
  background: rgba(58, 107, 143, 0.55);
}

.platform-select.selected::before {
  content: "✓";
  font-size: 14px;
  color: #fff;
  line-height: 1;
}

.hidden {
  display: none !important;
}

.app-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.app-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.topbar-center {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.7);
  border: 1px solid rgba(60, 75, 95, 0.3);
  max-width: 100%;
  overflow-x: auto;
}

.mode-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
}

.mode-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.mode-tab.active {
  color: #fff;
  background: rgba(58, 107, 143, 0.5);
  border-color: rgba(74, 123, 167, 0.6);
  box-shadow: 0 0 0 4px rgba(58, 107, 143, 0.15);
}

.topbar-right {
  justify-self: end;
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:hover {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.06);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  border-color: rgba(59, 130, 246, 0.55);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.5), rgba(37, 99, 235, 0.45));
  color: rgba(255, 255, 255, 0.92);
}

.btn-primary:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.6), rgba(37, 99, 235, 0.55));
}

.btn-secondary {
  color: var(--muted);
}

.btn-secondary:hover {
  color: var(--text);
}

.btn-danger {
  border-color: rgba(255, 77, 79, 0.55);
  color: #ffb4b6;
}

.btn-danger:hover {
  border-color: rgba(255, 77, 79, 0.9);
  background: rgba(255, 77, 79, 0.12);
  color: #ffd7d8;
}

.btn-small {
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
}

.btn-file {
  position: relative;
  overflow: hidden;
}

.btn-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.main {
  flex: 1;
  min-height: 0;
  display: flex;
}

.view {
  display: none;
  width: 100%;
  height: 100%;
}

.view.active {
  display: block;
}

.layout {
  height: 100%;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  padding: 14px;
}

.sidebar {
  background: rgba(10, 12, 18, 0.7);
  border: 1px solid rgba(60, 75, 95, 0.3);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  backdrop-filter: blur(16px);
}

.sidebar-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(60, 75, 95, 0.2);
}

.sidebar-title {
  font-weight: 700;
}

.sidebar-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sidebar-tools {
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid rgba(60, 75, 95, 0.2);
}

.content {
  background: rgba(10, 12, 18, 0.55);
  border: 1px solid rgba(60, 75, 95, 0.3);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  backdrop-filter: blur(16px);
}

.content-header {
  padding: 14px;
  border-bottom: 1px solid rgba(60, 75, 95, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.content-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.platform-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(20, 20, 20, 0.45);
}

.meta-item {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 500;
}

.meta-key {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.meta-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

.meta-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(58, 107, 143, 0.35);
  border: 1px solid rgba(74, 123, 167, 0.35);
  color: #d9f0ff;
  font-size: 12px;
  font-weight: 600;
}

.content-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-box {
  width: min(460px, 40vw);
}

.input,
.select,
.search-box input {
  width: 100%;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(60, 75, 95, 0.35);
  background: rgba(20, 20, 20, 0.6);
  color: var(--text-primary);
  padding: 0 12px;
  outline: none;
  transition: 0.15s;
}

.input:focus,
.select:focus,
.search-box input:focus {
  border-color: rgba(74, 123, 167, 0.75);
  box-shadow: 0 0 0 4px rgba(58, 107, 143, 0.18);
}

.list {
  padding: 10px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.list-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(20, 20, 20, 0.55);
  color: var(--text-primary);
  cursor: pointer;
  transition: 0.15s;
}

.list-item[draggable="true"] {
  cursor: grab;
}

.list-item.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.list-item.drop-target {
  border-color: rgba(74, 123, 167, 0.85);
  box-shadow: 0 0 0 4px rgba(58, 107, 143, 0.18);
}

.list-item:hover {
  border-color: rgba(74, 123, 167, 0.55);
  background: rgba(20, 25, 40, 0.65);
}

.list-item.active {
  border-color: rgba(74, 123, 167, 0.75);
  background: rgba(58, 107, 143, 0.28);
}

.list-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(58, 107, 143, 0.25);
  border: 1px solid rgba(74, 123, 167, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.list-text {
  text-align: left;
  font-size: 13px;
}

.list-badge {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(60, 75, 95, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
}

.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(10, 12, 18, 0.9);
  border-bottom: 1px solid rgba(60, 75, 95, 0.25);
  text-align: left;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
  padding: 12px 14px;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(60, 75, 95, 0.12);
  vertical-align: top;
  font-size: 13px;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.cell-title {
  font-weight: 700;
}

.cell-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  color: rgba(255, 255, 255, 0.85);
}

.cell-note {
  color: rgba(255, 255, 255, 0.75);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.8);
}

.status-ready {
  border-color: rgba(46, 204, 113, 0.35);
  background: rgba(46, 204, 113, 0.12);
  color: rgba(179, 255, 213, 0.95);
}

.status-authorized {
  border-color: rgba(46, 204, 113, 0.65);
  background: rgba(46, 204, 113, 0.18);
  color: rgba(179, 255, 213, 0.95);
}

.status-pending {
  border-color: rgba(245, 165, 36, 0.6);
  background: rgba(245, 165, 36, 0.14);
  color: rgba(255, 227, 179, 0.95);
}

.status-unauthorized {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.1);
  color: rgba(226, 232, 240, 0.85);
}

.status-expired {
  border-color: rgba(255, 77, 79, 0.6);
  background: rgba(255, 77, 79, 0.14);
  color: rgba(255, 205, 206, 0.95);
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  padding: 40px;
}

.empty-state.muted {
  position: static;
  padding: 18px 14px;
  place-content: start;
}

.empty-title {
  font-weight: 700;
}

.empty-desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.account-list {
  padding: 10px;
  overflow: auto;
  display: grid;
  gap: 8px;
  min-height: 0;
}

.platform-groups {
  padding: 10px;
  overflow: auto;
  display: grid;
  gap: 10px;
  min-height: 0;
}

.platform-group {
  border-radius: 14px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(20, 20, 20, 0.42);
  overflow: hidden;
}

.platform-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.platform-group-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.platform-group-title {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.platform-group-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(58, 107, 143, 0.25);
  border: 1px solid rgba(74, 123, 167, 0.25);
  display: grid;
  place-content: center;
  font-size: 14px;
  flex: 0 0 auto;
}

.platform-group-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.platform-group-right {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

.platform-group-count {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(60, 75, 95, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
}

.platform-group-chevron {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(0, 0, 0, 0.1);
  display: grid;
  place-content: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  transition: 0.15s;
}

.platform-group.collapsed .platform-group-chevron {
  transform: rotate(-90deg);
}

.platform-group-body {
  padding: 10px;
  border-top: 1px solid rgba(60, 75, 95, 0.18);
  display: grid;
  gap: 10px;
}

.platform-group.collapsed .platform-group-body {
  display: none;
}

.account-item {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(20, 20, 20, 0.55);
  color: var(--text-primary);
  cursor: pointer;
  transition: 0.15s;
  text-align: left;
}

.account-item:hover {
  border-color: rgba(74, 123, 167, 0.55);
  background: rgba(20, 25, 40, 0.65);
}

.account-item.active {
  border-color: rgba(74, 123, 167, 0.75);
  background: rgba(58, 107, 143, 0.28);
}

.account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(58, 107, 143, 0.25);
  border: 1px solid rgba(74, 123, 167, 0.25);
  display: grid;
  place-content: center;
  font-weight: 700;
}

.account-name {
  font-weight: 700;
  font-size: 13px;
}

.account-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.webview-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: rgba(0, 0, 0, 0.1);
}

.webview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  padding: 40px;
  pointer-events: none;
  z-index: 1;
}

#platform-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0f1117;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: min(720px, 92vw);
  border-radius: 14px;
  border: 1px solid rgba(60, 75, 95, 0.35);
  background: rgba(10, 12, 18, 0.85);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(60, 75, 95, 0.22);
}

.modal-title {
  font-weight: 700;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(60, 75, 95, 0.35);
  background: rgba(20, 20, 20, 0.6);
  color: var(--text-primary);
  cursor: pointer;
}

.icon-btn:hover {
  border-color: rgba(74, 123, 167, 0.55);
  background: rgba(20, 25, 40, 0.75);
}

.modal-body {
  padding: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.auth-card {
  border-radius: 14px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(20, 20, 20, 0.45);
  padding: 12px;
}

.auth-title {
  font-weight: 700;
}

.auth-desc {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.auth-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.auth-status {
  margin-left: auto;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(60, 75, 95, 0.25);
  background: rgba(0, 0, 0, 0.15);
}

.label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.checkbox {
  align-items: center;
  grid-auto-flow: column;
  justify-content: start;
  gap: 10px;
}

.checkbox input {
  width: 16px;
  height: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(60, 75, 95, 0.22);
}