:root {
  --bg: #f7f4ee;
  --panel: #ffffff;
  --ink: #12211c;
  --muted: #5a6a63;
  --line: #e4ebe6;
  --accent: #0e7c72;
  --accent-deep: #0a5c54;
  --accent-soft: rgba(14, 124, 114, 0.16);
  --side: #10211c;
  --side-ink: #e7f6f1;
  --side-muted: rgba(231, 246, 241, 0.68);
  --amber: #e8a317;
  --danger: #9f1239;
  --ok: #e7f6ef;
  --warn: #fff6e8;
  --shadow: 0 8px 24px rgba(16, 33, 28, 0.05);
  --sans: "Hind Siliguri", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 16px;
  --ease: 160ms ease;
  --side-w: 248px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-deep); }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
h1, h2, p { margin: 0; }
h1 { font-size: 1.85rem; letter-spacing: -0.03em; line-height: 1.2; font-weight: 700; }
h2 { font-size: 1.2rem; letter-spacing: -0.02em; line-height: 1.3; font-weight: 700; }

.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #123f39;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: none;
}
.mark span {
  width: 3px;
  border-radius: 99px;
  background: #9ff3e4;
  height: 10px;
}
.mark span:nth-child(2) { height: 18px; }
.mark span:nth-child(3) { height: 7px; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 15px; }
.brand-text span { color: var(--muted); font-size: 13px; font-weight: 600; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: var(--side);
  color: var(--side-ink);
}
.topbar .brand-text span { color: var(--side-muted); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.topbar a.text-link, .topbar a.button { color: var(--side-ink); text-decoration: none; }

.auth-main {
  width: min(560px, calc(100% - 32px));
  margin: 32px auto 64px;
  display: grid;
  gap: 16px;
}
.mast { display: grid; gap: 8px; }
.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lede { color: var(--muted); }

fieldset.sheet { margin: 0; }
fieldset.sheet legend { font-weight: 800; padding: 0 6px; }
.sheet, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.stack, .form, .sheet { display: grid; gap: 14px; }
label { display: grid; gap: 6px; }
label > span:first-child, .field-label { font-weight: 700; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  transition: border-color var(--ease), box-shadow var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
textarea { min-height: 96px; resize: vertical; }
input:disabled, select:disabled { background: #f4f7f5; color: var(--muted); }

button, .button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
button:hover, .button:hover { background: var(--accent-deep); }
button:active:not(:disabled), .button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
button.secondary, .button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost, .button.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid transparent;
}
button.danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #f1c4cf;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-links { display: flex; gap: 16px; flex-wrap: wrap; }
.auth-links a { font-weight: 650; }

.status {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ok);
  color: var(--accent-deep);
}
.status.error { background: #fde8ee; color: var(--danger); }
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
}
.check input { width: 20px; height: 20px; margin-top: 2px; min-height: 0; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.topbar .lang-switch { border-color: rgba(231, 246, 241, 0.28); background: transparent; }
.lang-switch button {
  min-height: 34px;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
}
.topbar .lang-switch button { color: var(--side-ink); }
.lang-switch button.is-current { background: var(--ink); color: #fff; }
.topbar .lang-switch button.is-current { background: #e7f6f1; color: var(--ink); }

.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }
.side {
  background: var(--side);
  color: var(--side-ink);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.side .brand-text span { color: var(--side-muted); }
.sidenav { display: grid; gap: 4px; }
.sidenav a {
  color: var(--side-ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  transition: background-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.sidenav a.is-current, .sidenav a:hover { background: rgba(231, 246, 241, 0.1); }
.sidenav a.is-current { box-shadow: inset 3px 0 0 #7dffe8; color: #fff; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.side-foot button {
  background: transparent;
  color: var(--side-ink);
  border: 1px solid rgba(231, 246, 241, 0.28);
}
.main { padding: 28px 24px 64px; }
.main-inner { width: min(760px, 100%); margin: 0 auto; display: grid; gap: 18px; }

.steps { display: grid; gap: 18px; }
.step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
}
.step-no {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.step-body { display: grid; gap: 8px; min-width: 0; }
.place-grid { display: grid; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.recorder {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #f7fbf9;
  border: 1px solid var(--line);
}
.mic {
  min-height: 64px;
  border-radius: 999px;
  font-size: 1.05rem;
  background: var(--amber);
  color: #1c1404;
}
.mic:hover { background: #d39210; }
.mic.is-live { background: var(--danger); color: #fff; }
.meter {
  width: 100%;
  height: 64px;
  border-radius: 12px;
  background: #10211c;
  display: block;
}
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
audio { width: 100%; }

.clip-list, .user-list { display: grid; gap: 12px; }
.clip { display: grid; gap: 12px; }
.clip p { white-space: pre-wrap; }
.meta { color: var(--muted); font-size: 13px; }
.lines { display: grid; gap: 10px; }
.lines p { display: grid; gap: 2px; margin: 0; }
.lines span, .range span, .facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.edit-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #f7fbf9;
  border: 1px solid var(--line);
}
.edit-panel textarea { min-height: 72px; }
.recorder.compact { padding: 0; background: transparent; border: 0; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.stat b {
  font-size: 1.85rem;
  letter-spacing: -0.045em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat span { font-weight: 700; }
.stat small, .range span { color: var(--muted); font-weight: 500; }
.range {
  display: grid;
  gap: 10px;
  padding: 4px 2px;
}
.range p { display: grid; gap: 2px; }
.occ-card h2 { margin-bottom: 10px; }
.occ-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.occ-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.occ-list b { font-variant-numeric: tabular-nums; }
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  margin: 0;
}
.facts div { display: grid; gap: 2px; min-width: 0; }
.facts dd { margin: 0; }
.speaker { display: grid; gap: 14px; }
.speaker-head, .pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.pills { justify-content: flex-start; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e7f6ef;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
}
.empty-card { display: grid; gap: 12px; }
.score { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; }
.score b { font-size: 1.45rem; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.score small { font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.score span { color: var(--muted); font-size: 13px; font-weight: 650; }
.score i {
  grid-column: 1 / -1;
  display: block;
  height: 8px;
  border-radius: 99px;
  background: #e7eeea;
  position: relative;
  overflow: hidden;
}
.score i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--p) * 10%);
  background: linear-gradient(90deg, #0f6e66, #1aa392);
  border-radius: inherit;
}
.redeem {
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, #fff8ec 0%, #fff 55%);
  border-color: #f0ddb4;
}
.soon {
  justify-self: start;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--amber);
  color: #1c1404;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.redeem-balance { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.redeem-balance b { font-size: 2.4rem; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; line-height: 1; }
.search {
  min-height: 48px;
  border-radius: 14px;
  padding-inline: 14px;
  background: #fff;
}
.admin-block { margin-top: 36px; display: grid; gap: 12px; }
.admin-block h2 { margin: 0; display: flex; align-items: baseline; gap: 10px; }
.admin-block .count { color: #5a6a63; font-size: 1rem; font-weight: 650; }
.speaker-id { display: flex; gap: 10px; align-items: flex-start; }
.pick { margin: 0; }
.curves { display: grid; gap: 8px; }
.curves .hint { margin: 0; color: #5a6a63; }
.curve-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.curve { display: grid; gap: 4px; }
.curve header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.curve header span { color: #5a6a63; font-size: 13px; }
.curve header b { font-size: 1.4rem; letter-spacing: -0.04em; }
.curve svg { width: 100%; height: auto; display: block; }
@media (max-width: 760px) {
  .curve-row { grid-template-columns: 1fr; }
}
body[data-page="admin"] .main-inner,
body[data-page="dashboard"] .main-inner,
body[data-page="mine"] .main-inner { width: min(1080px, 100%); }
.banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn);
  border: 1px solid #f0ddb4;
}
.guide, .example {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.guide p, .example p { margin: 0; }
.example ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.example li { display: grid; gap: 2px; }
.example li span { color: var(--muted); font-size: 13px; }
.example strong { font-size: 1.05rem; }

.user-row {
  display: grid;
  gap: 10px;
}
.user-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-controls select { width: auto; min-width: 120px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: sticky;
    height: auto;
    padding: 12px;
    gap: 12px;
  }
  .sidenav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-foot { margin-top: 0; grid-template-columns: auto 1fr; align-items: center; }
  .two, .facts, .stat-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .main { padding: 18px 14px 48px; }
  .topbar { align-items: flex-start; }
}

.site-foot {
  padding: 22px 22px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg);
}
.site-foot p { margin: 0; }
.site-foot a {
  color: var(--ink);
  font-weight: 700;
  text-underline-offset: 3px;
}
.site-foot a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  button:active:not(:disabled), .button:active { transform: none; }
}
