/* ============================================================
   ui.css - the silent
   The dashboard in the style of the recording page (pack.css): same colours, fonts,
   buttons, menus and pop-ups. Loaded after style.css and overrides it.
   ============================================================ */
:root {
  --ui-bg: #F4F5F7;
  --ui-card: #FFFFFF;
  --ui-soft: #F9FAFB;
  --ui-ink: #17181C;
  --ui-ink-2: #34363D;
  --ui-muted: #5B5D66;
  --ui-line: #E3E5EA;
  --ui-line-2: #ECEEF2;
  --ui-gold: #B8892E;
  --ui-gold-ink: #7A5A16;
  --ui-gold-soft: #EFF1F5;
  --ui-dark: #17181C;
  --ui-ok: #2F6B4F;
  --ui-bad: #A8462F;
  --ui-r: 14px;

  /* style.css variables, mapped to the same palette */
  --font: 'Switzer', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-d: 'Cabinet Grotesk', 'Switzer', system-ui, sans-serif;
  --font-display: var(--font-d);
  --bg: var(--ui-bg); --bg-warm: var(--ui-soft); --bg2: var(--ui-soft); --card: var(--ui-card);
  --sidebar-bg: #17181C; --sidebar-hover: rgba(255,255,255,0.06); --sidebar-active: rgba(255,255,255,0.09);
  --border: var(--ui-line); --border-light: var(--ui-line-2); --border-l: var(--ui-line-2);
  --text: var(--ui-ink); --text-2: var(--ui-muted); --text-3: #8B8D96;
  --t1: var(--ui-ink); --t2: var(--ui-muted); --t3: #8B8D96; --text-1: var(--ui-ink);
  --accent: var(--ui-gold); --accent-soft: var(--ui-gold-soft); --orange: var(--ui-gold); --orange-s: var(--ui-gold-soft);
  --gold: var(--ui-gold); --gold-soft: var(--ui-gold-soft);
  --r: 14px; --rs: 10px; --rxs: 8px;
}

html, body { background: var(--sidebar-bg); }
body { font-family: var(--font); color: var(--ui-ink); font-size: 16px; line-height: 1.5; }
button { font-family: inherit; }
h1, h2, h3 { font-family: var(--font-d); letter-spacing: -0.015em; }
:focus-visible { outline: 2px solid var(--ui-gold); outline-offset: 2px; }

/* ---------- buttons, inputs ---------- */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--ui-line);
  background: var(--ui-card); color: var(--ui-ink); font: 600 14px/1.2 var(--font);
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, transform .1s;
}
.ui-btn:hover:not([disabled]) { border-color: #CFC6B2; background: var(--ui-soft); }
.ui-btn:active:not([disabled]) { transform: scale(.98); }
.ui-btn[disabled] { opacity: .5; cursor: default; }
.ui-btn-dark { background: var(--ui-dark); border-color: var(--ui-dark); color: #fff; }
.ui-btn-dark:hover:not([disabled]) { background: #2A2B31; border-color: #2A2B31; }
.ui-btn-ghost { background: transparent; border-color: transparent; color: var(--ui-muted); }
.ui-btn-ghost:hover:not([disabled]) { background: rgba(23,24,28,0.05); border-color: transparent; color: var(--ui-ink); }
.ui-btn-danger { background: var(--ui-bad); border-color: var(--ui-bad); color: #fff; }
.ui-btn-danger:hover:not([disabled]) { background: #923A26; border-color: #923A26; }
.ui-btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.ui-btn svg { flex-shrink: 0; }
.ui-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ui-muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.ui-icon-btn:hover { background: var(--ui-card); border-color: var(--ui-line); color: var(--ui-ink); }
.ui-more { width: 40px; height: 40px; background: var(--ui-card); border-color: var(--ui-line); }
.ui-linkbtn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--ui-gold-ink); font: 600 14px var(--font); cursor: pointer; padding: 6px 4px; }
.ui-linkbtn:hover { text-decoration: underline; }

.ui-inp, input.ui-inp, select.ui-inp, textarea.ui-inp {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-card); color: var(--ui-ink); font: 400 15px/1.4 var(--font); outline: none; box-shadow: none;
}
.ui-inp:focus { border-color: var(--ui-gold); box-shadow: 0 0 0 3px rgba(184,137,46,0.14); }
.ui-inp-sm, select.ui-inp-sm { min-height: 34px; padding: 5px 10px; font-size: 13.5px; width: auto; border-radius: 9px; }
select.ui-inp { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235B5D66' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.ui-field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; font-size: 13.5px; font-weight: 600; color: var(--ui-ink-2); }
.ui-field em { font-style: normal; font-weight: 400; color: var(--ui-muted); margin-left: 4px; }
.ui-field-inline { flex-direction: row; align-items: center; gap: 10px; margin: 0; }
.ui-field-inline .ui-inp { width: auto; min-width: 160px; }
.ui-hint { font-size: 13.5px; color: var(--ui-muted); margin: 0; line-height: 1.5; }
.ui-hint b { color: var(--ui-ink); }
.ui-muted { color: var(--ui-muted); }
.ui-tabnum { font-variant-numeric: tabular-nums; }
.ui-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--ui-soft); border: 1px solid var(--ui-line); color: var(--ui-ink-2); white-space: nowrap; }
.ui-tag-ok { background: #E7F1EB; border-color: #CFE3D6; color: var(--ui-ok); }
.ui-tag-wait { background: var(--ui-gold-soft); border-color: #EADBB6; color: var(--ui-gold-ink); }
.ui-tag-bad { background: #F6E3DD; border-color: #EBC9BE; color: var(--ui-bad); }
.ui-ok { display: inline-flex; align-items: center; gap: 4px; color: var(--ui-ok); font-weight: 600; }

/* legacy buttons and fields used by older parts of the app */
.btn { border-radius: 10px; font-family: var(--font); font-weight: 600; }
.btn-primary { background: var(--ui-dark); color: #fff; }
.btn-ghost { border-color: var(--ui-line); color: var(--ui-ink-2); }
.btn-purple, .btn-orange, .btn-teal, .btn-green { background: var(--ui-gold-soft); color: var(--ui-gold-ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="search"], select, textarea { border-width: 1px; border-color: var(--ui-line); border-radius: 10px; font-family: var(--font); }
input:focus, select:focus, textarea:focus { border-color: var(--ui-gold); box-shadow: 0 0 0 3px rgba(184,137,46,0.14); }

/* ---------- shell ---------- */
.main { background: var(--ui-bg); border-radius: 16px 0 0 16px; }
.sidebar { width: 236px; background: var(--sidebar-bg); border-right: 0; }
.sidebar-logo { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.logo-wordmark { font-size: 17px; font-weight: 800; }
.logo-bars span:nth-child(3), .logo-wordmark b { color: var(--ui-gold-hi, #D9B865); }
.logo-bars span:nth-child(3) { background: #D9B865; }
.logo-wordmark b { color: #D9B865; }
#sidebar { padding: 10px; gap: 2px; }
.sidebar-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: rgba(255,255,255,0.38); padding: 16px 10px 6px; }
.cat-btn { gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.68); min-height: 38px; }
.cat-btn:hover { background: var(--sidebar-hover); color: #fff; }
.cat-btn.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #D9B865; }
.cat-btn svg { width: 18px; height: 18px; opacity: .7; }
.cat-btn.active svg { stroke: #D9B865; opacity: 1; }
.cat-btn span:not(.cat-count) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { font-size: 12px; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.55); border-radius: 999px; padding: 1px 8px; }
.cat-count:empty { display: none; }
.cat-btn.active .cat-count { background: rgba(217,184,101,0.18); color: #E9CF8E; }
#seriesList .cat-btn[style*="opacity"] { opacity: 1 !important; color: rgba(255,255,255,0.5); }
#seriesList .cat-btn[style*="opacity"]:hover { color: #fff; }
.sb-subs { padding-left: 18px; }
.sb-sub { font-size: 13px; color: rgba(255,255,255,0.5); padding: 6px 10px; border-radius: 8px; display: flex; justify-content: space-between; }
.sb-sub.active { color: #E9CF8E; }
.sb-add-sub { font-size: 12.5px; color: rgba(255,255,255,0.38); padding: 5px 10px; }
.sb-add-sub:hover { color: #E9CF8E; }
.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-user { padding: 8px; border-radius: 12px; gap: 10px; }
.sidebar-user-name { font-size: 14px; color: #fff; }
.sidebar-user-plan { font-size: 12px; color: rgba(255,255,255,0.5); }
.user-avatar { width: 34px; height: 34px; border-radius: 10px; background: #D9B865; color: var(--ui-ink); font-size: 14px; font-weight: 800; }
.sb-signout { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: rgba(255,255,255,0.45); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.sb-signout:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sb-toggle { color: rgba(255,255,255,0.5); }

/* ---------- top bar ---------- */
.topbar { background: var(--ui-bg); border-bottom: 1px solid var(--ui-line); padding: 14px clamp(16px, 3vw, 32px); gap: 12px; }
.topbar-title { font-size: 18px; font-weight: 800; }
.topbar-right { gap: 8px; }
.tb-btn { min-height: 40px; }
.search-box svg { left: 12px; width: 16px; height: 16px; color: var(--ui-muted); }
.search-box input { width: 260px; min-height: 40px; padding: 8px 12px 8px 36px; background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: 10px; font-size: 14.5px; }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
.hamburger-btn { width: 40px; height: 40px; border: 1px solid var(--ui-line); background: var(--ui-card); color: var(--ui-ink); border-radius: 10px; }

/* ---------- dashboard home ---------- */
.dash-scroll { padding: 28px clamp(16px, 3vw, 32px) 48px; }
.dash-scroll > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.welcome { margin-bottom: 22px; }
.welcome h1 { font-family: var(--font-d); font-size: clamp(26px, 3vw, 34px); font-weight: 800; line-height: 1.1; margin: 0 0 6px; }
.welcome p { font-size: 15.5px; color: var(--ui-muted); margin: 0; max-width: 60ch; }
.quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.qa-card {
  align-items: flex-start; text-align: left; gap: 4px; padding: 18px; border: 1px solid var(--ui-line); border-radius: var(--ui-r);
  background: var(--ui-card); font: inherit; color: inherit; cursor: pointer;
}
.qa-card::before { display: none; }
.qa-card:hover { border-color: #CFC6B2; transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(23,24,28,0.35); }
.qa-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--ui-gold-soft) !important; color: var(--ui-gold-ink); margin-bottom: 10px; }
.qa-icon svg { width: 20px; height: 20px; stroke: currentColor !important; }
.qa-text { font-family: var(--font-d); font-size: 17px; font-weight: 800; color: var(--ui-ink); }
.qa-sub { font-size: 13.5px; color: var(--ui-muted); }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card { background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: var(--ui-r); padding: 14px 16px; }
.stat-value { font-size: 24px; font-weight: 800; }
.stat-label { font-size: 13px; color: var(--ui-muted); margin-top: 4px; }

.home-series { margin-bottom: 28px; }
.ui-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.ui-sec-head h2 { font-size: 20px; font-weight: 800; margin: 0; }
.ui-series-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ui-series-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border: 1px solid var(--ui-line); border-radius: var(--ui-r); background: var(--ui-card); text-align: left; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
.ui-series-card:hover { border-color: #CFC6B2; transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(23,24,28,0.35); }
.ui-series-card b { font-family: var(--font-d); font-size: 16.5px; font-weight: 800; overflow-wrap: anywhere; }
.ui-series-card > span:last-child { font-size: 13.5px; color: var(--ui-muted); }
.ui-series-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--ui-dark); color: #D9B865; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sec-title { font-size: 20px; font-weight: 800; margin: 0; }
.sec-tools { display: flex; align-items: center; gap: 8px; }
.sec-tools [hidden] { display: none !important; }

/* recordings table */
.rec-table { background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: var(--ui-r); }
.rec-header, .rec-card, .list-item { grid-template-columns: minmax(0, 1fr) 110px 76px 96px 130px; gap: 12px; padding: 12px 18px; }
.rec-header { background: var(--ui-soft); border-bottom: 1px solid var(--ui-line); padding-top: 10px; padding-bottom: 10px; }
.rec-header span { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--ui-muted); }
.rec-card { border-bottom: 1px solid var(--ui-line-2); }
.rec-card:hover { background: var(--ui-soft); }
.rec-name-cell { gap: 12px; }
.rec-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--ui-soft) !important; border: 1px solid var(--ui-line-2); }
.rec-icon svg { width: 16px; height: 16px; stroke: var(--ui-ink-2) !important; }
.rec-name { font-size: 15px; font-weight: 600; }
.rec-excerpt { font-size: 13px; color: var(--ui-muted); margin-top: 2px; }
.rec-cell { font-size: 13.5px; color: var(--ui-ink-2); font-variant-numeric: tabular-nums; }
.type-badge { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 3px 9px; border-radius: 999px; background: var(--ui-soft) !important; border: 1px solid var(--ui-line); color: var(--ui-ink-2) !important; }
.type-badge::first-letter { text-transform: uppercase; }
.tb-lecture { background: var(--ui-gold-soft) !important; border-color: #EADBB6; color: var(--ui-gold-ink) !important; }
.rec-status { font-size: 13px; color: var(--ui-ok); }
.empty-state { padding: 48px 16px; color: var(--ui-muted); }
.empty-state p { font-size: 15px; }
.empty-state .hint { font-size: 13.5px; }

/* ---------- detail page ---------- */
#pageDetail { background: var(--ui-bg); }
.breadcrumb { background: var(--ui-bg); border-bottom: 1px solid var(--ui-line); font-size: 14px; color: var(--ui-muted); padding: 12px clamp(16px, 3vw, 32px); }
.breadcrumb:hover { color: var(--ui-ink); }
#pageDetail[data-mode="series"] #dashBtn, #pageDetail[data-mode="live"] #dashBtn { display: none; }
#pageDetail[data-mode="series"] #detailContent, #pageDetail[data-mode="live"] #detailContent { overflow-y: auto; flex: 1; }

/* page layout used by the series page and live transcription */
.ui-page { max-width: 1180px; margin: 0 auto; padding: 18px clamp(16px, 3vw, 32px) 56px; }
.ui-backlink { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--ui-muted); font: 500 14px var(--font); cursor: pointer; padding: 6px 6px 6px 0; margin-bottom: 6px; }
.ui-backlink:hover { color: var(--ui-ink); }
.ui-headrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.ui-head { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ui-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-gold-ink); }
.ui-title-row { display: flex; align-items: flex-start; gap: 6px; }
.ui-title { font-size: clamp(26px, 3vw, 34px); line-height: 1.1; font-weight: 800; margin: 0; overflow-wrap: anywhere; }
.ui-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: var(--ui-muted); }
.ui-desc { margin: 0; color: var(--ui-ink-2); font-size: 15.5px; max-width: 70ch; }
.ui-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-menu-wrap { position: relative; }
.ui-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 250px; background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: 14px; box-shadow: 0 18px 40px -16px rgba(23,24,28,0.35); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.ui-menu[hidden] { display: none; }
.ui-menu button { display: flex; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px; border-radius: 8px; font: 500 14px var(--font); color: var(--ui-ink); cursor: pointer; min-height: 40px; align-items: center; }
.ui-menu button:hover { background: var(--ui-soft); }
.ui-menu button.danger { color: var(--ui-bad); font-weight: 600; }
.ui-menu-div { height: 1px; background: var(--ui-line-2); margin: 4px 6px; }
.ui-callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--ui-r); background: var(--ui-dark); color: #fff; margin-bottom: 26px; }
.ui-callout b { font-family: var(--font-d); font-size: 18px; font-weight: 800; }
.ui-callout p { margin: 4px 0 0; color: rgba(255,255,255,0.72); font-size: 14.5px; max-width: 62ch; }
.ui-callout .ui-btn-dark { background: #D9B865; border-color: #D9B865; color: var(--ui-ink); }
.ui-callout .ui-btn-dark:hover { background: #E4C67A; border-color: #E4C67A; }
.ui-parts { list-style: none; margin: 0; padding: 0; background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: var(--ui-r); overflow: hidden; }
.ui-part { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--ui-line-2); }
.ui-part:last-child { border-bottom: 0; }
.ui-part:hover { background: var(--ui-soft); }
.ui-part-n { width: 30px; height: 30px; border-radius: 9px; background: var(--ui-gold-soft); color: var(--ui-gold-ink); font: 800 14px var(--font-d); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ui-part-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; background: none; text-align: left; cursor: pointer; padding: 6px 0; font: inherit; color: inherit; }
.ui-part-main b { font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
.ui-part-main span { font-size: 13px; color: var(--ui-muted); }
.ui-part-main:hover b { text-decoration: underline; text-underline-offset: 3px; }
.ui-empty { text-align: center; padding: 48px 20px; border: 1px dashed #D8CFBC; border-radius: var(--ui-r); background: var(--ui-soft); }
.ui-empty h2 { font-size: 22px; margin: 0 0 6px; }
.ui-empty p { margin: 0 auto 16px; color: var(--ui-muted); max-width: 52ch; }

/* ---------- pop-ups ---------- */
.ui-back { position: fixed; inset: 0; z-index: 120; background: rgba(23,24,28,0.45); display: flex; align-items: center; justify-content: center; padding: 16px; animation: uiFade .15s ease; }
.ui-modal { width: min(460px, 100%); max-height: min(88vh, 860px); display: flex; flex-direction: column; background: var(--ui-card); border-radius: 18px; box-shadow: 0 30px 80px -30px rgba(23,24,28,0.55); animation: uiPop .18s cubic-bezier(.2,.8,.2,1); overflow: hidden; }
.ui-modal-wide { width: min(620px, 100%); }
.ui-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 6px 22px; }
.ui-modal-head h2 { font-size: 22px; font-weight: 800; margin: 0; }
.ui-modal-head p { margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); line-height: 1.45; }
.ui-modal-body { padding: 14px 22px 8px; overflow-y: auto; }
.ui-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--ui-line-2); flex-wrap: wrap; }
.ui-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ui-choice { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 4px; padding: 16px; border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-card); cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, background .15s; }
.ui-choice:hover:not([disabled]) { border-color: var(--ui-ink); background: var(--ui-soft); }
.ui-choice[disabled] { opacity: .5; cursor: default; }
.ui-choice b { font-size: 15.5px; font-weight: 700; }
.ui-choice > span:last-child { font-size: 13.5px; color: var(--ui-muted); line-height: 1.4; }
.ui-choice-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--ui-gold-soft); color: var(--ui-gold-ink); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.ui-checklist { max-height: 300px; overflow-y: auto; border: 1px solid var(--ui-line); border-radius: 12px; }
.ui-check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--ui-line-2); cursor: pointer; font-weight: 400; color: var(--ui-ink); }
.ui-check:last-child { border-bottom: 0; }
.ui-check:hover { background: var(--ui-soft); }
.ui-check input { width: 18px; height: 18px; accent-color: var(--ui-dark); flex-shrink: 0; margin: 0; }
.ui-check-t { flex: 1; min-width: 0; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-check-m { font-size: 13px; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.ui-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ui-profile > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ui-profile b { font-size: 17px; }
.ui-profile > div > span { font-size: 14px; color: var(--ui-muted); overflow-wrap: anywhere; }
.ui-profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ui-avatar { width: 52px; height: 52px; border-radius: 14px; background: #D9B865; color: var(--ui-ink); font: 800 22px var(--font-d); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ui-stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.ui-stats3 > div { background: var(--ui-soft); border: 1px solid var(--ui-line-2); border-radius: 12px; padding: 10px 12px; }
.ui-stats3 b { display: block; font: 800 20px var(--font-d); }
.ui-stats3 span { font-size: 12.5px; color: var(--ui-muted); }
.ui-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@keyframes uiFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes uiPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* older pop-ups that still use the legacy markup */
.vn-modal-backdrop { background: rgba(23,24,28,0.45); z-index: 120; }
.vn-modal { border-radius: 18px; box-shadow: 0 30px 80px -30px rgba(23,24,28,0.55); }
.vn-modal-header { padding: 18px 20px 8px; border-bottom: 0; }
.vn-modal-header h3 { font-family: var(--font-d); font-size: 20px; font-weight: 800; }
.vn-modal-body { padding: 10px 20px 20px; }

/* ---------- live transcription ---------- */
.ui-live-on { color: var(--ui-bad); }
.ui-rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ui-bad); animation: uiPulse 1.2s ease-in-out infinite; }
@keyframes uiPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
.ui-live-tools { margin: -6px 0 16px; }
.ui-live-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ui-card { background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: var(--ui-r); padding: 16px 18px; }
.ui-lbl { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-gold-ink); margin-bottom: 8px; }
.ui-live-feed { max-height: 180px; overflow-y: auto; font-size: 16px; line-height: 1.6; background: var(--ui-soft); }
.ui-live-main { min-height: 280px; max-height: 58vh; overflow-y: auto; font-family: 'Gambetta', Georgia, serif; font-size: 18.5px; line-height: 1.75; }
.ui-live-main .ui-lbl { font-family: var(--font); }
.live-word-past { color: var(--ui-muted); }
.live-word-current { color: var(--ui-ink); font-weight: 500; }

/* ---------- recording bar, upload progress ---------- */
.recording-bar { top: auto !important; bottom: 20px; right: auto !important; left: 50%; transform: translateX(-50%); gap: 12px !important; padding: 8px 8px 8px 16px !important; background: var(--ui-dark) !important; border: 0 !important; border-radius: 999px !important; box-shadow: 0 18px 40px -16px rgba(23,24,28,0.6) !important; color: #fff; z-index: 150 !important; }
.recording-bar .rec-dot { background: #E8735A; }
.recording-bar .rec-timer { color: #fff !important; font-size: 15px; }
.recording-bar > span[style] { color: rgba(255,255,255,0.55) !important; font-size: 13px !important; }
.recording-bar .btn { min-height: 36px; border-radius: 999px; font-size: 13.5px; padding: 6px 14px; }
.recording-bar .btn:not(.btn-ghost) { background: #fff !important; color: var(--ui-ink) !important; }
.recording-bar .btn-ghost { color: rgba(255,255,255,0.75) !important; border-color: rgba(255,255,255,0.2) !important; background: transparent !important; }
body .upload-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 160; background: transparent; }
body .upload-progress-bar { height: 3px; background: #D9B865; border-radius: 0 2px 2px 0; }
body .upload-status { position: fixed; top: auto !important; right: auto !important; height: auto !important; width: auto !important; min-width: 0 !important; left: 50% !important; bottom: calc(20px + env(safe-area-inset-bottom)) !important; transform: translateX(-50%); z-index: 160; display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--ui-dark); color: #fff; border: 0; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: 0 18px 40px -16px rgba(23,24,28,0.6); max-width: calc(100vw - 32px); }
body .upload-status #uploadStatusText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body .upload-status .spinner { border-color: rgba(255,255,255,0.25) !important; border-top-color: #D9B865 !important; flex-shrink: 0; }
.spinner { border-top-color: var(--ui-gold) !important; }

/* ---------- installed app: bottom navigation and panels ---------- */
.bottom-nav { background: var(--ui-card); border-top: 1px solid var(--ui-line); }
.bottom-nav-item { color: var(--ui-muted); font-size: 11px; }
.bottom-nav-item.active { color: var(--ui-ink); }
.bottom-nav-item.active::before { background: var(--ui-gold); }
.bn-panel { display: flex; flex-direction: column; gap: 8px; }
.bn-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid var(--ui-line); border-radius: var(--ui-r); background: var(--ui-card); font: inherit; color: var(--ui-ink); cursor: pointer; }
.bn-row span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bn-row b { font-size: 15.5px; font-weight: 600; }
.bn-row em { font-style: normal; font-size: 13px; color: var(--ui-muted); }
.bn-row svg { color: var(--ui-muted); flex-shrink: 0; }
.bn-new { align-self: flex-start; margin-top: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .rec-header, .rec-card, .list-item { grid-template-columns: minmax(0, 1fr) 100px 70px 110px; }
  .rec-header span:nth-child(4), .rec-card > *:nth-child(4) { display: none; }
}
@media (max-width: 900px) {
  .main { border-radius: 0; }
  .sidebar { width: 280px; left: -300px; }
  .topbar { flex-wrap: wrap; }
  .topbar-right { flex: 1; justify-content: flex-end; }
  .search-box { display: block; order: 10; flex: 1 0 100%; }
  .topbar-right { flex-wrap: wrap; }
  .search-box input { width: 100%; }
  .quick-actions, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-header, .rec-card, .list-item { grid-template-columns: minmax(0, 1fr) 90px 64px; }
  .rec-header span:nth-child(4), .rec-header span:nth-child(5), .rec-card > *:nth-child(4), .rec-card > *:nth-child(5) { display: none; }
  .ui-choices { grid-template-columns: 1fr; }
  .ui-choice { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
  .ui-choice-ic { margin-bottom: 0; }
  .ui-choice > span:last-child { flex-basis: 100%; }
}
@media (max-width: 600px) {
  .topbar { padding: 10px 16px; }
  .tb-btn { min-height: 40px; padding: 8px 11px; }
  .dash-scroll { padding: 18px 16px 40px; }
  .quick-actions { gap: 10px; }
  .qa-card { padding: 14px; }
  .qa-sub { display: none; }
  .stats-grid { gap: 10px; margin-bottom: 22px; }
  .stat-value { font-size: 21px; }
  .rec-header { display: none; }
  .rec-header, .rec-card, .list-item { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .rec-card > *:nth-child(3) { display: none; }
  .ui-headrow { flex-direction: column; }
  .ui-head { flex: none; width: 100%; }
  .ui-actions { width: 100%; }
  .ui-actions .ui-btn { flex: 1 1 auto; }
  .ui-grid2 { grid-template-columns: 1fr; }
  .ui-modal { max-height: 92vh; }
  .ui-back { align-items: flex-end; padding: 0; }
  .ui-back .ui-modal { width: 100%; border-radius: 18px 18px 0 0; }
  .ui-modal-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .ui-modal-foot .ui-btn { flex: 1 1 auto; }
  .ui-field-inline { flex-direction: column; align-items: stretch; }
  .ui-field-inline .ui-inp { width: 100%; }
  .ui-part { padding: 8px 8px 8px 12px; }
  .recording-bar { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .ui-back, .ui-modal, .qa-card, .ui-series-card { animation: none; transition: none; }
  .ui-rec-dot { animation: none; }
}

/* phones: buttons next to the title, search on its own row */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .topbar-left { flex: 1 1 auto; min-width: 0; }
  .topbar-right { display: contents; }
  .topbar .search-box { order: 10; flex: 1 0 100%; }
}

/* Hours left this month (import pop-up, account) */
.ui-quota-box:empty { display: none; }
.ui-quota-box { margin: 14px 0 6px; padding: 12px 14px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-soft); display: flex; flex-direction: column; gap: 10px; }
.ui-quota-head { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ui-gold-ink); }
.ui-quota-t { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--ui-ink-2); }
.ui-quota-t b { font-weight: 600; white-space: nowrap; }
.ui-quota-bar { height: 6px; border-radius: 6px; background: var(--ui-line); overflow: hidden; margin-top: 5px; }
.ui-quota-bar i { display: block; height: 100%; background: var(--ui-ok); }
.ui-quota-bar i.hi { background: var(--ui-bad); }
.ui-quota-n { margin: 5px 0 0; font-size: 12px; color: var(--ui-ink-2); }

/* ---------- plans and billing ---------- */
.sb-upgrade { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0 0 8px; min-height: 38px; border-radius: 10px; border: 1px solid #EADBB6; background: var(--ui-gold-soft); color: var(--ui-gold-ink); font: 600 13.5px var(--font); cursor: pointer; }
.sb-upgrade:hover { background: #EFE0BC; }
.sb-upgrade.paid { background: transparent; border-color: rgba(255,255,255,0.12); color: rgba(255,255,255,0.65); font-weight: 500; }
.sb-upgrade.paid:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sb-collapsed .sb-upgrade { display: none; }
.ui-modal.ui-modal-plans { width: min(940px, 100%); }
.ui-plan-status { padding: 10px 14px; border-radius: 10px; background: var(--ui-gold-soft); border: 1px solid #EADBB6; color: var(--ui-gold-ink); font-size: 14px; margin-bottom: 14px; }
.ui-plan-period { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--ui-soft); border: 1px solid var(--ui-line); margin-bottom: 14px; }
.ui-plan-period button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font: 600 13.5px var(--font); color: var(--ui-muted); cursor: pointer; }
.ui-plan-period button[aria-pressed="true"] { background: var(--ui-card); color: var(--ui-ink); box-shadow: 0 1px 3px rgba(23,24,28,0.12); }
.ui-plan-period em { font-style: normal; font-weight: 600; color: var(--ui-gold-ink); margin-left: 4px; }
.ui-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ui-plan { display: flex; flex-direction: column; border: 1px solid var(--ui-line); border-radius: 14px; padding: 16px; background: var(--ui-card); }
.ui-plan-hi { border-color: var(--ui-gold); box-shadow: 0 0 0 1px var(--ui-gold) inset; }
.ui-plan-cur { background: var(--ui-soft); }
.ui-plan-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 17px; }
.ui-plan-price { font-weight: 800; font-size: 28px; margin-top: 8px; }
.ui-plan-price small { font-size: 13px; font-weight: 500; color: var(--ui-muted); margin-left: 4px; }
.ui-plan-note { margin: 2px 0 10px; font-size: 12.5px; color: var(--ui-muted); min-height: 18px; }
.ui-plan ul { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; flex: 1; }
.ui-plan li { display: flex; gap: 7px; align-items: flex-start; }
.ui-plan li svg { color: var(--ui-gold); margin-top: 2px; }
.ui-plan-act { display: flex; flex-direction: column; gap: 4px; }
.ui-plan-act .ui-btn { width: 100%; }
.ui-plan-pass { font-size: 13px; justify-content: center; }
.ui-plan-pass[disabled] { opacity: .5; cursor: default; }
.ui-plan-consent { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--ui-line); font-size: 13.5px; line-height: 1.45; cursor: pointer; }
.ui-plan-consent input { margin-top: 3px; accent-color: var(--ui-gold); width: 16px; height: 16px; flex-shrink: 0; }
.ui-plan-consent.need { border-color: var(--ui-bad); }
.ui-quota-box > .ui-btn, .ui-quota-box > .ui-linkbtn { align-self: flex-start; }
@media (max-width: 760px) { .ui-plans { grid-template-columns: 1fr; } }
.ui-legal { font-size: 12.5px; margin-top: 6px; }
.ui-legal a { color: var(--ui-muted); }
.ui-plan-start { margin: 14px 0 4px; font-size: 13.5px; color: var(--ui-muted); text-align: center; }

/* Installed app: the bottom navigation (z-index 210, 56px) covered the record menu,
   the recording bar and toasts. Keep them above it and lift bottom-anchored ones over the bar. */
.ui-back, .vn-modal-backdrop { z-index: 400 !important; }
.recording-bar { z-index: 420 !important; }
.toast-wrap { z-index: 430; }
body:has(#app.has-bottom-nav) .recording-bar { bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
body:has(#app.has-bottom-nav) .toast-wrap { bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (max-width: 600px) {
  .ui-modal { max-height: calc(100dvh - 24px); }
}
