:root {
  color-scheme: dark;
  --bg: #090c14;
  --bg-soft: #0d111c;
  --surface: #111725;
  --surface-2: #151c2b;
  --surface-3: #192132;
  --border: #2a3347;
  --border-soft: #20293a;
  --text: #edf0f7;
  --text-soft: #bec5d4;
  --dim: #7f899e;
  --muted: #5f6a80;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-soft: rgba(139, 92, 246, .14);
  --ok: #4dd294;
  --danger: #ff5f6d;
  --warn: #f6a72a;
  --blue: #6f91ff;
  --purple: #b679ff;
  --mint: #65d7bd;
  --r: 9px;
  --shadow: 0 18px 45px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { width: 100%; height: 100%; background: var(--bg); }

body {
  width: 100%;
  height: 100%;
  min-width: 320px;
  min-height: 0;
  padding: 0 clamp(6px, .75vw, 14px);
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 72% -10%, rgba(91, 78, 155, .15), transparent 32%),
    radial-gradient(circle at 8% 95%, rgba(43, 72, 119, .12), transparent 30%),
    linear-gradient(180deg, #090c14 0%, #0b0f19 46%, #090c14 100%);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }

.app-shell { --sidebar-width: clamp(230px, 18vw, 270px); width: min(1380px, calc(100% - 20px)); height: 100dvh; min-height: 0; max-width: 1380px; display: flex; flex-direction: column; margin: 0 auto; overflow: hidden; }

.topbar {
  flex: 0 0 auto;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 14px 10px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 270px; }
.brand h1 { font-size: 22px; line-height: 1.2; font-weight: 760; letter-spacing: .2px; }
.brand-caption { margin-top: 4px; color: var(--dim); font-size: 11px; transition: opacity .3s; }

.brand-mark { position: relative; width: 35px; height: 38px; flex: 0 0 35px; transform: rotate(-12deg); }
.brand-lens {
  position: absolute; left: 3px; top: 6px; width: 28px; height: 8px;
  border: 2px solid var(--accent-2); border-radius: 2px;
  box-shadow: 0 0 12px rgba(139, 92, 246, .2);
}
.brand-lens::before { content: ""; position: absolute; left: -8px; top: 1px; width: 6px; height: 3px; border: 2px solid var(--accent-2); }
.brand-lens::after { content: ""; position: absolute; right: 5px; top: 7px; width: 2px; height: 9px; background: var(--accent-2); }
.brand-tripod { position: absolute; left: 17px; top: 22px; width: 2px; height: 14px; background: var(--accent-2); }
.brand-tripod::before, .brand-tripod::after { content: ""; position: absolute; left: 0; top: 4px; width: 2px; height: 13px; background: var(--accent-2); transform-origin: top; }
.brand-tripod::before { transform: rotate(35deg); }
.brand-tripod::after { transform: rotate(-35deg); }

.top-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: .1px;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s, transform .18s, box-shadow .18s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-icon { font-family: Consolas, monospace; font-size: 15px; line-height: 1; color: var(--accent-2); }
.btn-primary {
  color: white;
  border-color: rgba(173, 148, 255, .65);
  background: linear-gradient(135deg, #7152e8, #8d5aee);
  box-shadow: 0 8px 22px rgba(99, 65, 210, .26), inset 0 1px rgba(255, 255, 255, .18);
}
.btn-primary .btn-icon { color: white; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #7d5df0, #9868f3); box-shadow: 0 10px 28px rgba(99, 65, 210, .34); }
.btn-secondary { color: var(--text-soft); border-color: var(--border); background: linear-gradient(180deg, rgba(27, 35, 52, .94), rgba(20, 27, 41, .94)); }
.btn-secondary:hover:not(:disabled) { color: white; border-color: #45516a; background: #1a2233; }
.btn-danger { color: #ff7783; border-color: rgba(255, 95, 109, .26); background: rgba(255, 95, 109, .07); }
.btn-danger .btn-icon { color: #ff6d79; }
.btn-danger:hover:not(:disabled) { border-color: rgba(255, 95, 109, .48); background: rgba(255, 95, 109, .12); }
.btn-wide { min-width: 148px; }
.btn-sm { min-height: 32px; padding: 6px 9px; border-radius: 6px; font-size: 11px; }

.surface {
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, .015), transparent 28%),
    linear-gradient(180deg, rgba(20, 27, 42, .96), rgba(15, 21, 33, .96));
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, .015);
}

.import-section { position: relative; flex: 0 0 auto; display: grid; grid-template-columns: calc(var(--sidebar-width) - 16px) minmax(0, 1fr); gap: 10px; align-items: stretch; padding: 13px 16px 11px; min-height: 145px; }
.import-guide {
  position: relative;
  width: auto;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 0 0;
  overflow: hidden;
  border-right: 1px solid rgba(70, 82, 116, .34);
}
.guide-title { margin-bottom: 6px; color: #edf0f7; font-size: 12px; font-weight: 750; letter-spacing: .1px; }
.guide-heading { display: flex; align-items: center; margin-bottom: 5px; color: var(--accent-2); font-size: 9px; font-weight: 700; }
.guide-heading .help-dot { width: 14px; height: 14px; margin-left: 4px; font-size: 7px; }
.guide-format { min-width: 0; height: 100%; display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 10px; color: var(--text-soft); border: 1px solid rgba(76, 88, 116, .36); border-radius: 7px; background: rgba(18, 25, 40, .48); }
.guide-format > div { min-width: 0; display: grid; gap: 1px; }
.guide-dot { width: 5px; height: 5px; flex: 0 0 5px; margin-top: 5px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 7px rgba(167, 139, 250, .42); }
.guide-format strong { color: #d9deea; font-size: 9px; line-height: 1.3; }
.guide-format code { overflow: hidden; color: #929db2; text-overflow: ellipsis; white-space: nowrap; font: 8px/1.35 Consolas, monospace; }
.guide-note { margin: 1px 0 0 2px; color: #758096; font-size: 8px; white-space: nowrap; }
.import-layout { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 172px; gap: 16px; align-items: stretch; margin-left: 0; }
#statusMsg, .progress-section { grid-column: 1 / -1; }
.import-workspace {
  min-width: 0;
  overflow: hidden;
  border: 1px dashed #465274;
  border-radius: 8px;
  background: linear-gradient(105deg, rgba(39, 48, 74, .38), rgba(22, 28, 45, .23));
}
.import-box {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 18px 22px 9px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.import-workspace:has(.import-box:hover) { border-color: var(--accent); background: rgba(84, 61, 150, .11); }
.import-workspace:has(.import-box.drag-over) { border-color: var(--accent-2); background: rgba(139, 92, 246, .13); }
.drop-copy p { margin-bottom: 7px; color: #dce1eb; font-size: 14px; font-weight: 650; letter-spacing: .2px; }
.drop-copy .hint { color: var(--dim); font-size: 11px; }
.upload-symbol { position: relative; width: 56px; height: 46px; color: var(--accent-2); flex: 0 0 56px; }
.upload-cloud { position: absolute; inset: -17px 0 auto; font-family: Georgia, serif; font-size: 74px; line-height: 1; transform: scaleX(1.1); }
.upload-arrow { position: absolute; left: 22px; top: 20px; font-size: 30px; font-weight: 300; line-height: 1; }
input[type="file"] { display: none; }
.json-input {
  display: block;
  width: calc(100% - 26px);
  height: 42px;
  min-height: 42px;
  margin: 0 13px 12px;
  padding: 11px 13px;
  resize: vertical;
  outline: none;
  color: var(--text-soft);
  border: 0;
  border-top: 1px solid rgba(70, 82, 116, .42);
  background: rgba(7, 11, 20, .22);
  font: 11px/1.5 Consolas, "SFMono-Regular", monospace;
}
.json-input:focus { color: white; background: rgba(7, 11, 20, .4); }
.json-input::placeholder { color: #667188; }
.import-actions { display: flex; flex-direction: column; justify-content: center; gap: 9px; }

.status-msg { margin-top: 11px; padding: 9px 12px; border: 1px solid transparent; border-radius: 6px; font-size: 11px; text-align: center; }
.status-msg.error { color: #ff7d88; border-color: rgba(255, 95, 109, .22); background: rgba(255, 95, 109, .07); }
.status-msg.success { color: #6be1a8; border-color: rgba(77, 210, 148, .2); background: rgba(77, 210, 148, .07); }
.status-msg.info { color: #8eabff; border-color: rgba(111, 145, 255, .19); background: rgba(111, 145, 255, .07); }

.progress-section { display: none; margin-top: 11px; padding: 10px 12px; border-radius: 7px; background: rgba(7, 11, 20, .35); }
.progress-head, .progress-text { display: flex; align-items: center; justify-content: space-between; color: var(--dim); font-size: 10px; }
.progress-head span:last-child { color: var(--accent-2); font-weight: 750; }
.progress-bar-outer { height: 5px; margin: 7px 0 5px; overflow: hidden; border-radius: 9px; background: rgba(255, 255, 255, .06); }
.progress-bar-inner { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7450e5, #aa7cf8); transition: width .3s; }

.report-section { display: none; flex: 0 0 auto; margin: 10px 0; }
.report-card { padding: 17px; margin-bottom: 10px; border: 1px solid var(--border-soft); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.report-title { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; font-size: 14px; font-weight: 700; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.report-stat { padding: 12px; text-align: center; border: 1px solid var(--border-soft); border-radius: 7px; background: rgba(255, 255, 255, .018); }
.report-stat .rv { font-size: 21px; font-weight: 800; }
.report-stat .rl { margin-top: 3px; color: var(--dim); font-size: 10px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.report-table th { padding: 8px; color: var(--dim); border-bottom: 1px solid var(--border); text-align: left; font-size: 10px; }
.report-table td { padding: 8px; border-bottom: 1px solid rgba(255, 255, 255, .035); }

.dashboard-layout { min-height: 0; height: auto; flex: 1 1 0; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); gap: 10px; margin: 10px 0 8px; overflow: hidden; align-items: stretch; }
.sidebar { min-height: 0; height: 100%; position: static; align-self: stretch; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; scrollbar-color: #414c63 #111725; scrollbar-width: thin; }
.overview-card, .format-card { padding: 16px 13px 13px; }
.overview-card { min-height: 0; height: 100%; flex: 1 1 auto; display: block; }
.panel-title { margin: 0 8px 12px; color: #c9cfdb; font-size: 12px; font-weight: 700; letter-spacing: .2px; }
.accent-title { color: var(--accent-2); }
.help-dot { display: inline-grid; width: 16px; height: 16px; margin-left: 4px; place-items: center; border: 1px solid #566077; border-radius: 50%; color: var(--dim); font-size: 9px; }

.stats-bar { display: grid; gap: 5px; }
.stat-item {
  position: relative;
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  color: var(--text-soft);
  border: 1px solid #30394d;
  border-radius: 7px;
  outline: none;
  background: linear-gradient(95deg, rgba(35, 43, 62, .58), rgba(24, 31, 47, .28));
  cursor: pointer;
  text-align: left;
  transition: background .17s, border-color .17s, transform .17s;
}
.stat-item:hover { transform: translateX(2px); border-color: #4a5670; background: rgba(38, 47, 68, .68); }
.stat-item.active { border-color: rgba(139, 92, 246, .72); background: linear-gradient(95deg, rgba(100, 70, 180, .24), rgba(29, 35, 52, .5)); box-shadow: inset 3px 0 var(--accent); }
.stat-icon { display: grid; width: 30px; height: 30px; place-items: center; color: var(--accent-2); border: 1px solid currentColor; border-radius: 50%; font-size: 17px; line-height: 1; }
.stat-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.stat-item .n { min-width: 30px; color: #f2f4fa; font-size: 20px; line-height: 1; text-align: right; }
.stat-ok { border-color: rgba(77, 210, 148, .24); background: linear-gradient(95deg, rgba(39, 80, 69, .18), rgba(24, 31, 47, .25)); }
.stat-ok .stat-icon, .stat-ok .n { color: var(--ok); }
.stat-fail { border-color: rgba(255, 95, 109, .23); background: linear-gradient(95deg, rgba(96, 41, 51, .17), rgba(24, 31, 47, .25)); }
.stat-fail .stat-icon, .stat-fail .n { color: var(--danger); }
.stat-query .stat-icon, .stat-query .n, .stat-all .stat-icon { color: var(--accent-2); }
.stat-warn { border-color: rgba(246, 167, 42, .25); background: linear-gradient(95deg, rgba(94, 66, 27, .19), rgba(24, 31, 47, .25)); }
.stat-warn .stat-icon, .stat-warn .n { color: var(--warn); }
.stat-mint { border-color: rgba(101, 215, 189, .22); background: linear-gradient(95deg, rgba(39, 92, 80, .17), rgba(24, 31, 47, .25)); }
.stat-mint .stat-icon, .stat-mint .n { color: var(--mint); }
.stat-purple { border-color: rgba(182, 121, 255, .24); background: linear-gradient(95deg, rgba(77, 48, 112, .2), rgba(24, 31, 47, .25)); }
.stat-purple .stat-icon, .stat-purple .n { color: var(--purple); }
.compat-counts { display: none; }

.format-card { min-height: 218px; }
.format-item { position: relative; display: grid; gap: 4px; margin: 0 8px 14px; padding-left: 15px; color: var(--text-soft); }
.format-item::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: #d6d9e2; }
.format-item strong { color: #e3e6ed; font-size: 12px; }
.format-item code { color: #a8b0c2; font: 10px Consolas, monospace; }
.format-item span { color: var(--muted); font-size: 10px; }
.format-note { margin: 16px 8px 2px; color: var(--dim); font-size: 10px; line-height: 1.7; }

.results-panel { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; padding: 14px 8px 0; overflow: hidden; }
.results-sticky {
  position: relative;
  flex: 0 0 auto;
  z-index: 30;
  margin: -14px -8px 0;
  padding: 14px 8px 0;
  border-bottom: 1px solid rgba(42, 51, 71, .7);
  border-radius: var(--r) var(--r) 0 0;
  background: linear-gradient(180deg, rgba(17, 23, 37, .99), rgba(17, 23, 37, .96));
  box-shadow: 0 12px 22px rgba(6, 9, 16, .18);
  backdrop-filter: blur(12px);
}
.result-actions { display: none; justify-content: flex-end; padding: 0 8px 9px; border-bottom: 1px solid rgba(42, 51, 71, .55); }
.result-actions .btn { min-height: 34px; padding: 6px 11px; font-size: 10px; }
.results-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 8px 11px; }
.result-actions + .results-toolbar { padding-top: 0; }
.result-actions[style*="display: flex"] + .results-toolbar { padding-top: 9px; }
.filter-bar { display: none !important; }
.filter-btn {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 8px 14px;
  color: #aeb6c7;
  border: 1px solid #343e53;
  border-right: 0;
  outline: none;
  background: rgba(15, 21, 33, .42);
  font-size: 10px;
  cursor: pointer;
  transition: color .17s, background .17s, border-color .17s;
}
.filter-btn:first-child { border-radius: 6px 0 0 6px; }
.filter-btn:last-child { border-right: 1px solid #343e53; border-radius: 0 6px 6px 0; }
.filter-btn:hover { color: white; background: rgba(44, 53, 75, .58); }
.filter-btn.active { color: white; border-color: #8f70ee; background: linear-gradient(135deg, #7153db, #8054d9); box-shadow: inset 0 1px rgba(255, 255, 255, .16); }
.filter-btn .cnt { display: inline-grid; min-width: 17px; height: 17px; margin-left: 5px; padding: 0 4px; place-items: center; border-radius: 4px; color: #d8dcec; background: rgba(255, 255, 255, .08); }
.filter-btn.active .cnt { background: rgba(255, 255, 255, .16); }
.secondary-filter { color: #8f98ab; }
.list-controls { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex: 0 0 auto; }
.density-toggle {
  height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  color: #aeb6c7;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: rgba(18, 24, 38, .78);
  font-size: 10px;
  white-space: nowrap;
  cursor: pointer;
  transition: color .17s, border-color .17s, background .17s;
}
.density-toggle:hover { color: white; border-color: #5b6680; }
.density-toggle.active { color: var(--accent-2); border-color: rgba(139, 92, 246, .48); background: rgba(139, 92, 246, .09); }
.density-toggle span { font-size: 15px; }
.search-wrap { min-width: 196px; height: 39px; display: flex; align-items: center; gap: 8px; padding: 0 11px; color: var(--dim); border: 1px solid var(--border); border-radius: 7px; background: rgba(18, 24, 38, .78); }
.search-wrap:focus-within { border-color: #6e5ba6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .08); }
.search-wrap > span { color: #9da6ba; font-size: 18px; transform: rotate(-12deg); }
.search-input { width: 100%; border: 0; outline: none; color: var(--text); background: transparent; font-size: 11px; }
.search-input::placeholder { color: #626d82; }
.page-size-wrap { height: 39px; display: flex; align-items: center; gap: 5px; padding: 0 10px; color: #b8bfd0; border: 1px solid var(--border); border-radius: 7px; background: rgba(18, 24, 38, .78); font-size: 11px; white-space: nowrap; }
.page-size-wrap select, .pagi-left select { padding: 2px; color: white; border: 0; outline: none; background: transparent; }
.page-size-wrap select { color-scheme: dark; cursor: pointer; }
.page-size-wrap select option,
.pagi-left select option { color: #eef1f7; background: #151c2b; }

.pagi-bar { min-height: 39px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px 10px; }
.pagi-left { display: flex; align-items: center; gap: 9px; color: var(--dim); font-size: 10px; }
.page-select { display: inline-flex; align-items: center; gap: 6px; color: #d5d9e2; cursor: pointer; white-space: nowrap; }
.page-select input, .select-wrap input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.page-select input:disabled { opacity: .4; cursor: not-allowed; }
.pagi-info { color: var(--dim); }
.pagi-right { display: flex; align-items: center; gap: 5px; }
.pagi-btn { min-width: 34px; height: 33px; padding: 0 9px; color: #98a2b6; border: 1px solid var(--border-soft); border-radius: 6px; outline: 0; background: rgba(20, 27, 42, .8); font-size: 11px; cursor: pointer; }
.pagi-btn:hover:not(:disabled) { color: white; border-color: #4c5871; }
.pagi-btn.active { color: white; border-color: #7e64da; background: linear-gradient(135deg, #7658df, #8b5cf6); }
.pagi-btn:disabled { opacity: .25; cursor: not-allowed; }
.pagi-bottom { padding-top: 10px; border-top: 1px solid var(--border-soft); }

.accounts-table-wrap {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(8, 13, 23, .32);
  scrollbar-color: #414c63 #111725;
  scrollbar-width: thin;
}
.accounts-head, .account-row {
  display: grid;
  grid-template-columns: 32px minmax(170px, 1.65fr) minmax(62px, .55fr) minmax(62px, .55fr) minmax(66px, .62fr) minmax(94px, 1fr) minmax(94px, 1fr) 88px;
  align-items: center;
  gap: clamp(4px, .5vw, 8px);
}
.accounts-head { position: sticky; top: 0; z-index: 12; width: 100%; min-width: 0; min-height: 52px; padding: 0 clamp(8px, .75vw, 14px); color: #858fa4; border-bottom: 1px solid var(--border); background: rgba(17, 23, 37, .98); box-shadow: 0 7px 16px rgba(4, 7, 13, .18); font-size: 10px; }
.accounts-head span:last-child { text-align: center; }
.accounts-grid { width: 100%; min-width: 0; min-height: 100%; }
.account-card { position: relative; border-bottom: 1px solid var(--border-soft); background: rgba(14, 20, 32, .3); animation: fadeIn .22s ease; transition: background .17s; }
.account-card:last-child { border-bottom: 0; }
.account-card:hover { background: rgba(30, 38, 56, .34); }
.account-row { width: 100%; min-width: 0; min-height: 85px; padding: 12px clamp(8px, .75vw, 14px); }
.select-wrap { display: grid; place-items: center; }
.account-main { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; }
.account-avatar { position: relative; width: 38px; height: 38px; display: grid; place-items: center; color: #dce0ea; border: 1px solid #586279; border-radius: 50%; background: linear-gradient(145deg, #242c3d, #171d2a); font-size: 17px; }
.account-avatar::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; border: 1px solid transparent; border-top-color: rgba(167, 139, 250, .45); transform: rotate(35deg); }
.account-copy { min-width: 0; }
.account-heading { min-width: 0; display: flex; align-items: center; gap: 8px; }
.card-email { display: block; min-width: 0; flex: 1; overflow: hidden; color: #d8dde8; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 560; }
.account-tags { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.account-sub { min-height: 16px; margin-top: 5px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.account-sub.error { color: var(--danger); }
.account-sub.loading { color: var(--accent-2); }
.account-sub.unsupported { color: var(--warn); }
.plan-mini { display: inline-flex; padding: 2px 7px; color: var(--ok); border: 1px solid rgba(77, 210, 148, .28); border-radius: 4px; background: rgba(77, 210, 148, .08); font-size: 8px; font-weight: 700; white-space: nowrap; }
.account-billing { display: inline-flex; padding: 2px 7px; color: var(--warn); border: 1px solid rgba(246, 167, 42, .25); border-radius: 4px; background: rgba(246, 167, 42, .07); font-size: 8px; font-weight: 700; white-space: nowrap; }

.badge { display: inline-flex; min-height: 25px; align-items: center; justify-content: center; padding: 4px 9px; border: 1px solid transparent; border-radius: 5px; white-space: nowrap; font-size: 9px; font-weight: 700; letter-spacing: .15px; }
.source-cell, .plan-cell, .status-cell { min-width: 0; }
.source-cell .badge, .plan-cell .badge, .status-cell .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.badge-source-sub2api { color: #9a87ff; border-color: rgba(137, 111, 255, .34); background: rgba(111, 82, 211, .1); }
.badge-source-cpa { color: #f5a934; border-color: rgba(246, 167, 42, .38); background: rgba(141, 88, 17, .16); }
.badge-plan { color: var(--purple); border-color: rgba(182, 121, 255, .34); background: rgba(110, 54, 150, .12); }
.badge-type { color: var(--blue); border-color: rgba(111, 145, 255, .3); background: rgba(57, 83, 160, .1); }
.status-badge { min-width: 66px; }
.badge-active { color: var(--ok); border-color: rgba(77, 210, 148, .3); background: rgba(41, 119, 84, .14); }
.badge-err, .badge-expired, .badge-account-expired { color: var(--danger); border-color: rgba(255, 95, 109, .34); background: rgba(153, 47, 57, .14); }
.badge-warn, .badge-account-expiring { color: var(--warn); border-color: rgba(246, 167, 42, .34); background: rgba(133, 85, 18, .14); }
.badge-pending, .badge-disabled { color: #9099aa; border-color: rgba(144, 153, 170, .24); background: rgba(92, 101, 119, .09); }
.badge-loading { color: var(--accent-2); border-color: rgba(167, 139, 250, .3); background: rgba(115, 77, 183, .12); }

.quota-cell { min-width: 0; }
.quota-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; color: #d9dde5; font-size: 11px; }
.quota-track { height: 7px; margin-bottom: 7px; overflow: hidden; border-radius: 7px; background: rgba(148, 158, 177, .27); }
.quota-fill { height: 100%; border-radius: inherit; transition: width .6s cubic-bezier(.4, 0, .2, 1); }
.quota-fill.high { background: linear-gradient(90deg, #43c987, #62dba3); }
.quota-fill.medium { background: linear-gradient(90deg, #e89b21, #f4bd4f); }
.quota-fill.low { background: linear-gradient(90deg, #e47636, #f49a52); }
.quota-fill.critical { background: linear-gradient(90deg, #ef4d5e, #ff707c); }
.quota-pct { flex: 0 0 auto; font-weight: 700; }
.quota-meta { overflow: hidden; color: var(--dim); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.quota-empty .quota-track { width: 75%; }
.quota-empty .quota-pct, .quota-empty .quota-meta { color: #687286; }

.card-actions { display: flex; align-items: center; justify-content: center; gap: 6px; }
.icon-btn { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; color: #c8ceda; }
.icon-btn:hover:not(:disabled) { color: white; }
.icon-btn.danger-action { color: var(--danger); }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255, 255, 255, .16); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .65s linear infinite; }

.account-supplement { padding: 0 58px 11px; }
.billing-inline { display: flex; gap: 7px; flex-wrap: wrap; }
.bi { min-width: 112px; display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 6px 9px; color: var(--dim); border: 1px solid rgba(246, 167, 42, .14); border-radius: 5px; background: rgba(246, 167, 42, .045); font-size: 9px; }
.bi b { color: var(--warn); font-size: 11px; }

.card-detail { display: none; margin: 0 14px 13px 58px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 7px; background: rgba(6, 10, 18, .42); }
.card-detail.open { display: block; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin-bottom: 10px; }
.info-item { min-width: 0; padding: 7px 8px; border: 1px solid rgba(255, 255, 255, .04); border-radius: 5px; background: rgba(255, 255, 255, .018); }
.info-label { margin-bottom: 3px; color: var(--dim); font-size: 8px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.info-value { overflow-wrap: anywhere; color: var(--text-soft); font: 9px/1.5 Consolas, monospace; }
.info-value.money { color: var(--warn); font-weight: 700; }
.info-value.expire-dead { color: var(--danger); }
.info-value.expire-warn { color: var(--warn); }
.toggle-row { display: flex; gap: 8px; flex-wrap: wrap; }
.raw-toggle { padding: 5px 8px; color: #9ba5b8; border: 1px solid var(--border-soft); border-radius: 5px; background: rgba(255, 255, 255, .02); font-size: 9px; cursor: pointer; }
.raw-toggle:hover { color: white; border-color: #48536a; }
.raw-data { max-height: 220px; margin-top: 8px; padding: 10px; overflow: auto; color: #818ba0; border: 1px solid var(--border-soft); border-radius: 5px; background: #090d16; white-space: pre-wrap; overflow-wrap: anywhere; font: 9px/1.5 Consolas, monospace; }
.token-row { display: flex; align-items: center; gap: 7px; margin-top: 5px; padding: 5px 7px; border-radius: 5px; background: rgba(255, 255, 255, .02); }
.token-label { min-width: 85px; color: var(--dim); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.token-value { min-width: 0; flex: 1; overflow: hidden; color: #778196; text-overflow: ellipsis; white-space: nowrap; font: 9px Consolas, monospace; }

.empty-state { min-height: 330px; display: grid; place-content: center; justify-items: center; padding: 42px 18px; color: var(--dim); text-align: center; }
.empty-state .ei { width: 58px; height: 58px; display: grid; margin-bottom: 13px; place-items: center; color: var(--accent-2); border: 1px solid rgba(167, 139, 250, .28); border-radius: 15px; background: rgba(139, 92, 246, .07); font-size: 25px; }
.empty-state .et { margin-bottom: 5px; color: #b9c0ce; font-size: 13px; font-weight: 650; }
.empty-state .ed { color: var(--muted); font-size: 10px; }

.footer { display: none; }

body.report-open { height: auto; min-height: 100%; overflow-y: auto; }
body.report-open .app-shell { height: auto; min-height: 100dvh; overflow: visible; }
body.report-open .dashboard-layout { min-height: 620px; overflow: visible; }
body.report-open .results-panel { min-height: 620px; }
body.report-open .accounts-table-wrap { max-height: 72vh; }

/* Dense account list: enabled by default and reversible with the density switch. */
.compact-mode .accounts-head,
.compact-mode .account-row {
  grid-template-columns: 28px minmax(165px, 1.55fr) minmax(58px, .52fr) minmax(58px, .52fr) minmax(62px, .58fr) minmax(90px, 1fr) minmax(90px, 1fr) 82px;
  gap: clamp(3px, .4vw, 6px);
}
.compact-mode .accounts-head { width: 100%; min-width: 0; min-height: 38px; padding-inline: clamp(7px, .6vw, 11px); }
.compact-mode .accounts-grid { width: 100%; min-width: 0; }
.compact-mode .account-row { min-height: 52px; padding: 6px clamp(7px, .6vw, 11px); }
.compact-mode .account-main { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
.compact-mode .account-avatar { width: 30px; height: 30px; font-size: 13px; }
.compact-mode .account-heading { gap: 6px; }
.compact-mode .card-email { font-size: 10px; }
.compact-mode .plan-mini,
.compact-mode .account-billing { padding: 1px 5px; font-size: 7px; }
.compact-mode .account-sub { min-height: 0; margin-top: 2px; font-size: 8px; line-height: 1.25; }
.compact-mode .account-sub:not(.error):not(.loading):not(.unsupported) { display: none; }
.compact-mode .badge { min-height: 22px; padding: 3px 7px; font-size: 8px; }
.compact-mode .status-badge { min-width: 58px; }
.compact-mode .quota-cell { min-width: 0; display: grid; grid-template-columns: minmax(54px, 1fr) 36px; align-items: center; gap: 6px; }
.compact-mode .quota-track { margin: 0; height: 6px; }
.compact-mode .quota-top { display: contents; }
.compact-mode .quota-meta { display: none; }
.compact-mode .quota-pct { grid-column: 2; text-align: right; font-size: 9px; }
.compact-mode .quota-empty .quota-track { width: 100%; }
.compact-mode .card-actions { gap: 4px; }
.compact-mode .icon-btn { width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; font-size: 10px; }
.compact-mode .card-detail { margin-left: 48px; }

.live-status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  width: min(248px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid #48546d;
  border-radius: 12px;
  background: rgba(17, 23, 37, .94);
  box-shadow: 0 14px 35px rgba(0, 0, 0, .42);
  backdrop-filter: blur(10px);
}
.live-status-title { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 12px; font-weight: 800; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(95, 106, 128, .15); }
.live-status.is-online .live-dot { background: var(--blue); box-shadow: 0 0 0 3px rgba(82, 157, 255, .16), 0 0 10px rgba(82, 157, 255, .45); }
.live-status.is-active .live-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(77, 210, 148, .16), 0 0 12px rgba(77, 210, 148, .72); animation: livePulse 1.5s ease-in-out infinite; }
.live-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.live-status-item { min-width: 0; padding: 8px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--bg-soft); }
.live-status-item span { display: block; overflow: hidden; color: var(--dim); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.live-status-item strong { display: inline-block; margin-top: 3px; color: var(--blue); font-size: 19px; line-height: 1.1; }
.live-status.is-active .live-status-active strong { color: var(--ok); }
.live-status-total { grid-column: 1 / -1; }
.live-status-item em { margin-left: 2px; color: var(--muted); font-size: 10px; font-style: normal; }
.live-status-limit { margin-top: 9px; color: var(--muted); font-size: 10px; text-align: center; }
.live-status-limit b { color: var(--warn); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@keyframes livePulse { 50% { transform: scale(1.14); } }

@media (max-height: 800px) and (min-width: 561px) {
  .topbar { min-height: 54px; padding-top: 7px; padding-bottom: 7px; }
  .brand-caption { display: none; }
  .top-actions .btn { min-height: 34px; padding-block: 6px; }
  .import-section { min-height: 0; padding-top: 18px; padding-bottom: 8px; }
  .import-guide { padding: 0 14px 0 0; }
  .guide-title { margin-bottom: 4px; font-size: 11px; }
  .guide-heading { margin-bottom: 3px; font-size: 8px; }
  .guide-format { gap: 6px; margin: 0; padding: 4px 7px; }
  .guide-format strong { font-size: 8px; }
  .guide-format code { font-size: 7px; }
  .guide-note { display: block; font-size: 7px; }
  .import-box { min-height: 58px; padding: 8px 18px 4px; }
  .upload-symbol { height: 36px; transform: scale(.72); }
  .drop-copy p { margin-bottom: 3px; font-size: 12px; }
  .drop-copy .hint { font-size: 9px; }
  .json-input { height: 30px; min-height: 30px; margin-bottom: 7px; padding-block: 7px; }
  .import-actions { gap: 5px; }
  .import-actions .btn { min-height: 32px; padding-block: 5px; }
  .dashboard-layout { height: auto; margin-top: 8px; }
  .results-panel { padding-top: 9px; }
  .results-sticky { margin-top: -9px; padding-top: 9px; }
  .results-toolbar { padding-bottom: 7px; }
  .pagi-bar { min-height: 34px; padding-bottom: 7px; }
}

@media (max-width: 1700px) {
  .results-toolbar { flex-direction: column; }
  .filter-btn,
  .filter-btn:first-child,
  .filter-btn:last-child { border: 1px solid #343e53; border-radius: 6px; }
  .list-controls { width: 100%; }
  .search-wrap { flex: 1; }
}

@media (max-width: 1380px) {
  .app-shell { --sidebar-width: 270px; }
}

@media (max-width: 1120px) {
  .topbar { align-items: flex-start; }
  .import-section { display: block; padding: 12px; }
  .import-layout { margin-left: 0; }
  .import-guide { display: none; }
  .dashboard-layout { height: auto; min-height: 560px; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { height: auto; display: block; overflow: visible; }
  .overview-card { height: auto; display: block; padding: 9px 10px; }
  .overview-card .panel-title { margin-bottom: 7px; }
  .stats-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(39px, auto)); grid-auto-rows: minmax(39px, auto); }
  .stat-item { min-height: 39px; height: auto; grid-template-columns: 27px minmax(0, 1fr) auto; padding: 5px 8px; }
  .stat-icon { width: 25px; height: 25px; font-size: 14px; }
  .stat-item .n { min-width: 22px; font-size: 17px; }
  .format-card { display: none; }
}

@media (max-width: 820px) {
  body { padding: 0 8px 18px; }
  .topbar { flex-direction: column; padding: 14px 5px; }
  .top-actions { width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .top-actions .btn { min-height: 36px; padding: 7px 12px; }
  .import-section { display: block; padding: 12px; }
  .import-layout { margin-left: 0; }
  .import-guide { display: none; }
  .import-layout { grid-template-columns: 1fr; }
  .import-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .btn-wide { min-width: 0; }
  .sidebar { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .results-toolbar { padding-inline: 3px; }
  .list-controls { align-items: stretch; }
  .search-wrap { min-width: 0; }
  .accounts-table-wrap { max-height: none; border: 0; background: transparent; overflow: auto; }
  .accounts-head { display: none !important; }
  .accounts-grid { min-width: 0; display: grid; gap: 8px; }
  .account-card { border: 1px solid var(--border); border-radius: 8px; background: rgba(15, 21, 34, .72); }
  .account-row {
    min-height: 0;
    grid-template-columns: 27px minmax(0, 1fr) auto;
    grid-template-areas:
      "select account actions"
      ". source status"
      ". plan status"
      ". hourly hourly"
      ". weekly weekly";
    padding: 12px;
  }
  .select-wrap { grid-area: select; align-self: start; padding-top: 11px; }
  .account-main { grid-area: account; }
  .source-cell { grid-area: source; justify-self: start; }
  .plan-cell { grid-area: plan; justify-self: start; }
  .status-cell { grid-area: status; align-self: start; }
  .hourly-cell { grid-area: hourly; padding-top: 8px; }
  .weekly-cell { grid-area: weekly; padding-top: 5px; }
  .card-actions { grid-area: actions; }
  .account-supplement { padding: 0 12px 12px 51px; }
  .card-detail { margin: 0 12px 12px; }
  .pagi-bar { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  body { height: auto; min-height: 100%; overflow-y: auto; }
  .app-shell { height: auto; min-height: 100dvh; overflow: visible; }
  .dashboard-layout { min-height: 560px; overflow: visible; }
  .results-panel { min-height: 430px; }
  .brand h1 { font-size: 19px; }
  .import-box { justify-content: flex-start; gap: 14px; padding-inline: 14px; }
  .upload-symbol { transform: scale(.8); margin-left: -4px; }
  .drop-copy p { font-size: 12px; }
  .import-actions { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: minmax(39px, auto); }
  .list-controls { flex-direction: column; }
  .page-size-wrap { justify-content: center; }
  .filter-btn { padding-inline: 11px; }
  .live-status { right: 12px; bottom: 12px; width: min(236px, calc(100vw - 24px)); }
}
