/* Voice Note — Pearl (light). Design reference: samples/ui-mockup-v2.html */
:root {
  --bg: #f2f3f7;
  --glass: rgba(255,255,255,.62); --glass-2: rgba(255,255,255,.82); --glass-3: #ffffff;
  --stroke: rgba(30,40,80,.08); --stroke-2: rgba(30,40,80,.14); --hi: rgba(255,255,255,.9);
  --ink: #171a24; --ink-2: #464b5c; --muted: #858a9b;
  --accent: #4e629a; --accent-hi: #c3cdea; --accent-lo: #3b4c7d; --accent-deep: #2a3559; --on-accent: #ffffff; --tint: #7d68b5;
  --accent-grad: linear-gradient(135deg, #7083b8 0%, #4e629a 50%, #3b4c7d 100%);
  --accent-soft: rgba(78,98,154,.08);
  --ok: #177245; --ok-soft: rgba(23,114,69,.06); --ok-line: rgba(23,114,69,.18);
  --warn: #946200; --warn-soft: rgba(148,98,0,.06); --warn-line: rgba(148,98,0,.18);
  --danger: #c4373b; --danger-soft: rgba(196,55,59,.07); --rec: #e5484d;
  --aurora-1: rgba(130,150,215,.18); --aurora-2: rgba(170,150,220,.11); --aurora-3: rgba(140,200,215,.09);
  --shadow: 0 1px 0 var(--hi) inset, 0 18px 40px rgba(40,50,90,.08);
  --shadow-lg: 0 24px 70px rgba(30,40,80,.18);
  --chart-mono: #4e629a;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300;
  --serif: "Noto Serif Thai", "IBM Plex Sans Thai", serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.7 "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 18% 8%, var(--aurora-1), transparent 70%),
    radial-gradient(35% 30% at 88% 4%, var(--aurora-2), transparent 70%),
    radial-gradient(40% 40% at 70% 95%, var(--aurora-3), transparent 70%);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.glass { background: var(--glass); border: 1px solid var(--stroke); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: var(--shadow); }
.hero h1 .accent-text { display: inline-block; }
.accent-text { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 13px; color: var(--accent); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--stroke-2); background: var(--glass-2); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; transition: background .2s, border-color .2s, transform .1s, box-shadow .2s, opacity .2s; }
.btn:hover { background: var(--glass-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent-grad); color: var(--on-accent); border: 0; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 28%, transparent), inset 0 1px 0 rgba(255,255,255,.35); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.block { width: 100%; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 300px 1fr; height: 100vh; height: 100dvh; }
.sidebar { margin: 12px 0 12px 12px; border-radius: 22px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.brand .word { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-grad); color: var(--on-accent); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.45); flex: none; }
.mark .icon { width: 18px; height: 18px; stroke-width: 2.1; }
.logo { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 6px 14px rgba(47,61,104,.28)); }
.logo.xl { width: 76px; height: 76px; filter: drop-shadow(0 18px 36px rgba(47,61,104,.32)); }
.side-actions { padding: 0 16px 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.side-actions .btn { height: 42px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--stroke); color: var(--muted); font-size: 14px; }
.search:focus-within { border-color: var(--accent); }
.search input { border: 0; outline: 0; background: transparent; flex: 1 1 0; width: 0; min-width: 0; color: var(--ink); }
.search kbd { flex: none; font-family: inherit; font-size: 11px; line-height: 1; border: 1px solid var(--stroke-2); border-radius: 6px; padding: 3px 6px; color: var(--muted); }
.nav-scroll { overflow-y: auto; padding: 4px 10px 12px; flex: 1; }
.nav-label { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 14px 10px 6px; display: flex; justify-content: space-between; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-item { position: relative; display: flex; align-items: center; gap: 6px; border-radius: 12px; transition: background .15s; }
.note-item:hover { background: var(--glass-2); }
.note-item.active { background: var(--glass-3); box-shadow: 0 1px 2px rgba(30,40,80,.06); }
.note-item.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--accent-grad); }
.note-item .open { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 10px 12px; cursor: pointer; border-radius: 12px; }
.note-item .t { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item .m { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.note-item .act { margin-right: 6px; }
.empty { padding: 6px 12px 10px; font-size: 13px; color: var(--muted); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
.mini-av { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 600; background: var(--accent-soft); color: var(--accent); flex: none; }
.me { margin: 8px; padding: 10px; border-radius: 14px; display: flex; align-items: center; gap: 10px; background: var(--glass-2); border: 1px solid var(--stroke); font: inherit; color: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.me:hover { background: var(--glass-3); border-color: var(--stroke-2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-family: var(--serif); background: var(--accent-grad); color: var(--on-accent); flex: none; border: 0; cursor: pointer; padding: 0; }
.me .who { flex: 1; min-width: 0; line-height: 1.35; }
.me .who b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 12px; color: var(--muted); }

.main { overflow-y: auto; min-width: 0; position: relative; }
.topbar, .tabbar, .scrim { display: none; }
.page { max-width: 860px; margin: 0 auto; padding: 56px 36px 120px; }
.page.narrow { max-width: 460px; }

/* ---------- Menu (account) ---------- */
.menu { position: fixed; z-index: 40; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--glass-3); border: 1px solid var(--stroke); box-shadow: var(--shadow-lg); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--accent-soft); }
.menu .head { padding: 8px 12px 10px; border-bottom: 1px solid var(--stroke); margin-bottom: 4px; line-height: 1.4; }
.menu .head b { display: block; }
.menu .head span { font-size: 12.5px; color: var(--muted); }

/* ---------- Recorder ---------- */
.hero { text-align: center; }
.hero h1 { font-family: var(--serif); font-size: 40px; line-height: 1.25; margin: 10px 0 8px; font-weight: 600; }
.hero p { color: var(--ink-2); margin: 0 auto; max-width: 460px; }
.stage { display: grid; justify-items: center; margin-top: 46px; }
.orb { --level: 0; position: relative; width: 180px; height: 180px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.orb .halo { position: absolute; inset: -40px; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent-hi), var(--accent), var(--tint), var(--accent-lo), var(--accent), var(--accent-hi)); filter: blur(36px); opacity: .35; animation: spin 16s linear infinite; pointer-events: none; }
.orb .ring { position: absolute; inset: -14px; border-radius: 50%; border: 1px solid var(--stroke-2); pointer-events: none; }
.orb .ring.r2 { inset: -30px; border-color: var(--stroke); }
.orb .core { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background:
    radial-gradient(circle at 32% 24%, rgba(255,255,255,.6), rgba(255,255,255,0) 36%),
    radial-gradient(circle at 70% 85%, rgba(0,0,0,.25), rgba(0,0,0,0) 50%),
    conic-gradient(from 210deg, #8a9bd0, var(--accent), var(--accent-lo), var(--accent-deep), var(--accent-lo), var(--accent), #8a9bd0);
  box-shadow: inset 0 -14px 34px rgba(0,0,0,.28), inset 0 2px 0 rgba(255,255,255,.5), 0 26px 70px color-mix(in srgb, var(--accent) 38%, transparent);
  transform: scale(calc(1 + var(--level) * .08)); transition: transform .08s linear; color: #fff; }
.orb .core .icon { width: 44px; height: 44px; stroke-width: 1.6; }
.orb:hover .core { filter: brightness(1.05); }
.orb.live .halo { animation-duration: 4s; opacity: .6; }
.orb.live .ring { animation: ripple 2.4s ease-out infinite; }
.orb.live .ring.r2 { animation-delay: 1.2s; }
.orb.paused .halo { animation-play-state: paused; opacity: .3; }
@keyframes ripple { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.status-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 50px; padding: 6px 14px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.live .dot { background: var(--rec); box-shadow: 0 0 10px var(--rec); animation: blink 1.2s infinite; }
.status-pill.paused .dot { background: var(--warn); }
@keyframes blink { 50% { opacity: .35; } }
.timer { font-family: var(--serif); font-size: 52px; font-weight: 500; letter-spacing: .04em; font-variant-numeric: tabular-nums; margin-top: 8px; line-height: 1.1; }
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 48px; margin-top: 14px; width: min(360px, 90%); }
.wave i { flex: 1; max-width: 4px; border-radius: 3px; background: var(--accent-grad); height: 4px; transition: height .08s linear; opacity: .85; }
.controls { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }
.controls:not(:has(.btn:not([hidden]))) { display: none; }
.upload { margin: 34px auto 0; max-width: 520px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px; cursor: pointer; text-align: left; transition: border-color .2s, background .2s; }
.upload:hover, .upload.over { border-color: var(--accent); background: var(--glass-2); }
.upload.disabled { opacity: .5; pointer-events: none; }
/* recording source: mic | online meeting */
.seg { display: inline-flex; gap: 4px; margin-top: 46px; padding: 4px; border-radius: 99px; background: var(--glass-2); border: 1px solid var(--stroke); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px; border: 0; border-radius: 99px; background: none; color: var(--ink-2); font: inherit; font-size: 13.5px; cursor: pointer; transition: background .15s, color .15s; }
.seg button .icon { width: 16px; height: 16px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--glass-3); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(30,40,80,.12); }
.seg button:disabled { opacity: .5; cursor: default; }
.stage .seg:not([hidden]) ~ .status-pill { margin-top: 16px; }
.meeting-opt { display: grid; justify-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.mic-opt { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); cursor: pointer; }
.mic-opt input { width: 16px; height: 16px; accent-color: var(--accent); }
.upload .ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.upload b { display: block; font-weight: 600; }
.upload span { color: var(--muted); font-size: 13px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 720px; margin: 30px auto 0; }
.feature { padding: 16px; border-radius: 16px; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.feature .icon { color: var(--accent); width: 20px; height: 20px; margin-bottom: 8px; display: block; }
.feature b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.recent { display: none; }

/* ---------- Processing ---------- */
.proc { max-width: 560px; margin: 10px auto 0; border-radius: 24px; padding: 30px; }
.proc h2 { font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 6px 0 2px; }
.proc .sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.step { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-radius: 14px; border: 1px solid transparent; }
.step + .step { margin-top: 4px; }
.step .s-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--stroke); color: var(--muted); flex: none; }
.step.done .s-ico { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.step.now { background: var(--glass-2); border-color: var(--stroke); }
.step.now .s-ico { background: var(--accent-grad); border: 0; color: var(--on-accent); }
.step.fail .s-ico { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.step .s-t { flex: 1; font-weight: 500; min-width: 0; }
.step .s-t small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.step .s-r { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 99px; background: var(--stroke); overflow: hidden; margin-top: 20px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-lo), var(--accent-hi), var(--accent-lo)); background-size: 200% 100%; animation: shimmer 2s linear infinite; transition: width .4s; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spin { animation: spin 1s linear infinite; }
.chunks { list-style: none; padding: 0; margin: 16px 0 0; font-size: 13.5px; max-height: 220px; overflow-y: auto; }
.chunks li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--stroke); }
.chunks li:last-child { border-bottom: 0; }
.chunks .state-done { color: var(--ok); }
.chunks .state-error { color: var(--danger); }
.chunks .state-working { color: var(--accent); }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 10px 14px; margin: 16px 0 0; font-size: 14px; }
.proc .actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Note document ---------- */
.doc-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--stroke); }
.doc-bar .crumb { flex: 1; color: var(--muted); font-size: 13.5px; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.doc-bar .crumb b { color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-bar .back { display: none; }
.doc { max-width: 800px; margin: 0 auto; padding: 44px 36px 140px; }
.doc h1 { font-family: var(--serif); font-size: 38px; line-height: 1.3; margin: 8px 0 16px; font-weight: 600; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 2px 12px; border-radius: 99px; font-size: 13px; color: var(--ink-2); background: var(--glass-2); border: 1px solid var(--stroke); }
.chip .icon { width: 14px; height: 14px; color: var(--accent); }
.chip.shared { color: var(--accent); }

.summary.has-meta > p:first-child { display: none; }
.summary .sec { margin: 0 0 16px; }
.summary h2 { font-family: var(--serif); font-size: 23px; font-weight: 600; margin: 42px 0 12px; }
.summary h3 { font-size: 17px; font-weight: 600; margin: 28px 0 6px; }
.summary p { margin: 8px 0; color: var(--ink-2); }
.summary li { margin: 5px 0; color: var(--ink-2); }
.summary li::marker { color: var(--accent); }
.summary li.task { list-style: none; margin-left: -18px; }
.summary ul, .summary ol { padding-left: 22px; margin: 6px 0; }
.summary strong { color: var(--ink); font-weight: 600; }
.summary hr { border: 0; border-top: 1px solid var(--stroke); margin: 24px 0; }
.summary pre { background: var(--glass-2); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px; overflow-x: auto; font-size: 13px; }
.summary .sec-tldr, .summary .sec-decisions, .summary .sec-actions, .summary .sec-open {
  position: relative; border-radius: 18px; padding: 20px 22px; border: 1px solid var(--stroke);
  background: var(--glass); box-shadow: var(--shadow); overflow: hidden;
}
.summary .sec-tldr::before, .summary .sec-decisions::before, .summary .sec-actions::before, .summary .sec-open::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent, var(--edge, var(--accent)), transparent); opacity: .6;
}
.summary .sec-tldr { --edge: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--glass); }
.summary .sec-decisions { --edge: var(--ok); background: linear-gradient(180deg, var(--ok-soft), transparent 80%), var(--glass); }
.summary .sec-open { --edge: var(--warn); background: linear-gradient(180deg, var(--warn-soft), transparent 80%), var(--glass); }
.summary .sec-tldr h2, .summary .sec-decisions h2, .summary .sec-actions h2, .summary .sec-open h2 { font-family: inherit; margin: 0 0 10px; font-size: 13.5px; font-weight: 600; }
.summary .sec-tldr h2 { color: var(--accent); }
.summary .sec-decisions h2 { color: var(--ok); }
.summary .sec-actions h2 { color: var(--ink-2); }
.summary .sec-open h2 { color: var(--warn); }
.summary .sec-tldr li { color: var(--ink); font-size: 15.5px; }

.table-scroll { overflow-x: auto; margin: 12px 0; border-radius: 14px; border: 1px solid var(--stroke); background: var(--glass-2); }
.sec-actions .table-scroll { border: 0; background: transparent; margin: 0 -8px; }
.summary table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 14.5px; }
.summary th, .summary td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--stroke); vertical-align: top; }
.summary thead th { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.summary tbody tr:last-child td { border-bottom: 0; }
.summary td { color: var(--ink-2); }
.summary td:first-child:not(:only-child) { white-space: nowrap; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }

figure.chart { margin: 18px 0; border-radius: 18px; padding: 20px 20px 12px; background: var(--glass); border: 1px solid var(--stroke); box-shadow: var(--shadow); }
figure.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
figure.chart .cap-title { font-weight: 600; font-size: 15px; }
figure.chart .unit { white-space: nowrap; flex: none; font-size: 12px; color: var(--muted); padding: 2px 8px; border: 1px solid var(--stroke); border-radius: 99px; }
.chart-svg { width: 100%; height: auto; display: block; font-family: inherit; overflow: visible; }
.chart-compact { display: none; }
@media (max-width: 600px) { .chart-wide { display: none; } .chart-compact { display: block; } }
.chart-svg .grid { stroke: var(--stroke-2); stroke-dasharray: 2 5; }
.chart-svg .baseline { stroke: var(--stroke-2); }
.chart-svg .axis { fill: var(--muted); font-size: 12px; }
.chart-svg .value { fill: var(--ink); font-size: 13px; font-weight: 600; }
.chart-svg .legend-text { fill: var(--ink-2); font-size: 13px; }
.chart-svg .bar { transition: filter .2s; }
.chart-svg .bar:hover { filter: brightness(1.1) drop-shadow(0 6px 12px rgba(30,40,80,.18)); }
.chart-svg .line { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.chart-svg .point { stroke: #fff; stroke-width: 2.5; }
.chart-svg .point.last { filter: drop-shadow(0 0 6px var(--chart-mono)); }
.chart-table summary { font-size: 12.5px; color: var(--muted); cursor: pointer; margin-top: 6px; }
.chart-table table { min-width: 0; width: 100%; border-collapse: collapse; }
.chart-table th, .chart-table td { padding: 5px 8px; border-bottom: 1px solid var(--stroke); text-align: left; font-size: 13.5px; }

.transcript-card { margin-top: 40px; border-radius: 18px; }
.transcript-card summary { padding: 16px 20px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 10px; list-style: none; }
.transcript-card summary::-webkit-details-marker { display: none; }
.transcript-card summary .icon { color: var(--accent); }
.transcript-card summary small { margin-left: auto; color: var(--muted); font-weight: 400; }
.transcript-card .tx { padding: 0 20px 20px; white-space: pre-wrap; color: var(--ink-2); }

/* Edit form */
.edit-form { display: grid; gap: 14px; border-radius: 18px; padding: 20px; }
.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field input, .field textarea, .field select, select.input {
  min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--stroke-2); background: var(--glass-3); outline: none; transition: border-color .2s, box-shadow .2s; font-weight: 400; color: var(--ink);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus, select.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 10px 14px; font-size: 14px; }

/* ---------- Login / password ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.card { border-radius: 24px; padding: 32px 28px 28px; }
.login { width: 100%; max-width: 400px; text-align: center; }
.login .mark { width: 54px; height: 54px; border-radius: 17px; margin: 0 auto 18px; }
.login .mark .icon { width: 26px; height: 26px; }
.login h2, .card h2 { font-family: var(--serif); margin: 0; font-size: 28px; font-weight: 600; }
.login > p, .card > p { margin: 4px 0 24px; color: var(--muted); font-size: 14px; }
.login form, .card form { display: grid; gap: 14px; text-align: left; }
.login .btn, .card form .btn.primary { height: 48px; font-size: 15px; }
.fine { margin-top: 18px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.fine .icon { width: 14px; height: 14px; color: var(--accent); }
.login-wrap { padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); }
.login-shell { width: 100%; max-width: 1000px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 64px; align-items: center; }
.login-brand h1 { font-family: var(--serif); font-size: 48px; font-weight: 600; line-height: 1.2; margin: 22px 0 8px; }
.login-brand .lead { font-size: 17px; color: var(--ink-2); margin: 0 0 28px; max-width: 420px; }
.perks { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.perks li { display: flex; gap: 14px; align-items: flex-start; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
.perks b { display: block; color: var(--ink); font-weight: 600; }
.perk-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--stroke); color: var(--accent); flex: none; }
.login.card { max-width: 420px; width: 100%; justify-self: end; text-align: left; padding: 36px 32px 28px; }
.login.card h2 { font-size: 28px; }
.login.card > p { margin: 4px 0 24px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.input-wrap input { width: 100%; padding-left: 42px; }
.input-wrap .peek { position: absolute; right: 6px; width: 36px; height: 36px; border: 0; background: none; border-radius: 10px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.input-wrap .peek:hover { background: var(--accent-soft); color: var(--ink); }
.input-wrap input[type="password"], .input-wrap input#login-password { padding-right: 46px; }

/* Shorter desktop screens (e.g. 1366 × 768, or 1920 × 1080 at 125% scaling) */
@media (min-width: 861px) and (max-height: 860px) {
  .page { padding-top: 32px; }
  .hero h1 { font-size: 34px; }
  .stage { margin-top: 30px; }
  .orb { width: 150px; height: 150px; }
  .status-pill { margin-top: 40px; }
  .timer { font-size: 44px; }
  .upload { margin-top: 24px; }
  .features { display: none; }
  .login-brand h1 { font-size: 40px; }
}

/* ---------- Admin ---------- */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-family: var(--serif); font-size: 32px; font-weight: 600; margin: 4px 0 0; }
.section { border-radius: 20px; padding: 22px; margin-bottom: 18px; }
.section h2 { margin: 0 0 14px; font-size: 17px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--stroke); }
.user-row:last-child { border-bottom: 0; }
.user-row .who { flex: 1; min-width: 0; line-height: 1.4; }
.user-row .who b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-row .who span { font-size: 13px; color: var(--muted); }
.user-row.off { opacity: .55; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: var(--stroke); color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Dialogs & toasts ---------- */
dialog { width: min(480px, calc(100vw - 32px)); border: 1px solid var(--stroke); border-radius: 22px; padding: 26px; background: var(--glass-3); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(23,26,36,.32); backdrop-filter: blur(3px); }
dialog h3 { font-family: var(--serif); font-size: 22px; margin: 0 0 6px; font-weight: 600; }
dialog p { margin: 0 0 16px; color: var(--ink-2); white-space: pre-line; }
dialog .form-actions { justify-content: flex-end; margin-top: 18px; }
.share-list { list-style: none; padding: 0; margin: 0 0 14px; }
.share-list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--stroke); }
.share-list .who { flex: 1; min-width: 0; line-height: 1.35; }
.share-list .who span { display: block; font-size: 12.5px; color: var(--muted); }
.share-add { display: flex; gap: 8px; flex-wrap: wrap; }
.share-add select.input { flex: 1; min-width: 150px; }
.share-add .share-notify { flex-basis: 100%; margin-top: 2px; }
.form-actions .share-email { margin-right: auto; }
.toasts { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; background: #1f2433; color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; max-width: calc(100vw - 32px); }
.toast .icon { width: 16px; height: 16px; color: #9fe0bd; }
.toast.error .icon { color: #ff9b9e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Mobile (iPhone SE 375 → Pro Max 430) ---------- */
@media (max-width: 860px) {
  /* iOS Safari zooms into any field under 16px and stays zoomed: keep every field at 16px */
  input, select, textarea, .field input, .field textarea, .field select, select.input { font-size: 16px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); margin: 0; border-radius: 0 22px 22px 0;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); background: var(--glass-3); transform: translateX(-105%); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(23,26,36,.3); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 8;
    height: calc(env(safe-area-inset-top) + 56px); padding: env(safe-area-inset-top) 12px 0; background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--stroke); }
  .topbar .brand { padding: 0; flex: 1; gap: 8px; }
  .topbar .brand .word { font-size: 17px; }
  .topbar .logo { width: 28px; height: 28px; }
  .topbar .avatar { width: 32px; height: 32px; font-size: 14px; }
  .search kbd, .features { display: none; }

  .page { padding: 20px 16px calc(env(safe-area-inset-bottom) + 36px); }
  .hero h1 { font-size: 25px; margin-top: 6px; }
  .hero p { font-size: 14px; }
  .stage { margin-top: 28px; }
  .orb { width: 132px; height: 132px; }
  .orb .core .icon { width: 36px; height: 36px; }
  .status-pill { margin-top: 36px; font-size: 13px; }
  .timer { font-size: 38px; }
  .wave { height: 40px; margin-top: 10px; }
  .controls { margin-top: 14px; }
  .upload { margin-top: 20px; padding: 14px; }
  .recent { display: block; margin-top: 22px; }

  .doc-bar { top: calc(env(safe-area-inset-top) + 56px); padding: 6px 8px; }
  .doc-bar .lbl, .doc-bar .crumb-path, .doc-bar .crumb .icon { display: none; }
  .doc-bar .back { display: inline-flex; }
  .doc { padding: 20px 16px calc(env(safe-area-inset-bottom) + 40px); }
  .doc h1 { font-size: 26px; }
  .summary h2 { font-size: 20px; }
  .summary .sec-tldr, .summary .sec-decisions, .summary .sec-actions, .summary .sec-open { padding: 16px; border-radius: 16px; }
  .proc { padding: 22px 18px; }
  .grid-2 { grid-template-columns: 1fr; }
  .user-row { flex-wrap: wrap; }
  .user-row .row-actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
  .user-row .email-btn .lbl { display: none; }
  .toasts { bottom: calc(env(safe-area-inset-bottom) + 20px); }

  .login-shell { grid-template-columns: 1fr; gap: 22px; }
  .login-brand { text-align: center; }
  .login-brand .logo.xl { width: 60px; height: 60px; }
  .login-brand h1 { font-size: 30px; margin: 12px 0 4px; }
  .login-brand .lead { font-size: 15px; margin: 0 auto; }
  .perks { display: none; }
  .login.card { justify-self: stretch; max-width: none; padding: 26px 20px 22px; }
}

/* ---------- Links in summaries and answers ---------- */
.summary a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-hi); text-underline-offset: 3px; overflow-wrap: anywhere; }
.summary a:hover { text-decoration-color: var(--accent); }

/* ---------- Ask AI ---------- */
.ask-ai { color: var(--accent); background: var(--accent-soft); border-color: transparent; margin: 0 6px 0 4px; }
.ask-ai:hover { background: rgba(78,98,154,.14); }
.ask-ai[aria-expanded="true"] { background: var(--accent-grad); color: var(--on-accent); }
.chat { display: flex; flex-direction: column; min-height: 0; margin: 12px 12px 12px 0; border-radius: 22px; background: var(--glass-2);
  border: 1px solid var(--stroke); box-shadow: var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); overflow: hidden; animation: chat-in .22s ease; }
@keyframes chat-in { from { opacity: 0; transform: translateX(14px); } }
body.chat-open .app { grid-template-columns: 300px minmax(0, 1fr) 400px; }
.chat-scrim { display: none; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 10px 12px 16px; border-bottom: 1px solid var(--stroke); }
.chat-badge { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-grad); color: var(--on-accent);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255,255,255,.45); }
.chat-badge .icon { width: 16px; height: 16px; }
.chat-title { flex: 1; min-width: 0; line-height: 1.35; }
.chat-title b { display: block; font-size: 15px; font-weight: 600; }
.chat-title small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.chat-empty { margin: auto 0; padding: 12px; text-align: center; color: var(--muted); font-size: 13.5px; }
.chat-empty b { display: block; margin: 12px 0 4px; color: var(--ink); font-size: 15px; font-weight: 600; }
.chat-empty p { margin: 0 auto; max-width: 300px; }
.chat-empty-mark { width: 48px; height: 48px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.chat-empty-mark .icon { width: 22px; height: 22px; }

.ask { align-self: flex-end; max-width: 88%; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ask .who { font-size: 11.5px; color: var(--muted); padding-right: 4px; }
.ask .bubble { padding: 9px 14px; border-radius: 16px 16px 4px 16px; background: var(--accent-grad); color: var(--on-accent);
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 22%, transparent); }
.web-tag .icon { width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; opacity: .85; }
.answer { padding: 12px 14px; border-radius: 4px 16px 16px 16px; background: var(--glass-3); border: 1px solid var(--stroke); box-shadow: 0 1px 2px rgba(30,40,80,.04); min-width: 0; }
.answer-body { font-size: 14px; line-height: 1.7; }
.answer-body > :first-child { margin-top: 0; }
.answer-body > :last-child { margin-bottom: 0; }
.answer-body h3, .answer-body h4 { font-size: 14.5px; margin: 14px 0 4px; }
.answer-body table { min-width: 0; font-size: 13px; }
.answer-body th, .answer-body td { padding: 8px 10px; }
.answer.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .25; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 30% { opacity: 1; transform: translateY(-2px); } }

.sources { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--stroke-2); display: grid; gap: 6px; }
.sources small { font-size: 12px; font-weight: 600; color: var(--muted); }
.source { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); text-decoration: none; font-size: 12.5px; line-height: 1.4; }
.source:hover { background: rgba(78,98,154,.14); }
.source b { flex: none; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; background: var(--glass-3); color: var(--accent); font-size: 11px; }
.source span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source em { flex: none; max-width: 40%; font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.answer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.answer-actions .insert { margin-left: auto; color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.answer-actions .insert:hover { background: rgba(78,98,154,.14); }
.inserted { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ok); }
.inserted .icon { width: 14px; height: 14px; }
.insert-form { display: grid; gap: 8px; }
.insert-form small { font-size: 12.5px; color: var(--muted); }
.insert-text { width: 100%; resize: vertical; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--stroke-2); background: var(--glass-2);
  color: var(--ink); font: inherit; font-size: 14px; line-height: 1.6; }
.insert-text:focus { outline: 0; border-color: var(--accent); }
.insert-form .answer-actions { justify-content: flex-end; margin-top: 0; }

.chat-form { padding: 10px 12px 12px; border-top: 1px solid var(--stroke); display: grid; gap: 8px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--stroke); background: var(--glass-3);
  color: var(--ink-2); font: inherit; font-size: 12.5px; line-height: 1.45; text-align: left; cursor: pointer; }
.suggest:hover { border-color: var(--accent-hi); color: var(--accent); }
.suggest .icon { width: 13px; height: 13px; flex: none; color: var(--accent); }
.suggest.loading { gap: 10px; color: var(--muted); cursor: default; border-style: dashed; }
.suggest.loading:hover { border-color: var(--stroke); color: var(--muted); }
.chat-box { padding: 8px 8px 8px 12px; border-radius: 16px; border: 1px solid var(--stroke-2); background: var(--glass-3); transition: border-color .15s, box-shadow .15s; }
.chat-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#chat-input { display: block; width: 100%; min-height: 30px; max-height: 160px; padding: 2px 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: inherit; font-size: 14.5px; line-height: 1.6; }
.chat-tools { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.web-toggle { position: relative; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.web-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.web-toggle .switch { position: relative; flex: none; width: 30px; height: 18px; border-radius: 99px; background: var(--stroke-2); transition: background .15s; }
.web-toggle .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.web-toggle input:checked + .switch { background: var(--accent); }
.web-toggle input:checked + .switch::after { transform: translateX(12px); }
.web-toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.web-toggle .icon { width: 15px; height: 15px; color: var(--accent); }
.send { border-radius: 11px; }

/* Ask AI open on desktop: the note column is narrower, so the toolbar goes icon-only */
body.chat-open .doc-bar .lbl, body.chat-open .doc-bar .crumb-path { display: none; }
.doc-bar .crumb, .doc-bar .crumb-path { white-space: nowrap; }

/* Narrower desktops: the panel slides over the note instead of taking a column */
@media (min-width: 861px) and (max-width: 1179px) {
  body.chat-open .app { grid-template-columns: 300px minmax(0, 1fr); }
  .chat { position: fixed; z-index: 35; top: 12px; right: 12px; bottom: 12px; width: min(420px, calc(100vw - 24px)); margin: 0; background: var(--glass-3); box-shadow: var(--shadow-lg); }
  .chat-scrim { display: block; position: fixed; inset: 0; z-index: 34; background: rgba(23,26,36,.18); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.chat-open .chat-scrim { opacity: 1; pointer-events: auto; }
}

/* Phones: bottom sheet */
@media (max-width: 860px) {
  body.chat-open .app { grid-template-columns: 1fr; }
  .chat { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: min(88dvh, 760px); margin: 0; border-radius: 22px 22px 0 0;
    background: var(--glass-3); box-shadow: var(--shadow-lg); padding-bottom: env(safe-area-inset-bottom); animation: sheet-up .25s ease; }
  .chat-scrim { display: block; position: fixed; inset: 0; z-index: 34; background: rgba(23,26,36,.3); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.chat-open .chat-scrim { opacity: 1; pointer-events: auto; }
  #chat-input, .insert-text { font-size: 16px; } /* no iOS zoom */
  .ask-ai { margin: 0 2px; }
  .doc-bar .crumb b { display: none; } /* the big title is right below */

  /* Top bar hides while scrolling down and comes back on scroll up (app.js toggles .topbar-hidden) */
  .topbar { transition: transform .25s ease; }
  body.topbar-hidden .topbar { transform: translateY(calc(-100% + env(safe-area-inset-top))); }
  .doc-bar { transition: top .25s ease; }
  body.topbar-hidden .doc-bar { top: env(safe-area-inset-top); }

  /* Bigger, evenly spaced note toolbar */
  .doc-bar { justify-content: space-between; gap: 2px; padding: 8px 10px; }
  .doc-bar .crumb { display: none; }
  .doc-bar .btn.sm { height: 42px; min-width: 40px; border-radius: 12px; }
  .doc-bar .btn.sm .icon { width: 21px; height: 21px; }
  .doc-bar .ask-ai { padding: 0 14px; font-size: 15px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ---------- Download / share menu ---------- */
.export-menu { width: min(320px, calc(100vw - 16px)); }
.export-menu .head span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.export-menu button { align-items: flex-start; padding: 10px 12px; }
.export-menu button .icon { margin-top: 3px; color: var(--accent); }
.export-menu button span { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.export-menu button b { font-weight: 600; }
.export-menu button small { font-size: 12.5px; color: var(--muted); }

/* ---------- "ตั้งชื่อด้วย AI" next to the title box ---------- */
.title-row { display: flex; gap: 8px; align-items: stretch; }
.title-row input { flex: 1; min-width: 0; margin-top: 0 !important; }
.ai-title { flex: none; height: auto; color: var(--accent); background: var(--accent-soft); border-color: transparent; white-space: nowrap; }
.ai-title:hover { background: rgba(78,98,154,.14); }
@media (max-width: 480px) { .ai-title span { display: none; } .ai-title { width: 44px; padding: 0; justify-content: center; } }

/* ---------- PDF (print): only the report, on white A4 ---------- */
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  html, body { height: auto !important; background: #fff !important; }
  body::before { display: none !important; }
  body { font-size: 10.5pt; line-height: 1.6; }
  .sidebar, .topbar, .doc-bar, .scrim, #chat, .chat-scrim, #toasts, .menu, dialog,
  #edit-form, #note-tabs, #transcript-pane, #tools, #view-home, #view-progress, #view-password, #view-admin { display: none !important; }
  #summary { display: block !important; }
  .app { display: block !important; height: auto !important; }
  .main { overflow: visible !important; height: auto !important; }
  .doc { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .doc h1 { font-size: 20pt; margin: 0 0 8px; }
  .chips { margin-bottom: 14px; }
  .chip { background: none !important; border: 1px solid #d5dae6 !important; box-shadow: none !important; min-height: 0; padding: 1px 10px; }
  .summary h2 { font-size: 14pt; margin-top: 22px; break-after: avoid; }
  .summary h3 { font-size: 12pt; break-after: avoid; }
  .summary .sec-tldr, .summary .sec-decisions, .summary .sec-actions, .summary .sec-open, figure.chart {
    box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    border: 1px solid #d5dae6 !important; break-inside: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .summary tr, .summary li { break-inside: avoid; }
  .table-scroll { overflow: visible !important; }
  .summary table { min-width: 0 !important; font-size: 9.5pt; }
  .summary th, .summary td { padding: 6px 8px; }
  .chart-wide { display: block !important; }
  .chart-compact, figure.chart details { display: none !important; }
  a { color: inherit !important; }
}

/* Share dialog when nobody else has an account */
.share-nobody { display: grid; gap: 6px; justify-items: start; margin-top: 6px; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.share-nobody b { color: var(--ink); font-size: 14.5px; }
.share-nobody .btn { margin-top: 4px; }

/* ---------- Email dialog ---------- */
#email-form { display: grid; gap: 12px; }
#email-form h3, #email-form > p { margin: 0; }
#email-note-title { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.field-hint { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
#email-form .form-actions { margin-top: 4px; }
#email-form textarea { resize: vertical; }
#relogin-form { display: grid; gap: 12px; }
#relogin-form h3, #relogin-form > p { margin: 0; }
#relogin-form .form-actions { margin-top: 4px; justify-content: space-between; }
.relogin-user { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink) !important; font-weight: 600; }

/* ----- Settings page: the settings menu replaces the notes list (same place and size) ----- */
body.settings-mode .sidebar { visibility: hidden; } /* keeps its column; the menu card sits on top */
#view-settings { padding-top: 12px; }
.settings-side { position: fixed; z-index: 10; top: 12px; bottom: 12px; left: 12px; width: 288px; border-radius: 22px; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.settings-side-head { display: grid; justify-items: start; gap: 6px; padding: 16px 16px 12px; }
.settings-side-head h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 0 0 0 4px; }
.back-btn { color: var(--ink-2); }

.settings-nav { display: grid; gap: 2px; padding: 0 12px 16px; }
.settings-nav-title { margin: 14px 12px 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.settings-nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 12px; background: none; color: var(--ink-2); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.settings-nav-item .icon { width: 18px; height: 18px; flex: none; color: var(--muted); }
.settings-nav-item:hover { background: var(--accent-soft); color: var(--ink); }
.settings-nav-item.active { background: var(--glass-3); color: var(--accent); font-weight: 600; box-shadow: 0 1px 2px rgba(30,40,80,.06), 0 0 0 1px var(--stroke); }
.settings-nav-item.active .icon { color: var(--accent); }
.settings-nav-item .grow { flex: 1; min-width: 0; }
.settings-nav-item .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.settings-nav-item .count[hidden] { display: none; }

.settings-panel { min-width: 0; max-width: 780px; display: grid; gap: 20px; }
.settings-card { border-radius: 20px; padding: 6px 28px; }
.settings-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 22px 0 18px; border-bottom: 1px solid var(--stroke); }
.settings-group-head h2 { margin: 0 0 4px; font-size: 18px; }
.settings-group-head p { margin: 0; font-size: 13.5px; color: var(--muted); }
.settings-list { display: grid; }

/* name and help on the left, the control on the right */
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 10px 32px; align-items: center; padding: 20px 0; border-top: 1px solid var(--stroke); }
.settings-list > .setting:first-child { border-top: 0; }
.setting.switch-row { grid-template-columns: minmax(0, 1fr) auto; }
.setting.wide { grid-template-columns: minmax(0, 1fr); }
.setting-info { display: grid; gap: 4px; min-width: 0; }
.setting-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setting-head label { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.setting-help { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.setting-control { min-width: 0; }
.setting-control input:not([type="checkbox"]), .setting-control select, .prompt-box {
  width: 100%; min-height: 42px; padding: 9px 13px; border-radius: 11px; border: 1px solid var(--stroke-2); background: var(--glass-3); outline: none; color: var(--ink); font: inherit; font-size: 14.5px;
}
.setting-control input:focus, .setting-control select:focus, .prompt-box:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.setting-control input[type="number"]:invalid { border-color: var(--danger); }
.prompt-box { resize: vertical; line-height: 1.65; font-size: 13.5px; min-height: 180px; }
.setting-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 0 22px; }
.settings-card .form-error { margin: 0 0 14px; }

/* on/off switch */
.toggle { position: relative; display: inline-flex; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .switch { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--stroke-2); transition: background .15s; }
.toggle .switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(18px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.account-card { display: flex; align-items: center; gap: 16px; padding: 22px 28px; }
.account-card .avatar { width: 52px; height: 52px; font-size: 20px; }
.account-card .who { display: grid; gap: 2px; }
.account-card .who b { font-size: 17px; }
.account-card .who span { font-size: 13.5px; color: var(--muted); }

.settings-history { list-style: none; margin: 0; padding: 8px 0 18px; display: grid; font-size: 13.5px; }
.settings-history li { overflow-wrap: anywhere; padding: 12px 0; border-top: 1px solid var(--stroke); }
.settings-history li:first-child { border-top: 0; }
.settings-list > p { padding: 18px 0; margin: 0; }
.settings-bar { position: sticky; bottom: 16px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-radius: 16px; box-shadow: var(--shadow-lg); font-size: 14px; }
.settings-bar .grow { flex: 1; min-width: 0; }

@media (max-width: 860px) {
  body.settings-mode .sidebar { visibility: visible; } /* the off-screen drawer */
  body.settings-mode .topbar { display: none; } /* the page has its own back button */
  #view-settings { padding-top: calc(env(safe-area-inset-top) + 12px); }
  /* the menu card becomes a page header + a sticky, scrolling bar of sections */
  .settings-side { display: contents; }
  .settings-side-head { padding: 0 0 12px; }
  .settings-side-head .back-btn { margin-left: -10px; }
  .settings-side-head h1 { margin: 0; }
  .settings-nav { position: sticky; top: 0; z-index: 4; display: flex; overflow-x: auto; gap: 6px; margin: 0 -16px 14px; padding: 8px 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-title { display: none; }
  .settings-nav-item { flex: none; min-height: 38px; padding: 6px 14px; white-space: nowrap; border-radius: 99px; background: var(--glass-2); box-shadow: 0 0 0 1px var(--stroke); }
  .settings-nav-item .grow { flex: none; }
  .settings-card { padding: 4px 18px; }
  .account-card { padding: 18px; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px 0; }
  .setting.switch-row { grid-template-columns: minmax(0, 1fr) auto; }
  .setting-control input:not([type="checkbox"]), .setting-control select, .prompt-box { font-size: 16px; } /* no iOS zoom */
  .settings-actions .btn { width: 100%; height: 44px; }
  .settings-bar { bottom: calc(env(safe-area-inset-bottom) + 12px); }
}
.meeting-opt b { color: var(--ink-2); font-weight: 600; }
.badge.user { background: var(--glass-2); color: var(--ink-2); border: 1px solid var(--stroke); }
.user-row .who .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.user-row .who .meta .badge { font-size: 11.5px; padding: 1px 8px; }
.user-row .who .badge.admin { color: var(--accent); }
.user-row .who .badge.user { color: var(--ink-2); }
.chunks .state-retrying { color: var(--warn); }

/* ---------- System log page (admins) ---------- */
.page.wide { max-width: 1040px; }
.log-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.log-toolbar .seg { margin-top: 0; }
.log-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.log-summary .stat { padding: 12px 14px; border-radius: 14px; background: var(--glass-2); border: 1px solid var(--stroke); display: grid; gap: 2px; min-width: 0; }
.log-summary .stat b { font-size: 22px; font-weight: 600; color: var(--ink); }
.log-summary .stat span { font-size: 12.5px; color: var(--muted); }
.log-summary .stat.bad b { color: var(--danger); }
#view-logs table { width: 100%; border-collapse: collapse; font-size: 14px; }
#view-logs th, #view-logs td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
#view-logs th { font-size: 12.5px; color: var(--muted); font-weight: 600; }
#view-logs td.bad { color: var(--danger); font-weight: 600; }
.log-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.log-filters { display: grid; grid-template-columns: 150px 170px 150px minmax(0, 1fr); gap: 8px; margin-bottom: 12px; }
.log-filters .input { height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--stroke-2); background: var(--glass-3); color: var(--ink); font: inherit; font-size: 14px; min-width: 0; }
.log-list { display: grid; gap: 4px; }
.log-row { border-radius: 10px; border: 1px solid var(--stroke); background: var(--glass-3); }
.log-row.error { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.log-row.warn { border-color: var(--warn-line); }
.log-row summary { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; cursor: pointer; list-style: none; font-size: 13.5px; flex-wrap: wrap; }
.log-row summary::-webkit-details-marker { display: none; }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; }
.log-type { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.log-user { color: var(--accent); white-space: nowrap; }
.log-text { color: var(--ink-2); overflow-wrap: anywhere; flex: 1 1 260px; min-width: 0; }
.badge.lvl-error { background: var(--danger-soft); color: var(--danger); }
.badge.lvl-warn { background: var(--warn-soft); color: var(--warn); }
.badge.lvl-info { background: var(--glass-2); color: var(--muted); border: 1px solid var(--stroke); }
.log-detail { margin: 0; padding: 10px 12px; border-top: 1px dashed var(--stroke-2); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); max-height: 360px; overflow: auto; }
@media (max-width: 860px) {
  .log-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-filters { grid-template-columns: 1fr 1fr; }
  .log-filters .input { height: 42px; font-size: 16px; } /* no iOS zoom */
  .log-filters input[type="search"] { grid-column: 1 / -1; }
}

/* ---------- v27: app layout (home library, note tabs, transcript turns) ---------- */
.dock, .home-lib { display: none; }
.topbar .brand { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }

/* Note tabs: a segmented switch under the title (computers, and phones in Safari) */
.note-tabs { display: inline-flex; gap: 4px; margin: 0 0 26px; padding: 4px; border-radius: 99px; background: var(--glass-2); border: 1px solid var(--stroke); }
.note-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 18px; border: 0; border-radius: 99px; background: none;
  color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; transition: background .15s, color .15s; }
.note-tabs button .icon { width: 17px; height: 17px; }
.note-tabs button:hover { color: var(--ink); }
.note-tabs button[aria-current="page"] { background: var(--glass-3); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(30,40,80,.12); }
@media (min-width: 861px) { .note-tabs [data-tab="chat"] { display: none; } } /* the "ถาม AI" button opens the side panel */

/* Transcript: who said what */
.turns { display: grid; gap: 18px; }
.turn { --spk: #4e629a; display: flex; gap: 12px; align-items: flex-start; }
.turn.s1 { --spk: #c0612b; } .turn.s2 { --spk: #17805d; } .turn.s3 { --spk: #8a5cc2; } .turn.s4 { --spk: #8f6a00; } .turn.s5 { --spk: #c2417a; }
.turn .who { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin-top: 2px;
  font-size: 14px; font-weight: 600; color: #fff; background: var(--spk); box-shadow: 0 4px 12px color-mix(in srgb, var(--spk) 30%, transparent); }
.turn .said { min-width: 0; }
.turn .said b { display: block; font-size: 13.5px; font-weight: 600; color: var(--spk); line-height: 1.4; }
.turn .said p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.turn.plain { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }

@media (max-width: 860px) {
  #open-list, .doc-bar .ask-ai { display: none; }
  .topbar .brand { padding-left: 4px; }

  /* Home = library + two big actions; while recording it turns into the recorder */
  body:not(.recording) #view-home > :is(.hero, .stage, #dropzone, .features) { display: none; }
  body.recording #view-home > :is(.hero, #dropzone, .features, .dock, .home-lib) { display: none; }
  body.recording .stage { margin-top: 12vh; }
  .dock { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-bottom: 14px; }
  .dock-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 54px; border-radius: 18px; font: inherit; font-size: 16px; font-weight: 600;
    cursor: pointer; color: var(--ink); background: var(--glass-3); border: 1px solid var(--stroke-2); box-shadow: 0 1px 2px rgba(30,40,80,.06); }
  .dock-btn .icon { width: 21px; height: 21px; }
  .dock-btn.primary { color: var(--on-accent); border: 0; background: var(--accent-grad); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 35%, transparent); }
  .dock-btn:active { transform: scale(.98); }
  .home-lib { display: block; }
  .home-lib .search { height: 46px; border-radius: 14px; background: var(--glass-3); }
  .home-lib .nav-label { padding: 18px 4px 8px; font-size: 13px; }
  .note-list.cards { display: grid; gap: 8px; }
  .note-list.cards .note-item { background: var(--glass-3); border: 1px solid var(--stroke); border-radius: 16px; box-shadow: 0 1px 2px rgba(30,40,80,.05); }
  .note-list.cards .note-item .open { padding: 13px 16px; }
  .note-list.cards .note-item .t { font-size: 15.5px; }
  .note-list.cards .note-item .m { font-size: 13px; }
  .install-hint { display: flex; align-items: flex-start; gap: 12px; padding: 14px 8px 14px 14px; border-radius: 16px; margin-bottom: 14px; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
  .install-hint .ico { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
  .install-hint b { display: block; color: var(--ink); font-weight: 600; }

  /* Note tabs in Safari: full width switch under the title */
  .note-tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-bottom: 22px; }
  .note-tabs button { padding: 0 6px; height: 40px; font-size: 14.5px; }
}

/* Opened from the home screen (PWA): real bottom bars, like a native app */
@media (max-width: 860px) {
  html.standalone .dock { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; margin: 0; padding: 12px 16px calc(env(safe-area-inset-bottom) + 10px);
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--stroke); }
  html.standalone #view-home { padding-bottom: calc(env(safe-area-inset-bottom) + 110px); }

  html.standalone .note-tabs { position: fixed; z-index: 36; left: 0; right: 0; bottom: 0; margin: 0; padding: 6px 10px calc(env(safe-area-inset-bottom) + 4px);
    border-radius: 0; border: 0; border-top: 1px solid var(--stroke); background: var(--glass-3);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  html.standalone .note-tabs button { flex-direction: column; gap: 2px; height: 56px; border-radius: 14px; font-size: 12.5px; color: var(--muted); box-shadow: none; background: none; }
  html.standalone .note-tabs button .icon { width: 44px; height: 28px; padding: 4px 12px; border-radius: 99px; transition: background .15s; }
  html.standalone .note-tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }
  html.standalone .note-tabs button[aria-current="page"] .icon { background: var(--accent-soft); }
  html.standalone .doc { padding-bottom: calc(env(safe-area-inset-bottom) + 100px); }

  /* Ask AI: the whole screen above the tab bar instead of a sheet */
  html.standalone .chat { top: 0; height: auto; bottom: calc(66px + env(safe-area-inset-bottom)); border-radius: 0; padding: env(safe-area-inset-top) 0 0; border: 0; animation: none; }
  html.standalone .chat-scrim { display: none; }

  /* Keyboard up: bars step aside */
  html.standalone body.typing :is(.dock, .note-tabs) { display: none; }
  html.standalone body.typing .chat { bottom: 0; }
}

/* Live text while recording (v27) */
.livebox { width: min(640px, 100%); margin-top: 22px; padding: 14px 16px 12px; border-radius: 20px; text-align: left; max-height: 38vh; overflow-y: auto; overscroll-behavior: contain; }
.live-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 12px; }
.live-head b { font-size: 14px; font-weight: 600; }
.live-head small { font-size: 12.5px; color: var(--muted); }
.livebox .turns { gap: 14px; }
.livebox .turn .who { width: 30px; height: 30px; font-size: 13px; }
.live-status { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.live-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rec); animation: blink 1.4s infinite; flex: none; }
.livebox.busy .live-status .dot { background: var(--accent); }
@media (max-width: 860px) {
  /* Phones: a compact recorder on top, the live text fills the rest of the screen */
  body.recording:has(#live:not([hidden])) .stage { margin-top: 4px; }
  body.recording:has(#live:not([hidden])) .orb { width: 92px; height: 92px; }
  body.recording:has(#live:not([hidden])) .orb .core .icon { width: 28px; height: 28px; }
  body.recording:has(#live:not([hidden])) .status-pill { margin-top: 22px; }
  body.recording:has(#live:not([hidden])) .timer { font-size: 32px; }
  body.recording:has(#live:not([hidden])) .wave { height: 30px; margin-top: 6px; }
  .livebox { margin-top: 16px; max-height: none; height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 420px); min-height: 180px; }
}

/* ---------- v28: rename speakers, report tools ---------- */
.turn button.who { border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; }
.turn .spk-name { display: inline-block; border: 0; padding: 0; background: none; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.4;
  color: var(--spk); text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--spk) 45%, transparent); }
.turn .spk-name:hover { text-decoration-style: solid; }

.tools { margin: 0 0 22px; }
.tool-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 99px; cursor: pointer; font: inherit; font-size: 14px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid transparent; transition: background .15s; }
.tool-btn:hover { background: rgba(78,98,154,.14); }
.tool-btn .icon { width: 17px; height: 17px; }
.tool-btn.making { opacity: .75; cursor: progress; }
.tool-btn.making .icon { animation: blink 1.2s infinite; }
.outputs { display: grid; gap: 10px; }
.outputs:not(:empty) { margin-top: 14px; }
.output-card { border-radius: 18px; }
.output-card > summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.output-card > summary::-webkit-details-marker { display: none; }
.output-card .o-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-grad); color: var(--on-accent); }
.output-card .o-ico .icon { width: 16px; height: 16px; }
.output-card .o-t { flex: 1; min-width: 0; line-height: 1.4; }
.output-card .o-t b { display: block; font-weight: 600; }
.output-card .o-t small { display: block; font-size: 12.5px; color: var(--muted); }
.output-card .o-stale { margin: 0 16px 8px; padding: 8px 12px; border-radius: 10px; font-size: 13px; color: var(--warn); background: var(--warn-soft); }
.output-card .output-body { padding: 0 18px; }
.output-card .o-actions { display: flex; gap: 6px; padding: 6px 12px 12px; }
@media (max-width: 860px) {
  .tool-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tool-btn { flex-direction: column; justify-content: center; gap: 2px; height: 60px; padding: 0 4px; border-radius: 14px; font-size: 13px; text-align: center; line-height: 1.25; }
  .output-card .output-body { padding: 0 14px; }
}

/* × close button in the corner of the share and email boxes */
.dialog-x { position: absolute; top: 12px; right: 12px; z-index: 1; color: var(--muted); }
