:root {
  color-scheme: dark;
  --black: #2d2926;
  --deep: #181512;
  --deeper: #0f0d0b;
  --green: #009639;
  --green-deep: #005c25;
  --gold: #c8a020;
  --gold-bright: #ffd100;
  --text: #f0f4f1;
  --muted: rgba(240, 244, 241, 0.72);
  --soft: rgba(240, 244, 241, 0.52);
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(255, 255, 255, 0.052);
  --panel-strong: rgba(255, 255, 255, 0.085);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 28% 12%, rgba(0, 150, 57, 0.18), transparent 26rem),
    radial-gradient(circle at 88% 18%, rgba(200, 160, 32, 0.1), transparent 22rem),
    linear-gradient(rgba(200, 160, 32, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 150, 57, 0.022) 1px, transparent 1px),
    var(--deep);
  background-size: auto, auto, 28px 28px, 28px 28px, auto;
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 4;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 268px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(15, 13, 11, 0.88);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 900;
}

.brand-mark {
  width: 24px;
  height: 22px;
  position: relative;
  display: inline-block;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border-left: 4px solid var(--green);
  border-top: 4px solid var(--green);
  transform: rotate(45deg);
  border-radius: 3px 0 0 0;
}

.brand-mark::before {
  left: 1px;
  top: 5px;
}

.brand-mark::after {
  left: 9px;
  top: 5px;
  border-color: var(--gold-bright);
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-top: 34px;
}

.side-nav a {
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.side-nav a:hover,
.side-nav a.active {
  border-color: rgba(200, 160, 32, 0.24);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.sidebar-card,
.panel,
.metric-card,
.payment-card,
.agent-dialog form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 20px 70px rgba(0,0,0,0.25);
}

.sidebar-card {
  display: grid;
  gap: 7px;
  padding: 16px;
}

.sidebar-card span,
.eyebrow,
.metric-card span,
.panel-header span,
th,
.template-card span {
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-card strong {
  color: var(--green);
}

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

.admin-shell {
  width: min(1480px, calc(100% - 268px));
  margin-left: 268px;
  padding: 28px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 22px;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  border: 1px solid transparent;
  background: var(--green);
  color: #04160d;
  box-shadow: 0 16px 36px rgba(0, 150, 57, 0.2);
}

.ghost-button {
  border: 1px solid rgba(200, 160, 32, 0.28);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.metric-grid,
.control-grid {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.payments-panel {
  margin-bottom: 14px;
}

.metric-card {
  padding: 20px;
}

.metric-card strong {
  display: block;
  margin: 12px 0 5px;
  color: var(--green);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
}

.metric-card.gold strong {
  color: var(--gold-bright);
}

.metric-card small {
  color: var(--muted);
  font-weight: 750;
}

.control-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  margin-bottom: 14px;
}

.panel {
  min-width: 0;
  padding: 20px;
}

.panel.wide {
  min-height: 360px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-header.compact {
  align-items: center;
}

.search-label {
  display: grid;
  gap: 7px;
  min-width: 220px;
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  color: var(--text);
  padding: 0 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: left;
}

td {
  color: var(--muted);
  font-weight: 750;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #06150f;
  background: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.paused {
  color: var(--text);
  background: rgba(255,255,255,0.12);
}

.agent-list,
.lead-list,
.booking-list,
.settings-list,
.template-grid,
.subscription-list {
  display: grid;
  gap: 10px;
}

.agent-row,
.lead-row,
.booking-list div,
.template-card,
.settings-list label,
.subscription-list div {
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(0,0,0,0.17);
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.payment-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.payment-card.featured {
  border-color: rgba(0, 150, 57, 0.36);
}

.payment-card span {
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.payment-card strong {
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.payment-card small,
.subscription-list span,
.subscription-list small {
  color: var(--muted);
}

.payment-card a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  margin-top: 6px;
  border: 1px solid rgba(200, 160, 32, 0.28);
  border-radius: 8px;
  color: var(--text);
  font-weight: 900;
}

.subscription-list div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
}

.subscription-list span {
  grid-column: 1;
}

.subscription-list small {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--gold-bright);
  font-weight: 900;
}

.agent-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.agent-row strong,
.lead-row strong,
.template-card strong {
  display: block;
  margin-bottom: 4px;
}

.agent-row small,
.lead-row small,
.booking-list small,
.template-card span {
  color: var(--muted);
}

.toggle-agent {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.toggle-agent.active {
  background: rgba(0, 150, 57, 0.18);
  color: var(--green);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
}

.segmented button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.segmented button.active {
  background: var(--gold);
  color: #17130b;
}

.lead-row {
  display: grid;
  gap: 8px;
}

.lead-top,
.lead-actions,
.booking-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lead-score {
  color: var(--gold-bright);
  font-weight: 950;
}

.lead-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.055);
  color: var(--text);
  cursor: pointer;
  font-weight: 850;
}

.booking-list div {
  align-items: flex-start;
}

.booking-list strong {
  color: var(--gold-bright);
}

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

.template-card {
  min-height: 124px;
}

.settings-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.settings-list input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.agent-dialog {
  width: min(520px, calc(100% - 30px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.agent-dialog::backdrop {
  background: rgba(0,0,0,0.68);
  backdrop-filter: blur(10px);
}

.agent-dialog form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.dialog-header,
.agent-dialog menu {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 0;
}

.dialog-header button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
}

.agent-dialog label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 850;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  padding: 13px 16px;
  border: 1px solid rgba(200, 160, 32, 0.28);
  border-radius: 8px;
  background: rgba(15, 13, 11, 0.92);
  color: var(--text);
  box-shadow: 0 18px 46px rgba(0,0,0,0.38);
  opacity: 0;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .sidebar {
    position: relative;
    width: auto;
    min-height: auto;
    grid-template-rows: auto auto auto;
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
    margin-top: 18px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-nav a {
    white-space: nowrap;
  }

  .admin-shell {
    width: 100%;
    margin-left: 0;
  }

  .metric-grid,
  .control-grid,
  .template-grid,
  .payment-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .admin-shell,
  .sidebar {
    padding: 16px;
  }

  .admin-header,
  .panel-header,
  .lead-top,
  .lead-actions,
  .booking-list div {
    display: grid;
  }

  .header-actions {
    justify-content: stretch;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .metric-grid,
  .control-grid,
  .template-grid,
  .board-metrics,
  .payment-grid,
  .subscription-list div {
    grid-template-columns: 1fr;
  }

  .subscription-list small {
    grid-row: auto;
    grid-column: auto;
  }

  .search-label {
    min-width: 0;
  }
}
