:root {
  --bg: #ffffff;
  --bg-2: #fafafb;
  --sidebar: #fbfbfc;
  --text: #1f2328;
  --text-2: #6e7781;
  --text-3: #9aa1a9;
  --line: #f1f2f4;
  --line-2: #e6e8eb;
  --hover: #f3f4f6;
  --active: #eef1f5;
  --accent: #6a4bd6;
  --accent-2: #5a3fc0;
  --accent-soft: #efeafb;
  --ok: #2da44e;
  --ok-soft: #e7f4ec;
  --warn: #b9842a;
  --warn-soft: #faf3e2;
  --error: #d6453f;
  --error-soft: #fdeceb;
  --live: #e0483f;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .05), 0 8px 28px rgba(20, 20, 40, .07);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---- sidebar --------------------------------------------------------------- */
#sidebar {
  width: 226px; flex: none; align-self: stretch;
  background: var(--sidebar); border-right: 1px solid var(--line-2);
  padding: 14px 12px; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
#sidebar:empty { display: none; }            /* login: no shell */
.ws { display: flex; align-items: center; gap: 9px; padding: 6px 6px 12px; }
.ws .ws-badge {
  width: 26px; height: 26px; border-radius: 7px; background: var(--text); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
}
.ws .ws-name { font-weight: 600; }
.new-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); border-radius: 9px; padding: 9px; margin-bottom: 8px;
  font-weight: 600; color: var(--text); cursor: pointer; background: var(--bg); transition: background .12s, border-color .12s;
}
.new-btn:hover { background: var(--hover); border-color: #d8dbdf; text-decoration: none; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; cursor: pointer;
}
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 600; }
.nav-item .ti { font-size: 17px; flex: none; width: 18px; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { color: var(--text-3); font-size: 12px; flex: none; }
.nav-sep { height: 1px; background: var(--line-2); margin: 10px 6px; }
.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 10px 6px 2px; color: var(--text-2);
}
.sidebar-foot .user-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; color: var(--text-2);
  border-radius: 8px; padding: 4px; margin: -4px; font-weight: 500;
}
.sidebar-foot .user-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.sidebar-foot .user-link.active { background: var(--active); color: var(--text); }
.sidebar-foot .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none;
}
.sidebar-foot .logout { margin-left: auto; color: var(--text-3); font-size: 12px; }

/* ---- main / layout --------------------------------------------------------- */
#app { flex: 1; min-width: 0; min-height: 100vh; overflow-x: hidden; }
.page { max-width: 920px; margin: 0 auto; padding: 30px 36px 64px; }
h1.brand { font-size: 26px; letter-spacing: .04em; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 23px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 13px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 600; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.page-head .grow { flex: 1; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.error { color: var(--error); }
.back { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.back:hover { color: var(--text); }

/* ---- controls -------------------------------------------------------------- */
input, button { font: inherit; }
input {
  display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--text-3); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="file"] { padding: 8px; color: var(--text-2); cursor: pointer; }

button {
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; transition: filter .12s, background .12s;
}
button:hover { filter: brightness(1.05); }
button:disabled { opacity: .55; cursor: not-allowed; filter: none; }
button.secondary, button.small {
  background: var(--bg); color: var(--text); border: 1px solid var(--line-2);
}
button.secondary:hover, button.small:hover { background: var(--hover); filter: none; }
button.small { padding: 5px 11px; font-size: 13px; font-weight: 500; }
button.danger { background: var(--bg); color: var(--error); border: 1px solid var(--line-2); }
button.danger:hover { background: var(--error-soft); }
.card { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 18px; margin: 0 0 22px; }

/* ---- recording Details (meta) card ---------------------------------------- */
textarea, select {
  display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 64px; }
textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.meta-card .meta-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.meta-card h3 { margin: 0; }
.meta-card.collapsed { padding-top: 15px; padding-bottom: 15px; }
.meta-card.collapsed .meta-head { margin-bottom: 0; }
/* header doubles as the collapse toggle — strip the default button chrome */
.meta-toggle {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  color: inherit; font: inherit; text-align: left;
}
.meta-toggle:hover { background: none; filter: none; }
.meta-toggle:hover h3 { color: var(--text); }
.meta-caret { color: var(--text-3); font-size: 11px; width: 11px; line-height: 1; display: inline-block; }
.meta-field { display: block; margin: 12px 0; }
.meta-field .k { display: block; color: var(--text-2); font-size: 13px; margin-bottom: 5px; }
.meta-actions { display: flex; gap: 8px; margin-top: 14px; }
.kv.meta-desc { flex-direction: column; align-items: stretch; gap: 4px; }
.kv.meta-desc .v { text-align: left; font-weight: 400; white-space: pre-wrap; }

/* ---- auth (login) ---------------------------------------------------------- */
.auth { max-width: 360px; margin: 13vh auto; padding: 0 20px; }
.auth form { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 30px 28px; box-shadow: var(--shadow); }
.auth h1 { text-align: center; }
.auth p { text-align: center; margin: 0 0 18px; }
.auth input { margin: 8px 0; }
.auth button { width: 100%; margin-top: 8px; padding: 11px; }
.auth a { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.brand-mark { display: inline-flex; align-items: center; gap: 9px; }
.brand-mark::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ---- recordings (file list) ------------------------------------------------ */
.rec-list { list-style: none; padding: 0; margin: 0; }
.rec-list li { display: flex; align-items: center; border-bottom: 1px solid var(--line); transition: background .12s; padding-right: 8px; }
.rec-list li:hover { background: var(--bg-2); }
.rec-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 13px 8px; color: var(--text); }
.rec-row:hover { text-decoration: none; }
.rec-icon {
  width: 34px; height: 34px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 16px;
}
.rec-icon.live { background: var(--error-soft); color: var(--live); }
.rec-main { min-width: 0; flex: 1; }
.rec-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-sub { color: var(--text-3); font-size: 12px; margin-top: 1px; }
.rec-dur { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.rec-date { color: var(--text-3); font-size: 13px; width: 150px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.rec-actions { display: flex; gap: 6px; flex: none; opacity: 0; transition: opacity .12s; }
.rec-list li:hover .rec-actions { opacity: 1; }
.rec-actions:has(.menu.open) { opacity: 1; }   /* keep the kebab visible while its menu is open */
@media (hover: none) { .rec-actions { opacity: 1; } }

/* ---- dropdown menu (kebab) ------------------------------------------------- */
.menu { position: relative; display: inline-flex; }
.menu-trigger {
  width: 30px; height: 30px; padding: 0; border-radius: 8px; background: var(--bg);
  border: 1px solid transparent; color: var(--text-2); font-size: 18px; line-height: 1; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.menu-trigger:hover { background: var(--hover); filter: none; }
.menu.open .menu-trigger { background: var(--active); border-color: var(--line-2); color: var(--text); }
.menu-list {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 188px; display: none;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px;
}
.menu.open .menu-list { display: block; animation: slidein .12s ease; }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; text-align: left;
  background: none; border: none; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; cursor: pointer;
}
.menu-item:hover { background: var(--hover); filter: none; }
.menu-item.danger { color: var(--error); }
.menu-item.danger:hover { background: var(--error-soft); }
.menu-item .menu-ico { width: 18px; flex: none; text-align: center; color: var(--text-3); font-size: 15px; }
.menu-item.danger .menu-ico { color: var(--error); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500;
  padding: 2px 9px; border-radius: 999px; background: var(--hover); color: var(--text-2);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.live { background: var(--error-soft); color: var(--live); }

/* ---- transcript view ------------------------------------------------------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line-2); margin: 18px 0 0; }
.tab {
  padding: 0 2px 12px; color: var(--text-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; background: none; font-size: 14px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab.disabled { color: var(--text-3); cursor: default; }

.player {
  display: flex; align-items: center; gap: 14px; margin: 20px 0; padding: 12px 16px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius);
}
.player audio { width: 100%; height: 38px; }

.speakers-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 22px 0 18px; }
.speaker-chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; line-height: 1; color: var(--text);
}
.speaker-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--spk, var(--text-3)); }
.speaker-chip input { width: 130px; margin: 0; padding: 4px 9px; font-size: 13px; }

.seg-group { padding: 14px 0; border-bottom: 1px solid var(--line); }
.seg-group:last-child { border-bottom: none; }
.seg-group .who { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--spk, var(--text)); margin-bottom: 5px; }
.seg-group .ts { color: var(--text-3); font-weight: 400; font-size: 12px; font-variant-numeric: tabular-nums; }
.seg-group .seg-text { color: var(--text); line-height: 1.7; }

/* ---- speakers -------------------------------------------------------------- */
.speakers { list-style: none; padding: 0; margin: 0; }
.speakers li { display: flex; align-items: center; gap: 11px; padding: 14px 8px; border-bottom: 1px solid var(--line); }
.speakers li:hover { background: var(--bg-2); }
.speaker-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--spk, var(--text-3)); flex: none; }
.spk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.speakers li .rec-actions { opacity: .6; }
.speakers li:hover .rec-actions { opacity: 1; }

/* ---- live console ---------------------------------------------------------- */
.live-controls { display: flex; gap: 12px; align-items: center; margin: 20px 0 16px; }
.live-status { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); flex: none; }
.live-status.on .live-dot { background: var(--live); animation: pulse 1.5s infinite; }
.live-clock { font-variant-numeric: tabular-nums; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(224, 72, 63, .4); } 70% { box-shadow: 0 0 0 7px rgba(224, 72, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(224, 72, 63, 0); } }
.live-log { min-height: 200px; max-height: 56vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px 16px; }
.live-empty { color: var(--text-3); text-align: center; padding: 64px 12px; }
.live-saved {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px; background: var(--ok-soft);
  border: 1px solid #cfe7d7; border-radius: var(--radius); padding: 14px 18px;
}
.live-saved .check { width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--ok); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.live-saved .grow { flex: 1; }
.live-log .segment { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.live-log .segment:last-child { border-bottom: none; }
.live-log .partial .seg-text { color: var(--text-2); }
.live-log .who { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.live-log .who .ts { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.live-log .seg-text { line-height: 1.6; }

/* ---- states + toasts ------------------------------------------------------- */
.state { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 64px 16px; color: var(--text-2); }
.state-title { font-weight: 600; color: var(--text); }
.state-glyph { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; background: var(--bg-2); color: var(--text-3); border: 1px solid var(--line-2); }
.state-error .state-glyph { color: var(--error); border-color: #f0c2bf; background: var(--error-soft); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.toast { padding: 11px 16px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line-2); box-shadow: var(--shadow); max-width: 360px; animation: slidein .18s ease; }
.toast.error { border-color: #f0c2bf; color: var(--error); }
.toast.info { border-color: #cfc6f0; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 720px) {
  #sidebar { width: 64px; padding: 12px 8px; }
  /* collapse to a 64px icon rail: hide the labels/counts, keep the glyphs (.ti / .folder-glyph) */
  #sidebar .ws-name, #sidebar .nav-item .nav-label, #sidebar .new-btn span, #sidebar .sidebar-foot .user-name, #sidebar .nav-item .count, .nav-group-label { display: none; }
  .new-btn { padding: 9px 0; }
  .page { padding: 22px 18px 48px; }
  .rec-date { display: none; }
  .panels { grid-template-columns: 1fr; }
}

/* -- admin -------------------------------------------------------------------------- */
.nav-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); margin: 12px 10px 4px; font-weight: 600; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 14px; }
.admin-table th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12px;
  padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr.row-off td { color: var(--text-3); }
.admin-table .row-actions { text-align: right; white-space: nowrap; display: table-cell; }
.admin-table .row-actions button { margin-left: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: var(--line); color: var(--text-2); }
.badge-ok { background: #e7f6ec; color: var(--ok); }
.badge-warn { background: #fbf1dd; color: var(--warn); }
.badge-error { background: #fbe3e2; color: var(--error); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.tag { margin-left: 6px; font-size: 11px; color: var(--text-3); border: 1px solid var(--line-2);
  border-radius: 4px; padding: 0 5px; }

.counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.panel { border: 1px solid var(--line-2); border-radius: 10px; padding: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.svc-list { list-style: none; margin: 0; padding: 0; }
.svc-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-ok { background: var(--ok); }
.dot-down { background: var(--error); }

/* ---- settings -------------------------------------------------------------- */
.settings-view .card { max-width: 460px; }
.settings-view form input { margin: 8px 0; }
.settings-view form button { margin-top: 6px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-2); }
.kv .v { color: var(--text); font-weight: 500; min-width: 0; text-align: right; word-break: break-word; }

/* ---- AI summary / highlights ---------------------------------------------- */
.summary { padding-top: 6px; }
.summary-head { display: flex; align-items: flex-start; gap: 14px; }
.summary-prose { line-height: 1.65; margin: 2px 0 0; }
.topics { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }
.topic-chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 11px; font-size: 13px; }
.gen-meta { margin-top: 18px; }
.highlights { margin-top: 6px; }

/* ---- folders --------------------------------------------------------------- */
/* rendered folder icon — inline SVG, tinted by the folder color (set on the span via JS) */
.folder-glyph { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.folder-glyph.none { width: 18px; height: 18px; color: var(--text-3); font-size: 14px; }

/* sidebar section */
.folders-sec { margin-top: 14px; display: flex; flex-direction: column; gap: 3px; }
.folders-head { display: flex; align-items: center; padding: 0 4px 2px; }
.folders-toggle {
  flex: 1; display: flex; align-items: center; gap: 5px; background: none; border: none;
  padding: 4px; margin: 0; cursor: pointer; color: var(--text-3); font: inherit; text-align: left; border-radius: 6px;
}
.folders-toggle:hover { background: none; filter: none; color: var(--text-2); }
.folders-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.folders-caret { font-size: 10px; display: inline-block; transition: transform .15s; }
.folders-caret.collapsed { transform: rotate(-90deg); }
.folders-add {
  background: none; border: none; color: var(--text-3); font-size: 16px; line-height: 1;
  padding: 4px 6px; margin: 0; cursor: pointer; border-radius: 6px; flex: none;
}
.folders-add:hover { background: var(--hover); filter: none; color: var(--text-2); }
.folder-item { overflow: hidden; gap: 9px; }
.folder-item .folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.folder-item .count { margin-left: 0; flex: none; }
.folders-empty { color: var(--text-3); font-size: 12px; padding: 4px 10px 6px; }

/* a folder row = the nav anchor + a hover kebab (Edit/Delete); the wrapper owns the row background */
.folder-row-wrap { display: flex; align-items: center; border-radius: 8px; }
.folder-row-wrap:hover { background: var(--hover); }
.folder-row-wrap.active { background: var(--active); }
.folder-row-wrap .folder-item { flex: 1; min-width: 0; }
.folder-row-wrap .folder-item:hover { background: none; }
.folder-row-wrap:hover .folder-item, .folder-row-wrap.active .folder-item { color: var(--text); }
.folder-row-wrap.active .folder-item { font-weight: 600; }
.folder-actions { flex: none; opacity: 0; padding-right: 2px; transition: opacity .12s; }
.folder-row-wrap:hover .folder-actions, .folder-actions:has(.menu.open) { opacity: 1; }
@media (hover: none) { .folder-actions { opacity: 1; } }

/* the folder badge under a recording title (replaces the "Uploaded"/"Live session" sub) */
.rec-folder { display: flex; align-items: center; gap: 5px; color: var(--text-2); }
.rec-folder .folder-glyph { flex: none; }

/* a clickable folder chip — used in the transcript header (links to the folder's filtered view) */
.head-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.head-title h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tag {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 11px 3px 9px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg-2);
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
}
.folder-tag:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.folder-tag .folder-glyph { flex: none; }

/* the Folder row inside the transcript Details card */
.meta-folder .folder-value { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font-weight: 500; }
.meta-folder .folder-value .folder-glyph { flex: none; }
.meta-folder .folder-value button { margin-left: 4px; }

/* the ✕ that clears the folder Name field (shown only when it has text) */
.field-clear {
  flex: none; background: none; border: none; color: var(--text-3); font-size: 13px; line-height: 1;
  padding: 5px; margin: -3px -5px -3px 0; cursor: pointer; border-radius: 6px;
}
.field-clear:hover { background: var(--hover); color: var(--text); filter: none; }
.field-clear[hidden] { display: none; }

/* ---- modal dialog ---------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; padding: 20px; background: rgba(20, 20, 40, .34);
  display: flex; align-items: center; justify-content: center; animation: fadein .12s ease;
}
@keyframes fadein { from { opacity: 0; } }
.modal-card {
  width: 100%; max-width: 460px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); animation: slideup .16s ease;
}
@keyframes slideup { from { opacity: 0; transform: translateY(10px); } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 14px; border-bottom: 1px solid var(--line); }
.modal-title { flex: 1; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.modal-x {
  background: none; border: none; color: var(--text-3); font-size: 15px; line-height: 1;
  padding: 5px; margin: -3px -4px; cursor: pointer; border-radius: 6px;
}
.modal-x:hover { background: var(--hover); filter: none; color: var(--text); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; }
/* a disabled primary (e.g. Save before a name is typed) reads grey, not faded-accent */
.modal-foot button:disabled { background: var(--line-2); border-color: var(--line-2); color: var(--text-3); opacity: 1; }

/* name field — a bordered box with an inline label and a chromeless input */
.field-box {
  display: flex; align-items: center; gap: 14px; padding: 13px 15px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s;
}
.field-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-box .fb-label { font-weight: 600; flex: none; }
.field-box input { border: none; padding: 0; background: none; }
.field-box input:focus { outline: none; border: none; box-shadow: none; }

/* color + icon rows */
.picker-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 15px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.picker-row .pr-label { font-weight: 600; }
button.icon-row { width: 100%; background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
button.icon-row:hover { background: var(--hover); filter: none; }
.pr-right { display: flex; align-items: center; gap: 9px; color: var(--text-2); }
.pr-chevron { color: var(--text-3); font-size: 18px; line-height: 1; transition: transform .15s; }
.pr-chevron.open { transform: rotate(90deg); }

.swatches { display: flex; align-items: center; gap: 8px; }
.swatch {
  width: 26px; height: 26px; border-radius: 7px; padding: 0; border: none; background: var(--sw); cursor: pointer;
  position: relative; display: inline-flex; align-items: center; justify-content: center; transition: box-shadow .12s;
}
.swatch:hover { filter: brightness(1.04); }
.swatch.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--line-2); }
.swatch.sel::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 700; text-shadow: 0 0 2px rgba(0, 0, 0, .45); }

.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 4px; }
.icon-grid[hidden] { display: none; }   /* `display:grid` beats the UA [hidden] rule — restore it */
.icon-opt {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 0;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer;
}
.icon-opt:hover { background: var(--hover); filter: none; color: var(--text); }
.icon-opt.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* move-to-folder picker */
.move-list { display: flex; flex-direction: column; gap: 2px; }
.move-opt {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; text-align: left;
  background: none; border: none; border-radius: var(--radius-sm); color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
}
.move-opt:hover { background: var(--hover); filter: none; }
.move-opt.sel { background: var(--active); }
.move-opt .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-check { color: var(--accent); font-weight: 700; flex: none; }

/* sidebar collapsed (narrow) — show only the folder glyphs, hide the section chrome */
@media (max-width: 720px) {
  #sidebar .folders-label, #sidebar .folders-add, #sidebar .folder-name,
  #sidebar .folder-item .count, #sidebar .folders-empty, #sidebar .folder-actions { display: none; }
  .folders-head { justify-content: center; }
}
