@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+Thai:wght@400;500&family=Noto+Sans+JP:wght@400;500&family=Noto+Sans+SC:wght@400;500&display=swap');

/* Thai text uses Thonburi (built into Apple devices); the unicode-range keeps Latin text on DM Sans.
   Devices without Thonburi fall back to Noto Sans Thai. */
@font-face {
  font-family: 'Thai';
  src: local('Thonburi');
  font-weight: 100 450;
  unicode-range: U+0E00-0E7F;
}
@font-face {
  font-family: 'Thai';
  src: local('Thonburi-Bold'), local('Thonburi Bold');
  font-weight: 500 900;
  unicode-range: U+0E00-0E7F;
}

/* Design tokens: AI-Deate Live design (near-black, DM Sans with IBM Plex Mono labels, yellow accent, hairlines). */
:root {
  --bg: #0b0c0e;
  --surface: #111317;
  --surface-2: #0e1013;
  --raised: #16191d;
  --hover: #121418;
  --active: #1a1d22;
  --track: #2a2f36;
  --ink: #e9ecef;
  --ink-on-light: #0b0c0e;
  --ink-2: #e9ecefdb;
  --ink-3: #b3bac2;
  --muted: #8b939c;
  --dim: #5e666f;
  --accent: #ffd300;
  --online: #7ee0a8;
  --online-glow: #7ee0a88c;
  --warn: #ffd300;
  --bad: #ff8a7a;
  --line: #1e2228;
  --line-soft: #1a1d22;
  --line-strong: #2a2f36;
  --line-button: #3a4048;
  --display: 'Thai', 'DM Sans', 'Noto Sans Thai', 'Noto Sans JP', 'Noto Sans SC', system-ui, sans-serif;
  --body: 'Thai', 'DM Sans', 'Noto Sans Thai', 'Noto Sans JP', 'Noto Sans SC', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-pill: 999px;
  --radius-card: 16px;
  --radius-row: 10px;
  color-scheme: dark;
}
/* Thai (Noto Sans): skip the Thonburi face so Thai text uses Noto Sans Thai on every device. */
:root.thai-noto {
  --display: 'DM Sans', 'Noto Sans Thai', 'Noto Sans JP', 'Noto Sans SC', system-ui, sans-serif;
  --body: 'DM Sans', 'Noto Sans Thai', 'Noto Sans JP', 'Noto Sans SC', system-ui, sans-serif;
}
/* Light variant – only offered on the attendee phone page. */
:root[data-theme='light'] {
  --bg: #fff;
  --surface: #f6f6f6;
  --surface-2: #fafafa;
  --raised: #f0f0f0;
  --hover: #f4f4f4;
  --active: #ececec;
  --track: #e5e5e5;
  --ink: #0a0a0a;
  --ink-on-light: #fafafa;
  --ink-2: #000000db;
  --ink-3: #0000009e;
  --muted: #6b6b6b;
  --dim: #9a9a9a;
  --line: #0000001a;
  --line-soft: #00000012;
  --line-strong: #00000024;
  --line-button: #00000038;
  --accent: #b38f00;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--body); /* Regular: Light (300) read too thin on dark backgrounds */
  -webkit-font-smoothing: antialiased;
}
::selection {
  background: rgba(255, 255, 255, 0.24);
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
  margin: 0;
}
.muted {
  color: var(--muted);
}
.dim {
  color: var(--dim);
}
.small {
  font-size: 12px;
}
.mono,
code {
  font-family: var(--mono);
  font-size: 12.5px;
}
code {
  color: var(--ink-2);
}
.spacer {
  flex: 1;
}
.flex {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
svg.i {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- app shell ---------- */
.app {
  display: flex;
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.nav {
  width: 232px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.nav-head {
  height: 60px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.nav-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 10px;
  overflow-y: auto;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-label {
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  text-align: left;
  width: 100%;
}
.nav-item:hover {
  background: var(--hover);
  color: var(--ink);
}
.nav-item[aria-current='page'] {
  background: var(--active);
  color: #fff;
}
.nav-item .grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-foot {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #262626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex: none;
}
.brand {
  font-family: var(--display);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 400;
}
.brand-tag {
  font-family: var(--body);
  color: var(--muted);
  letter-spacing: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  font-size: 11px;
}
.logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--ink-on-light);
  display: grid;
  place-items: center;
  flex: none;
}
.logo svg.i {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}
.page {
  max-width: 1240px;
  padding: 56px 48px 96px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.mobile-bar {
  display: none;
}
@media (max-width: 860px) {
  .nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  body.nav-open .nav {
    transform: none;
  }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 5;
  }
  .page {
    padding: 32px 16px 64px;
    gap: 24px;
  }
}

/* ---------- page header ---------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.page-head h1 {
  margin-top: 18px;
  font-size: 52px;
  line-height: 1.02;
  letter-spacing: -0.045em;
}
.page-head h1 .dim {
  display: block;
}
@media (max-width: 860px) {
  .page-head h1 {
    font-size: 38px;
  }
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.eyebrow {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* The AI-Deate star mark (logos/mark.svg), tinted with the accent. */
.eyebrow .sq {
  width: 12px;
  height: 12px;
  flex: none;
  background: var(--accent);
  -webkit-mask: url('logos/mark.svg') center / contain no-repeat;
  mask: url('logos/mark.svg') center / contain no-repeat;
}
button.eyebrow {
  background: none;
  border: 0;
  padding: 0;
}
button.eyebrow:hover {
  color: var(--ink);
}
.lede {
  max-width: 680px;
  color: var(--ink-3);
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 22px 24px;
  border-right: 1px solid var(--line-soft);
}
.stat:first-child {
  padding-left: 0;
}
.stat:last-child {
  border-right: 0;
}
.stat-label,
.stat-note {
  color: var(--muted);
  font-size: 12px;
}
.stat-label,
.nav-label,
.table th {
  font-family: var(--mono);
  font-size: 11px !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 860px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat:nth-child(2) {
    border-right: 0;
  }
  .stat:nth-child(3) {
    padding-left: 0;
  }
  .stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line-soft);
  }
}

/* ---------- sections, rows, tables ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
}
.grid-2.wide-left {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}
@media (max-width: 960px) {
  .grid-2,
  .grid-2.wide-left {
    grid-template-columns: 1fr;
  }
}
.section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.section h2 {
  font-size: 22px;
  letter-spacing: -0.025em;
}
.link {
  font-size: 13px;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-strong);
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  padding: 0;
}
.link:hover {
  color: var(--ink);
}
.row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding: 8px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line-soft);
}
.row-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-main .sub {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  padding: 10px 16px 10px 0;
  font-size: 12px;
  font-weight: 400;
}
.table td {
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  padding: 12px 16px 12px 0;
}
.table th.r,
.table td.r {
  text-align: right;
  padding-right: 0;
}
.table tr.clickable {
  cursor: pointer;
}
.table tr.clickable:hover td {
  background: var(--surface-2);
}
.table td.empty {
  color: var(--muted);
  padding: 28px 0;
}
.table .sub {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}
.table-wrap {
  overflow-x: auto;
}
.row-actions {
  white-space: nowrap;
}
.row-actions .btn + .btn {
  margin-left: 6px;
}
.empty-note {
  color: var(--muted);
  margin: 0;
  padding: 14px 0;
  font-size: 13.5px;
}

/* ---------- controls ---------- */
.btn {
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid var(--line-button);
  background: none;
  color: var(--ink);
}
.btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
}
.btn-light {
  background: var(--accent);
  color: #0b0c0e;
  border: 0;
  font-weight: 500;
}
.btn-light:hover {
  background: #ffdd33;
}
.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
}
.btn-icon {
  width: 34px;
  padding: 0;
}
.btn-danger {
  color: var(--bad);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.tag,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--ink-3);
  white-space: nowrap;
}
.tag {
  height: 22px;
  padding: 0 9px;
  font-size: 11.5px;
}
.pill {
  height: 26px;
  padding: 0 11px;
  font-size: 12px;
}
.pill.on {
  color: var(--ink);
}
.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.online-dot,
.off-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}
.online-dot {
  background: var(--online);
  box-shadow:
    0 0 0 3px #34d39929,
    0 0 10px var(--online-glow);
  animation: breathe 3s ease-in-out infinite;
}
.off-dot {
  background: var(--dim);
}
.warn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  display: inline-block;
}
@keyframes breathe {
  50% {
    opacity: 0.55;
  }
}
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
}
.seg button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--ink-3);
  font-size: 12.5px;
}
.seg button:hover {
  color: var(--ink);
}
.seg button[aria-selected='true'] {
  background: var(--accent);
  color: var(--ink-on-light);
  font-weight: 500;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: nowrap;
}
.chip:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.3);
}
.chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-on-light);
  font-weight: 500;
}
.field {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-row);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  outline: none;
}
.field:focus {
  border-color: var(--accent);
}
.field::placeholder {
  color: #666;
}
textarea.field {
  height: auto;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}
select.field {
  appearance: none;
  cursor: pointer;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 18px,
    calc(100% - 14px) 18px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
select.field option {
  background: #0d0d0d;
  color: var(--ink);
}
input[type='color'].field {
  padding: 6px;
}
.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}
.form .full {
  grid-column: 1 / -1;
}
.form label,
label.lbl {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-3);
  font-size: 12.5px;
}
@media (max-width: 640px) {
  .form {
    grid-template-columns: 1fr;
  }
}

/* ---------- cards + dialog ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-2);
}
.card h2 {
  font-size: 26px;
  letter-spacing: -0.03em;
}
.card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: #0b0b0b;
  color: var(--ink);
}
.dialog.wide {
  width: min(760px, calc(100vw - 32px));
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.dialog-head h2 {
  font-size: 26px;
  letter-spacing: -0.03em;
}
.dialog p {
  color: var(--ink-2);
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* meter bar (e.g. audio level) */
.meter-track {
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--ink);
  width: 0;
  transition: width 0.08s;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: #0b0b0b;
  font-size: 13px;
  z-index: 100;
  max-width: calc(100vw - 32px);
}

/* sign-in gate */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.gate-box {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.gate h1 {
  font-size: 40px;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
