/* u-notetaker portal — brand-styled, Bluedot-like layout. */
:root {
  --bg: #f4f5f7;
  --content-bg: #ffffff;
  --fg: #17181c;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --accent: #f5c518; /* brand yellow */
  --accent-fg: #17181c;
  --accent-soft: #fff6d6;
  --danger: #e5484d;
  --ok: #16a34a;
  --line: #e6e8ec;
  --card: #ffffff;
  --hover: #f7f8fa;
  --radius: 12px;
  --sidebar-w: 248px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --content-bg: #1a1b1f;
    --fg: #e8e9ec;
    --muted: #9aa1ab;
    --faint: #6b7280;
    --accent: #f5c518;
    --accent-fg: #17181c;
    --accent-soft: #2a2612;
    --danger: #f26d6d;
    --ok: #4ade80;
    --line: #303236;
    --card: #202226;
    --hover: #24262b;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: inherit; }
button { font-family: inherit; }

/* ---------- Auth screen ---------- */
#authScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-brand img { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.auth-brand h1 { font-size: 18px; margin: 0; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-card label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 5px; }
.auth-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 14px; background: var(--content-bg); color: var(--fg);
  margin-bottom: 14px;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.btn-primary {
  width: 100%; padding: 11px; border: none; border-radius: 9px;
  background: var(--accent); color: var(--accent-fg); font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-error {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
  padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px;
}
@media (prefers-color-scheme: dark) {
  .auth-error { background: #3a2020; border-color: #5b2b2b; color: #fca5a5; }
}

/* ---------- App shell ---------- */
#mainApp { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--content-bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.sidebar .brand img { width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.sidebar .brand .names { line-height: 1.15; }
.sidebar .brand .n1 { font-weight: 700; font-size: 14px; }
.sidebar .brand .n2 { font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; text-decoration: none;
  color: var(--fg); font-weight: 500; cursor: pointer;
}
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--accent-soft); color: var(--accent-fg); font-weight: 600; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.8; }
.sidebar-spacer { flex: 1; }
.user-box {
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px;
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.user-box .um { flex: 1; overflow: hidden; }
.user-box .ue { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-box .signout { font-size: 11px; color: var(--faint); cursor: pointer; text-decoration: underline; }
.portal-version { text-align: center; font-size: 10px; color: var(--faint); margin-top: 10px; letter-spacing: 0.02em; }

.content { flex: 1; min-width: 0; background: var(--content-bg); }
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--content-bg); border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; align-items: center; gap: 12px;
}
.search {
  flex: 1; max-width: 640px; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px;
}
.search svg { width: 16px; height: 16px; opacity: 0.5; flex: none; }
.search input { flex: 1; border: none; background: transparent; color: var(--fg); font-size: 14px; outline: none; }
.topbar-btn {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border: 1px solid var(--line); background: var(--card);
  color: var(--fg); border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.topbar-btn:hover { border-color: var(--accent); background: var(--hover); }
.topbar-btn svg { width: 16px; height: 16px; opacity: 0.8; }

.page { padding: 26px 28px 60px; }
.page h1.page-title { font-size: 30px; margin: 0 0 22px; letter-spacing: -0.01em; }

/* ---------- Meetings grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px 18px;
}
.card { cursor: pointer; }
.thumb {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, #1c1d22 0%, #2a2b31 100%);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph-logo { width: 40px; height: 40px; border-radius: 50%; opacity: 0.9; }
.thumb .dur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 12px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px; font-variant-numeric: tabular-nums;
}
.thumb .lang {
  position: absolute; left: 8px; top: 8px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 5px;
}
.card .c-title {
  margin: 10px 2px 2px; font-weight: 600; font-size: 14px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .c-date { margin: 0 2px; font-size: 12px; color: var(--muted); }
.c-owner { margin: 3px 2px 0; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-shared { margin: 3px 2px 0; font-size: 11px; color: var(--accent-ink, var(--muted)); font-weight: 600; }
.badge-owner { text-transform: none !important; letter-spacing: 0 !important; }
.admin-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: var(--fg);
}
.admin-banner svg { opacity: 0.8; flex: none; }
.admin-banner span { flex: 1; }
.admin-banner-exit {
  border: 1px solid var(--line); background: var(--content-bg); color: var(--fg);
  padding: 5px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.admin-banner-exit:hover { background: var(--hover); border-color: var(--accent); }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 2px 0; }
.card-tag {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--accent-soft); border: 1px solid var(--line); color: var(--fg);
  padding: 1px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 600;
}
.card:hover .thumb { border-color: var(--accent); }
.card.processing { cursor: default; }
.card.processing:hover .thumb { border-color: var(--line); }
.card-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: rgba(23, 24, 28, 0.72); color: #fff; font-size: 12px; font-weight: 600;
}
.card-overlay .spinner { width: 22px; height: 22px; margin: 0; border-width: 2px; border-color: rgba(255,255,255,0.3); border-top-color: var(--accent); }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.spinner-wrap { padding: 60px 0; text-align: center; color: var(--muted); }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Detail ---------- */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: var(--muted); font-size: 13px; cursor: pointer;
  padding: 0; margin-bottom: 14px;
}
.back-btn:hover { color: var(--fg); }
.detail-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.player { width: 100%; border-radius: var(--radius); background: #000; max-height: 380px; display: block; }
.player.audio { background: transparent; }
.detail-title { font-size: 24px; margin: 16px 0 6px; letter-spacing: -0.01em; }
.detail-title[contenteditable], .detail-desc[contenteditable] {
  outline: none; border-radius: 8px; padding: 4px 8px; margin-left: -8px; cursor: text;
  transition: background 0.12s, box-shadow 0.12s;
}
.detail-title[contenteditable]:hover, .detail-desc[contenteditable]:hover { background: var(--hover); }
.detail-title[contenteditable]:focus, .detail-desc[contenteditable]:focus { background: var(--content-bg); box-shadow: 0 0 0 2px var(--accent-soft); }
.detail-desc { font-size: 14px; color: var(--fg); margin: 0 0 12px; min-height: 24px; line-height: 1.5; white-space: pre-wrap; }
[contenteditable][data-placeholder]:empty:before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.detail-meta { font-size: 12px; color: var(--muted); margin-bottom: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tag-row { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-soft); border: 1px solid var(--line); color: var(--fg);
  padding: 3px 4px 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.tag-x { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.tag-x:hover { color: var(--danger); }
.tag-add {
  border: 1px dashed var(--line); background: transparent; color: var(--muted);
  padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.tag-add:hover { border-color: var(--accent); color: var(--fg); background: var(--hover); }
.detail-meta .badge { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.03em; font-size: 10px; }

.note-block { margin-bottom: 22px; }
.note-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.note-head .note-h { margin-bottom: 0; }
.note-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px; }
.icon-copy {
  border: none; background: transparent; color: var(--faint); cursor: pointer;
  padding: 4px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.icon-copy:hover { color: var(--fg); background: var(--hover); }
.icon-copy.copied { color: var(--ok); }
.note-block p { margin: 0; line-height: 1.6; }
.ai-person { font-weight: 600; margin: 12px 0 4px; }
.note-block ul { margin: 0; padding-left: 20px; }
.note-block li { margin: 4px 0; line-height: 1.5; }
.topic { margin-bottom: 14px; }
.topic-t { font-weight: 600; margin: 0 0 3px; }
.topic p { margin: 0; line-height: 1.55; color: var(--fg); }
.topic ul { margin: 0; padding-left: 18px; line-height: 1.55; color: var(--fg); }
.topic li { margin: 2px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.notes-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.notes-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.notes-ctl select {
  font-family: inherit; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0;
  color: var(--fg); background: var(--content-bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 8px; cursor: pointer;
}
.notes-ctl select:hover { border-color: var(--accent); }
.notes-ctl select:disabled { opacity: 0.55; cursor: default; }
.copy-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--fg);
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 7px; cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); }

/* Right panel tabs */
.panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--content-bg); }
.tab {
  padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; border: none; background: transparent; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab-body { padding: 14px 16px; max-height: 560px; overflow: auto; }

.seg { margin-bottom: 14px; }
.seg .spk { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.seg .txt { font-size: 13px; line-height: 1.5; color: var(--fg); }
.seg .t { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; margin-left: 6px; }

.transcript-tools { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.transcript-tools input {
  flex: 1; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font-size: 13px; outline: none;
}

/* AI chat */
.chat-msgs { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.chat-msg { font-size: 13px; line-height: 1.55; }
.chat-msg .who { font-weight: 700; margin-bottom: 3px; }
.chat-msg.ai .who { color: var(--accent-fg); }
.chat-msg .bubble { white-space: pre-wrap; }
.chat-input { display: flex; gap: 8px; }
.chat-input input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--fg); font-size: 13px; outline: none;
}
.chat-input input:focus { border-color: var(--accent); }
.chat-input button {
  border: none; background: var(--accent); color: var(--accent-fg);
  padding: 0 16px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.chat-input button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-hint { font-size: 11px; color: var(--faint); text-align: center; margin-top: 8px; }

/* ---------- Collections (sidebar) ---------- */
.collections { margin-top: 18px; }
.collections-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px 6px; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.collections-head button {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1; width: 22px; height: 22px; border-radius: 6px;
}
.collections-head button:hover { background: var(--hover); color: var(--fg); }
.collection-list { display: flex; flex-direction: column; gap: 1px; }
.collection-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; cursor: pointer; color: var(--fg);
}
.collection-item:hover { background: var(--hover); }
.collection-item.active { background: var(--accent-soft); font-weight: 600; }
.collection-item svg { width: 15px; height: 15px; flex: none; opacity: 0.7; }
.collection-item .cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-empty { padding: 4px 10px; font-size: 12px; color: var(--faint); }

/* ---------- Add recording button ---------- */
.add-recording {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px; margin-bottom: 12px;
  background: var(--accent); color: var(--accent-fg); border: none; border-radius: 10px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.add-recording svg { width: 16px; height: 16px; }
.add-recording:hover { filter: brightness(0.96); }
.bot-btn { background: var(--content-bg); color: var(--fg); border: 1px solid var(--line); font-weight: 600; }
.bot-btn:hover { background: var(--hover); filter: none; border-color: var(--accent); }

/* ---------- Card menu (…) ---------- */
.card { position: relative; }
.card-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.card-footer .c-meta { min-width: 0; flex: 1; }
.card-menu-btn {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; flex: none; margin-top: 8px;
}
.card-menu-btn:hover { background: var(--hover); color: var(--fg); }

.popover {
  position: fixed; z-index: 50; min-width: 220px; max-height: 320px; overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18); padding: 6px;
}
.popover .pop-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 6px 8px; }
.popover label {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 7px;
  font-size: 13px; cursor: pointer; margin: 0;
}
.popover label:hover { background: var(--hover); }
.popover input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }
.popover .pop-new {
  display: flex; align-items: center; gap: 8px; padding: 8px; margin-top: 4px;
  border-top: 1px solid var(--line); color: var(--accent-fg); font-weight: 600; font-size: 13px; cursor: pointer;
}
.popover .pop-new:hover { background: var(--hover); border-radius: 7px; }
.popover .pop-sep { height: 1px; background: var(--line); margin: 4px 0; }
.popover .pop-action { padding: 8px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; }
.popover .pop-action:hover { background: var(--hover); }
.popover .pop-danger { color: var(--danger); }

/* ---------- Share ---------- */
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.detail-head .back-btn { margin-bottom: 0; }
.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: var(--accent-fg); border: none;
  padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.share-btn:hover { filter: brightness(0.96); }
.detail-actions { display: flex; align-items: center; gap: 8px; }
.share-btn.ghost { background: var(--content-bg); color: var(--fg); border: 1px solid var(--line); }
.share-btn.ghost:hover { background: var(--hover); filter: none; }
.share-btn.icon-only { padding: 8px 10px; }
.share-pop { min-width: 290px; }
.share-opt { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.share-opt:hover { background: var(--hover); }
.share-opt input { accent-color: var(--accent); }
.share-link { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); margin-top: 4px; }

/* Share with team: a scrolling roster of tick boxes, so a long team does not push
   the Apply button off the bottom of the popover. */
.team-all { font-weight: 600; }
.team-list { max-height: 210px; overflow-y: auto; }
.team-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.team-apply[disabled] { opacity: .5; cursor: default; border-color: var(--line); }
.team-count { font-size: 12px; color: var(--muted); }
.team-picker { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 6px; }
.share-url { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--fg); font-size: 12px; }
.share-copy { flex: none; white-space: nowrap; }

/* ---------- Public shared view ---------- */
#sharedView { min-height: 100vh; background: var(--bg); }
.shared-top { display: flex; align-items: center; gap: 10px; padding: 15px 28px; border-bottom: 1px solid var(--line); background: var(--content-bg); font-weight: 700; }
.shared-top .shared-logo { width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.shared-wrap { max-width: 1100px; margin: 0 auto; padding: 28px; }

/* ---------- Upload modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(20,21,25,0.5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 560px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-x { border: none; background: transparent; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-x:hover { color: var(--fg); }
.dropzone {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 40px 20px; text-align: center;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { width: 30px; height: 30px; color: var(--muted); margin-bottom: 10px; }
.dz-text { font-size: 14px; }
.dz-text .browse { color: #2563eb; text-decoration: underline; font-weight: 600; }
.dz-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.upload-progress {
  margin-top: 16px; padding: 14px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--line); font-size: 13px; display: flex; align-items: center; gap: 10px;
}
.upload-progress .spinner { width: 18px; height: 18px; margin: 0; border-width: 2px; }
.progress-track { width: 100%; height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width 0.2s ease; }

/* ---------- Admin (usage per user) ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-refresh {
  border: 1px solid var(--line); background: var(--content-bg); color: var(--fg);
  padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.admin-refresh:hover { background: var(--hover); border-color: var(--accent); }
.admin-sub { color: var(--muted); font-size: 13px; margin: 6px 0 16px; max-width: 640px; }
.admin-note {
  background: var(--accent-soft); border: 1px solid var(--line); color: var(--fg);
  padding: 10px 12px; border-radius: 9px; font-size: 12.5px; margin-bottom: 16px;
}
.admin-note code { font-size: 12px; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.admin-table th, .admin-table td { padding: 11px 14px; text-align: left; white-space: nowrap; }
.admin-table thead th {
  background: var(--content-bg); color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
.admin-table tbody tr { border-top: 1px solid var(--line); }
.admin-table tbody tr:hover { background: var(--hover); }
.admin-table .a-num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .a-user { font-weight: 600; }
.admin-table .a-date { color: var(--muted); }
.admin-table .a-empty { text-align: center; color: var(--muted); padding: 26px; }
.admin-table tfoot td {
  border-top: 2px solid var(--line); font-weight: 700;
  background: var(--content-bg); font-variant-numeric: tabular-nums;
}
.admin-table tfoot td.a-num { text-align: right; }

/* team management (add user + reset password) */
.admin-users {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--content-bg); padding: 16px; margin: 14px 0 20px;
}
.admin-users-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.admin-user-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-user-form input {
  flex: 1 1 200px; min-width: 160px; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--fg);
}
.admin-user-form input:focus { outline: none; border-color: var(--accent); }
.admin-user-form button { flex: 0 0 auto; }
.admin-user-msg {
  margin-top: 12px; padding: 10px 12px; border-radius: 9px; font-size: 13px;
  border: 1px solid var(--line); background: var(--bg); line-height: 1.5;
}
.admin-user-msg.ok { background: var(--accent-soft); }
.admin-user-msg.err { border-color: #e0526b; color: #c0324a; }
.admin-user-msg .cred {
  font-size: 13px; font-weight: 700; background: var(--content-bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; margin: 0 4px;
}
.cred-copy {
  border: 1px solid var(--line); background: var(--content-bg); color: var(--fg);
  padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.cred-copy:hover { background: var(--hover); border-color: var(--accent); }
.cred-hint { color: var(--muted); font-size: 12px; }
.admin-table .a-actions { text-align: right; }
.a-reset {
  border: 1px solid var(--line); background: var(--content-bg); color: var(--fg);
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.a-reset:hover { background: var(--hover); border-color: var(--accent); }
.a-reset:disabled { opacity: 0.6; cursor: default; }
.a-menu-btn {
  border: 1px solid var(--line); background: var(--content-bg); color: var(--fg);
  width: 30px; height: 28px; border-radius: 8px; font-size: 16px; line-height: 1; cursor: pointer;
}
.a-menu-btn:hover { background: var(--hover); border-color: var(--accent); }
.a-suspended {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
  background: #fdecec; color: var(--danger); border: 1px solid #f6cccc;
}
@media (prefers-color-scheme: dark) {
  .a-suspended { background: #3a2020; border-color: #5b2b2b; color: #fca5a5; }
}
.a-row-suspended .a-user { color: var(--muted); }

/* ---------- AI chat (recording detail) ---------- */
#tab-chat {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; height: 560px; max-height: 560px; overflow: hidden;
}
.chat-log {
  flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column;
  gap: 10px; padding-right: 2px;
}
.chat-empty { margin: auto 0; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.chat-empty strong { display: block; color: var(--fg); font-size: 14px; margin-bottom: 4px; }
.chat-empty p { margin: 0 0 14px; }
.chat-chips { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.chat-chip {
  border: 1px solid var(--line); background: var(--content-bg); color: var(--fg);
  padding: 6px 13px; border-radius: 20px; font-size: 12.5px; cursor: pointer; max-width: 100%;
}
.chat-chip:hover { background: var(--hover); border-color: var(--accent); }
.chat-msg {
  font-size: 13.5px; line-height: 1.6; border-radius: 12px;
  padding: 9px 12px; max-width: 92%; word-wrap: break-word;
}
.chat-msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--line); white-space: pre-wrap; }
.chat-msg.bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.chat-msg.err { border-color: #e0526b; color: #c0324a; }
.chat-msg p { margin: 0 0 8px; }
.chat-msg ul { margin: 0 0 8px; padding-left: 18px; }
.chat-msg li { margin-bottom: 3px; }
.chat-msg p:last-child, .chat-msg ul:last-child { margin-bottom: 0; }
.chat-msg code {
  background: var(--content-bg); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; font-size: 12.5px;
}
.chat-form { flex: 0 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea {
  flex: 1 1 auto; resize: none; font: inherit; font-size: 13.5px; line-height: 1.5;
  color: var(--fg); background: var(--content-bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; max-height: 120px; overflow-y: auto;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); }
.chat-send {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--content-bg); color: var(--fg);
  display: grid; place-items: center;
}
.chat-send:hover { background: var(--hover); border-color: var(--accent); }
.chat-send:disabled { opacity: 0.5; cursor: default; }
.chat-dots { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.chat-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chatBlink 1.2s infinite; }
.chat-dots i:nth-child(2) { animation-delay: 0.2s; }
.chat-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatBlink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
@media (prefers-color-scheme: dark) {
  .chat-msg.err { border-color: #5b2b2b; color: #fca5a5; }
}

/* ---------- collapsible sections in the card menu ---------- */
.popover .pop-group {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); padding: 7px 8px; border-radius: 7px; cursor: pointer;
  user-select: none;
}
.popover .pop-group:hover { background: var(--hover); color: var(--fg); }
.pop-group-n {
  display: inline-block; min-width: 15px; text-align: center; margin-left: 3px;
  background: var(--accent-soft); color: var(--fg); border-radius: 20px;
  padding: 0 5px; font-size: 10px; letter-spacing: 0;
}
.pop-caret { flex: 0 0 auto; transition: transform 0.14s ease; }
.pop-group.open .pop-caret { transform: rotate(90deg); }
