:root {
  color-scheme: dark;
  --ink: #edf7f4;
  --muted: #9cb4ae;
  --line: rgba(152, 184, 176, 0.2);
  --surface: #142522;
  --surface-strong: #1a302c;
  --soft: #0b1715;
  --deep: #7ee0bd;
  --green: #63d7a4;
  --gold: #f2bd5c;
  --danger: #ff9b81;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  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;
  background:
    radial-gradient(circle at top left, rgba(99, 215, 164, 0.1), transparent 34rem),
    linear-gradient(180deg, #081311 0%, #0b1715 45%, #07110f 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(8, 19, 17, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 320px;
  color: var(--ink);
  text-decoration: none;
}

.brand-full-logo {
  display: block;
  width: clamp(92px, 8vw, 118px);
  height: 58px;
  border-radius: 0;
  object-fit: contain;
  object-position: left center;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}

.brand-copy strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
}

.admin-session span,
p {
  color: var(--muted);
}

.admin-session {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-action,
.secondary-action {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 850;
}

.primary-action {
  border: 0;
  background: #0f7d66;
  color: #f7fffc;
  box-shadow: 0 10px 28px rgba(15, 125, 102, 0.28);
}

.secondary-action {
  background: rgba(255, 255, 255, 0.04);
  color: var(--deep);
  border: 1px solid var(--line);
}

.danger-action {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 155, 129, 0.5);
  border-radius: 8px;
  background: rgba(142, 42, 36, 0.2);
  color: #ffd8cd;
  font-weight: 850;
}

.danger-action:hover:not(:disabled) {
  background: rgba(142, 42, 36, 0.38);
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.admin-shell {
  padding: clamp(24px, 4vw, 48px);
}

.auth-panel,
.dashboard-panel {
  display: grid;
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
}

.auth-panel {
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  align-items: start;
}

.auth-form,
.dashboard-panel {
  padding: clamp(18px, 3vw, 28px);
  background: rgba(20, 37, 34, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dashboard-panel {
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
}

.dashboard-heading,
.user-count-ribbon,
.metrics-grid {
  grid-column: 1 / -1;
}

.dashboard-panel > .tabs {
  position: sticky;
  top: 98px;
  display: grid;
  grid-column: 1;
  grid-row: 4;
  align-content: start;
}

.dashboard-panel > .tabs button {
  width: 100%;
  text-align: left;
}

.dashboard-panel > .admin-content {
  grid-column: 2;
  grid-row: 4;
}

.admin-content {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 14px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

h3 {
  margin-bottom: 6px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #0d1b18;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

select option {
  background: #0d1b18;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(11, 143, 100, 0.11);
}

.auth-actions,
.dashboard-heading,
.filters,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-heading {
  align-items: end;
  justify-content: space-between;
}

.filters label {
  min-width: 180px;
}

.filters .admin-search-field {
  min-width: min(320px, 100%);
}

.form-note {
  margin: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.55;
}

.success-note {
  color: #bcf8df;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(99, 215, 164, 0.36);
  font-weight: 800;
}

.error-note {
  color: #ffd3c8;
  background: rgba(255, 155, 129, 0.12);
  border-color: rgba(255, 155, 129, 0.34);
  font-weight: 800;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
}

.user-count-ribbon {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(76, 225, 169, 0.32);
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(11, 143, 100, 0.24), rgba(20, 37, 34, 0.96));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

.user-count-intro {
  display: grid;
  min-width: 180px;
  align-content: center;
  gap: 3px;
}

.user-count-intro h2,
.user-count-intro p {
  margin: 0;
}

.user-count-items {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.user-count-items article {
  display: grid;
  align-content: center;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.user-count-items strong {
  color: var(--green);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1;
}

.user-count-items span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.metrics-grid article {
  padding: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics-grid strong {
  display: block;
  color: var(--green);
  font-size: 2rem;
}

.metrics-grid span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.tabs button {
  min-height: 40px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.tabs button.is-active {
  background: #0f7d66;
  color: #f7fffc;
}

.work-list {
  display: grid;
  gap: 10px;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.queue-card {
  display: grid;
  gap: 5px;
  min-height: 132px;
  padding: 16px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
}

.queue-card strong {
  color: var(--green);
  font-size: 2rem;
}

.queue-card span {
  font-weight: 900;
}

.queue-card small {
  color: var(--muted);
}

.automation-card,
.audit-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(12, 28, 25, 0.86);
}

.audit-card {
  display: grid;
  gap: 9px;
}

.audit-card p {
  margin: 0;
}

.work-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.7fr);
  gap: 16px;
  padding: 16px;
  background: rgba(12, 28, 25, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.work-card p {
  margin-bottom: 8px;
  line-height: 1.5;
}

.work-meta,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(126, 224, 189, 0.13);
  color: var(--deep);
  font-size: 0.76rem;
  font-weight: 900;
}

.badge.gold {
  background: rgba(242, 189, 92, 0.16);
  color: var(--gold);
}

.work-actions {
  display: grid;
  align-content: start;
  gap: 8px;
}

.mini-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.empty-state {
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .dashboard-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-heading,
  .user-count-ribbon,
  .metrics-grid,
  .dashboard-panel > .tabs,
  .dashboard-panel > .admin-content {
    grid-column: 1;
    grid-row: auto;
  }

  .dashboard-panel > .tabs {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .dashboard-panel > .tabs button {
    width: auto;
    min-width: max-content;
  }

  .queue-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-count-ribbon {
    align-items: stretch;
    flex-direction: column;
  }

  .user-count-items {
    grid-template-columns: 1fr;
  }

  .brand {
    min-width: 0;
  }

  .admin-topbar {
    position: static;
    gap: 10px;
    padding: 10px 12px 12px;
  }

  .dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-session,
  .auth-actions,
  .filters {
    width: 100%;
  }

  .auth-panel,
  .metrics-grid,
  .work-card {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    padding: 18px 12px 34px;
  }

  .auth-form,
  .dashboard-panel {
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .queue-grid {
    grid-template-columns: 1fr;
  }

  .brand {
    width: 100%;
    gap: 10px;
    min-width: 0;
  }

  .brand-full-logo {
    width: 78px;
    height: 48px;
  }

  .brand-copy strong {
    font-size: 0.95rem;
  }

  .brand-copy small {
    font-size: 0.74rem;
    white-space: normal;
  }

  .admin-session,
  .auth-actions,
  .filters,
  .tabs {
    flex-direction: column;
  }

  .admin-session button,
  .auth-actions button,
  .tabs button {
    width: 100%;
  }

  body {
    overflow-x: hidden;
  }

  input,
  textarea,
  select,
  button {
    min-height: 48px;
  }

  input,
  textarea,
  select {
    min-width: 0;
    font-size: 16px;
  }

  .work-card,
  .record-list article,
  .metrics-grid > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .admin-shell {
    padding-inline: 8px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }

  .auth-form,
  .dashboard-panel {
    padding: 13px;
  }
}
