/* Admin panel: phone first, same tokens as the public site. */
.admin-body { background: var(--bg); min-height: 100svh; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.admin-who { color: var(--soft); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reauth { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 16px 8px; padding: 10px 14px; border-radius: 12px; border: 1px solid #FFB38A; background: rgba(255,179,138,.12); color: var(--text); font-size: 14px; }
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px max(16px, env(safe-area-inset-right, 0px)) 10px; scrollbar-width: none; position: sticky; top: 0; z-index: 2; background: linear-gradient(180deg, var(--bg) 70%, rgba(2,2,14,0)); }
.admin-tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; border: 1px solid rgba(140,123,255,.35); background: rgba(10,10,34,.6); color: var(--soft); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.tab.is-active { color: var(--text); border-color: var(--gold); background: rgba(140,123,255,.18); }
.admin-main { padding: 6px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); max-width: 1080px; margin: 0 auto; }
.admin-gate { padding: 40px 0; text-align: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: var(--panel, rgba(10,10,34,.72)); border: 1px solid rgba(140,123,255,.25); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.big { font-size: 30px; font-weight: 600; line-height: 1.1; }
.delta { font-size: 13px; color: var(--soft); margin-left: 6px; }
.delta.up { color: #8CE99A; }
.delta.down { color: #FF8A8A; }
.read-at { font-size: 12px; color: var(--soft); white-space: nowrap; }
.read-at.stale { color: #FFB38A; }
.read-at.live { color: #8FE3B0; }
.read-at.live::before { content: "● "; }
.read-at.stale::before { content: "⚠ "; }
.bar { margin: 10px 0; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--soft); margin-bottom: 4px; }
.bar-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--violet), var(--gold)); width: 0; transition: width .4s; }
.muted { color: var(--soft); font-size: 13px; }
.plain { white-space: pre-wrap; font: inherit; font-size: 13px; color: var(--soft); margin: 0; }

.list { display: grid; gap: 10px; }
.row { background: var(--panel, rgba(10,10,34,.72)); border: 1px solid rgba(140,123,255,.2); border-radius: 14px; padding: 12px 14px; }
.row-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.row-title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(140,123,255,.4); color: var(--soft); margin-right: 6px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--soft); margin-top: 6px; }
.stats b { color: var(--text); font-weight: 600; }
.seg { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.comment-text { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-box { display: grid; gap: 8px; margin-top: 8px; }
.reply-box textarea { width: 100%; min-height: 64px; border-radius: 10px; border: 1px solid rgba(140,123,255,.35); background: rgba(2,2,14,.6); color: var(--text); font: inherit; padding: 8px 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; background: linear-gradient(90deg, var(--violet), var(--gold)); color: #12102a; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid rgba(140,123,255,.45); color: var(--text); font-weight: 400; }
.btn:disabled { opacity: .5; cursor: default; }
.answered { color: var(--soft); font-size: 13px; margin-top: 6px; overflow-wrap: anywhere; }
table.ads { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ads th, table.ads td { text-align: left; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
table.ads td.n, table.ads th.n { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.budget-form { display: grid; gap: 10px; }
.budget-form .field { display: grid; gap: 4px; font-size: 14px; }
.budget-form input, .actions select, .actions input.cap { font: inherit; color: var(--text, #F1EEFF); background: rgba(2,2,14,.55); border: 1px solid rgba(140,123,255,.28); border-radius: 10px; padding: 9px 11px; }
.actions input.cap { width: 110px; }

.row.urgent { border-color: #e5484d; box-shadow: 0 0 0 1px #e5484d inset; }
.chip-followup { border-color: #ffc56b; color: #1b1530; background: #ffc56b; font-weight: 600; }
.thread-context { margin: 6px 0 4px; padding: 6px 10px; border-left: 3px solid rgba(255,197,107,.6); background: rgba(140,123,255,.08); border-radius: 0 8px 8px 0; }
.ctx-line { margin: 2px 0; font-size: 13px; color: var(--soft); cursor: pointer; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ctx-line.is-open { display: block; -webkit-line-clamp: unset; }
.ctx-line strong { font-weight: 600; }
.chip-urgent { border-color: #e5484d; color: #fff; background: #e5484d; font-weight: 600; }
.urgent-hint { margin: 4px 0 8px; padding: 8px 10px; border-radius: 8px; background: rgba(229,72,77,.12); color: var(--soft); font-size: 14px; }
.budget-form textarea { font: inherit; color: var(--text, #F1EEFF); background: rgba(2,2,14,.55); border: 1px solid rgba(140,123,255,.28); border-radius: 10px; padding: 9px 11px; min-height: 80px; }
.budget-form select { font: inherit; color: var(--text, #F1EEFF); background: rgba(2,2,14,.55); border: 1px solid rgba(140,123,255,.28); border-radius: 10px; padding: 9px 11px; }
.budget-form h4, .card h4 { margin: 14px 0 4px; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }

/* Loading placeholders: the panel draws at once and each value shimmers until its data arrives. */
.skel { height: 64px; border-radius: 14px; background: linear-gradient(90deg, rgba(140,123,255,.08) 25%, rgba(140,123,255,.2) 50%, rgba(140,123,255,.08) 75%); background-size: 200% 100%; animation: skel 1.3s linear infinite; }
.skel-num { height: 34px; width: 55%; border-radius: 8px; margin: 2px 0 6px; }
.skel-line { height: 12px; border-radius: 6px; margin: 10px 0; }
.skel-card { height: 140px; margin-bottom: 12px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.btn.ghost.danger { border-color: rgba(255,138,138,.55); color: #FF8A8A; }
