/* Soveliq Admin — dark, calm, dense.
   Matches the landing palette (apps/localist/lib/shared/theme/app_colors.dart). */

:root {
  --bg: #0f1417;
  --bg-elev: #161b1f;
  --surface: #1c2227;
  --surface-hover: #232a30;
  --surface-active: #2a323a;
  --border: #232a30;
  --border-strong: #2f373e;
  --text: #f0f3f5;
  --muted: #8c95a0;
  --dim: #5d6770;
  --accent: #14b8a6;
  --accent-hover: #11a395;
  --accent-soft: rgba(20, 184, 166, 0.14);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --warn: #f59e0b;
  --info: #3b82f6;
  --time: #c084fc;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1, h2, h3 { color: var(--text); margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 600; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
code { font-family: var(--mono); font-size: .88em; background: var(--surface); padding: 1px 5px; border-radius: 4px; }

/* === BOOT === */
.boot {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

/* === LOGIN === */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.login-card h1 {
  margin-bottom: 4px;
  font-size: 1.3rem;
}
.login-card .muted { margin-bottom: 24px; font-size: .9rem; }
.field { display: block; margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .92rem;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }

.error-banner {
  background: var(--danger-soft);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 14px;
}

.info-banner {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(20,184,166,0.3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 14px;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 550;
  font-size: .88rem;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  font-family: inherit;
}
.btn:hover { background: var(--surface-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #06231f; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface); }
.btn.small { padding: 5px 10px; font-size: .8rem; }
.btn.block { width: 100%; justify-content: center; }

/* === SHELL === */
.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #11161a;
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 1rem;
  color: var(--text);
  padding: 4px 10px 18px;
}
.sidebar-brand img { border-radius: 6px; }
.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
}
.sidebar-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.sidebar-link.active { background: var(--accent-soft); color: var(--text); }
.sidebar-link .badge {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: .7rem;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.sidebar-bottom { margin-top: auto; padding: 8px 10px; font-size: .78rem; color: var(--dim); }
.sidebar-bottom a { color: var(--muted); }

.main {
  padding: 24px 32px 48px;
  min-width: 0;
  overflow-x: hidden;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 1.4rem; }
.page-head .meta { color: var(--muted); font-size: .85rem; }

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar .search {
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}
.toolbar input, .toolbar select {
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .88rem;
}
.toolbar input { width: 100%; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }

/* === CARDS / SECTIONS === */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card + .card { margin-top: 14px; }
.card h2 { margin-bottom: 14px; }
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}
.stat-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-value { font-size: 1.5rem; font-weight: 650; color: var(--text); line-height: 1.1; }
.stat-sub { color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* === TABLES === */
.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  background: #11161a;
  color: var(--muted);
  font-weight: 550;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border-strong);
  position: sticky;
  top: 0;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr {
  cursor: default;
  transition: background .1s;
}
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface); }
table.data td.num { font-variant-numeric: tabular-nums; text-align: right; }
table.data td.nowrap { white-space: nowrap; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 4px;
  color: var(--muted);
  font-size: .85rem;
}
.pager .controls { display: flex; gap: 8px; }

.empty {
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .02em;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: rgba(245,158,11,0.15); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: #fca5a5; }
.badge.dim { color: var(--dim); }
.badge.priority-1 { background: rgba(239,68,68,0.16); color: #fca5a5; }
.badge.priority-2 { background: rgba(245,158,11,0.16); color: var(--warn); }
.badge.priority-3 { background: rgba(59,130,246,0.16); color: var(--info); }
.badge.priority-4 { background: rgba(255,255,255,0.06); color: var(--muted); }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  margin-right: 6px;
  vertical-align: middle;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 16px;
  font-size: .9rem;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }

/* === DIALOG === */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 24px;
}
.dialog {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
}
.dialog h2 { margin-bottom: 14px; }
.dialog .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
  }
  .sidebar-brand { padding: 0 12px 0 4px; }
  .sidebar-link { white-space: nowrap; }
  .sidebar-bottom { display: none; }
  .main { padding: 18px; }
  .page-head h1 { font-size: 1.2rem; }
  .kv { grid-template-columns: 1fr; }
}
