:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: rgba(13, 25, 43, 0.82);
  --panel-solid: #0d192b;
  --line: rgba(125, 211, 252, 0.14);
  --line-strong: rgba(34, 211, 238, 0.34);
  --text: #e7f0f7;
  --muted: #8296a9;
  --cyan: #22d3ee;
  --blue: #60a5fa;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #fb7185;
  --gradient: linear-gradient(135deg, #22d3ee, #3b82f6 55%, #6366f1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 82% -10%, rgba(37, 99, 235, 0.22), transparent 34%), radial-gradient(circle at -5% 35%, rgba(6, 182, 212, 0.12), transparent 30%), var(--bg); }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.admin-shell { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 64px; }
.admin-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 74px; border-bottom: 1px solid var(--line); background: rgba(7, 16, 29, 0.82); backdrop-filter: blur(18px); }
.admin-brand { display: inline-flex; align-items: center; gap: 12px; }
.admin-brand img { width: 38px; height: 38px; object-fit: contain; }
.admin-brand span { display: grid; gap: 3px; }
.admin-brand strong { font-size: 15px; letter-spacing: 0.02em; }
.admin-brand small, .eyebrow { color: var(--cyan); font-size: 9px; font-weight: 700; letter-spacing: 0.18em; }
.admin-header-actions { display: flex; align-items: center; gap: 10px; }
.admin-identity { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.button, .text-button { border: 1px solid var(--line-strong); color: var(--cyan); background: rgba(34, 211, 238, 0.07); cursor: pointer; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: 9px; font-size: 12px; font-weight: 700; }
.button:hover { background: rgba(34, 211, 238, 0.13); }
.button.ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.text-button { padding: 5px 8px; border-radius: 7px; font-size: 11px; }
.text-button.danger { color: var(--red); border-color: rgba(251, 113, 133, 0.28); background: rgba(251, 113, 133, 0.07); }

.state-panel { margin: 90px auto; max-width: 560px; padding: 36px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); text-align: center; }
.state-panel.danger { border-color: rgba(251, 113, 133, 0.35); }
.state-panel p { color: var(--muted); }
.admin-tabs { display: flex; gap: 4px; margin: 24px 0 32px; padding: 5px; width: fit-content; border: 1px solid var(--line); border-radius: 12px; background: rgba(13, 25, 43, 0.62); }
.tab { min-height: 36px; padding: 0 16px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.tab.active { color: #06131d; background: var(--gradient); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-heading h1 { margin: 4px 0 0; font-size: clamp(22px, 3vw, 34px); font-weight: 650; letter-spacing: -0.03em; }
.eyebrow { margin: 0; }
.count-label { color: var(--muted); font-size: 12px; }

select, input { min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: var(--text); background: rgba(9, 20, 35, 0.9); }
select:focus, input:focus { border-color: var(--line-strong); }
.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters input { flex: 1; min-width: 220px; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.metric-card, .card { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12); }
.metric-card { padding: 18px; border-radius: 14px; }
.metric-card span { color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; margin-top: 9px; font-size: 25px; font-weight: 650; }
.dashboard-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
.card { padding: 20px; border-radius: 14px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; }
.card h2 { margin: 0 0 16px; font-size: 14px; }
.card-heading span { color: var(--green); font-size: 12px; }
.status-bars { display: grid; gap: 12px; }
.status-row { display: grid; grid-template-columns: 70px 1fr 44px; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.status-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.06); }
.status-fill { height: 100%; border-radius: inherit; background: var(--gradient); }
.definition-list { display: grid; gap: 12px; margin: 0; }
.definition-list div { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.definition-list dt { color: var(--muted); font-size: 11px; }
.definition-list dd { margin: 0; font-size: 12px; }

.table-shell { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { position: sticky; top: 0; z-index: 1; padding: 12px 14px; color: var(--muted); background: var(--panel-solid); font-size: 10px; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; }
td { padding: 13px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(96, 165, 250, 0.035); }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.user-cell img, .avatar-fallback { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; color: #06131d; background: var(--gradient); font-weight: 800; }
.primary-line { display: block; max-width: 260px; overflow: hidden; color: var(--text); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.secondary-line { display: block; max-width: 260px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; color: var(--muted); background: rgba(148, 163, 184, 0.1); font-size: 10px; font-weight: 750; }
.badge.done, .badge.active { color: var(--green); background: rgba(52, 211, 153, 0.1); }
.badge.failed, .badge.disabled { color: var(--red); background: rgba(251, 113, 133, 0.1); }
.badge.running { color: var(--cyan); background: rgba(34, 211, 238, 0.1); }
.badge.queued { color: var(--yellow); background: rgba(251, 191, 36, 0.1); }
.quota-input { width: 70px; min-height: 32px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; min-width: 220px; }
.empty-row { padding: 38px; color: var(--muted); text-align: center; }

dialog { width: min(900px, calc(100% - 32px)); max-height: 82vh; padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 15px; color: var(--text); background: var(--panel-solid); box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55); }
dialog::backdrop { background: rgba(2, 8, 18, 0.72); backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; font-size: 15px; }
.dialog-heading button { border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 24px; }
dialog pre { max-height: 68vh; margin: 0; padding: 18px; overflow: auto; color: #b8d6e8; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.feedback-dialog-body { display: grid; gap: 14px; padding: 18px; }
.feedback-toolbar, .feedback-reply-actions { display: flex; justify-content: flex-end; gap: 8px; }
.feedback-conversation { display: grid; gap: 10px; max-height: 45vh; overflow: auto; padding: 4px; }
.feedback-message { max-width: 82%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(96, 165, 250, 0.06); }
.feedback-message.admin { justify-self: end; border-color: rgba(34, 211, 238, 0.25); background: rgba(34, 211, 238, 0.08); }
.feedback-message.internal { justify-self: stretch; max-width: 100%; border-style: dashed; color: var(--yellow); background: rgba(251, 191, 36, 0.05); }
.feedback-message span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.feedback-message p { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.feedback-dialog textarea { width: 100%; padding: 11px; resize: vertical; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--text); background: rgba(9, 20, 35, 0.9); }
.feedback-notifications { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 12px; }
.feedback-notification { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: #10233a; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); font-size: 12px; }
.toast.error { border-color: rgba(251, 113, 133, 0.5); color: #fecdd3; }

@media (max-width: 1100px) { .metric-grid { grid-template-columns: repeat(3, 1fr); } .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .admin-shell { width: min(100% - 20px, 1500px); } .admin-header { position: static; align-items: flex-start; padding: 14px 0; } .admin-header-actions { flex-wrap: wrap; justify-content: flex-end; } .admin-identity { display: none; } .admin-tabs { width: 100%; overflow-x: auto; } .tab { flex: 1; min-width: 90px; padding-inline: 10px; } .metric-grid { grid-template-columns: repeat(2, 1fr); } .filters { flex-wrap: wrap; } .filters input { width: 100%; } .section-heading { align-items: flex-start; } }
