:root {
  --bg: #0b1016;
  --panel: #111820;
  --panel-2: #151e28;
  --line: #26313d;
  --text: #edf2f5;
  --muted: #8693a0;
  --acid: #cbe968;
  --acid-dark: #a8c34f;
  --danger: #ef8278;
  --warning: #e5b85f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; background: var(--bg); }
body { min-width: 320px; margin: 0; background: var(--bg); color: var(--text); font-family: "Instrument Sans", sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 62px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(11,16,22,.96);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand > i { width: 22px; height: 22px; background: var(--acid); clip-path: polygon(0 15%, 35% 0, 100% 12%, 91% 100%, 8% 88%); }
.brand span { display: flex; flex-direction: column; }
.brand b { font-family: "Oswald", sans-serif; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.brand small, .signed-in span { color: var(--muted); font-family: "DM Mono", monospace; font-size: 8px; text-transform: uppercase; }
.signed-in { display: flex; align-items: center; gap: 14px; }

.auth-shell {
  min-height: calc(100vh - 62px);
  padding: 7vw max(24px, 10vw);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 480px);
  align-items: center;
  gap: 8vw;
  background:
    linear-gradient(rgba(203,233,104,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(203,233,104,.035) 1px, transparent 1px);
  background-size: 42px 42px;
}
.auth-copy h1, .panel-heading h1 {
  margin: 8px 0;
  font-family: "Oswald", sans-serif;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .95;
  text-transform: uppercase;
}
.auth-copy p { max-width: 530px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.eyebrow { color: var(--acid); font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.auth-card, .inline-form, .account-form {
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 25px 80px rgba(0,0,0,.3);
}
.auth-card h2 { margin: 7px 0 24px; font-family: "Oswald", sans-serif; font-size: 28px; text-transform: uppercase; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
input, select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  background: #0b1118;
  color: var(--text);
  font-size: 13px;
  text-transform: none;
}
input:focus, select:focus { border-color: var(--acid); box-shadow: 0 0 0 2px rgba(203,233,104,.12); }
.auth-card label + label, .auth-card .form-row + label, .account-form label + label { margin-top: 15px; }
.auth-card small, .account-form small { display: block; margin: 8px 0; color: var(--muted); font-size: 10px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-row label + label { margin-top: 0; }

.primary-button, .quiet-button, .danger-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--text);
  background: var(--panel-2);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.primary-button { border-color: var(--acid); background: var(--acid); color: #10150c; font-weight: 600; }
.primary-button:hover { background: var(--acid-dark); }
.quiet-button:hover { border-color: #53616f; }
.danger-button { border-color: rgba(239,130,120,.45); color: var(--danger); }
.auth-card > .primary-button, .account-form > .primary-button { width: 100%; margin-top: 20px; }
.form-message { min-height: 18px; margin: 12px 0 0; color: var(--danger); font-size: 11px; }

.admin-shell { min-height: calc(100vh - 62px); display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.admin-sidebar {
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  padding: 30px 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: #0d131a;
}
.admin-sidebar nav { margin-top: 18px; display: grid; gap: 4px; }
.nav-button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-button:hover { color: var(--text); }
.nav-button.active { border-color: var(--line); background: var(--panel); color: var(--acid); }
.back-link { color: var(--muted); font-size: 11px; text-decoration: none; }
.admin-content { min-width: 0; padding: 36px clamp(20px, 4vw, 60px) 80px; }
.view-panel { display: none; }
.view-panel.active { display: block; }
.panel-heading { min-height: 105px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.panel-heading h1 { font-size: clamp(38px, 5vw, 64px); }
.panel-heading p, .subsection-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.search-control { width: min(320px, 40vw); }
.summary-strip { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.summary-strip > div { padding: 16px 18px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span, .build-head, .user-meta span, .activity-meta, .session-meta {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.summary-strip b { display: block; margin-top: 4px; font-size: 22px; }

.build-table { margin-top: 14px; border: 1px solid var(--line); }
.review-filters { display: flex; gap: 8px; margin-top: 16px; }
.review-filters .active { border-color: var(--acid); color: var(--acid); }
.build-head, .build-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.3fr) 120px minmax(110px, .8fr) 112px 100px minmax(120px, .9fr) 78px;
  align-items: center;
  gap: 8px;
}
.build-head { min-height: 36px; padding: 0 12px; background: #0e141c; border-bottom: 1px solid var(--line); }
.build-row { min-height: 62px; padding: 9px 12px; border-bottom: 1px solid rgba(134,147,160,.13); }
.build-row:last-child { border-bottom: 0; }
.build-row.dirty { background: rgba(229,184,95,.035); box-shadow: inset 3px 0 var(--warning); }
.build-row.needs-review { background: rgba(239,130,120,.045); }
.review-status { font-size: 9px; text-transform: uppercase; }
.review-status.fresh { color: var(--acid); }
.review-status.aging { color: var(--warning); }
.review-status.stale { color: var(--danger); }
.hero-identity { min-width: 0; display: flex; align-items: center; gap: 10px; }
.hero-identity img { width: 34px; height: 34px; object-fit: cover; background: var(--panel-2); }
.hero-identity span { min-width: 0; display: flex; flex-direction: column; }
.hero-identity b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.hero-identity small { color: var(--muted); font-size: 8px; }
.build-row input, .build-row select { height: 34px; padding: 0 8px; font-size: 10px; }
.save-build { min-height: 34px; padding: 0 8px; }
.save-build:disabled { opacity: .35; cursor: default; }

.build-row.flash { animation: row-flash 1.6s ease; }
@keyframes row-flash { 0%, 40% { background: rgba(203,233,104,.16); } 100% { background: transparent; } }
.nav-button { display: flex; align-items: center; justify-content: space-between; }
.nav-badge { min-width: 22px; padding: 2px 6px; border-radius: 11px; background: var(--danger); color: #1a0c0a; font-family: "DM Mono", monospace; font-size: 10px; font-weight: 600; text-align: center; }
.review-alert {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(239,130,120,.45);
  border-left: 4px solid var(--danger);
  background: rgba(239,130,120,.07);
}
.review-alert.checking { border-color: var(--line); border-left-color: var(--muted); background: var(--panel); color: var(--muted); }
.review-alert.clear { border-color: rgba(203,233,104,.35); border-left-color: var(--acid); background: rgba(203,233,104,.05); }
.review-alert > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.review-alert b { font-size: 15px; }
.review-alert > div:first-child span { color: #f2b3ac; font-size: 12px; }
.review-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.review-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px 4px 4px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}
.review-chip:hover { border-color: var(--text); }
.review-chip img { width: 24px; height: 24px; object-fit: cover; }
.review-chip small { font-family: "DM Mono", monospace; font-size: 10px; }
.review-chip.stale small { color: var(--danger); }
.review-chip.aging small { color: var(--warning); }
.notice { margin-bottom: 20px; padding: 14px 16px; border: 1px solid var(--line); font-size: 12px; }
.notice.warning { border-color: rgba(229,184,95,.45); color: #f0cf8b; background: rgba(229,184,95,.06); }
.notice button { margin-left: 10px; border: 0; cursor: pointer; background: transparent; color: var(--acid); text-decoration: underline; }
.activity-list, .user-list, .session-list { margin-top: 26px; border: 1px solid var(--line); }
.activity-item, .user-item, .session-item { min-height: 66px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid rgba(134,147,160,.13); }
.activity-item:last-child, .user-item:last-child, .session-item:last-child { border-bottom: 0; }
.activity-item > div:first-child, .user-identity { min-width: 0; }
.activity-item b, .user-identity b, .session-item b { display: block; font-size: 12px; }
.activity-item p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.activity-meta { flex: none; text-align: right; }
.user-identity { display: flex; flex-direction: column; }
.user-meta { display: flex; gap: 8px; }
.role-chip, .state-chip { padding: 4px 7px; border: 1px solid var(--line); color: var(--muted); font-size: 8px; text-transform: uppercase; }
.state-chip.active { border-color: rgba(203,233,104,.35); color: var(--acid); }
.user-actions { display: flex; align-items: center; gap: 7px; }
.user-actions select { width: 100px; height: 34px; }
.inline-form { margin-top: 24px; box-shadow: none; }
.inline-form .form-row { grid-template-columns: 1fr 1fr 150px; }
.inline-form > label { margin-top: 12px; max-width: 480px; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; }
.subsection-heading { margin-top: 38px; display: flex; justify-content: space-between; }
.subsection-heading h2 { margin: 0 0 5px; font-family: "Oswald", sans-serif; text-transform: uppercase; }
.account-form { max-width: 520px; margin-top: 28px; box-shadow: none; }
.loading { padding: 28px; color: var(--muted); font-size: 12px; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  padding: 12px 16px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: var(--acid);
  color: #10150c;
  font-size: 11px;
  transition: .2s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1050px) {
  .build-table { overflow-x: auto; }
  .build-head, .build-row { min-width: 1120px; }
}

@media (max-width: 760px) {
  .admin-header { padding: 0 16px; }
  .auth-shell { padding: 40px 18px; grid-template-columns: 1fr; gap: 30px; }
  .auth-copy h1 { font-size: 48px; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; width: 100%; height: auto; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-sidebar nav { display: flex; overflow-x: auto; }
  .nav-button { flex: none; }
  .back-link { display: none; }
  .admin-content { padding: 25px 14px 60px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .search-control { width: 100%; }
  .summary-strip { grid-template-columns: 1fr; }
  .summary-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-strip > div:last-child { border-bottom: 0; }
  .form-row, .inline-form .form-row { grid-template-columns: 1fr; }
  .user-item, .session-item { align-items: flex-start; flex-direction: column; }
  .user-actions { width: 100%; flex-wrap: wrap; }
}
