:root {
  --canvas: #f5f5f2;
  --surface: #ffffff;
  --surface-subtle: #fafaf8;
  --surface-hover: #f2f2ee;
  --border: #e6e6e0;
  --border-strong: #d5d5cd;

  --ink: #161618;
  --ink-secondary: #4c4c54;
  --ink-muted: #7c7c85;
  --ink-subtle: #a1a1aa;

  --brand: #18181b;
  --brand-hover: #2c2c31;
  --accent: #3b5bdb;
  --danger: #dc2626;
  --success: #15803d;

  /* Plaud Bento pastel palette */
  --rose-bg: #fdf2f6;
  --rose-border: #f5d8e3;
  --rose-badge-bg: #f8e1ea;
  --rose-badge-ink: #9c2f59;
  --rose-icon: #b8446f;

  --blue-bg: #f1f7fe;
  --blue-border: #d8e8fb;
  --blue-badge-bg: #e1effe;
  --blue-badge-ink: #1f5594;
  --blue-icon: #356eb3;

  --amber-bg: #fcf8ec;
  --amber-border: #efe2be;
  --amber-badge-bg: #f3e5bf;
  --amber-badge-ink: #7a5813;
  --amber-icon: #a4761a;

  --emerald-bg: #f1fbf6;
  --emerald-border: #d0eedd;
  --emerald-badge-bg: #dcf4e6;
  --emerald-badge-ink: #186a42;
  --emerald-icon: #1f8050;

  --violet-bg: #f6f3fe;
  --violet-border: #e4dbfa;
  --violet-badge-bg: #ebe3fc;
  --violet-badge-ink: #5a37a6;
  --violet-icon: #6d47be;

  --neutral-bg: #f8f8f6;
  --neutral-border: #e6e6e0;
  --neutral-badge-bg: #ecece8;
  --neutral-badge-ink: #52525b;
  --neutral-icon: #6b6b73;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sheet: 0 1px 3px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.035);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, sans-serif;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: #efefeb;
  color: #3f3f46;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.86em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.hidden { display: none !important; }
.muted { color: var(--ink-muted); }
.small-text { font-size: 0.85rem; }
.xsmall-text { font-size: 0.77rem; }
.error-text { color: var(--danger); font-size: 0.88rem; margin: 0; }

.ico { width: 17px; height: 17px; flex-shrink: 0; }
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 22px; height: 22px; color: var(--ink-muted); }

/* Brand mark */
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark-sm { width: 28px; height: 28px; border-radius: 8px; }
.brand-mark-sm svg { width: 15px; height: 15px; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--canvas);
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow-sheet);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-brand h1 { font-size: 1.35rem; }
.login-brand p { margin: 2px 0 0; font-size: 0.86rem; }

/* App Shell */
.app-shell {
  display: flex;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--surface-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px;
}
.brand-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.sidebar-cta {
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, color 0.14s;
}
.nav-btn:hover { background: var(--surface-hover); color: var(--ink); }
.nav-btn.active {
  background: #eaeae4;
  color: var(--ink);
  font-weight: 600;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.sync-status-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a1a1aa;
  flex-shrink: 0;
}
.status-dot.ok { background: #16a34a; }
.status-dot.warn { background: #d97706; }
.status-dot.err { background: #dc2626; }

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.alert-banner {
  background: #fef3c7;
  border-bottom: 1px solid #f5d08a;
  color: #78350f;
  padding: 9px 20px;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.view.active { display: flex; flex-direction: column; }

/* Recordings Split View */
.recordings-layout {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
}

.recordings-list-pane {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  padding: 16px 14px;
  gap: 11px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}
.list-header h2 { font-size: 1.05rem; font-weight: 700; }

.header-actions { display: flex; gap: 6px; align-items: center; }

.search-wrap {
  position: relative;
}
.search-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-subtle);
  pointer-events: none;
}
.search-wrap input {
  padding-left: 33px !important;
  background: var(--surface-subtle) !important;
  border-color: var(--border) !important;
  font-size: 0.86rem !important;
}
.search-wrap input:focus {
  background: var(--surface) !important;
}

.category-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  padding: 2px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.category-filter-bar::-webkit-scrollbar { display: none; }

.cat-filter-btn {
  flex-shrink: 0;
  background: #f1f1ed;
  border: 1px solid transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}
.cat-filter-btn:hover { background: #e8e8e2; color: var(--ink); }
.cat-filter-btn.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.rec-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 6px 4px;
  margin-top: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  border-bottom: 1px solid #efefea;
}
.rec-group-header:first-child { margin-top: 0; padding-top: 2px; }

.segmented-filter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #f1f1ed;
  padding: 3px;
  border-radius: 9px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.recordings-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rec-swipe-item {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  flex-shrink: 0;
  transition: max-height 0.22s ease, opacity 0.2s ease, margin 0.22s ease;
}
.rec-swipe-item.removing {
  opacity: 0;
  max-height: 0 !important;
  margin: 0 !important;
}

.rec-swipe-actions {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  background: #dc2626;
  border-radius: 10px;
}

.rec-swipe-delete-btn {
  width: 88px;
  border: none;
  background: transparent;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 0 8px;
  transition: width 0.14s ease, background 0.14s ease;
}
.rec-swipe-delete-btn:active { background: rgba(0, 0, 0, 0.12); }
.rec-swipe-item.full-swipe .rec-swipe-actions { background: #b91c1c; }

.rec-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  touch-action: pan-y;
  will-change: transform;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.12s, border-color 0.12s;
}
.rec-swipe-item.swiping .rec-card {
  transition: none;
}
.rec-card:hover { background: var(--surface-subtle); }
.rec-card.selected {
  background: #f3f3ef;
  border-color: #dcdcd5;
}

.rec-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.rec-card-title {
  font-weight: 600;
  font-size: 0.89rem;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rec-card-cat {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--rose-badge-ink);
  background: var(--rose-badge-bg);
  padding: 1px 7px;
  border-radius: 999px;
  margin-bottom: 5px;
}
.rec-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--ink-muted);
}
.rec-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Detail Pane */
.recording-detail-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--canvas);
}

.detail-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px;
  gap: 8px;
}
.placeholder-circle {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.placeholder-circle svg { width: 24px; height: 24px; }
.detail-placeholder p { max-width: 340px; margin: 0; font-size: 0.88rem; }

.detail-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.detail-topbar {
  background: rgba(245, 245, 242, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.segmented-tabs {
  display: inline-flex;
  background: #eaeae4;
  padding: 3px;
  border-radius: 9px;
  gap: 2px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  padding: 5px 13px;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.detail-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 64px;
}

.detail-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.doc-controls-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.doc-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.title-input {
  flex: 1;
  min-width: 220px;
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.05rem !important;
  font-weight: 700;
  padding: 4px 8px !important;
  margin-left: -8px;
  border-radius: 8px;
}
.title-input:hover, .title-input:focus {
  background: var(--surface-subtle) !important;
  border-color: var(--border) !important;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.audio-bar audio {
  width: 100%;
  height: 38px;
  display: block;
}

/* Speaker bar + MP-AI-PM link bar */
.doc-chips-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid #f0f0ec;
}
.speaker-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mp-link-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.mp-linked-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--emerald-badge-bg);
  color: var(--emerald-badge-ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.77rem;
  font-weight: 600;
}
.rec-card-mp {
  display: inline-block;
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--emerald-badge-ink);
  background: var(--emerald-badge-bg);
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 4px;
}

.modal-card-lg { max-width: 540px; }
.mp-kind-btn {
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}
.mp-kind-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.mp-results-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mp-result-item {
  width: 100%;
  text-align: left;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: inherit;
  transition: all 0.14s;
}
.mp-result-item:hover {
  background: #eff6ff;
  border-color: var(--blue-border);
}
.mp-result-title { font-weight: 600; font-size: 0.87rem; color: var(--ink); }
.mp-result-sub { font-size: 0.76rem; color: var(--ink-muted); }
.speaker-bar-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
}
.speaker-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.speaker-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s;
}
.speaker-chip:hover {
  border-color: var(--border-strong);
  background: #efefea;
}
.speaker-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e7e5e0;
  color: #3f3f46;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.speaker-chip svg { width: 11px; height: 11px; color: var(--ink-subtle); }

/* Status Box */
.status-box {
  padding: 11px 15px;
  border-radius: 11px;
  font-size: 0.86rem;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: var(--blue-badge-ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-box.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.sub-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sub-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================================================
   PLAUD-STYLE VISUAL BENTO BOARD
   ========================================================= */
.bento-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 30px 30px;
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bento-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.bento-category-pill {
  align-self: flex-start;
  background: var(--rose-badge-bg);
  color: var(--rose-badge-ink);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 11px;
  border-radius: 999px;
}

.bento-hero h1 {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.22;
  color: #111113;
  margin-top: 2px;
}

.bento-subtitle {
  margin: 0;
  font-size: 0.94rem;
  color: var(--ink-secondary);
}

/* 12-column responsive Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.bento-card {
  border-radius: 14px;
  padding: 18px 20px;
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.bento-span-wide { grid-column: span 8; }
.bento-span-narrow { grid-column: span 4; }
.bento-span-half { grid-column: span 6; }
.bento-span-full { grid-column: span 12; }

.bento-tone-rose { background: var(--rose-bg); border-color: var(--rose-border); }
.bento-tone-blue { background: var(--blue-bg); border-color: var(--blue-border); }
.bento-tone-amber { background: var(--amber-bg); border-color: var(--amber-border); }
.bento-tone-emerald { background: var(--emerald-bg); border-color: var(--emerald-border); }
.bento-tone-violet { background: var(--violet-bg); border-color: var(--violet-border); }
.bento-tone-neutral { background: var(--neutral-bg); border-color: var(--neutral-border); }

.bento-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bento-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bento-card-title-wrap h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #18181b;
}

.bento-icon { width: 17px; height: 17px; flex-shrink: 0; color: var(--neutral-icon); }
.bento-tone-rose .bento-icon { color: var(--rose-icon); }
.bento-tone-blue .bento-icon { color: var(--blue-icon); }
.bento-tone-amber .bento-icon { color: var(--amber-icon); }
.bento-tone-emerald .bento-icon { color: var(--emerald-icon); }
.bento-tone-violet .bento-icon { color: var(--violet-icon); }

.bento-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--neutral-badge-bg);
  color: var(--neutral-badge-ink);
}
.bento-tone-rose .bento-badge { background: var(--rose-badge-bg); color: var(--rose-badge-ink); }
.bento-tone-blue .bento-badge { background: var(--blue-badge-bg); color: var(--blue-badge-ink); }
.bento-tone-amber .bento-badge { background: var(--amber-badge-bg); color: var(--amber-badge-ink); }
.bento-tone-emerald .bento-badge { background: var(--emerald-badge-bg); color: var(--emerald-badge-ink); }
.bento-tone-violet .bento-badge { background: var(--violet-badge-bg); color: var(--violet-badge-ink); }

.bento-lead {
  margin: 0;
  font-size: 0.88rem;
  color: #36363c;
  line-height: 1.55;
}

/* Highlight Metric Callout (like "15s") */
.bento-metric-box {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 11px;
  padding: 16px 14px;
  text-align: center;
}
.bento-metric-value {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  color: #111113;
  letter-spacing: -0.03em;
}
.bento-metric-label {
  margin-top: 5px;
  font-size: 0.79rem;
  color: var(--ink-secondary);
}

/* Nested white subcards */
.bento-subcards {
  display: grid;
  gap: 10px;
}
.bento-subcards.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bento-subcards.cols-1 { grid-template-columns: 1fr; }

.bento-subcard {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
}
.bento-subcard-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #18181b;
  margin-bottom: 4px;
}
.bento-subcard-body {
  font-size: 0.83rem;
  color: #44444b;
  line-height: 1.5;
}

/* Bullets inside Bento card */
.bento-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.bento-bullets li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  color: #36363c;
  line-height: 1.48;
}
.bento-bullet-ico {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--ink-muted);
}
.bento-bullet-ico.check { color: var(--rose-icon); }

/* Table inside Bento card */
.bento-table-wrap {
  overflow-x: auto;
}
.bento-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.bento-table th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 6px 8px 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.bento-table td {
  padding: 9px 8px 9px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: top;
  color: #36363c;
}
.bento-table tr:last-child td { border-bottom: none; }
.bento-table td:first-child { font-weight: 600; color: #18181b; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill-green { background: #dcfce7; color: #166534; }
.status-pill-green::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #16a34a; }
.status-pill-neutral { background: #eceef2; color: #525866; }
.status-pill-blue { background: #dbeafe; color: #1d4ed8; }
.status-pill-amber { background: #fef3c7; color: #92400e; }
.status-pill-rose { background: #ffe4e6; color: #be123c; }

.bento-footer-note {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.81rem;
  color: var(--ink-secondary);
}

/* Action Owners Section (Warm Amber Bottom Card) */
.action-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.action-owner-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(180, 145, 70, 0.18);
  border-radius: 11px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.action-owner-head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.owner-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ede4cc;
  color: #5c4514;
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.action-owner-name {
  font-size: 0.87rem;
  font-weight: 700;
  color: #18181b;
}
.action-owner-role {
  font-weight: 500;
  color: var(--ink-muted);
}

.action-items-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.action-item-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 2px 0;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.84rem;
  color: #36363c;
  line-height: 1.48;
}
.action-item-btn:hover .action-circle { border-color: var(--amber-icon); }
.action-circle {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.6px solid #a8a29e;
  margin-top: 3px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
}
.action-item-btn.done .action-circle {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}
.action-item-btn.done .action-text {
  text-decoration: line-through;
  color: var(--ink-muted);
}

/* Markdown & Transcript Sheets */
.segmented-tabs-sm { padding: 2px; }
.view-mode-btn,
.md-mode-btn {
  background: transparent;
  border: none;
  color: var(--ink-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.77rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s;
}
.view-mode-btn.active,
.md-mode-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.editor-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.md-editor-wrap {
  display: grid;
  gap: 12px;
}
.md-editor-wrap.mode-split {
  grid-template-columns: 1fr 1fr;
}
.md-editor-wrap.mode-write {
  grid-template-columns: 1fr;
}
.md-editor-wrap.mode-write .markdown-preview-box {
  display: none;
}
.md-editor-wrap.mode-preview {
  grid-template-columns: 1fr;
}
.md-editor-wrap.mode-preview textarea {
  display: none;
}

.md-textarea {
  min-height: 300px;
  resize: vertical;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.markdown-preview-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  min-height: 300px;
  max-height: 540px;
  overflow-y: auto;
}

.markdown-sheet,
.transcript-sheet,
.editor-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 30px;
  box-shadow: var(--shadow-sheet);
}

.markdown-sheet,
.markdown-preview-box {
  color: #27272a;
  line-height: 1.68;
}
.markdown-sheet h1, .markdown-preview-box h1 { font-size: 1.5rem; margin: 1.1em 0 0.5em; }
.markdown-sheet h2, .markdown-preview-box h2 {
  font-size: 1.15rem;
  margin: 1.35em 0 0.45em;
  padding-bottom: 6px;
  border-bottom: 1px solid #efefeb;
}
.markdown-sheet h3, .markdown-preview-box h3 { font-size: 0.98rem; margin: 1.1em 0 0.35em; }
.markdown-sheet h1:first-child,
.markdown-sheet h2:first-child,
.markdown-preview-box h1:first-child,
.markdown-preview-box h2:first-child { margin-top: 0; }
.markdown-sheet p, .markdown-preview-box p { margin: 0 0 0.85em; }
.markdown-sheet ul, .markdown-sheet ol,
.markdown-preview-box ul, .markdown-preview-box ol {
  margin: 0 0 0.95em;
  padding-left: 22px;
}
.markdown-sheet li, .markdown-preview-box li { margin-bottom: 5px; }

.md-task-list { list-style: none; padding-left: 0 !important; }
.md-task {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.md-task-box {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid #a1a1aa;
  margin-top: 4px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}
.md-task.done .md-task-box {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}
.md-task.done > span:last-child {
  text-decoration: line-through;
  color: var(--ink-muted);
}

.markdown-sheet blockquote, .markdown-preview-box blockquote {
  margin: 0 0 1em;
  padding: 10px 14px;
  border-left: 3px solid #d4d4ce;
  background: var(--surface-subtle);
  border-radius: 0 8px 8px 0;
  color: var(--ink-secondary);
}
.markdown-sheet blockquote p:last-child,
.markdown-preview-box blockquote p:last-child { margin-bottom: 0; }

.markdown-sheet hr, .markdown-preview-box hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25em 0;
}

.md-pre {
  background: #18181b;
  color: #f4f4f5;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 0 0 1em;
}
.md-pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.md-table-wrap { overflow-x: auto; margin: 0 0 1em; }
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.md-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink-muted);
  background: var(--surface-subtle);
  padding: 8px 10px;
  border: 1px solid var(--border);
}
.md-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  vertical-align: top;
}

.transcript-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.transcript-turn {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 9px;
  transition: background 0.12s;
}
.transcript-turn:hover { background: var(--surface-subtle); }
.ts-link {
  background: #f1f1ec;
  color: var(--ink-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-align: center;
}
.ts-link:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.turn-speaker-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.89rem;
  font-weight: 700;
  color: #18181b;
  cursor: pointer;
  margin-right: 5px;
  border-bottom: 1px dashed transparent;
}
.turn-speaker-btn:hover { border-bottom-color: var(--ink-muted); }
.turn-text { color: #36363c; line-height: 1.65; }

/* Standard Pages (Record, Voices, Templates, Settings) */
.page-container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.page-container-wide {
  max-width: 1120px;
}

.ai-template-card {
  background: linear-gradient(180deg, #fffafd 0%, #ffffff 100%);
  border-color: var(--rose-border);
}
.ai-template-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-template-input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-template-input-row input {
  flex: 1;
  min-width: 240px;
}
.page-header h1 { font-size: 1.5rem; font-weight: 800; }
.page-header p { margin: 4px 0 0; }
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.page-header-row h1 { font-size: 1.5rem; font-weight: 800; }
.page-header-row p { margin: 4px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h3 { font-size: 1.02rem; font-weight: 700; }
.card-head p { margin: 2px 0 0; }

/* Badges & Pills */
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: #efefeb;
  color: var(--ink-secondary);
  white-space: nowrap;
}
.pill-ok, .pill-done { background: #dcfce7; color: #166534; }
.pill-working { background: #e0e7ff; color: #3730a3; }
.pill-failed, .pill-expired { background: #fee2e2; color: #991b1b; }
.pill-amber { background: #fef3c7; color: #92400e; }
.pill-source { background: #f1f1ed; color: #52525b; }

/* Forms */
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 0.89rem;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

.select-sm, .input-sm {
  width: auto !important;
  min-width: 160px;
  padding: 6px 10px !important;
  font-size: 0.83rem !important;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
}
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--brand); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}
.btn-secondary:hover { background: var(--surface-subtle); border-color: #b8b8b0; }
.btn-ghost { background: transparent; color: var(--ink-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

.btn-record {
  background: #dc2626;
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 0.92rem;
}
.btn-record:hover { background: #b91c1c; }
.btn-record.recording { animation: pulse-rec 1.6s infinite; }
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}
@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.btn-sm { padding: 6px 11px; font-size: 0.81rem; }
.btn-xs { padding: 3px 8px; font-size: 0.75rem; }
.btn-block { width: 100%; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.icon-btn-danger:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions.end { justify-content: flex-end; }
.divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Draft recovery banner & OLED blackout overlay */
.draft-recovery-card {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 15px 18px;
}
.draft-recovery-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--amber-badge-ink);
}

.oled-dim-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;
  color: #52525b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(36px + var(--safe-bottom));
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.oled-dim-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: auto 0;
}
.oled-dim-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #991b1b;
  animation: oled-pulse 2.4s ease-in-out infinite;
}
@keyframes oled-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}
.oled-dim-timer {
  font-family: "Plus Jakarta Sans", -apple-system, sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #3f3f46;
}
.oled-dim-label {
  font-size: 0.85rem;
  color: #3f3f46;
}
.oled-wake-btn {
  background: transparent;
  border: 1px solid #27272a;
  color: #52525b;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.oled-wake-btn:active {
  background: #18181b;
  color: #a1a1aa;
}

/* Recorder Stage & Tactile Template Picker */
.rec-template-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.rec-template-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}
.rec-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.rec-tpl-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 78px;
  padding: 14px 15px;
  background: var(--surface-subtle);
  border: 1.5px solid var(--border);
  border-radius: 15px;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.rec-tpl-btn:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}
.rec-tpl-btn:active {
  transform: scale(0.98);
}
.rec-tpl-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(24, 24, 27, 0.16);
}
.rec-tpl-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}
.rec-tpl-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #ecece6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rec-tpl-btn.active .rec-tpl-icon-wrap {
  background: rgba(255, 255, 255, 0.14);
}
.rec-tpl-ico {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--ink);
}
.rec-tpl-btn.active .rec-tpl-ico { color: #ffffff; }
.rec-tpl-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rec-tpl-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rec-tpl-pill {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7f6ec;
  color: #166534;
  white-space: nowrap;
}
.rec-tpl-btn.active .rec-tpl-pill {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}
.rec-tpl-name {
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.2;
}
.rec-tpl-sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.25;
}
.rec-tpl-btn.active .rec-tpl-sub {
  color: rgba(255, 255, 255, 0.78);
}
.rec-tpl-rec-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dc2626;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.28);
}
.rec-tpl-rec-badge svg { width: 17px; height: 17px; }
.rec-tpl-btn.active .rec-tpl-rec-badge {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25);
}
.recorder-stage:not(.is-recording) .rec-fallback-start {
  display: none;
}

.recorder-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
}
.recorder-timer {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.recorder-timer.recording { color: #dc2626; }
#recorder-visualizer {
  width: 100%;
  max-width: 500px;
  height: 58px;
}
.recorder-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Drop Zone */
.drop-zone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  background: var(--surface-subtle);
  cursor: pointer;
  transition: all 0.14s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--brand);
  background: #f0f0eb;
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-zone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
}

/* Voices & Templates Grids */
.voices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}

.voice-card, .template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-xs);
}
.voice-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.voice-avatar-lg {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eceae4;
  color: #27272a;
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.voice-card audio { width: 100%; height: 32px; }
.voice-capture-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.file-btn-label { margin: 0; }

.template-md-preview {
  background: var(--surface-subtle);
  border: 1px solid #f0f0ec;
  border-radius: 10px;
  padding: 13px 15px;
  font-size: 0.82rem;
  color: #36363c;
  line-height: 1.55;
  max-height: 220px;
  overflow-y: auto;
}
.template-md-preview h1,
.template-md-preview h2,
.template-md-preview h3 {
  font-size: 0.86rem;
  margin: 0.8em 0 0.25em;
  color: var(--ink);
  border-bottom: none;
  padding-bottom: 0;
}
.template-md-preview h1:first-child,
.template-md-preview h2:first-child,
.template-md-preview p:first-child { margin-top: 0; }
.template-md-preview p { margin: 0 0 0.55em; }
.template-md-preview ul, .template-md-preview ol { margin: 0 0 0.55em; padding-left: 18px; }
.template-md-preview li { margin-bottom: 3px; }

/* Callout Info */
.callout-info {
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  color: #1e3a5f;
}
.callout-info ol { margin: 8px 0 0; padding-left: 18px; }
.callout-info li { margin-bottom: 5px; }
.code-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.code-copy-row code {
  max-width: 100%;
  overflow-x: auto;
  display: inline-block;
  font-size: 0.78rem;
}
.plaud-otp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.plaud-otp-row input {
  flex: 1 1 200px;
  min-width: 0;
  background: #ffffff;
}
.bookmarklet-drag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.bookmarklet-pill {
  cursor: grab;
  text-decoration: none !important;
  color: #ffffff !important;
}
.bookmarklet-pill-alt {
  cursor: grab;
  text-decoration: none !important;
}
.bookmarklet-pill:active,
.bookmarklet-pill-alt:active { cursor: grabbing; }
.manual-token-details {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(30, 58, 95, 0.12);
}
.manual-token-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue-badge-ink);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.modal-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.quick-picks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.quick-pick-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
}
.quick-pick-btn:hover { background: #ecece6; border-color: var(--border-strong); }
.modal-voice-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.speaker-clip-quote {
  font-style: italic;
  line-height: 1.4;
  padding: 6px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--ink-secondary);
}
.speaker-clip-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Empty & Toasts */
.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}
.toast {
  background: #18181b;
  color: #fafafa;
  padding: 10px 15px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 340px;
}
.toast.error { background: #991b1b; }
.toast.success { background: #14532d; }

/* Responsive */
.mobile-nav { display: none; }
.mobile-only { display: none; }

@media (max-width: 1080px) {
  .bento-span-wide, .bento-span-narrow, .bento-span-half { grid-column: span 12; }
  .bento-subcards.cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .sidebar { display: none; }
  .mobile-only { display: inline-flex; }
  .hide-xs { display: none; }

  /* Förhindra auto-zoom på iOS Safari vid fokus i fält */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    width: 100%;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(8px + var(--safe-bottom));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
  }
  .mobile-nav-btn {
    background: transparent;
    border: none;
    color: var(--ink-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 2px 2px;
    min-width: 0;
    cursor: pointer;
  }
  .mobile-nav-btn small {
    font-size: 0.67rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .mobile-nav-btn.active { color: var(--ink); font-weight: 700; }

  .mobile-nav-record { padding-top: 0; }
  .mobile-rec-fab {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--brand);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: -16px;
    box-shadow: 0 6px 16px rgba(24, 24, 27, 0.22);
    transition: transform 0.14s, background 0.14s;
  }
  .mobile-nav-record.active .mobile-rec-fab { background: #dc2626; }
  .mobile-nav-record:active .mobile-rec-fab { transform: scale(0.94); }

  .main-content {
    width: 100%;
    max-width: 100%;
    padding-bottom: calc(68px + var(--safe-bottom));
  }

  .recordings-layout { grid-template-columns: minmax(0, 1fr); }
  .recordings-list-pane {
    border-right: none;
    padding: 14px 12px 20px;
  }
  .recording-detail-pane { display: none; }
  .recordings-layout.show-detail .recordings-list-pane { display: none; }
  .recordings-layout.show-detail .recording-detail-pane { display: flex; }

  /* Kompakt 2-rads topbar på mobil så inget någonsin sticker ut i sidled */
  .detail-topbar {
    padding: 8px 12px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .detail-topbar .segmented-tabs {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 2px;
  }
  .tab-btn {
    padding: 6px 6px;
    font-size: 0.78rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .detail-scroll {
    padding: 12px 12px 84px;
    overflow-x: hidden;
  }
  .detail-inner { min-width: 0; max-width: 100%; }
  .doc-controls-strip { padding: 12px 13px; border-radius: 14px; min-width: 0; }
  .title-input { min-width: 0; width: 100%; margin-left: 0; }
  .mp-link-bar { margin-left: 0; width: 100%; }
  .bento-sheet { padding: 16px 14px; border-radius: 16px; min-width: 0; }
  .bento-card { padding: 14px 14px; overflow-wrap: anywhere; }
  .bento-card-head, .card-head { flex-wrap: wrap; }
  .bento-hero h1 { font-size: 1.28rem; overflow-wrap: anywhere; }
  .bento-metric-value { font-size: 1.85rem; }
  .markdown-sheet, .transcript-sheet, .editor-sheet {
    padding: 16px 14px;
    border-radius: 14px;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .transcript-turn { grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 5px 4px; }
  .turn-text { min-width: 0; overflow-wrap: anywhere; }

  .sub-toolbar { gap: 8px; }
  .sub-toolbar-group { width: 100%; }
  .select-sm, .input-sm { min-width: 0; max-width: 100%; flex: 1 1 140px; }

  .page-container {
    padding: 16px 12px 96px;
    max-width: 100%;
    overflow-x: hidden;
  }
  .card {
    padding: 16px 14px;
    border-radius: 14px;
    min-width: 0;
    max-width: 100%;
  }
  .recorder-stage { padding: 16px 12px; min-width: 0; max-width: 100%; }
  .recorder-card-head { margin-bottom: 10px; }
  .rec-template-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .rec-tpl-btn {
    min-height: 74px;
    padding: 14px 15px;
    border-radius: 15px;
  }
  .rec-tpl-name { font-size: 1rem; }
  .rec-tpl-sub { font-size: 0.78rem; }
  .rec-tpl-rec-badge { width: 42px; height: 42px; }
  #view-record .page-header p { display: none; }
  #view-record .page-header h1 { font-size: 1.3rem; }
  #recorder-visualizer { display: block; width: 100%; max-width: 100%; height: 44px; }
  .form-grid,
  .voices-grid,
  .templates-grid,
  .action-groups-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ai-template-input-row input { min-width: 0; width: 100%; }
  .md-editor-wrap.mode-split { grid-template-columns: minmax(0, 1fr); }
  .md-textarea { min-height: 200px; }
  .markdown-preview-box { min-height: 160px; overflow-wrap: anywhere; }
  .md-pre, pre { max-width: 100%; overflow-x: auto; }
  .code-copy-row { min-width: 0; max-width: 100%; }
  .code-copy-row code { max-width: 100%; word-break: break-all; }
  .callout-info { overflow-wrap: anywhere; }
  .alert-banner { padding: 9px 12px; flex-wrap: wrap; }

  /* Bottom-sheet känsla på mobilen för modaler */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-card {
    max-width: 100%;
    width: 100%;
    max-height: 90dvh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 20px 16px calc(22px + var(--safe-bottom));
  }

  .toast-container {
    bottom: calc(78px + var(--safe-bottom));
    left: 12px;
    right: 12px;
  }
  .toast { max-width: none; }
}

/* Mötesbot (Attendee) & Egen Branding */
.branding-upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.branding-preview-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 240px;
}
.brand-preview-img {
  width: 56px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 3px;
  flex-shrink: 0;
}
input[type="color"] {
  width: 56px;
  height: 38px;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
}
.bots-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-subtle);
}
.bot-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 240px;
}
.bot-row-top {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
