  :root {
    /* Dark Theme (Default) */
    --bg: #0f1117;
    --surface: #1a1d2e;
    --surface2: #232640;
    --surface3: #2d3158;
    --accent: #6c63ff;
    --accent2: #a78bfa;
    --accent3: #38bdf8;
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
    --orange: #fb923c;
    --text: #e2e8f0;
    --text2: #94a3b8;
    --text3: #64748b;
    --border: #2d3158;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s cubic-bezier(.4,0,.2,1);
  }

  /* Light Theme Overrides */
  [data-theme="light"] {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface2: #f1f5f9;
    --surface3: #e2e8f0;
    --accent: #4f46e5;
    --accent2: #6366f1;
    --accent3: #0ea5e9;
    --text: #1e293b;
    --text2: #475569;
    --text3: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
  }

  /* ── LAYOUT ── */
  .app-shell { display: flex; height: 100vh; overflow: hidden; }

  /* ── SIDEBAR ── */
  .sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    z-index: 10;
  }
  .sidebar-logo {
    padding: 22px 20px 18px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border);
  }
  .logo-icon {
    width: 36px; 
    height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
  }
  .logo-text { font-size: 16px; font-weight: 700; color: var(--text); }
  .logo-sub  { font-size: 10px; color: var(--text3); letter-spacing: .05em; text-transform: uppercase; }

  .sidebar-nav { flex: 1; padding: 12px 8px; }
  .nav-section-title {
    font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
    color: var(--text3); padding: 8px 12px 4px; margin-top: 8px;
  }
  .nav-btn {
    width: 100%; background: none; border: none; color: var(--text2);
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13.5px; font-weight: 500;
    transition: var(--transition); text-align: left;
  }
  .nav-btn:hover { background: var(--surface2); color: var(--text); }
  .nav-btn.active {
    background: linear-gradient(90deg, rgba(108,99,255,.25), rgba(108,99,255,.08));
    color: var(--accent2);
    border-left: 3px solid var(--accent);
    padding-left: 9px;
  }
  .nav-btn .nav-icon { font-size: 16px; width: 20px; text-align: center; }
  .nav-badge {
    margin-left: auto; background: var(--accent);
    color: #fff; font-size: 10px; padding: 1px 6px;
    border-radius: 10px; font-weight: 600;
  }

  .sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
  }

  /* ── AI CHAT SIDEBAR ── */
.chat-sidebar {
  position: fixed; right: -400px; top: 0; width: 380px; height: 100vh;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); z-index: 1000; display: flex;
  flex-direction: column; transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-sidebar.open { right: 0; }
.chat-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
}
.chat-messages {
  flex: 1; padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-bubble {
  max-width: 85%; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.5; word-wrap: break-word;
}
.bubble-ai {
  align-self: flex-start; background: var(--surface3);
  color: var(--text); border-bottom-left-radius: 2px;
}
.bubble-user {
  align-self: flex-end; background: var(--accent);
  color: #fff; border-bottom-right-radius: 2px;
}
.chat-input-area {
  padding: 15px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; background: var(--surface2);
}
.chat-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 999; display: none; backdrop-filter: blur(2px);
}
.chat-overlay.active { display: block; }

  /* ── MAIN ── */
  .main-content {
    flex: 1; overflow-y: auto; background: var(--bg);
    display: flex; flex-direction: column;
  }

  .topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 5;
    backdrop-filter: blur(12px);
  }
  .topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
  .topbar-sub   { font-size: 12px; color: var(--text3); }
  .status-dot   {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text3);
    display: inline-block; margin-right: 6px;
  }
  .status-dot.recording { background: var(--red); animation: pulse 1s infinite; }
  .status-dot.connected { background: var(--green); }

  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

  .page { display: none; padding: 28px; animation: fadeIn .2s ease; }
  .page.active { display: block; }
  @keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

  /* ── CARDS ── */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
  }
  .card-title {
    font-size: 14px; font-weight: 600; color: var(--text2);
    text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
  }
  .card-title span { font-size: 16px; }

  /* ── BUTTONS ── */
  .btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    border: none; cursor: pointer; font-size: 13.5px; font-weight: 600;
    transition: var(--transition); white-space: nowrap;
  }
  .btn-primary  { background: var(--accent); color: #fff; }
  .btn-primary:hover { background: #7c74ff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(108,99,255,.4); }
  .btn-success  { background: var(--green); color: #0f1117; }
  .btn-success:hover { background: #4ade80; transform: translateY(-1px); }
  .btn-danger   { background: var(--red); color: #fff; }
  .btn-danger:hover { background: #fc8181; }
  .btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--surface3); }
  .btn-ghost     { background: transparent; color: var(--text2); border: 1px solid var(--border); }
  .btn-ghost:hover { background: var(--surface2); color: var(--text); }
  .btn-warn      { background: var(--yellow); color: #0f1117; }
  .btn-warn:hover { background: #fcd34d; }
  .btn-info      { background: var(--accent3); color: #0f1117; }
  .btn-info:hover { background: #7dd3fc; }
  .btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }
  .btn-lg { padding: 12px 24px; font-size: 15px; }

  .btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

  /* ── RECORD PAGE ── */
  .recorder-center {
    display: flex; flex-direction: column; align-items: center;
    padding: 32px 20px;
  }
  .record-btn-wrap { position: relative; display: flex; align-items: center; justify-content: center; margin: 24px 0; }
  .record-ring {
    position: absolute;
    width: 110px; height: 110px; border-radius: 50%;
    border: 3px solid var(--red);
    opacity: 0;
    animation: none;
  }
  .record-ring.active { animation: ringPulse 1.4s ease-out infinite; opacity: 1; }
  @keyframes ringPulse { 0%{transform:scale(1);opacity:.8} 100%{transform:scale(1.7);opacity:0} }

  .record-main-btn {
    width: 82px; height: 82px; border-radius: 50%;
    background: linear-gradient(135deg, var(--red), #dc2626);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; transition: var(--transition); box-shadow: 0 6px 24px rgba(248,113,113,.4);
    position: relative; z-index: 1;
  }
  .record-main-btn:hover { transform: scale(1.06); }
  .record-main-btn.recording {
    background: linear-gradient(135deg, #374151, #1f2937);
    box-shadow: 0 6px 24px rgba(0,0,0,.4);
  }

  .timer { font-size: 42px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--text); }
  .timer-sub { color: var(--text3); font-size: 12px; margin-top: 4px; }

  /* Waveform */
  #waveCanvas { border-radius: var(--radius-sm); background: var(--surface2); display: block; }

  /* ── UPLOAD PAGE ── */
  .dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface2);
  }
  .dropzone:hover, .dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(108,99,255,.07);
  }
  .dropzone-icon { font-size: 44px; margin-bottom: 12px; }
  .dropzone h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
  .dropzone p  { color: var(--text3); font-size: 13px; }
  #fileInput { display: none; }

  /* ── SETTINGS GRID ── */
  .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  @media(max-width:680px) { .settings-grid { grid-template-columns: 1fr; } }

  .form-group { margin-bottom: 14px; }
  .form-label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em;
  }
  .form-input, .form-select, .form-textarea {
    width: 100%; background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px;
    padding: 9px 12px; outline: none; transition: var(--transition);
    font-family: inherit;
  }
  .form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,99,255,.15);
  }
  .form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
  .form-select option { background: var(--surface2); }

  /* ── TRANSCRIPT ── */
  .transcript-box {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 16px;
    font-size: 14px; line-height: 1.75; color: var(--text);
    min-height: 160px; white-space: pre-wrap; word-break: break-word;
    max-height: 400px; overflow-y: auto;
  }
  .transcript-box.placeholder { color: var(--text3); font-style: italic; }

  /* ── MINUTES ── */
  .minutes-output {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 20px;
    line-height: 1.7; min-height: 200px;
    max-height: 520px; overflow-y: auto;
    font-size: 14px; color: var(--text);
  }
  .minutes-output h1 { font-size: 20px; margin-bottom: 8px; color: var(--accent2); }
  .minutes-output h2 { font-size: 15px; margin: 16px 0 6px; color: var(--accent3); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
  .minutes-output h3 { font-size: 13px; margin: 12px 0 4px; color: var(--yellow); }
  .minutes-output ul { padding-left: 20px; margin: 6px 0; }
  .minutes-output li { margin: 4px 0; }
  .minutes-output p  { margin: 6px 0; }
  .minutes-output strong { color: var(--text); }
  .minutes-output .placeholder { color: var(--text3); font-style: italic; }

  /* ── TASKS ── */
  .task-add-row { display: flex; gap: 8px; margin-bottom: 14px; }
  .task-add-row .form-input { flex: 1; }
  .task-list-wrap { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; }
  .task-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 14px;
    transition: var(--transition);
  }
  .task-item:hover { border-color: var(--surface3); }
  .task-item.done { opacity: .55; }
  .task-item.done .task-text { text-decoration: line-through; color: var(--text3); }
  .task-check {
    width: 18px; height: 18px; border-radius: 5px;
    border: 2px solid var(--border); cursor: pointer;
    background: none; flex-shrink: 0; transition: var(--transition);
    appearance: none; -webkit-appearance: none;
    display: flex; align-items: center; justify-content: center;
  }
  .task-check:checked {
    background: var(--green); border-color: var(--green);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='%230f1117' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.485 3.515a.75.75 0 010 1.06l-7 7a.75.75 0 01-1.06 0l-3-3a.75.75 0 011.06-1.06L6 9.94l6.425-6.425a.75.75 0 011.06 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 12px;
  }
  .task-text { flex: 1; font-size: 13.5px; }
  .task-priority {
    font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600;
  }
  .priority-high   { background: rgba(248,113,113,.15); color: var(--red); }
  .priority-medium { background: rgba(251,191,36,.15);  color: var(--yellow); }
  .priority-low    { background: rgba(52,211,153,.15);  color: var(--green); }
  .task-delete { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; padding: 2px 5px; border-radius: 4px; transition: var(--transition); }
  .task-delete:hover { color: var(--red); background: rgba(248,113,113,.1); }
  .task-assignee {
    font-size: 11px; color: var(--text3); background: var(--surface);
    padding: 2px 7px; border-radius: 8px;
  }

  /* ── PROGRESS / SPINNER ── */
  .progress-bar-wrap {
    background: var(--surface2); border-radius: 20px; height: 6px;
    overflow: hidden; margin-top: 8px;
  }
  .progress-bar {
    height: 100%; border-radius: 20px;
    background: linear-gradient(90deg, var(--accent), var(--accent3));
    width: 0; transition: width .4s ease;
  }
  .spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.2);
    border-top-color: #fff; border-radius: 50%;
    animation: spin .7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── STATUS BAR ── */
  .status-bar {
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 7px 28px; font-size: 12px; color: var(--text3);
    display: flex; align-items: center; gap: 16px;
    position: sticky; bottom: 0;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
  }
  .status-item { display: flex; align-items: center; gap: 5px; }

  /* ── TOAST ── */
  #toastContainer {
    position: fixed; bottom: 60px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
  }
  .toast {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 11px 16px;
    font-size: 13px; color: var(--text);
    box-shadow: var(--shadow); min-width: 240px;
    animation: slideIn .25s ease; display: flex; align-items: center; gap: 8px;
  }
  .toast.success { border-left: 3px solid var(--green); }
  .toast.error   { border-left: 3px solid var(--red); }
  .toast.info    { border-left: 3px solid var(--accent3); }
  @keyframes slideIn { from{transform:translateX(30px);opacity:0} to{transform:none;opacity:1} }

  /* ── DIVIDER ── */
  .divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

  /* ── AUDIO PLAYER ── */
  .audio-wrap audio {
    width: 100%; height: 36px;
    accent-color: var(--accent);
    border-radius: var(--radius-sm);
    outline: none;
  }

  /* ── MEETINGS LIST ── */
  .meeting-item {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 18px;
    margin-bottom: 10px; cursor: pointer;
    transition: var(--transition); display: flex; align-items: center; gap: 14px;
  }
  .meeting-item:hover { border-color: var(--accent); background: var(--surface2); }
  .meeting-item-icon { font-size: 24px; }
  .meeting-item-info { flex: 1; }
  .meeting-item-title { font-size: 14px; font-weight: 600; }
  .meeting-item-meta  { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .meeting-item-badge {
    font-size: 11px; padding: 3px 9px; border-radius: 10px; font-weight: 600;
  }
  .badge-done { background: rgba(52,211,153,.15); color: var(--green); }
  .badge-draft{ background: rgba(251,191,36,.15); color: var(--yellow); }

  /* ── PRINT / PDF ── */
  @media print {
    body { background: #fff !important; color: #111 !important; }
    .sidebar, .topbar, .status-bar, #toastContainer,
    .no-print, .btn-row, .btn, button { display: none !important; }
    .main-content { overflow: visible; }
    .page { display: block !important; padding: 20px; }
    .page:not(#page-pdf) { display: none !important; }
    #page-pdf { display: block !important; }
    #pdfContent {
      color: #111 !important;
      font-family: 'Times New Roman', serif;
    }
    #pdfContent h1 { color: #1a1a6e !important; }
    #pdfContent h2 { color: #2563eb !important; border-bottom: 1px solid #ccc; }
    #pdfContent h3 { color: #1d4ed8 !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; page-break-inside: avoid; }
  }

  /* ── GRID STAT CARDS ── */
  .stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
  @media(max-width:720px){ .stat-grid { grid-template-columns: repeat(2,1fr); } }
  .stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    display: flex; flex-direction: column; gap: 6px;
  }
  .stat-num  { font-size: 28px; font-weight: 700; }
  .stat-lbl  { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
  .stat-icon { font-size: 22px; margin-bottom: 2px; }

  /* ── MISC ── */
  .tag {
    display: inline-flex; align-items: center;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 3px 10px; font-size: 12px;
    color: var(--text2); gap: 5px;
  }
  .inline-flex { display: inline-flex; align-items: center; gap: 8px; }
  .mt-4 { margin-top: 16px; }
  .mb-0 { margin-bottom: 0; }
  .text-accent { color: var(--accent2); }
  .text-green  { color: var(--green); }
  .text-red    { color: var(--red); }
  .text-muted  { color: var(--text3); }
  .text-sm     { font-size: 12px; }
  .bold        { font-weight: 700; }
  .flex        { display: flex; align-items: center; gap: 10px; }
  .flex-1      { flex: 1; }
  .hidden      { display: none !important; }

  .large-audio-warning {
    border: 1px solid rgba(250,190,60,.3);
    background: rgba(255,246,214,.92);
    color: #6e5700;
    padding: 12px 14px;
    border-radius: 12px;
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.5;
  }

  /* Connection Test */
  .conn-status { 
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; padding: 3px 10px; border-radius: 10px;
    background: var(--surface3); font-weight: 600;
  }
  .conn-status.ok   { background: rgba(52,211,153,.15); color: var(--green); }
  .conn-status.fail { background: rgba(248,113,113,.15); color: var(--red); }
  .conn-status.idle { color: var(--text3); }

  /* Tabs inside a card */
  .tab-row { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
  .tab-pill {
    padding: 7px 16px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: none; border: none; color: var(--text3);
    cursor: pointer; font-size: 13px; font-weight: 600;
    border-bottom: 2px solid transparent; transition: var(--transition);
  }
  .tab-pill.active { color: var(--accent2); border-bottom-color: var(--accent); }
  .tab-pane { display: none; }
  .tab-pane.active { display: block; }

  /* Recordings table */
  .recordings-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .recordings-table th {
    text-align: left; padding: 8px 10px; background: var(--surface2);
    color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  }
  .recordings-table td {
    padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle;
  }
  .recordings-table tr:hover td { background: var(--surface2); }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 10px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--accent); }

  /* New Features CSS */
  .timer-elapsed { font-family: monospace; font-size: 11px; color: var(--accent2); float: right; }
  #attendeeBadgeList { margin-top: 10px; }
/* ── AUDIO GUIDE POPUP ── */
#audioGuideOverlay.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.7);
    position: fixed;
    inset: 0;
}

#audioGuideOverlay .card {
    width: 90%;
    max-width: 420px;
    animation: popupScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
