:root {
  --bg: #f6f7f7; --card: #fff; --ink: #14201f; --muted: #5d6b6a; --line: #dfe5e4;
  --accent: #0f766e; --accent-ink: #fff; --danger: #b42318; --warn: #b54708; --ok: #067647;
  --chip: #e9eeee; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101514; --card: #18201f; --ink: #e8efee; --muted: #9aa8a6; --line: #2a3533;
    --accent: #2dd4bf; --accent-ink: #06231f; --danger: #f97066; --warn: #fdb022; --ok: #47cd89; --chip: #232d2b; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
a { color: var(--accent); }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem; padding: .625rem 1rem;
  padding-top: calc(.625rem + env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: var(--accent); text-decoration: none; }
.tenant { color: var(--muted); font-size: .875rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { display: flex; align-items: center; gap: .5rem; margin: 0; }
.who { font-size: .875rem; color: var(--muted); max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .who { display: none; } }

.view { max-width: 760px; margin: 0 auto; padding: 1rem 1rem calc(5rem + env(safe-area-inset-bottom)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px;
  padding: .625rem 1rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn.small { min-height: 34px; padding: .25rem .75rem; font-size: .875rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; }

label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .875rem; }
label .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=search], textarea, select {
  display: block; width: 100%; margin-top: .25rem; padding: .625rem .75rem; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
textarea { min-height: 5rem; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: .625rem; align-items: flex-start; font-weight: 500; font-size: 1rem; }
.check input { width: 1.25rem; height: 1.25rem; margin-top: .15rem; flex: none; }
.hint { font-weight: 400; color: var(--muted); font-size: .8125rem; margin-top: .25rem; }

.chip { display: inline-block; padding: .125rem .625rem; border-radius: 999px; background: var(--chip); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.chip.recording { background: var(--danger); color: #fff; }
.chip.processing { background: var(--warn); color: #fff; }
.chip.ready { background: var(--ok); color: #fff; }
.chip.failed { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a { display: flex; align-items: center; gap: .75rem; padding: .75rem .25rem; color: inherit; text-decoration: none; }
.list .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { color: var(--muted); font-size: .8125rem; }
.section-title { font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.25rem 0 .5rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.alert { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-radius: 10px; padding: .625rem .75rem; font-size: .9375rem; }
.note { background: color-mix(in srgb, var(--warn) 14%, transparent); border-radius: 10px; padding: .625rem .75rem; font-size: .875rem; }
.banner { background: var(--warn); color: #fff; padding: .5rem 1rem; font-size: .875rem; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: .625rem 1rem; border-radius: 10px; font-size: .9375rem; max-width: calc(100% - 2rem); z-index: 20; }

.rec { text-align: center; }
.rec .timer { font-size: 3.5rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: .5rem 0; }
.rec .state { font-weight: 700; }
.rec .state.live { color: var(--danger); }
.rec .state.live::before { content: ""; display: inline-block; width: .625rem; height: .625rem; border-radius: 50%; background: var(--danger); margin-right: .5rem; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec .state.live::before { animation: none; } }
.meter { height: 10px; background: var(--chip); border-radius: 999px; overflow: hidden; margin: 1rem auto; max-width: 420px; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.rec .actions { display: flex; gap: .75rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.rec .actions .btn { min-width: 9rem; min-height: 52px; }
.upload-state { font-size: .875rem; color: var(--muted); margin-top: .75rem; }

audio { width: 100%; margin-top: .5rem; }
dl.info { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0; font-size: .9375rem; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; overflow-wrap: anywhere; }
table.segs { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.segs th, table.segs td { text-align: left; padding: .375rem .5rem; border-top: 1px solid var(--line); }
table.segs th { color: var(--muted); font-weight: 600; border-top: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.progress { display: flex; align-items: center; gap: .625rem; }
.spinner { width: 1.125rem; height: 1.125rem; border: 3px solid var(--chip); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.login-card .brand { font-size: 2rem; }
[hidden] { display: none !important; }
a.link-card { display: block; color: inherit; text-decoration: none; }
ol.plain { margin: 0; padding-left: 1.25rem; }
details.card summary { cursor: pointer; font-weight: 600; }

/* Fasa 2: nota, transkrip, akaun */
.chip.done { background: var(--ok); color: #fff; }
a.who { text-decoration: none; }
a.who:hover { text-decoration: underline; }
.card.player { position: sticky; top: calc(3.25rem + env(safe-area-inset-top)); z-index: 4; box-shadow: 0 4px 14px rgb(0 0 0 / 8%); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: -.25rem 0 1rem; }
.tabs button { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .875rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 44px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; min-width: 10rem; }
.toolbar input[type=search] { margin-top: 0; }
.notes h3 { font-size: 1.0625rem; margin: 1.25rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.notes h3:first-child { margin-top: 0; }
.notes h4 { font-size: 1rem; margin: 1rem 0 .375rem; }
.notes ul, .notes ol { margin: 0 0 .75rem; padding-left: 1.25rem; }
.notes li { margin-bottom: .25rem; }
.table-wrap { overflow-x: auto; margin-bottom: .75rem; }
.notes table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.notes th, .notes td { border: 1px solid var(--line); padding: .5rem .625rem; text-align: left; vertical-align: top; }
.notes th { background: var(--chip); font-weight: 600; white-space: nowrap; }
.ts { appearance: none; border: 0; background: var(--chip); color: var(--accent); font: inherit; font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
  border-radius: 6px; padding: .0625rem .375rem; cursor: pointer; white-space: nowrap; }
.ts:hover { background: var(--accent); color: var(--accent-ink); }
.tlines { max-height: 60vh; overflow-y: auto; margin-bottom: .75rem; }
.tline { display: flex; gap: .625rem; align-items: baseline; padding: .375rem .375rem; border-radius: 8px; }
.tline .ts { flex: none; }
.tline.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tline.excluded { opacity: .5; text-decoration: line-through; }
