/* Dolly Admin — design system mirrors the mobile apps */
:root {
  --orange: #FF7A3D;
  --pink: #F31E7A;
  --grad: linear-gradient(90deg, #FF7A3D 0%, #F31E7A 100%);
  --ink: #070A2B;
  --indigo: #6C5CE7;
  --green: #1E9E5F;
  --amber: #FFB020;
  --red: #E5484D;
  --text: #1A1A2E;
  --muted: #6B6B80;
  --bg: #F7F7FB;
  --card: #FFFFFF;
  --line: #E8E8F0;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(32,26,56,.06), 0 8px 24px rgba(32,26,56,.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px;
}
.brand-name { color: #fff; font-weight: 800; font-size: 19px; letter-spacing: -.3px; }
.brand-tag { color: rgba(255,255,255,.45); font-size: 11px; font-weight: 600; letter-spacing: .6px; }

.nav-section { color: rgba(255,255,255,.35); font-size: 10px; font-weight: 700;
  letter-spacing: 1px; padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px; cursor: pointer;
  color: rgba(255,255,255,.62); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--grad); color: #fff; font-weight: 600; }
.nav-item .ico { width: 17px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}
.nav-item.active .badge { background: rgba(0,0,0,.25); }

.main { padding: 26px 30px 60px; max-width: 1400px; }

.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.topbar h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topbar .spacer { flex: 1; }

.admin-chip {
  display: flex; align-items: center; gap: 9px; background: var(--card);
  border: 1px solid var(--line); border-radius: 40px; padding: 6px 14px 6px 6px;
}
.admin-chip .av { width: 30px; height: 30px; border-radius: 50%; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; }
.admin-chip .nm { font-size: 13px; font-weight: 600; }
.admin-chip .rl { font-size: 11px; color: var(--muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .spacer { flex: 1; }

/* KPI grid */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); }
.kpi .top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kpi .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  font-size: 16px; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .val { font-size: 27px; font-weight: 800; letter-spacing: -.6px; }
.kpi .delta { font-size: 12px; font-weight: 600; margin-top: 4px; }
.up { color: var(--green); } .down { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .5px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: #FCFCFE;
}
td { padding: 13px 20px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFD; }
.t-name { display: flex; align-items: center; gap: 10px; }
.t-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #EEE; }
.t-sub { font-size: 11.5px; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

/* ---------- Bits ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.pill.green { background: rgba(30,158,95,.12); color: var(--green); }
.pill.amber { background: rgba(255,176,32,.15); color: #B77900; }
.pill.red   { background: rgba(229,72,77,.12); color: var(--red); }
.pill.grey  { background: #EFEEF4; color: var(--muted); }
.pill.indigo{ background: rgba(108,92,231,.12); color: var(--indigo); }
.pill.pink  { background: rgba(243,30,122,.10); color: var(--pink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.btn {
  border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 11px;
  background: var(--grad); color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn:disabled { background: #E0DCE8; color: var(--muted); cursor: not-allowed; }

.search {
  flex: 1; max-width: 320px; padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card);
  font-family: inherit; font-size: 13px; outline: none;
}
.search:focus { border-color: var(--pink); }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty .em { font-size: 34px; display: block; margin-bottom: 10px; }

/* Bar chart */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 10px 0; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.bar { width: 100%; border-radius: 7px 7px 3px 3px; background: var(--grad); min-height: 4px; }
.bar-lbl { font-size: 10.5px; color: var(--muted); font-weight: 600; }

/* Feed */
.feed-row { display: flex; gap: 11px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  align-items: flex-start; }
.feed-row:last-child { border-bottom: none; }
.feed-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 14px; flex-shrink: 0; }
.feed-txt { font-size: 13px; line-height: 1.45; }
.feed-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

.view { display: none; }
.view.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------ live-data panel additions */
.toolbar{display:flex;gap:8px;margin-bottom:14px;flex-wrap:wrap}
.input{padding:9px 12px;border:1px solid var(--line,#E6E8F0);border-radius:8px;
       font:inherit;background:#fff;color:inherit;min-width:180px}
.input:focus{outline:none;border-color:#6C5CE7;box-shadow:0 0 0 3px rgba(108,92,231,.14)}
.hint{color:var(--muted,#6B7280);font-size:13px;margin:0 0 12px}
.tablewrap{overflow-x:auto}
.btn.sm{padding:5px 10px;font-size:12.5px}
.btn.ok{background:#E7F7EE;color:#1E7F4E;border-color:#BFE8D2}
.btn.bad{background:#FEF3F2;color:#B42318;border-color:#FEE4E2}
.btn.primary{background:linear-gradient(135deg,#FF5F6D,#FF3B7F);color:#fff;border:0}
.pill.ok{background:#E7F7EE;color:#1E7F4E}
.pill.warn{background:#FFF4E5;color:#B54708}
.pill.bad{background:#FEF3F2;color:#B42318}
.queue-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.queue{border:1px solid var(--line,#E6E8F0);border-radius:12px;padding:16px;background:#fff;
       cursor:pointer;text-align:left;font:inherit}
.queue.has{border-color:#FFD8A8;background:#FFFBF5}
.queue-n{font-size:26px;font-weight:700}
.queue-l{color:var(--muted,#6B7280);font-size:13px}
.cfgbar{display:flex;gap:18px;flex-wrap:wrap;padding:10px 0 14px;font-size:13px;
        color:var(--muted,#6B7280)}
.form{display:grid;gap:12px}
.form label{display:grid;gap:5px;font-size:12.5px;font-weight:600;color:var(--muted,#6B7280)}
.form .input{font-weight:400;color:inherit}
.kv{display:grid;grid-template-columns:auto 1fr;gap:8px 18px;margin:16px 0}
.kv dt{color:var(--muted,#6B7280);font-size:13px}
.kv dd{margin:0;font-size:14px}
.kpis.small .kpi-v{font-size:20px}
.modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:18px;flex-wrap:wrap}
code.tiny{font-size:11.5px;color:var(--muted,#6B7280)}
#modal{display:none}
#modal.show{display:block}
.modal-bg{position:fixed;inset:0;background:rgba(7,10,43,.45);z-index:50}
.modal-box{position:fixed;z-index:51;top:50%;left:50%;transform:translate(-50%,-50%);
  width:min(560px,92vw);max-height:86vh;overflow:auto;background:#fff;border-radius:16px;
  padding:22px;box-shadow:0 20px 60px rgba(7,10,43,.25)}
#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(80px);
  background:#070A2B;color:#fff;padding:12px 20px;border-radius:10px;font-size:14px;
  opacity:0;transition:.25s;z-index:60;max-width:90vw}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
#toast.bad{background:#B42318}

/* ---------------------------------------------------------------------------
   Rules for the class names the panel actually emits.
   The stylesheet had grown a parallel set — .card-head, .kpi .lbl, .kpi .val —
   that nothing used, so every card header and every figure on the dashboard was
   rendering unstyled: no padding, no rule under the title, numbers the same
   size as their labels.
   --------------------------------------------------------------------------- */
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.card-h h3 { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: -.1px; }
/* Keeps a row of buttons together and off the title. */
.card-h > div { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.kpi-l { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.kpi-v {
  font-size: 27px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15;
  /* Digits line up column to column rather than drifting with their widths. */
  font-variant-numeric: tabular-nums;
}
.kpi-s { font-size: 12px; color: var(--muted); margin-top: 4px; }

.modal-body { padding: 20px; }

/* A card's own content needs the padding the header already has; a bare table
   supplies its own, so this only applies to loose content. */
.card > p,
.card > .form,
.card > .hint,
.card > .modal-actions { padding-left: 20px; padding-right: 20px; }
.card > p:last-child,
.card > .form:last-child { padding-bottom: 18px; }

/* Table cells hold two lines in places — a name over a user code, interests over
   a bio — so they align to the top rather than floating in the middle. */
td { vertical-align: middle; }
td .hint { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
/* Numbers and dates read as columns when they share an alignment. */
th:last-child, td:last-child { text-align: right; white-space: nowrap; }
td audio { vertical-align: middle; }

/* A search box inside a card lines up with the rows it filters. */
.card > .toolbar { padding: 14px 20px 0; margin-bottom: 12px; }
.card > .toolbar .input { flex: 1; min-width: 200px; }
