:root {
  color-scheme: light dark;
  --bg: #f5f2ea;
  --panel: #fffaf0;
  --panel-strong: #ffffff;
  --text: #1f231d;
  --muted: #697060;
  --line: #d7d0bf;
  --green: #2f8f46;
  --green-strong: #176b31;
  --amber: #c8841a;
  --danger: #a33b2c;
  --shadow: 0 18px 48px rgba(38, 43, 31, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a15;
    --panel: #20251d;
    --panel-strong: #272d23;
    --text: #f3f0df;
    --muted: #abb59e;
    --line: #3e4737;
    --green: #63c174;
    --green-strong: #8bdb8e;
    --amber: #e2a33a;
    --danger: #f07f68;
    --shadow: 0 22px 54px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(47, 143, 70, 0.16), transparent 32rem),
    linear-gradient(315deg, rgba(200, 132, 26, 0.14), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

code {
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel-strong) 84%, var(--green) 16%);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.topbar,
.dashboard-head,
.section-title,
.metric-row,
.link-row,
.avatar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: 68px;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid var(--green);
  border-radius: 8px;
  color: var(--green-strong);
  background: color-mix(in srgb, var(--panel) 76%, var(--green) 24%);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted,
small {
  color: var(--muted);
}

.icon-button,
.primary-action,
.danger-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

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

input[type="file"],
select {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 86%, transparent);
  color: var(--text);
}

input[type="file"] {
  padding: 8px;
}

select {
  padding: 0 10px;
}

.icon-button {
  padding: 0 14px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.primary-action {
  padding: 0 18px;
  color: #fffef7;
  background: linear-gradient(135deg, var(--green-strong), var(--green));
  box-shadow: 0 10px 24px rgba(47, 143, 70, 0.25);
}

.danger-button {
  padding: 0 12px;
  color: var(--danger);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--line));
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
}

.login-grid,
.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
}

.hero-panel,
.card,
.claim-banner,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: relative;
  min-height: 360px;
  padding: 42px;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(47, 143, 70, 0.82), rgba(32, 37, 29, 0.92)),
    radial-gradient(circle at 70% 18%, rgba(226, 163, 58, 0.6), transparent 22rem);
  color: #fffceb;
}

.hero-panel::after {
  content: "4:20";
  position: absolute;
  right: 28px;
  bottom: -28px;
  font-size: clamp(5rem, 16vw, 13rem);
  font-weight: 950;
  line-height: 1;
  opacity: 0.18;
}

.hero-panel h1,
.dashboard-head h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 0.95;
}

.hero-panel p {
  max-width: 580px;
  font-size: 1.1rem;
  line-height: 1.55;
}

.status-dot {
  width: 14px;
  height: 14px;
  margin-bottom: 54px;
  border-radius: 999px;
  background: #8bff8a;
  box-shadow: 0 0 0 8px rgba(139, 255, 138, 0.18);
}

.card {
  padding: 20px;
}

.login-card {
  align-self: end;
}

.card h2,
.card h3,
.section-title h2,
.section-title h3 {
  margin: 0 0 8px;
}

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

.dashboard-head {
  margin-bottom: 20px;
}

.mode-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.pill.good {
  color: var(--green-strong);
  border-color: color-mix(in srgb, var(--green) 60%, var(--line));
}

.pill.warn {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 55%, var(--line));
}

.pill.neutral {
  color: var(--muted);
}

.notice,
.claim-banner {
  padding: 14px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.notice.success {
  border: 1px solid color-mix(in srgb, var(--green) 55%, var(--line));
  border-radius: 8px;
  color: var(--green-strong);
}

.notice.danger {
  border: 1px solid color-mix(in srgb, var(--danger) 50%, var(--line));
  border-radius: 8px;
  color: var(--danger);
}

.claim-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.claim-banner strong {
  display: block;
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  line-height: 0.9;
}

.claim-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.avatar-row {
  justify-content: flex-start;
}

.avatar,
.avatar.fallback {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  object-fit: cover;
}

.avatar.fallback,
.mini-user span {
  display: grid;
  place-items: center;
  color: #fffef7;
  background: linear-gradient(135deg, var(--green), var(--amber));
  font-weight: 900;
  text-transform: uppercase;
}

.metric-row {
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: 0;
}

.timezone-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 14px;
  padding-top: 14px;
}

.timezone-list span,
.metric-row span {
  color: var(--muted);
}

.timezone-list strong {
  overflow-wrap: anywhere;
}

.timezone-value,
.timezone-value-list {
  display: grid;
  gap: 8px;
}

.timezone-value {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.timezone-card {
  display: grid;
  gap: 14px;
}

.timezone-card .timezone-list {
  padding-top: 0;
}

.timezone-card .stack-form:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.admin-section {
  margin-top: 26px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title.compact {
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 16px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat strong {
  display: block;
  margin-top: 8px;
  color: var(--green-strong);
  font-size: 2rem;
  line-height: 1;
}

.table-card {
  margin-bottom: 18px;
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.mini-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-user img,
.mini-user span {
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.mini-user strong,
.mini-user small {
  display: block;
}

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

.link-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
}

.link-row strong,
.link-row small {
  display: block;
}

.sound-card {
  display: grid;
  gap: 16px;
}

.stack-form,
.sound-list {
  display: grid;
  gap: 10px;
}

.stack-form {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.stack-form label,
.checkbox-row {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.sound-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
}

.sound-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.sound-select-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sound-select-row span {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sound-row audio {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 840px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .login-grid,
  .grid.two,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .dashboard-head,
  .claim-banner,
  .claim-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-panel {
    min-height: 300px;
    padding: 28px;
  }

  .mode-stack {
    justify-content: flex-start;
  }

  .timezone-list {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}
