/* SONNY Dashboard — style.css v28 — Command Centre */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border: #30363d;
    --border-light: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --orange: #db6d28;
    --purple: #bc8cff;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

.hidden { display: none !important; }

/* ── Login ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    width: 360px;
}
.modal-avatar { width: 80px; height: 80px; border-radius: 50%; margin-bottom: 16px; }
.modal-logo { font-size: 28px; font-weight: 700; color: var(--accent); }
.modal-sub { color: var(--text-secondary); margin-bottom: 24px; font-size: 13px; }
#login-form input {
    width: 100%; padding: 10px 14px; margin-bottom: 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px;
}
#login-form button {
    width: 100%; padding: 10px; background: var(--accent);
    border: none; border-radius: var(--radius-sm); color: #fff;
    font-weight: 600; cursor: pointer; font-size: 14px;
}
#login-form button:hover { background: var(--accent-hover); }
.login-error { color: var(--red); margin-top: 8px; font-size: 13px; }

/* ── App Shell ────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
    display: flex; align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 16px; height: 48px;
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 8px; margin-right: 16px; }
.topbar-avatar { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.topbar-logo { font-weight: 700; font-size: 16px; color: var(--accent); }

.tab-nav {
    display: flex; gap: 2px; overflow-x: auto; flex: 1;
    scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab {
    background: transparent; border: none; color: var(--text-secondary);
    padding: 8px 12px; cursor: pointer; font-size: 12px;
    white-space: nowrap; border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.tab:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.tab.active { color: var(--accent); background: var(--bg-tertiary); font-weight: 600; }

/* Tab "More" dropdown */
.tab-more-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    margin-left: 4px;
}
.tab-more-btn {
    cursor: pointer;
    color: var(--text-muted);
}
.tab-more-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.tab-more-btn.has-active {
    color: var(--accent);
    font-weight: 600;
}
.tab-more-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 180px;
    padding: 4px 0;
    animation: dropdown-fade 0.15s ease;
}
.tab-more-dropdown.open {
    display: block;
}
@keyframes dropdown-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.tab-more-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}
.tab-more-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.tab-more-item.active {
    color: var(--accent);
    font-weight: 600;
    background: var(--bg-tertiary);
}

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.topbar-btn {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-secondary); width: 32px; height: 32px;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
}
.topbar-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.status-pill {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 12px;
    background: var(--bg-tertiary); font-size: 12px;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.pill-dot.green { background: var(--green); }
.pill-dot.red { background: var(--red); }
.pill-text { color: var(--text-secondary); }
.uptime-display { font-size: 12px; color: var(--text-muted); }

/* ── Content ──────────────────────────────────────────────────── */
.content {
    flex: 1; overflow-y: auto; padding: 20px;
    background: var(--bg-primary);
}
.content.chat-active { padding: 0; overflow: hidden; height: calc(100vh - 48px); }

.tab-pane { display: none; }
.tab-pane.active { display: block; height: 100%; overflow: hidden; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-primary); padding: 6px 14px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px; transition: all 0.15s;
}
.btn:hover { border-color: var(--text-secondary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-muted { color: var(--text-secondary); }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; }

/* ── Pane Header ──────────────────────────────────────────────── */
.pane-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.pane-header h2 { font-size: 18px; font-weight: 600; }
.pane-controls { display: flex; align-items: center; gap: 8px; }
.pane-controls select, .pane-controls input[type="date"] {
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-primary); padding: 4px 8px; border-radius: var(--radius-sm);
    font-size: 12px;
}
.checkbox-label {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--text-secondary); cursor: pointer;
}

/* ── Badges ───────────────────────────────────────────────────── */
.priority-badge {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 2px 6px; border-radius: 3px;
}
.p1 { background: var(--red); color: #fff; }
.p2 { background: var(--orange); color: #fff; }
.p3 { background: var(--yellow); color: #000; }
.p4 { background: var(--text-muted); color: var(--text-primary); }
.p5 { background: var(--bg-tertiary); color: var(--text-secondary); }

.email-account-badge {
    display: inline-block; font-size: 10px; font-weight: 600;
    padding: 2px 6px; border-radius: 3px; text-transform: uppercase;
}
.email-account-badge.outlook { background: #0078d4; color: #fff; }
.email-account-badge.gmail { background: #ea4335; color: #fff; }
.email-account-badge.mim { background: var(--purple); color: #fff; }

.severity-badge {
    display: inline-block; font-size: 10px; font-weight: 600;
    padding: 2px 6px; border-radius: 3px; text-transform: uppercase;
}
.sev-critical { background: var(--red); color: #fff; }
.sev-high { background: var(--orange); color: #fff; }
.sev-medium { background: var(--yellow); color: #000; }
.sev-low { background: var(--accent); color: #fff; }
.sev-info { background: var(--bg-tertiary); color: var(--text-secondary); }

.stage-badge {
    display: inline-block; font-size: 11px; padding: 2px 8px;
    border-radius: 3px;
}
.stage-lead { background: var(--bg-tertiary); color: var(--text-secondary); }
.stage-qualified { background: var(--accent); color: #fff; }
.stage-proposal { background: var(--yellow); color: #000; }
.stage-negotiation { background: var(--orange); color: #fff; }
.stage-won { background: var(--green); color: #fff; }
.stage-lost { background: var(--red); color: #fff; }


/* ══════════════════════════════════════════════════════════════
   HOME TAB — Morning Brief
   ══════════════════════════════════════════════════════════════ */

.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 1200px;
}

.home-stats {
    grid-column: 1 / -1;
    display: flex; gap: 12px; flex-wrap: wrap;
}
.stat-card {
    flex: 1; min-width: 140px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat-number { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }

.home-widget {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.home-widget-wide { grid-column: 1 / -1; }
.widget-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.widget-title { font-weight: 600; font-size: 14px; }
.widget-action {
    background: none; border: none; color: var(--accent);
    cursor: pointer; font-size: 12px;
}
.widget-action:hover { text-decoration: underline; }
.widget-list { max-height: 300px; overflow-y: auto; }
.widget-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-bottom: 1px solid var(--border-light);
    cursor: pointer; font-size: 13px;
}
.widget-item:hover { background: var(--bg-hover); }
.widget-item:last-child { border-bottom: none; }
.widget-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-item-meta { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.widget-empty { padding: 20px; text-align: center; color: var(--text-muted); }

/* Agents grid (home) */
.agent-grid {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px;
}
.agent-card {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); cursor: pointer; font-size: 12px;
}
.agent-card:hover { background: var(--bg-hover); }
.agent-dot { width: 8px; height: 8px; border-radius: 50%; }
.agent-dot.online { background: var(--green); }
.agent-dot.offline { background: var(--text-muted); }
.agent-name { font-weight: 600; }
.agent-meta { color: var(--text-muted); }

/* Tokens */
.token-list { padding: 8px 16px; }
.token-item {
    display: flex; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid var(--border-light);
    font-size: 12px;
}
.token-item:last-child { border-bottom: none; }
.token-item.expired .token-expiry { color: var(--red); }
.token-item.warning .token-expiry { color: var(--yellow); }
.token-item.ok .token-expiry { color: var(--green); }
.token-name { color: var(--text-secondary); }


/* ══════════════════════════════════════════════════════════════
   EMAIL TAB
   ══════════════════════════════════════════════════════════════ */

.email-layout { display: flex; flex-direction: column; height: calc(100vh - 88px); }

.email-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; gap: 12px; flex-wrap: wrap;
}
.email-search-bar { display: flex; gap: 8px; flex: 1; max-width: 500px; }
.email-search-input {
    flex: 1; padding: 6px 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
}
.email-filters { display: flex; align-items: center; gap: 8px; }
.email-filters select {
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-primary); padding: 4px 8px;
    border-radius: var(--radius-sm); font-size: 12px;
}
.email-count { font-size: 12px; color: var(--text-muted); }

.email-body {
    display: flex; flex: 1; gap: 0; overflow: hidden;
    border: 1px solid var(--border); border-radius: var(--radius);
}

.email-list-panel {
    width: 420px; min-width: 300px;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    background: var(--bg-secondary);
}
.email-list { flex: 1; overflow-y: auto; }

.email-row {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer; transition: background 0.1s;
}
.email-row:hover { background: var(--bg-hover); }
.email-row.selected { background: var(--bg-tertiary); border-left: 3px solid var(--accent); }
.email-row-left { display: flex; align-items: center; gap: 6px; }
.email-from { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-row-center { display: flex; flex-direction: column; gap: 2px; }
.email-subject { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-snippet {
    font-size: 11px; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.email-snippet mark { background: var(--yellow); color: #000; border-radius: 2px; padding: 0 2px; }
.email-row-right {
    display: flex; align-items: center; gap: 6px; justify-content: flex-end;
    margin-top: 2px;
}
.email-date { font-size: 11px; color: var(--text-muted); }
.email-attach-icon { font-size: 12px; }

.email-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 8px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
}

.email-detail-panel { flex: 1; overflow-y: auto; background: var(--bg-primary); }
.email-detail { padding: 20px; }
.email-detail-empty { padding: 60px; text-align: center; color: var(--text-muted); }
.email-detail-header { margin-bottom: 20px; }
.email-detail-subject { font-size: 18px; margin-bottom: 12px; }
.email-meta { font-size: 13px; color: var(--text-secondary); }
.email-meta-row { margin-bottom: 4px; }
.email-meta-label { font-weight: 600; color: var(--text-primary); }
.email-attachments {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 12px; padding: 8px;
    background: var(--bg-tertiary); border-radius: var(--radius-sm);
}
.email-attachment { font-size: 12px; }
.email-att-size { color: var(--text-muted); }
.email-body-text {
    font-size: 14px; line-height: 1.6;
    padding-top: 16px; border-top: 1px solid var(--border);
    white-space: pre-wrap; word-break: break-word;
}
.email-body-text a { color: var(--accent); }
.email-empty { padding: 40px; text-align: center; color: var(--text-muted); }
.email-error { padding: 20px; color: var(--red); }
.loading { padding: 40px; text-align: center; color: var(--text-secondary); }


/* ══════════════════════════════════════════════════════════════
   DRIVE TAB
   ══════════════════════════════════════════════════════════════ */

.drive-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
    height: calc(100vh - 88px);
}

.drive-toolbar {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: 16px;
    padding: 8px 0; flex-wrap: wrap;
}
.drive-search-bar { display: flex; gap: 8px; }
.drive-search-input {
    width: 300px; padding: 6px 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
}
.drive-breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.drive-crumb { color: var(--accent); cursor: pointer; }
.drive-crumb:hover { text-decoration: underline; }
.drive-crumb.active { color: var(--text-primary); cursor: default; }
.drive-crumb.active:hover { text-decoration: none; }
.drive-crumb-sep { color: var(--text-muted); }

.drive-sidebar {
    background: var(--bg-secondary); border-right: 1px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 12px;
    overflow-y: auto;
}
.drive-bookmarks-title {
    font-size: 11px; text-transform: uppercase; color: var(--text-muted);
    font-weight: 600; margin-bottom: 8px; letter-spacing: 0.5px;
}
.drive-bookmark {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px;
}
.drive-bookmark:hover { background: var(--bg-hover); }
.drive-bookmark-icon { font-size: 14px; }

.drive-files-panel {
    overflow-y: auto;
    background: var(--bg-primary);
}

.drive-home-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px; padding: 16px;
}
.drive-home-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px 16px;
    text-align: center; cursor: pointer; transition: all 0.15s;
}
.drive-home-card:hover { border-color: var(--accent); background: var(--bg-tertiary); }
.drive-home-icon { font-size: 36px; margin-bottom: 8px; }
.drive-home-name { font-size: 13px; font-weight: 600; }

.drive-table { width: 100%; border-collapse: collapse; }
.drive-table th {
    text-align: left; padding: 8px 12px;
    font-size: 11px; text-transform: uppercase; color: var(--text-muted);
    border-bottom: 1px solid var(--border); font-weight: 600;
}
.drive-file-row td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); }
.drive-file-row:hover { background: var(--bg-hover); }
.drive-folder-row { cursor: pointer; }
.drive-folder-row:hover { background: var(--bg-tertiary); }
.drive-icon { width: 30px; font-size: 16px; }
.drive-name { font-size: 13px; font-weight: 500; }
.drive-folder-row .drive-name { color: var(--accent); font-weight: 600; }
.drive-modified, .drive-size { font-size: 12px; color: var(--text-secondary); }
.drive-actions { width: 40px; text-align: center; }
.drive-open-link {
    color: var(--accent); text-decoration: none; font-size: 14px;
}
.drive-open-link:hover { color: var(--accent-hover); }
.drive-empty { padding: 40px; text-align: center; color: var(--text-muted); }
.drive-error { padding: 20px; color: var(--red); }


/* ══════════════════════════════════════════════════════════════
   TASKS TAB
   ══════════════════════════════════════════════════════════════ */

.tasks-board { display: flex; flex-direction: column; gap: 16px; }
.task-group { background: var(--bg-secondary); border-radius: var(--radius); overflow: hidden; }
.task-group-header {
    padding: 10px 16px; font-weight: 600; font-size: 14px;
    background: var(--bg-tertiary); border-bottom: 1px solid var(--border);
}
.task-count { color: var(--text-muted); font-weight: 400; }
.task-card {
    display: flex; flex-direction: column; gap: 4px;
    padding: 10px 16px; border-bottom: 1px solid var(--border-light);
}
.task-card:last-child { border-bottom: none; }
.task-card-top { display: flex; align-items: center; gap: 8px; }
.task-title { font-size: 13px; flex: 1; }
.task-card-meta {
    display: flex; gap: 8px; font-size: 11px; color: var(--text-muted);
    padding-left: 34px;
}
.task-agent { color: var(--accent); }
.task-category { color: var(--text-secondary); }
.task-id { color: var(--text-muted); }
.task-card-actions { display: flex; gap: 4px; padding-left: 34px; margin-top: 2px; }
.tasks-empty { padding: 40px; text-align: center; color: var(--text-muted); }


/* ══════════════════════════════════════════════════════════════
   CHAT TAB
   ══════════════════════════════════════════════════════════════ */

.chat-layout { display: flex; height: 100%; overflow: hidden; position: relative; }
.chat-sidebar {
    width: 200px; min-width: 200px; max-width: 200px; flex-shrink: 0; flex-grow: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto; overflow-x: hidden;
    position: relative; z-index: 2;
}
.chat-sidebar-title {
    padding: 12px 14px; font-size: 11px; text-transform: uppercase;
    color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px;
}
.chat-agent-item {
    padding: 8px 14px; cursor: pointer; font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}
.chat-agent-item:hover { background: var(--bg-hover); }
.chat-agent-item.active { background: var(--bg-tertiary); color: var(--accent); font-weight: 600; }

.chat-main { flex: 1; min-width: 0; max-width: calc(100% - 200px); display: flex; flex-direction: column; overflow: hidden; }
.chat-header {
    padding: 10px 16px; font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
/* ── Chat Messages (Slack-style) ────────────────────────────────────── */
.chat-messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 20px; }

.chat-msg {
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
    padding: 8px 8px;
    border-radius: 6px;
    max-width: 100%;
    align-items: flex-start;
    transition: background 0.15s;
}
.chat-msg:hover { background: rgba(255,255,255,0.02); }

.chat-msg-avatar {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    font-weight: 700;
}
.chat-msg.user .chat-msg-avatar {
    background: var(--accent);
    color: #fff;
}
.chat-msg.assistant .chat-msg-avatar {
    background: #2ea043;
    color: #fff;
}

.chat-msg-body {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.chat-msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-msg-name {
    font-weight: 700;
    font-size: 14px;
}
.chat-msg.user .chat-msg-name { color: var(--accent); }
.chat-msg.assistant .chat-msg-name { color: #3fb950; }

.chat-msg-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.chat-msg-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-x: auto;
    max-width: 100%;
}

.chat-msg.user .chat-msg-text {
    color: var(--text-primary);
}

.chat-msg.assistant .chat-msg-text {
    /* full width, no bubble constraint */
}

.chat-msg.error {
    padding: 6px 12px;
    margin-bottom: 8px;
}
.chat-msg.error .chat-msg-text {
    background: rgba(248,81,73,0.15);
    color: var(--red);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--red);
    font-size: 13px;
}

/* ── Typing Indicator ────────────────────────────────────────────── */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px;
}
.chat-typing-avatar {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: #2ea043;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
}
.chat-typing-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chat-typing-name {
    font-size: 13px;
    font-weight: 600;
    color: #3fb950;
}
.chat-typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}
.chat-typing-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── IT Tab Typing Indicator ────────────────────────────────────── */
.it-chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    align-self: flex-start;
}
.it-chat-typing-label {
    font-size: 12px;
    font-weight: 600;
    color: #3fb950;
}
.it-chat-typing-dots {
    display: flex;
    gap: 4px;
}
.it-chat-typing-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.it-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.it-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
/* ── Markdown Rendering in Chat ────────────────────────────────────── */
.chat-msg-text.md-content,
.it-chat-msg .md-content {
    font-size: 14px;
    line-height: 1.7;
}

.md-content p.md-para { margin: 0.4em 0; }

/* Headings */
.md-content .md-h1 { font-size: 1.3em; font-weight: 700; margin: 0.6em 0 0.3em; color: var(--text-primary); border-bottom: 1px solid var(--border); padding-bottom: 0.2em; }
.md-content .md-h2 { font-size: 1.15em; font-weight: 700; margin: 0.5em 0 0.2em; color: var(--text-primary); }
.md-content .md-h3 { font-size: 1.05em; font-weight: 600; margin: 0.4em 0 0.2em; color: var(--text-primary); }
.md-content .md-h4 { font-size: 1em; font-weight: 600; margin: 0.3em 0 0.2em; color: var(--text-secondary); }

/* Bold & Italic */
.md-content strong { font-weight: 600; color: var(--text-primary); }
.md-content em { font-style: italic; }

/* Inline code */
.md-content .md-inline-code {
    background: var(--bg-primary);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.88em;
    color: var(--accent);
    border: 1px solid var(--border);
}

/* Code blocks */
.md-content .md-codeblock {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 0.5em 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85em;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre;
}
.md-content .md-codeblock code {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
    font-size: inherit;
}

/* Tables */
.md-content .md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5em 0;
    font-size: 0.9em;
}
.md-content .md-table th {
    background: var(--bg-primary);
    font-weight: 600;
    text-align: left;
    padding: 6px 10px;
    border: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
}
.md-content .md-table td {
    padding: 5px 10px;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.md-content .md-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}
.md-content .md-table tbody tr:hover {
    background: var(--bg-hover);
}

/* Lists */
.md-content .md-list {
    margin: 0.3em 0;
    padding-left: 1.5em;
}
.md-content .md-list li {
    margin: 0.15em 0;
    line-height: 1.5;
}

/* Blockquotes */
.md-content .md-blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 12px;
    margin: 0.4em 0;
    color: var(--text-secondary);
    background: rgba(88,166,255,0.05);
    border-radius: 0 4px 4px 0;
}

/* Links */
.md-content .md-link {
    color: var(--accent);
    text-decoration: none;
}
.md-content .md-link:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* Horizontal rules */
.md-content .md-hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.6em 0;
}





.chat-input-area {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.chat-input-area textarea {
    flex: 1; resize: none; padding: 8px 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
    font-family: inherit;
}
.chat-send-btn {
    padding: 8px 20px; background: var(--accent);
    border: none; border-radius: var(--radius-sm); color: #fff;
    font-weight: 600; cursor: pointer;
}
.chat-send-btn:hover { background: var(--accent-hover); }


/* ══════════════════════════════════════════════════════════════
   APPROVALS TAB
   ══════════════════════════════════════════════════════════════ */

.approvals-list { display: flex; flex-direction: column; gap: 12px; }
.approval-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
}
.approval-header { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.approval-tool { font-weight: 600; color: var(--accent); }
.approval-agent { color: var(--text-secondary); font-size: 12px; }
.approval-time { color: var(--text-muted); font-size: 11px; margin-left: auto; }
.approval-detail pre {
    background: var(--bg-tertiary); padding: 8px 12px; border-radius: var(--radius-sm);
    font-size: 12px; overflow-x: auto; margin-bottom: 8px;
}
.approval-actions { display: flex; gap: 8px; }
.approvals-empty { padding: 40px; text-align: center; color: var(--text-muted); }


/* ══════════════════════════════════════════════════════════════
   BRIEFINGS TAB
   ══════════════════════════════════════════════════════════════ */

.briefings-list { display: flex; flex-direction: column; gap: 8px; }
.briefing-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px;
}
.sev-border-critical { border-left: 3px solid var(--red); }
.sev-border-high { border-left: 3px solid var(--orange); }
.sev-border-medium { border-left: 3px solid var(--yellow); }
.sev-border-low { border-left: 3px solid var(--accent); }
.sev-border-info { border-left: 3px solid var(--text-muted); }
.briefing-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.briefing-title { font-weight: 500; font-size: 13px; flex: 1; }
.briefing-time { font-size: 11px; color: var(--text-muted); }
.briefing-detail { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.briefing-source { font-size: 12px; color: var(--accent); display: inline-block; margin-top: 6px; }
.briefings-empty { padding: 40px; text-align: center; color: var(--text-muted); }


/* ══════════════════════════════════════════════════════════════
   PIPELINE TAB
   ══════════════════════════════════════════════════════════════ */

.pipeline-summary { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pipeline-stage-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 16px; text-align: center; min-width: 100px;
}
.pipeline-stage-name { font-size: 12px; text-transform: capitalize; color: var(--text-secondary); }
.pipeline-stage-count { font-size: 22px; font-weight: 700; color: var(--accent); }
.pipeline-stage-value { font-size: 12px; color: var(--text-muted); }
.pipeline-empty { padding: 40px; text-align: center; color: var(--text-muted); }


/* ══════════════════════════════════════════════════════════════
   HEALTH TAB
   ══════════════════════════════════════════════════════════════ */

.health-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.health-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; min-width: 120px; text-align: center;
}
.health-card.good { border-color: var(--green); }
.health-card.warn { border-color: var(--yellow); }
.health-card-value { font-size: 24px; font-weight: 700; }
.health-card.good .health-card-value { color: var(--green); }
.health-card.warn .health-card-value { color: var(--yellow); }
.health-card-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.health-empty { padding: 40px; text-align: center; color: var(--text-muted); }


/* ══════════════════════════════════════════════════════════════
   SETTINGS TAB
   ══════════════════════════════════════════════════════════════ */

.settings-layout {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 20px; max-width: 1000px;
}
.settings-section {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
}
.settings-section h3 {
    font-size: 15px; margin-bottom: 16px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.settings-group { margin-bottom: 14px; }
.settings-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.settings-group select, .settings-group input {
    width: 100%; padding: 6px 10px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
}
.settings-checkboxes { display: flex; gap: 16px; }
.settings-checkboxes label { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }

.settings-drive-bookmarks { margin-bottom: 12px; }
.settings-bookmark-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.settings-bookmark-id { color: var(--text-muted); font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.settings-add-bookmark { display: flex; gap: 8px; }
.settings-add-bookmark input {
    flex: 1; padding: 4px 8px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 12px;
}

.settings-agent-card {
    padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.settings-agent-card:last-child { border-bottom: none; }
.settings-agent-name { font-weight: 600; font-size: 13px; }
.settings-agent-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.settings-agent-tools { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.settings-system-info { font-size: 13px; line-height: 1.8; }


/* ══════════════════════════════════════════════════════════════
   DATA TABLE (shared)
   ══════════════════════════════════════════════════════════════ */

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 8px 12px;
    font-size: 11px; text-transform: uppercase; color: var(--text-muted);
    border-bottom: 1px solid var(--border); font-weight: 600;
    background: var(--bg-secondary);
}
.data-table td {
    padding: 8px 12px; border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.data-table tr:hover { background: var(--bg-hover); }


/* ══════════════════════════════════════════════════════════════
   MODAL DIALOG (task create/edit)
   ══════════════════════════════════════════════════════════════ */

.modal-dialog {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius); width: 500px; max-width: 90vw;
    padding: 24px; position: relative;
}
.modal-dialog-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; font-size: 16px; font-weight: 600;
}
.modal-close {
    background: none; border: none; color: var(--text-secondary);
    font-size: 18px; cursor: pointer;
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 8px 10px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
    font-family: inherit;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .home-grid { grid-template-columns: 1fr; }
    .home-stats { flex-direction: column; }
    .email-body { flex-direction: column; }
    .email-list-panel { width: 100%; max-height: 300px; }
    .drive-layout { grid-template-columns: 1fr; }
    .drive-sidebar { display: none; }
    .settings-layout { grid-template-columns: 1fr; }
    .chat-sidebar { width: 150px; min-width: 150px; max-width: 150px; }
    .chat-main { max-width: calc(100% - 150px); }
    .tab { padding: 8px 8px; font-size: 11px; }
    .form-row { flex-direction: column; }
    .it-layout { flex-direction: column; }
    .it-panel-nav { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); min-width: auto; }
    .it-panel-btn { padding: 8px 12px; font-size: 11px; }
    .it-terminal-container { height: 350px; }
    .it-explorer-row { font-size: 12px; }
    .it-chat-history { max-height: 300px; }
}

/* ══════════════════════════════════════════════════════════════════════
   SONNY IT TAB
   ══════════════════════════════════════════════════════════════════════ */

.it-layout {
    display: flex;
    height: calc(100vh - 80px);
    gap: 0;
}

.it-panel-nav {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 8px 0;
    gap: 2px;
}

.it-panel-btn {
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.it-panel-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.it-panel-btn.active { color: var(--accent); border-left-color: var(--accent); background: var(--bg-tertiary); }

.it-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.it-panel.active { display: flex; }

/* Terminal */
.it-terminal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}
.it-terminal-label { font-size: 12px; color: var(--text-secondary); }
.it-terminal-container { flex: 1; padding: 4px; background: #0d1117; }

/* Chat */
.it-chat-toolbar {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}
.it-chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.it-chat-msg {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 85%;
}
.it-chat-user { background: var(--bg-tertiary); align-self: flex-end; }
.it-chat-agent { background: var(--bg-secondary); border: 1px solid var(--border); align-self: flex-start; }
.it-chat-error { color: var(--red); font-size: 12px; }
.it-chat-msg code { background: var(--bg-primary); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.it-chat-time { color: var(--text-muted); font-size: 11px; font-weight: normal; margin-left: 6px; }
.it-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.it-chat-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
}
.it-chat-send-btn {
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.it-chat-send-btn:hover { opacity: 0.9; }

/* Explorer */
.it-explorer-toolbar {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.it-explorer-path {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 13px;
    font-family: monospace;
}
.it-explorer-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.it-explorer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}
.it-explorer-row:hover { background: var(--bg-hover); }
.it-explorer-icon { width: 20px; text-align: center; }
.it-explorer-name { flex: 1; color: var(--text-primary); }
.it-explorer-size { width: 70px; text-align: right; color: var(--text-secondary); font-size: 12px; }
.it-explorer-mod { width: 80px; text-align: right; color: var(--text-secondary); font-size: 11px; }
.it-explorer-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.5;
}
.it-explorer-action:hover { opacity: 1; background: var(--bg-tertiary); }

/* File Viewer Modal (global) */
.it-file-viewer-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.it-file-viewer-modal.active { display: flex; }
.it-file-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}
.it-file-viewer-card {
    position: relative;
    width: 80vw;
    max-width: 1000px;
    height: 75vh;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.it-file-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
}
.it-file-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Ingest */
.it-ingest-header { padding: 16px; }
.it-ingest-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.it-ingest-zone {
    margin: 0 16px;
    padding: 60px 20px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.it-ingest-zone:hover, .it-ingest-zone.drag-over {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.05);
}
.it-ingest-icon { font-size: 48px; margin-bottom: 12px; }
.it-ingest-text { color: var(--text-secondary); font-size: 14px; }
.it-ingest-status { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.it-ingest-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 13px;
}
.it-ingest-name { flex: 1; color: var(--text-primary); }
.it-ingest-size { color: var(--text-secondary); font-size: 12px; }
.it-ingest-ok { color: var(--green); }
.it-ingest-err { color: var(--red); }

/* Config */
.it-config-section { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.it-config-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.it-services-list { display: flex; flex-direction: column; gap: 4px; }
.it-svc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
}
.it-svc-dot { width: 8px; height: 8px; border-radius: 50%; }
.it-svc-dot.online { background: var(--green); }
.it-svc-dot.offline { background: var(--red); }
.it-svc-name { flex: 1; color: var(--text-primary); font-family: monospace; }
.it-svc-state { color: var(--text-secondary); font-size: 12px; }
.it-svc-restart {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 14px;
}
.it-svc-restart:hover { color: var(--accent); border-color: var(--accent); }

.it-channel-configs { display: flex; flex-wrap: wrap; gap: 6px; }
.it-config-row {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.it-config-row:hover { background: var(--bg-hover); }
.it-config-icon { font-size: 14px; }
.it-config-name { color: var(--text-primary); }

.it-crontab {
    background: var(--bg-primary);
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.5;
    overflow-x: auto;
    color: var(--text-secondary);
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
}

.it-env-keys { display: flex; flex-wrap: wrap; gap: 4px; }

.it-env-key {
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.it-env-key:hover { background: var(--accent); color: var(--bg-primary); }
.it-env-key.copied { background: var(--green); color: var(--bg-primary); }

/* Logs */
.it-logs-toolbar {
    display: flex;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.it-logs-content {
    flex: 1;
    overflow: auto;
    padding: 8px 12px;
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--bg-primary);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Shared */
.it-loading { padding: 20px; text-align: center; color: var(--text-secondary); }
.it-error { padding: 12px; color: var(--red); font-size: 13px; }
.it-empty { padding: 20px; text-align: center; color: var(--text-secondary); font-size: 13px; }

/* ══════════════════════════════════════════════════════════════════════
   IMAGE PASTE/DROP — preview strip + chat message images
   ══════════════════════════════════════════════════════════════════════ */

.chat-image-preview {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    align-items: flex-end;
}

.chat-image-thumb {
    position: relative;
    display: inline-block;
}

.chat-image-thumb img {
    max-height: 80px;
    max-width: 160px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: contain;
}

.chat-image-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    line-height: 18px;
    text-align: center;
    padding: 0;
}
.chat-image-remove:hover { background: #e74c3c; }

/* Images displayed in chat messages */
.chat-msg-image {
    max-width: 400px;
    max-height: 300px;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin: 4px 0;
    display: block;
    object-fit: contain;
}

/* Drag-over visual hint */
.drag-over {
    outline: 2px dashed var(--accent) !important;
    outline-offset: -4px;
    background: rgba(52, 152, 219, 0.05) !important;
}

/* IT chat panel images */
.it-chat-msg .chat-msg-image {
    max-width: 350px;
    max-height: 250px;
    margin: 4px 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   UNREAD MESSAGE INDICATORS
   ══════════════════════════════════════════════════════════════════════════ */

/* Tab badge (red pill with count) */
.tab {
    position: relative;
}

.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ff4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    margin-left: 6px;
    vertical-align: middle;
    animation: unread-pulse 2s ease-in-out infinite;
}

/* Dot-only variant (no count, just a dot) */
.unread-badge.unread-dot-only {
    min-width: 10px;
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: 50%;
}

/* Unread dot on sidebar agent items */
.unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4444;
    margin-left: auto;
    flex-shrink: 0;
    animation: unread-pulse 2s ease-in-out infinite;
}

/* Make agent item a flex container so dot aligns right */
.chat-agent-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-agent-item.has-unread {
    font-weight: 600;
    color: #e2e8f0;
}

/* IT panel chat button with dot */
.it-panel-btn {
    position: relative;
}

.it-panel-btn .unread-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    margin-left: 0;
}

/* Agent card dot (home grid) */
.agent-card .unread-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    margin-left: 0;
}

/* Subtle pulse animation */
@keyframes unread-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ══════════════════════════════════════════════════════════════════════
   CALENDAR TAB
   ══════════════════════════════════════════════════════════════════════ */
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; gap: 12px; flex-wrap: wrap; }
.cal-toolbar-left { display: flex; align-items: center; gap: 8px; }
.cal-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-nav-btn { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.cal-nav-btn:hover { background: var(--border); }
.cal-date-label { font-size: 16px; font-weight: 600; color: var(--text); margin-left: 8px; }
.cal-view-btn { background: var(--card); border: 1px solid var(--border); color: var(--muted); padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.cal-view-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-new-btn { padding: 6px 16px; font-size: 13px; }
.cal-source-toggle { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.cal-source-toggle input { margin: 0; }
.cal-src-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cal-src-outlook-dot { background: #0078d4; }
.cal-src-google-dot { background: #34a853; }

/* Week View */
.cal-week { display: flex; flex-direction: column; }
.cal-week-header { display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-week-day-header { text-align: center; padding: 8px 4px; font-size: 12px; color: var(--muted); }
.cal-week-day-header.cal-today { color: var(--accent); font-weight: 700; }
.cal-day-num { font-size: 18px; font-weight: 600; }
.cal-week-body { max-height: calc(100vh - 200px); overflow-y: auto; }
.cal-week-row { display: grid; grid-template-columns: 60px repeat(7, 1fr); min-height: 48px; border-bottom: 1px solid var(--border-faint, rgba(255,255,255,0.05)); }
.cal-week-gutter { font-size: 11px; color: var(--muted); padding: 4px 8px 0 0; text-align: right; }
.cal-week-cell { border-left: 1px solid var(--border-faint, rgba(255,255,255,0.05)); padding: 2px; cursor: pointer; min-height: 48px; }
.cal-week-cell:hover { background: rgba(255,255,255,0.03); }
.cal-today-cell { background: rgba(99,162,255,0.06); }

/* All-day row */
.cal-allday-row { display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 2px solid var(--border); padding: 4px 0; }
.cal-allday-cell { padding: 2px; }

/* Event chips */
.cal-event { font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-bottom: 2px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-event:hover { filter: brightness(1.2); }
.cal-event-time { font-weight: 600; }
.cal-ev-outlook { background: rgba(0,120,212,0.25); color: #7ab8f5; border-left: 3px solid #0078d4; }
.cal-ev-google { background: rgba(52,168,83,0.25); color: #7dd494; border-left: 3px solid #34a853; }
.cal-event-allday { font-size: 11px; padding: 1px 6px; }

/* Category colours */
.cal-cat-work { border-left-color: #e67e22; }
.cal-cat-health { border-left-color: #e74c3c; }
.cal-cat-kids { border-left-color: #9b59b6; }
.cal-cat-hobby { border-left-color: #f39c12; }
.cal-cat-amks { border-left-color: #3498db; }

/* Month View */
.cal-month { display: flex; flex-direction: column; }
.cal-month-header { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-month-day-header { text-align: center; padding: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-month-week { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 90px; }
.cal-month-cell { border: 1px solid var(--border-faint, rgba(255,255,255,0.05)); padding: 4px; cursor: pointer; min-height: 90px; }
.cal-month-cell:hover { background: rgba(255,255,255,0.03); }
.cal-month-cell.cal-today-cell { background: rgba(99,162,255,0.08); }
.cal-month-cell.cal-other-month { opacity: 0.4; }
.cal-month-date { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cal-event-mini { font-size: 10px; padding: 1px 4px; border-radius: 3px; margin-bottom: 1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.cal-more { font-size: 10px; color: var(--muted); padding: 1px 4px; }

/* Modal */
.cal-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.cal-modal-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 90%; max-width: 480px; max-height: 80vh; overflow-y: auto; }
.cal-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cal-modal-header h3 { margin: 0; font-size: 18px; }
.cal-modal-close { background: none; border: none; color: var(--muted); font-size: 24px; cursor: pointer; }
.cal-modal-body { display: flex; flex-direction: column; gap: 10px; }
.cal-modal-row { font-size: 13px; color: var(--text); }
.cal-modal-desc { background: var(--bg); padding: 10px; border-radius: 6px; font-size: 12px; max-height: 120px; overflow-y: auto; }
.cal-modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.cal-modal-cat { background: var(--border); padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.cal-badge-outlook { background: rgba(0,120,212,0.3); color: #7ab8f5; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.cal-badge-google { background: rgba(52,168,83,0.3); color: #7dd494; padding: 2px 8px; border-radius: 10px; font-size: 11px; }

/* Form inputs */
.cal-form-input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.cal-form-input:focus { border-color: var(--accent); outline: none; }
.cal-form-row { display: flex; gap: 12px; }
.cal-form-col { flex: 1; }
.cal-form-col label, .cal-modal-body label { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: block; }

.cal-error { color: var(--red); padding: 20px; text-align: center; }

.btn-danger { background: var(--red, #e74c3c); color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-danger:hover { filter: brightness(1.1); }


/* ══════════════════════════════════════════════════════════════════════════
   AUTOPILOT TAB — v1 25 Mar 2026
   ══════════════════════════════════════════════════════════════════════════ */

.autopilot-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    max-width: 1400px;
}

/* ── Status Bar ────────────────────────────────────────────────────────── */

.ap-status-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ap-status-card {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 10px;
    padding: 14px 20px;
    flex: 1;
    min-width: 140px;
    text-align: center;
    transition: border-color 0.3s;
}

.ap-status-card.ap-highlight {
    border-color: #4ade80;
}

.ap-state {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    text-align: left;
}

.ap-status-icon {
    font-size: 32px;
    line-height: 1;
}

.ap-status-label {
    font-size: 15px;
    font-weight: 600;
    color: #e0e0e0;
    flex: 1;
}

.ap-status-number {
    font-size: 20px;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 4px;
}

.ap-status-sublabel {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ap-pause-btn {
    background: transparent;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}
.ap-pause-btn:hover {
    background: rgba(255,255,255,0.08);
}

/* State colours */
.ap-state-active { border-color: #4ade80; }
.ap-state-active .ap-status-label { color: #4ade80; }
.ap-state-paused { border-color: #fbbf24; }
.ap-state-paused .ap-status-label { color: #fbbf24; }
.ap-state-waiting_idle { border-color: #60a5fa; }
.ap-state-waiting_idle .ap-status-label { color: #60a5fa; }
.ap-state-outside_window { border-color: #6b7280; }
.ap-state-outside_window .ap-status-label { color: #9ca3af; }
.ap-state-disabled { border-color: #ef4444; }
.ap-state-disabled .ap-status-label { color: #ef4444; }

/* ── Main Layout ─────────────────────────────────────────────────────── */

.ap-main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 16px;
}

@media (max-width: 1100px) {
    .ap-main { grid-template-columns: 1fr; }
}

.ap-right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Panels ──────────────────────────────────────────────────────────── */

.ap-queue-panel,
.ap-config-panel,
.ap-activity-panel {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 10px;
    overflow: hidden;
}

.ap-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #2d2d3d);
}

.ap-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}

/* ── Queue ────────────────────────────────────────────────────────────── */

.ap-queue-content {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding: 8px;
}

.ap-queue-section {
    margin-bottom: 12px;
}

.ap-queue-section-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ap-queue-section-header.in-progress { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.ap-queue-section-header.todo { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.ap-queue-section-header.blocked { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.ap-queue-section-header.backlog { background: rgba(107, 114, 128, 0.10); color: #9ca3af; }

.ap-count {
    background: rgba(255,255,255,0.1);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.ap-task-card {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 4px;
    transition: border-color 0.2s;
    border-left: 3px solid transparent;
}

.ap-task-card.in-progress { border-left-color: #60a5fa; }
.ap-task-card.todo { border-left-color: #4ade80; }
.ap-task-card.blocked { border-left-color: #ef4444; }
.ap-task-card.backlog { border-left-color: #4b5563; }

.ap-task-card:hover {
    border-color: #555;
}

.ap-task-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}

.ap-task-priority {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 1px;
}
.ap-task-priority.p1 { background: #dc2626; color: white; }
.ap-task-priority.p2 { background: #f59e0b; color: #000; }
.ap-task-priority.p3 { background: #3b82f6; color: white; }
.ap-task-priority.p4 { background: #6b7280; color: white; }
.ap-task-priority.p5 { background: #374151; color: #aaa; }

.ap-task-title {
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
    line-height: 1.3;
}

.ap-task-desc {
    font-size: 11px;
    color: #888;
    margin: 2px 0 4px 0;
    line-height: 1.3;
}

.ap-task-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.ap-task-agent {
    font-size: 11px;
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    padding: 1px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.ap-task-id {
    font-size: 10px;
    color: #666;
    font-family: monospace;
}

.ap-task-cat {
    font-size: 10px;
    color: #888;
    background: rgba(255,255,255,0.05);
    padding: 1px 6px;
    border-radius: 3px;
}

.ap-task-time {
    font-size: 10px;
    color: #666;
    margin-left: auto;
}

/* ── Config ───────────────────────────────────────────────────────────── */

.ap-config-content {
    padding: 12px 16px;
}

.ap-config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ap-config-row label {
    font-size: 13px;
    color: #ccc;
}

.ap-config-row input[type="time"],
.ap-config-row input[type="number"] {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border, #2d2d3d);
    border-radius: 6px;
    color: #e0e0e0;
    padding: 6px 10px;
    font-size: 13px;
    width: 100px;
    text-align: center;
}

.ap-config-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4ade80;
}

.ap-config-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 12px 0 8px 0;
}

.ap-agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
    margin-bottom: 16px;
}

.ap-agent-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #ccc;
    padding: 6px 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.ap-agent-toggle:hover {
    background: rgba(255,255,255,0.08);
}

.ap-agent-toggle input {
    accent-color: #4ade80;
}

.ap-save-btn {
    width: 100%;
    margin-top: 4px;
}

/* ── Activity Log ────────────────────────────────────────────────────── */

.ap-activity-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 8px;
}

.ap-activity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
}

.ap-activity-item:last-child { border-bottom: none; }

.ap-activity-icon { font-size: 14px; flex-shrink: 0; }

.ap-activity-time {
    color: #888;
    font-family: monospace;
    font-size: 11px;
    flex-shrink: 0;
    width: 40px;
}

.ap-activity-agent {
    color: #60a5fa;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
    width: 60px;
}

.ap-activity-title {
    color: #ccc;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-activity-id {
    color: #555;
    font-family: monospace;
    font-size: 10px;
    flex-shrink: 0;
}

/* ── Common ──────────────────────────────────────────────────────────── */

.ap-loading {
    padding: 24px;
    text-align: center;
    color: #666;
    font-size: 13px;
}

.ap-empty {
    padding: 24px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

.ap-error {
    padding: 24px;
    text-align: center;
    color: #ef4444;
    font-size: 13px;
}

/* ── Calendar Week View v2 — Outlook-style duration blocks ─────────── */
.cal-day-col { border-left: 1px solid var(--border-faint, rgba(255,255,255,0.05)); cursor: pointer; }
.cal-day-col:hover { background: rgba(255,255,255,0.01); }
.cal-today-col { background: rgba(99,162,255,0.04); }
.cal-hour-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--border-faint, rgba(255,255,255,0.06)); pointer-events: none; z-index: 0; }
.cal-hour-label { height: 48px; font-size: 11px; color: var(--muted); padding: 2px 8px 0 0; text-align: right; border-bottom: 1px solid var(--border-faint, rgba(255,255,255,0.04)); box-sizing: border-box; }
.cal-now-line { position: absolute; left: 0; right: 0; height: 2px; background: #e74c3c; z-index: 5; pointer-events: none; }
.cal-now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #e74c3c; }

/* Event blocks — absolute positioned within day column */
.cal-event-block { position: absolute; border-radius: 4px; padding: 3px 6px; cursor: pointer; overflow: hidden; z-index: 2; box-sizing: border-box; font-size: 11px; line-height: 1.3; transition: filter 0.15s; }
.cal-event-block:hover { filter: brightness(1.3); z-index: 10; }
.cal-event-block-time { font-weight: 600; font-size: 10px; opacity: 0.9; }
.cal-event-block-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-block-loc { font-size: 10px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Outlook-style colours */
.cal-event-block.cal-ev-outlook { background: rgba(0,120,212,0.35); color: #c0dcf5; border-left: 3px solid #0078d4; }
.cal-event-block.cal-ev-google { background: rgba(52,168,83,0.35); color: #b8e6c6; border-left: 3px solid #34a853; }

/* Category overrides on blocks */
.cal-event-block.cal-cat-work { background: rgba(230,126,34,0.3); border-left-color: #e67e22; color: #f5d0a9; }
.cal-event-block.cal-cat-health { background: rgba(231,76,60,0.3); border-left-color: #e74c3c; color: #f5b0a9; }
.cal-event-block.cal-cat-kids { background: rgba(155,89,182,0.3); border-left-color: #9b59b6; color: #d4b0e6; }
.cal-event-block.cal-cat-hobby { background: rgba(243,156,18,0.3); border-left-color: #f39c12; color: #f5d89a; }
.cal-event-block.cal-cat-amks { background: rgba(52,152,219,0.3); border-left-color: #3498db; color: #a9d4f5; }

/* Week grid gutter column */
.cal-week-gutter-col { border-right: 1px solid var(--border); }

/* Unread email styling */
.email-row.email-unread { background: rgba(99,162,255,0.08); }
.email-row.email-unread .email-from { font-weight: 700; }
.email-row.email-unread .email-subject { font-weight: 600; }

/* === Audio Transcription Tab (added 2026-03-31) === */
/* ── Audio Transcription Tab ──────────────────────────────────────────── */

.audio-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    padding: 20px;
    height: calc(100vh - 80px);
    overflow: hidden;
}

.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.audio-controls h2 {
    margin: 0;
    font-size: 1.3em;
    color: #e0e0e0;
}

.audio-source-tabs {
    display: flex;
    gap: 4px;
    background: #1a1a2e;
    border-radius: 8px;
    padding: 4px;
}

.audio-src-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.audio-src-btn.active {
    background: #2a2a4a;
    color: #e0e0e0;
}

.audio-src-btn:hover {
    color: #e0e0e0;
}

/* Drop zone */
.audio-drop-zone {
    border: 2px dashed #333;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #0d0d1a;
}

.audio-drop-zone:hover,
.audio-drop-zone.drag-over {
    border-color: #4a9eff;
    background: #0d1a2e;
}

.audio-drop-icon {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.audio-drop-text {
    color: #ccc;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.audio-drop-formats {
    color: #666;
    font-size: 0.75em;
}

.audio-file-display {
    padding: 10px 14px;
    background: #1a2a1a;
    border-radius: 8px;
    border: 1px solid #2a4a2a;
}

.audio-file-name {
    color: #6aff6a;
    font-weight: 500;
}

.audio-file-size {
    color: #888;
    font-size: 0.85em;
}

.audio-action-btn {
    width: 100%;
    padding: 10px;
    font-size: 1em;
}

/* Drive input */
.audio-drive-input-group {
    display: flex;
    gap: 8px;
}

.audio-drive-input {
    flex: 1;
    padding: 10px 14px;
    background: #0d0d1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.9em;
}

.audio-drive-input:focus {
    border-color: #4a9eff;
    outline: none;
}

.audio-drive-hint {
    color: #666;
    font-size: 0.75em;
    margin-top: 4px;
}

/* Options */
.audio-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.audio-option label {
    display: block;
    color: #888;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.audio-option select {
    width: 100%;
    padding: 8px 10px;
    background: #0d0d1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85em;
}

.audio-option select:focus {
    border-color: #4a9eff;
    outline: none;
}

/* Status */
.audio-status {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85em;
    display: none;
}

.audio-status.active {
    display: block;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #4a9eff;
}

.audio-status.success {
    display: block;
    background: #1a2a1a;
    border: 1px solid #2a4a2a;
    color: #6aff6a;
}

.audio-status.error {
    display: block;
    background: #2a1a1a;
    border: 1px solid #4a2a2a;
    color: #ff6a6a;
}

/* Spinner */
.audio-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #333;
    border-top: 2px solid #4a9eff;
    border-radius: 50%;
    animation: audio-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes audio-spin {
    to { transform: rotate(360deg); }
}

/* Results panel */
.audio-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.audio-result-card {
    background: #12121e;
    border: 1px solid #252538;
    border-radius: 12px;
    overflow: hidden;
}

.audio-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a1a2e;
    border-bottom: 1px solid #252538;
}

.audio-result-title {
    color: #e0e0e0;
    font-weight: 600;
}

.audio-result-actions {
    display: flex;
    gap: 6px;
}

.audio-result-meta {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    background: #0d0d18;
    color: #888;
    font-size: 0.8em;
    border-bottom: 1px solid #252538;
}

.audio-result-text {
    padding: 16px;
    margin: 0;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 50vh;
    overflow-y: auto;
}

/* History */
.audio-history h3 {
    color: #888;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

.audio-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-history-empty {
    color: #555;
    font-size: 0.85em;
    padding: 20px;
    text-align: center;
}

.audio-history-item {
    background: #12121e;
    border: 1px solid #252538;
    border-radius: 8px;
    padding: 12px 16px;
}

.audio-history-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.audio-history-name {
    color: #e0e0e0;
    font-weight: 500;
    font-size: 0.9em;
}

.audio-history-meta {
    color: #666;
    font-size: 0.75em;
}

.audio-history-preview {
    color: #888;
    font-size: 0.8em;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-history-time {
    color: #555;
    font-size: 0.7em;
    margin-top: 4px;
}


/* ── Minutes toggle ─────────────────────────────── */
.audio-minutes-row {
    margin-top: 12px;
    padding: 10px 14px;
    background: #1a1f2e;
    border: 1px solid #2a3045;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.audio-minutes-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.9em;
    color: #c8d0e0;
}

.audio-minutes-label input[type="checkbox"] {
    display: none;
}

.audio-minutes-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #333a4d;
    border-radius: 10px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.audio-minutes-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #666;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.audio-minutes-label input:checked + .audio-minutes-slider {
    background: #3b82f6;
}

.audio-minutes-label input:checked + .audio-minutes-slider::after {
    transform: translateX(16px);
    background: #fff;
}

.audio-minutes-text {
    white-space: nowrap;
}

.audio-minutes-hint {
    color: #555;
    font-size: 0.75em;
    font-style: italic;
}

/* ── Result tabs (Transcript / Minutes) ──────────── */
.audio-result-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
    background: #1a1f2e;
    border-radius: 6px;
    padding: 3px;
}

.audio-result-tab {
    flex: 1;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 0.85em;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.audio-result-tab:hover {
    background: #252b3d;
    color: #c8d0e0;
}

.audio-result-tab.active {
    background: #2a3552;
    color: #fff;
    font-weight: 600;
}

/* ── Minutes content ─────────────────────────────── */
.audio-result-minutes {
    padding: 16px;
    background: #12151f;
    border-radius: 6px;
    border: 1px solid #1f2537;
    max-height: 600px;
    overflow-y: auto;
    font-size: 0.9em;
    line-height: 1.6;
    color: #c8d0e0;
}

.minutes-content h2 {
    font-size: 1.3em;
    color: #fff;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #2a3045;
}

.minutes-content h3 {
    font-size: 1.05em;
    color: #8bb4f0;
    margin: 16px 0 8px 0;
}

.minutes-content h4 {
    font-size: 0.95em;
    color: #a0b4d0;
    margin: 12px 0 6px 0;
}

.minutes-content hr {
    border: none;
    border-top: 1px solid #2a3045;
    margin: 12px 0;
}

.minutes-content strong {
    color: #e0e8f4;
}

.minutes-content ul {
    margin: 4px 0 8px 0;
    padding-left: 20px;
}

.minutes-content ul li {
    margin-bottom: 4px;
}

.minutes-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.9em;
}

.minutes-table th {
    background: #1f2a40;
    color: #a0b4d0;
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid #2a3552;
    font-weight: 600;
}

.minutes-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #1f2537;
    color: #c0c8d8;
}

.minutes-table tr:hover td {
    background: #181d2a;
}

/* Responsive */
@media (max-width: 900px) {
    .audio-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: auto;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE NAV DRAWER
   ══════════════════════════════════════════════════════════════════════════ */

.hamburger-btn {
    display: none;  /* hidden on desktop */
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.hamburger-btn:hover {
    background: var(--bg-tertiary);
}

/* Backdrop overlay */
.nav-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.nav-drawer-backdrop.open {
    display: block;
    opacity: 1;
}

/* Drawer panel */
.nav-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 80vw;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 1000;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow: hidden;
}
.nav-drawer.open {
    display: flex;
    transform: translateX(0);
}
/* Allow animation out */
.nav-drawer.closing {
    display: flex;
    transform: translateX(-100%);
}

/* Drawer header */
.nav-drawer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.nav-drawer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}
.nav-drawer-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    flex: 1;
}
.nav-drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.nav-drawer-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Nav items */
.nav-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.nav-drawer-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    position: relative;
}
.nav-drawer-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-drawer-item.active {
    color: var(--accent);
    font-weight: 600;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    padding-left: 17px;
}

/* Unread badge in drawer */
.nav-drawer-item .unread-badge {
    margin-left: auto;
}

.nav-drawer-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 16px;
}

/* Drawer footer */
.nav-drawer-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.nav-drawer-status {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Mobile: show hamburger, hide tab row ────────────────────────── */
@media (max-width: 768px) {
    .hamburger-btn {
        display: block;
    }
    .tab-nav,
    .tab-more-wrap {
        display: none !important;
    }
    .topbar {
        justify-content: space-between;
    }
    .topbar-left {
        margin-right: 0;
    }
    .topbar-right {
        margin-left: auto;
    }
    /* Hide uptime on mobile to save space */
    .uptime-display {
        display: none;
    }
    /* Pill text shorter on mobile */
    .pill-text {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
