:root {
  color-scheme: dark;
  --bg: #0d1113;
  --panel: #151b1e;
  --field: #0f1416;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f7f6;
  --muted: #98a3a5;
  --mint: #79dfc2;
  --gold: #f4b85f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 7px; }
.hidden { display: none !important; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; min-height: 64px; border-bottom: 1px solid var(--line); padding: 10px 24px; background: rgba(13, 17, 19, 0.94); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand small, td small { display: block; margin-top: 3px; color: var(--muted); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; color: #0c1110; background: var(--gold); font-size: 12px; font-weight: 900; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.connection { color: var(--muted); font-size: 13px; }
.connection.online { color: var(--mint); }
main { width: min(1500px, 100%); margin: 0 auto; padding: 24px; }
.login-view { display: grid; place-items: center; min-height: calc(100vh - 112px); }
.login-panel { width: min(430px, 100%); border: 1px solid var(--line); padding: 24px; background: var(--panel); }
.eyebrow { color: var(--gold); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1, h2, p { margin: 0; }
.login-panel h1 { margin-top: 6px; }
.login-panel p { margin: 10px 0 20px; color: var(--muted); line-height: 1.5; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; color: var(--text); background: var(--field); }
textarea { resize: vertical; }
button { min-height: 40px; padding: 9px 13px; color: #0b1110; background: var(--mint); font-weight: 800; }
.login-panel > button { width: 100%; margin-top: 14px; }
.quiet { border: 1px solid var(--line); color: var(--text); background: var(--panel); }
.danger { border: 1px solid rgba(255, 111, 111, 0.35); color: #ffb0b0; background: transparent; }
.error { margin-top: 12px; border: 1px solid rgba(255, 111, 111, 0.4); padding: 10px; color: #ffb0b0; background: rgba(255, 111, 111, 0.07); }
.notice { border: 1px solid rgba(121, 223, 194, 0.35); padding: 10px; color: var(--mint); background: rgba(121, 223, 194, 0.07); }
.tabs { display: flex; gap: 5px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs button { flex: 0 0 auto; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); background: transparent; }
.tabs button.active { border-color: var(--mint); color: var(--text); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 18px; }
.section-head h1 { margin-top: 4px; font-size: 27px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { border: 1px solid var(--line); padding: 18px; background: var(--panel); }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 28px; }
.search { display: flex; width: min(520px, 100%); }
.search input { border-radius: 7px 0 0 7px; }
.search button { border-radius: 0 7px 7px 0; }
.table-shell { border: 1px solid var(--line); background: var(--panel); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); background: #111719; font-size: 12px; text-transform: uppercase; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; color: var(--muted); font-size: 12px; }
.badge.success { border-color: rgba(121, 223, 194, 0.35); color: var(--mint); }
.empty { padding: 36px; color: var(--muted); text-align: center; }
dialog { width: min(560px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 8px; padding: 0; color: var(--text); background: var(--panel); }
dialog::backdrop { background: rgba(4, 7, 8, 0.75); backdrop-filter: blur(8px); }
dialog form { display: grid; gap: 14px; padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.icon-button { display: grid; place-items: center; width: 36px; min-height: 36px; padding: 0; color: var(--text); background: var(--field); font-size: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 18px; min-height: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions { display: flex; gap: 6px; }
.upload-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.upload-control input { padding: 7px; }

@media (max-width: 760px) {
  .topbar { padding: 9px 12px; }
  .brand small, .connection { display: none; }
  main { padding: 16px 12px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 14px; }
  .metric strong { font-size: 23px; }
  .form-grid { grid-template-columns: 1fr; }
}
