/* === NORDIC CALM DESIGN SYSTEM — Olli's Viestit === */

:root {
    --bg-dark: #F5F3EF;
    --bg-teal: #2C3E50;
    --bg-teal-light: #34495E;
    --surface: #FAFAF8;
    --surface-dark: #222838;
    --card-bg: #FFFFFF;
    --border: #E8E6E1;
    --accent: #C28840;
    --accent-hover: #B07935;
    --mint: #6B8F71;
    --text-dark: #2D2926;
    --text-teal: #3D4F5F;
    --text-light: #FAF9F7;
    --text-muted: rgba(250, 249, 247, 0.6);
    --text-muted-dark: #6B6560;
    --danger: #D45D5D;
    --radius: 12px;
    --radius-pill: 10px;
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
    --shadow-strong: 0 4px 24px rgba(0,0,0,0.10);
    --transition: 0.2s ease;
}

body.dark-mode {
    --bg-dark: #1A1F2E;
    --card-bg: #222838;
    --surface: #1E2333;
    --border: #333A4D;
    --text-dark: #E8E6E1;
    --text-teal: #A0B0C0;
    --text-muted-dark: #9BA3B0;
    --shadow: 0 2px 16px rgba(0,0,0,0.25);
    --shadow-strong: 0 4px 24px rgba(0,0,0,0.35);
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-dark);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ==================== LOGIN ==================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-dark);
    padding: 20px;
}

.login-card {
    background: var(--bg-teal);
    border-radius: 20px;
    padding: 56px 48px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-card h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 36px;
    font-size: 15px;
}

.login-card input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid rgba(248, 249, 247, 0.15);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    margin-bottom: 14px;
    background: rgba(255,255,255,0.06);
    color: var(--text-light);
    transition: border var(--transition);
}

.login-card input::placeholder { color: var(--text-muted); }
.login-card input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

/* ==================== APP SHELL ==================== */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: none; /* shown on mobile */
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-teal);
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header-logo {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 900;
    font-size: 14px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.5px;
}

.app-header-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-light);
    letter-spacing: -0.3px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-header .refresh-button {
    padding: 7px 14px;
    font-size: 12px;
}
.app-header .theme-toggle-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

/* LOGIN LOGO */
.login-logo {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 900;
    font-size: 24px;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    letter-spacing: -1px;
}

/* APP VIEWS */
.app-view { display: none; }
.app-view.active { display: block; }

/* ==================== LAYOUT ==================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    padding: 20px;
    flex: 1;
}

.main-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: hidden;
}

body.dark-mode .main-content { background: var(--surface); }

/* ==================== HEADER ==================== */

.header {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-teal);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

body.dark-mode .header h1 { color: var(--text-light); }

.header p {
    color: var(--text-muted-dark);
    font-size: 15px;
}

.header-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== BUTTONS ==================== */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.btn:hover {
    opacity: 0.88;
}

.btn-send {
    background: var(--accent);
    color: var(--bg-dark);
}
.btn-send:hover { background: var(--accent-hover); }

.btn-prev, .btn-mark-read, .btn-skip {
    background: transparent;
    color: var(--text-teal);
    border: 1.5px solid var(--border);
}
.btn-prev:hover, .btn-mark-read:hover, .btn-skip:hover {
    background: var(--bg-teal);
    color: var(--text-light);
    border-color: var(--bg-teal);
}

body.dark-mode .btn-prev, body.dark-mode .btn-mark-read, body.dark-mode .btn-skip {
    color: var(--text-light);
    border-color: var(--border);
}
body.dark-mode .btn-prev:hover, body.dark-mode .btn-mark-read:hover, body.dark-mode .btn-skip:hover {
    background: var(--bg-teal-light);
    border-color: var(--bg-teal-light);
}

/* ==================== REFRESH ==================== */

.refresh-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.refresh-button:hover:not(:disabled) {
    background: var(--accent-hover);
}
.refresh-button:disabled { opacity: 0.7; cursor: not-allowed; }
.refresh-button.refreshing {
    background: var(--surface);
    color: var(--text-teal);
    border: 1.5px solid var(--border);
}
.refresh-icon { font-size: 15px; line-height: 1; }
.refresh-button.refreshing .refresh-icon { animation: spin 1s linear infinite; }
.refresh-label { font-size: 13px; }

.theme-toggle-btn {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle-btn:hover {
    border-color: var(--accent);
}
body.dark-mode .theme-toggle-btn { background: var(--surface-dark); }

/* ==================== FETCH ALL BUTTON ==================== */

.fetch-all-bar {
    margin-bottom: 12px;
}

.btn-fetch-all {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: #D1F459;
    color: #223B3E;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-fetch-all:hover {
    background: #c5e84d;
}

.btn-fetch-all:active {
    transform: scale(0.98);
}

.btn-fetch-all.loading {
    background: #e8f5a0;
    color: #5a6b3a;
    cursor: wait;
}

.btn-fetch-all .fetch-all-icon {
    font-size: 18px;
}

.fetch-all-result {
    text-align: center;
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

.fetch-all-result.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.fetch-all-result.empty {
    background: #fff3e0;
    color: #e65100;
}

body.dark-mode .btn-fetch-all {
    background: #D1F459;
    color: #223B3E;
}

body.dark-mode .btn-fetch-all:hover {
    background: #c5e84d;
}

body.dark-mode .btn-fetch-all.loading {
    background: #3a4a2a;
    color: #a0b870;
}

body.dark-mode .fetch-all-result.success {
    background: #1b3a1b;
    color: #81c784;
}

body.dark-mode .fetch-all-result.empty {
    background: #3a2a1a;
    color: #ffb74d;
}

@keyframes fetchSpin {
    to { transform: rotate(360deg); }
}

.btn-fetch-all.loading .fetch-all-icon {
    display: inline-block;
    animation: fetchSpin 1s linear infinite;
}

/* ==================== PRIORITY FILTER ==================== */

.source-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.source-filter {
    padding: 5px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--card-bg);
    color: var(--text-muted-dark);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
body.dark-mode .source-filter { background: var(--surface-dark); color: var(--text-muted); }
.source-filter:hover { border-color: var(--accent); }
.source-filter.active { background: var(--bg-teal); color: var(--text-light); border-color: var(--bg-teal); }
.source-filter.src-slack.active { background: #4A154B; border-color: #4A154B; color: white; }
.source-filter.src-gmail.active { background: #1a73e8; border-color: #1a73e8; color: white; }

.priority-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.priority-filter {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--card-bg);
    color: var(--text-muted-dark);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
body.dark-mode .priority-filter { background: var(--surface-dark); color: var(--text-muted); }
.priority-filter:hover { border-color: var(--accent); }
.priority-filter.active { background: var(--bg-teal); color: var(--text-light); border-color: var(--bg-teal); }

.priority-filter.p1.active { background: #C06B65; border-color: #C06B65; color: white; }
.priority-filter.p2.active { background: #C28840; border-color: #C28840; color: white; }
.priority-filter.p3.active { background: #6B8F71; border-color: #6B8F71; color: white; }
.priority-filter.p4.active { background: #8B8F94; border-color: #8B8F94; color: white; }

.filter-refresh-btn {
    padding: 6px 16px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--bg-dark);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-left: auto;
}
.filter-refresh-btn:hover:not(:disabled) { background: var(--accent-hover); }
.filter-refresh-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.filter-count {
    background: rgba(0,0,0,0.15);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}
.priority-filter:not(.active) .filter-count { background: rgba(0,0,0,0.06); }
body.dark-mode .priority-filter:not(.active) .filter-count { background: rgba(255,255,255,0.08); }

/* Priority badge on message card */
.priority-badge {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.priority-badge.p1 { background: #F5DCD9; color: #A04E48; }
.priority-badge.p2 { background: #F5E6D0; color: #8B6830; }
.priority-badge.p3 { background: #DDE8DF; color: #4D7053; }
.priority-badge.p4 { background: #EAEAEB; color: #6E7277; }
body.dark-mode .priority-badge.p1 { background: rgba(192, 107, 101, 0.18); color: #E8A9A4; }
body.dark-mode .priority-badge.p2 { background: rgba(194, 136, 64, 0.18); color: #E0C080; }
body.dark-mode .priority-badge.p3 { background: rgba(107, 143, 113, 0.18); color: #A0C8A6; }
body.dark-mode .priority-badge.p4 { background: rgba(139, 143, 148, 0.18); color: #A8AAAD; }

/* Priority card backgrounds */
.message-card.priority-card-p1 { border-left: 4px solid #C06B65; background: #FBF3F2; }
.message-card.priority-card-p1 .message-source { background: #7A3E39; }
.message-card.priority-card-p2 { border-left: 4px solid #C28840; background: #FBF6EF; }
.message-card.priority-card-p2 .message-source { background: #7A5528; }
.message-card.priority-card-p3 { border-left: 4px solid var(--bg-teal); }
.message-card.priority-card-p3 .message-source { background: var(--bg-teal); }
.message-card.priority-card-p4 { border-left: 4px solid #8B8F94; background: #F7F7F8; opacity: 0.75; }
.message-card.priority-card-p4 .message-source { background: #5A5E63; }

body.dark-mode .message-card.priority-card-p1 { background: rgba(192, 107, 101, 0.08); border-left-color: #D4807A; }
body.dark-mode .message-card.priority-card-p1 .message-source { background: rgba(192, 107, 101, 0.35); }
body.dark-mode .message-card.priority-card-p2 { background: rgba(194, 136, 64, 0.06); border-left-color: #D4A050; }
body.dark-mode .message-card.priority-card-p2 .message-source { background: rgba(194, 136, 64, 0.3); }
body.dark-mode .message-card.priority-card-p3 { background: var(--surface); border-left-color: var(--bg-teal); }
body.dark-mode .message-card.priority-card-p4 { background: rgba(139, 143, 148, 0.06); border-left-color: #8B8F94; opacity: 0.7; }
body.dark-mode .message-card.priority-card-p4 .message-source { background: rgba(139, 143, 148, 0.3); }

/* ==================== TIME SAVINGS ==================== */

.time-savings-display {
    text-align: center;
    padding: 12px 0 6px;
}
.time-savings-display.small { padding: 8px 0 4px; text-align: left; }

.time-savings-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
}
.time-savings-display.small .time-savings-value { font-size: 22px; }

.time-savings-unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted-dark);
    margin-left: 4px;
}
.time-savings-display.small .time-savings-unit { font-size: 12px; }

.time-savings-detail {
    font-size: 11px;
    color: var(--text-muted-dark);
    text-align: center;
    padding-bottom: 4px;
}
.time-savings-sidebar .time-savings-detail { text-align: left; }

.time-savings-sidebar {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.setting-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted-dark);
    margin-bottom: 6px;
}

/* ==================== MESSAGE COUNTER ==================== */

.message-counter { text-align: center; margin-bottom: 24px; }

.message-counter-pill {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    background: var(--surface);
    border-radius: var(--radius-pill);
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-teal);
}
body.dark-mode .message-counter-pill { background: var(--surface-dark); color: var(--text-light); }

/* ==================== MESSAGE CARD ==================== */

.message-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 0;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all var(--transition);
}
body.dark-mode .message-card { background: var(--surface-dark); border-color: var(--border); }

.message-card:hover {
    border-color: var(--accent);
}

.message-source {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-teal);
    padding: 16px 24px;
    color: var(--text-light);
}

.source-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.source-badge {
    background: rgba(194, 136, 64, 0.2);
    color: #E0C080;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.source-badge.gmail { background: rgba(107, 143, 113, 0.2); color: #A0C8A6; }
.source-badge.linkedin { background: rgba(10, 102, 194, 0.2); color: #0A66C2; }

#sender-name { color: var(--text-light); font-weight: 600; font-size: 15px; }
#channel-name { color: var(--text-muted); font-size: 13px; }

.vip-badge {
    background: var(--accent);
    color: var(--bg-dark);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timestamp { color: var(--text-muted); font-size: 13px; }

/* META */
.meta-info {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 20px 24px 0;
    border-left: 3px solid var(--accent);
    overflow-wrap: break-word;
    word-break: break-word;
}
body.dark-mode .meta-info { background: rgba(255,255,255,0.04); }

.meta-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-dark);
}
.meta-row:last-child { margin-bottom: 0; }
.meta-label {
    font-weight: 700;
    color: var(--text-teal);
    white-space: nowrap;
    min-width: 70px;
}
body.dark-mode .meta-label { color: var(--mint); }

.linkedin-link {
    color: #0A66C2;
    text-decoration: none;
    font-weight: 600;
}
.linkedin-link:hover { text-decoration: underline; }
body.dark-mode .linkedin-link { color: #5BA3E6; }

/* ==================== CONTEXT PANEL ==================== */

.context-panel {
    background: var(--surface);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 12px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
body.dark-mode .context-panel { background: rgba(194, 136, 64, 0.06); border-left-color: var(--accent); }

.urgency-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.5px;
}
.badge-critical { background: #F5DCD9; color: #A04E48; }
.badge-important { background: #F5E6D0; color: #8B6830; }
.badge-normal { background: #DDE8DF; color: #4D7053; }
body.dark-mode .badge-critical { background: rgba(192, 107, 101, 0.18); color: #E8A9A4; }
body.dark-mode .badge-important { background: rgba(194, 136, 64, 0.18); color: #E0C080; }
body.dark-mode .badge-normal { background: rgba(107, 143, 113, 0.18); color: #A0C8A6; }

.context-summary {
    font-size: 13px;
    color: var(--text-teal);
    opacity: 0.85;
    line-height: 1.4;
}
body.dark-mode .context-summary { color: var(--text-muted); opacity: 1; }

.warning-bar {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
    line-height: 1.5;
}
body.dark-mode .warning-bar { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); color: #fbbf24; }

.thread-summary {
    font-size: 13px;
    color: var(--text-teal);
}
body.dark-mode .thread-summary { color: var(--text-muted); }

.toggle-thread {
    background: none;
    border: none;
    color: var(--text-teal);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    margin-left: 8px;
    font-family: inherit;
    opacity: 0.7;
    transition: opacity var(--transition);
}
.toggle-thread:hover { opacity: 1; }
body.dark-mode .toggle-thread { color: var(--accent); }

.thread-history {
    margin-top: 8px;
    padding-left: 14px;
    border-left: 2px solid var(--border);
    transition: all 0.2s;
}
.thread-history.hidden { display: none; }

.thread-item {
    font-size: 12px;
    color: var(--text-teal);
    opacity: 0.7;
    margin: 4px 0;
    line-height: 1.4;
}
body.dark-mode .thread-item { color: var(--text-muted); }

.suggested-action {
    font-size: 13px;
    color: var(--text-teal);
    font-weight: 600;
}
body.dark-mode .suggested-action { color: var(--mint); }

.vip-info {
    font-size: 12px;
    color: var(--text-teal);
    opacity: 0.75;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
body.dark-mode .vip-info { color: var(--text-muted); border-top-color: rgba(255,255,255,0.08); }

/* MESSAGE CONTENT */
.message-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin: 16px 24px 0;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-dark);
    overflow-wrap: break-word;
    word-break: break-word;
}
body.dark-mode .message-content { background: rgba(255,255,255,0.04); }

/* ==================== RESPONSE OPTIONS ==================== */

.response-section {
    margin: 20px 24px 0;
}

.response-section h3 {
    font-size: 11px;
    color: var(--text-muted-dark);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.response-option {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.5;
}
body.dark-mode .response-option { background: var(--surface-dark); }

.response-option:hover {
    border-color: var(--accent);
    background: rgba(194, 136, 64, 0.04);
}

.response-option.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
}

/* RESPONSE LOADING */
.response-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    color: var(--text-muted-dark);
    font-size: 13px;
    font-weight: 500;
}
.response-spinner {
    width: 18px; height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* CUSTOM RESPONSE */
.custom-response {
    margin: 16px 24px 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
body.dark-mode .custom-response { background: rgba(255,255,255,0.03); }

.custom-response-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-teal);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
body.dark-mode .custom-response-label { color: var(--text-muted); }

.custom-response textarea {
    width: 100%;
    min-height: 72px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    color: var(--text-dark);
    background: var(--card-bg);
    transition: border var(--transition);
}
body.dark-mode .custom-response textarea { background: var(--surface-dark); }
.custom-response textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* FEEDBACK */
.feedback-section {
    margin: 20px 24px 0;
    text-align: center;
}

/* === TRAFFIC LIGHT — "Oliko tämä tärkeä?" === */
.traffic-light {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
body.dark-mode .traffic-light {
    background: var(--surface-dark);
}

.traffic-light-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted-dark);
    white-space: nowrap;
}

.traffic-light-buttons {
    display: flex;
    gap: 6px;
}

.tl-btn {
    width: 34px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
    padding: 0;
}

.tl-green {
    background: #7CB686;
    color: #fff;
    border-color: #6B9F74;
}
.tl-yellow {
    background: #E0C06B;
    color: #5C4A1D;
    border-color: #CDB05E;
}
.tl-red {
    background: #D4807A;
    color: #fff;
    border-color: #C06B65;
}

.tl-btn:hover {
    opacity: 0.85;
}
.tl-green:hover { background: #6B9F74; }
.tl-yellow:hover { background: #CDB05E; }
.tl-red:hover { background: #C06B65; }

.tl-btn.active {
    box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px currentColor;
}
.tl-green.active { background: #6B9F74; box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px #6B9F74; }
.tl-yellow.active { background: #CDB05E; box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px #CDB05E; }
.tl-red.active { background: #C06B65; box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px #C06B65; }

.feedback-label {
    font-size: 12px;
    color: var(--text-muted-dark);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.feedback-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.feedback-btn {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 24px;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
}
body.dark-mode .feedback-btn { background: var(--surface-dark); }

.feedback-btn:hover { transform: scale(1.05); }
.feedback-btn.important:hover { background: var(--accent); border-color: var(--accent); color: var(--bg-dark); }
.feedback-btn.not-important:hover { background: var(--border); border-color: var(--border); }
.feedback-btn.hide:hover { background: var(--bg-teal); border-color: var(--bg-teal); color: var(--text-light); }

.feedback-btn.active { transform: scale(1.08); }
.feedback-btn.important.active { background: var(--accent); border-color: var(--accent); color: var(--bg-dark); }
.feedback-btn.not-important.active { background: var(--border); }
.feedback-btn.hide.active { background: var(--bg-teal); color: var(--text-light); }

/* ACTION BUTTONS */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 24px;
}
.action-buttons .btn {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
}

/* ==================== SIDEBAR ==================== */

.sidebar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    color: var(--text-dark);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-teal);
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

/* NAV FIREFLIES */
.btn-nav-fireflies {
    width: 100%;
    background: var(--accent);
    color: #fff;
    padding: 10px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-bottom: 8px;
}
.btn-nav-fireflies:hover {
    background: var(--accent-hover);
}
.btn-nav-fireflies.active {
    background: var(--text-teal);
    color: #fff;
}

/* LOGOUT */
.btn-logout {
    width: 100%;
    background: transparent;
    color: var(--text-teal);
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-bottom: 4px;
}
.btn-logout:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* INTEGRATIONS */
/* === INTEGRATION CARDS — 2-row layout === */
.integration-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background 0.2s ease;
}
.integration-card:hover {
    border-color: var(--accent);
}

.ic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 20px;
}

.ic-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted-dark);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}
.status-dot.connected { background: var(--mint); box-shadow: 0 0 6px rgba(107, 143, 113, 0.4); }
.status-dot.disconnected { background: var(--danger); box-shadow: 0 0 6px rgba(212, 93, 93, 0.3); }
.status-dot.disabled { background: var(--border); }

.ic-detail {
    font-size: 11px;
    color: var(--text-muted-dark);
    font-weight: 500;
    letter-spacing: 0.2px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-connect {
    margin-left: auto;
    border: none;
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
}
.btn-connect:hover {
    opacity: 0.85;
}
.btn-connect:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-connect-off {
    background: var(--accent);
    color: var(--bg-dark);
}
.btn-connect-off:hover:not(:disabled) { background: var(--accent-hover); }

.btn-connect-on {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-connect-on:hover { background: rgba(239, 68, 68, 0.25); }

.btn-connect-connecting {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    cursor: wait;
}

/* STATS */
.stats-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-teal);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted-dark); font-size: 13px; }
.stat-value { font-weight: 700; color: var(--text-dark); font-size: 14px; }

/* SYSTEM STATUS */
.system-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}
.system-status-row:last-child { border-bottom: none; }
.system-status-label { flex: 1; font-size: 13px; color: var(--text-muted-dark); }
.system-status-value { font-size: 12px; font-weight: 700; color: var(--text-dark); }

.system-status-detail {
    background: var(--surface);
    border-radius: 8px;
    padding: 6px 12px;
    margin: 4px 0 8px;
}
.system-status-detail .stat-row { padding: 4px 0; }
.system-status-detail .stat-label { font-size: 12px; }
.system-status-detail .stat-value { font-size: 13px; }

/* ==================== SIGNATURE ==================== */

.signature-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    color: var(--text-dark);
    background: var(--surface);
    transition: border var(--transition);
    line-height: 1.5;
}
.signature-textarea::placeholder { color: var(--text-muted); font-size: 12px; }
.signature-textarea:focus { outline: none; border-color: var(--accent); }

/* Mobile settings signature override */
.mobile-settings-section .signature-textarea {
    background: var(--surface);
    color: var(--text-dark);
    border-color: var(--border);
}
body.dark-mode .mobile-settings-section .signature-textarea {
    background: rgba(255,255,255,0.04);
    color: var(--text-light);
    border-color: var(--border);
}

.signature-hint {
    font-size: 10px;
    color: var(--text-muted-dark);
    margin-top: 6px;
    opacity: 0.7;
}

/* ==================== SETTINGS EMAIL ACCOUNTS ==================== */

.settings-email-account {
    background: var(--surface);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.settings-email-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.settings-email-icon {
    font-size: 16px;
    opacity: 0.7;
}

.settings-email-addr {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    flex: 1;
}

.settings-email-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.settings-email-status.connected { background: var(--mint); box-shadow: 0 0 6px rgba(107, 143, 113, 0.4); }

.settings-email-account .setting-label {
    margin-bottom: 6px;
}

.settings-email-account .signature-textarea {
    min-height: 64px;
}

/* Mobile overrides */
.mobile-settings-section .settings-email-account {
    background: var(--surface);
    border-color: var(--border);
}
body.dark-mode .mobile-settings-section .settings-email-account {
    background: rgba(255,255,255,0.04);
    border-color: rgba(248, 249, 247, 0.08);
}
.mobile-settings-section .settings-email-addr { color: var(--text-dark); }
body.dark-mode .mobile-settings-section .settings-email-addr { color: var(--text-light); }
.mobile-settings-section .settings-email-account .signature-textarea {
    background: var(--card-bg);
    color: var(--text-dark);
    border-color: var(--border);
}
body.dark-mode .mobile-settings-section .settings-email-account .signature-textarea {
    background: rgba(255,255,255,0.04);
    color: var(--text-light);
}

/* ==================== VIESTILOKI ==================== */

.btn-log-toggle {
    width: 100%;
    background: var(--surface);
    color: var(--text-muted-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-bottom: 8px;
}
.btn-log-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Mobile settings viestiloki button override */
.mobile-settings-section .btn-log-toggle {
    background: var(--surface);
    color: var(--text-muted-dark);
    border-color: var(--border);
}
body.dark-mode .mobile-settings-section .btn-log-toggle {
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    border-color: var(--border);
}
.mobile-settings-section .btn-log-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#sent-log-container, #m-sent-log-container {
    max-height: 400px;
    overflow-y: auto;
}

.log-entry {
    background: var(--surface);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-left: 2px solid var(--border);
    transition: border-color var(--transition);
}
.log-entry:hover { border-left-color: var(--accent); }

/* Mobile settings log entry */
.mobile-settings-section .log-entry {
    background: var(--surface);
    border-left-color: var(--border);
}
body.dark-mode .mobile-settings-section .log-entry {
    background: rgba(255,255,255,0.04);
    border-left-color: rgba(248, 249, 247, 0.1);
}

.log-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.log-source-badge {
    background: rgba(194, 136, 64, 0.12);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.log-source-badge.gmail { background: rgba(107, 143, 113, 0.12); color: var(--mint); }
.log-source-badge.linkedin { background: rgba(10, 102, 194, 0.2); color: #0A66C2; }

.log-recipient {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mobile-settings-section .log-recipient { color: var(--text-dark); }

.log-status-ok { font-size: 12px; }
.log-status-fail { font-size: 12px; }
.log-status-pending { font-size: 12px; }

.log-time {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

.log-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.log-email {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 2px;
}

.log-loading, .log-empty {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state h3 {
    color: var(--text-teal);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}
body.dark-mode .empty-state h3 { color: var(--text-light); }
.empty-state p { color: var(--text-muted-dark); }

/* ==================== NOTIFICATION ==================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-teal);
    padding: 14px 24px;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: none;
    animation: slideIn 0.3s ease;
    z-index: 1000;
    color: var(--text-light);
    font-weight: 500;
    font-size: 14px;
}
.notification.show { display: block; }
.notification.success { border-left: 3px solid var(--accent); }
.notification.error { border-left: 3px solid var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==================== BOTTOM NAV ==================== */

.bottom-nav {
    display: none; /* shown on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--bg-teal);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    border-top: 1px solid rgba(248, 249, 247, 0.08);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    transition: color var(--transition);
    letter-spacing: 0.3px;
}

.bottom-nav-item.active {
    color: var(--accent);
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

/* ==================== MOBILE STATS ==================== */

.mobile-stats-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
body.dark-mode .mobile-stats-card { background: var(--surface-dark); }

.mobile-stats-card h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.mobile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mobile-stat {
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 8px;
}
body.dark-mode .mobile-stat { background: rgba(255,255,255,0.04); }

.mobile-stat.accent .mobile-stat-value { color: var(--accent); }

.mobile-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-teal);
    letter-spacing: -1px;
}
body.dark-mode .mobile-stat-value { color: var(--text-light); }

.mobile-stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    font-weight: 600;
}

/* ==================== MOBILE SETTINGS ==================== */

.mobile-settings-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
body.dark-mode .mobile-settings-section { background: var(--surface-dark); }

.mobile-settings-section > h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.mobile-settings-section .integration-card {
    background: var(--surface);
    margin-bottom: 6px;
    padding: 12px 14px;
}
body.dark-mode .mobile-settings-section .integration-card { background: rgba(255,255,255,0.04); }
.mobile-settings-section .ic-name { color: var(--text-dark); }
.mobile-settings-section .ic-detail { color: var(--text-muted-dark); font-size: 12px; max-width: 180px; }
.mobile-settings-section .status-badge { color: var(--text-muted-dark); }

.mobile-settings-section .system-status-row {
    border-color: var(--border);
}
.mobile-settings-section .system-status-label { color: var(--text-muted-dark); }
.mobile-settings-section .system-status-value { color: var(--text-dark); }

.btn-logout-mobile {
    width: 100%;
    background: transparent;
    color: var(--danger);
    padding: 14px;
    border: 1.5px solid var(--danger);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
    transition: all var(--transition);
}
.btn-logout-mobile:hover {
    background: var(--danger);
    color: white;
}

.desktop-only { display: block; }

/* ==================== MODAL OVERLAY ==================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.show { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-panel {
    background: var(--card-bg);
    border-radius: 20px;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideUp 0.25s ease;
}
body.dark-mode .modal-panel { background: var(--surface-dark); }

@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header-icon { font-size: 22px; }
.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-teal);
    flex: 1;
}
body.dark-mode .modal-header h2 { color: var(--text-light); }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted-dark);
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--surface); color: var(--text-dark); }
body.dark-mode .modal-close { color: var(--text-muted); }
body.dark-mode .modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text-light); }

.modal-body { padding: 20px 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.modal-btn-secondary {
    background: transparent;
    color: var(--text-teal);
    border: 1.5px solid var(--border);
}
.modal-btn-secondary:hover { background: var(--surface); }
body.dark-mode .modal-btn-secondary { color: var(--text-light); }
body.dark-mode .modal-btn-secondary:hover { background: rgba(255,255,255,0.06); }

.modal-btn-primary {
    background: var(--accent);
    color: var(--bg-dark);
}
.modal-btn-primary:hover { background: var(--accent-hover); }

/* ==================== TASK MODAL ==================== */

.task-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    margin-bottom: 16px;
    font-size: 13px;
}
.task-meta-label {
    font-weight: 700;
    color: var(--text-teal);
}
body.dark-mode .task-meta-label { color: var(--mint); }
.task-meta-value { color: var(--text-dark); }
body.dark-mode .task-meta-value { color: var(--text-light); }

.task-description-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.task-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    color: var(--text-dark);
    background: var(--surface);
    transition: border var(--transition);
}
body.dark-mode .task-textarea { background: rgba(255,255,255,0.04); color: var(--text-light); }
.task-textarea:focus { outline: none; border-color: var(--accent); }

.task-priority-group {
    display: flex;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.task-priority-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-dark);
    background: var(--card-bg);
}
body.dark-mode .task-priority-option { background: var(--surface-dark); color: var(--text-light); }
.task-priority-option:hover { border-color: var(--accent); }
.task-priority-option.selected { border-color: var(--accent); background: var(--accent); color: var(--bg-dark); }

.task-priority-radio { display: none; }

.task-info-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 12px;
    color: var(--text-muted-dark);
    line-height: 1.5;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 12px;
}
body.dark-mode .task-info-box { background: rgba(255,255,255,0.04); color: var(--text-muted); }
.task-info-icon { font-size: 16px; flex-shrink: 0; }

.task-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    color: var(--text-muted-dark);
    font-size: 13px;
}

/* ==================== SIGNATURES MODAL ==================== */

.sig-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
body.dark-mode .sig-card { background: rgba(255,255,255,0.04); }

.sig-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.sig-card-email {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    flex: 1;
}
body.dark-mode .sig-card-email { color: var(--text-light); }

.sig-card-actions {
    display: flex;
    gap: 6px;
}

.sig-action-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-muted-dark);
    font-family: inherit;
}
body.dark-mode .sig-action-btn { color: var(--text-muted); }
.sig-action-btn:hover { border-color: var(--accent); color: var(--text-dark); }
body.dark-mode .sig-action-btn:hover { color: var(--text-light); }
.sig-action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.sig-preview {
    font-size: 13px;
    color: var(--text-dark);
    line-height: 1.5;
    white-space: pre-wrap;
    opacity: 0.85;
}
body.dark-mode .sig-preview { color: var(--text-light); }

.sig-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    color: var(--text-dark);
    background: var(--card-bg);
    line-height: 1.5;
    transition: border var(--transition);
}
body.dark-mode .sig-textarea { background: var(--surface-dark); color: var(--text-light); }
.sig-textarea:focus { outline: none; border-color: var(--accent); }

.sig-email-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-dark);
    background: var(--card-bg);
    transition: border var(--transition);
    margin-bottom: 10px;
}
body.dark-mode .sig-email-input { background: var(--surface-dark); color: var(--text-light); }
.sig-email-input:focus { outline: none; border-color: var(--accent); }

.sig-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    justify-content: center;
}
body.dark-mode .sig-add-btn { color: var(--text-muted); }
.sig-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Sidebar signatures button */
.btn-signatures {
    width: 100%;
    background: var(--surface);
    color: var(--text-teal);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}
.btn-signatures:hover {
    border-color: var(--accent);
    color: var(--accent);
}
/* Mobile signatures button */
.btn-signatures-mobile {
    width: 100%;
    background: var(--surface);
    color: var(--text-dark);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}
body.dark-mode .btn-signatures-mobile { background: rgba(255,255,255,0.04); color: var(--text-light); }
.btn-signatures-mobile:hover { border-color: var(--accent); color: var(--accent); }

/* ==================== EXPORT SECTION ==================== */

.export-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    gap: 8px;
}

.export-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.export-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.export-date {
    font-size: 11px;
    color: var(--text-muted-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-export {
    background: var(--surface);
    color: var(--text-teal);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-export:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Mobile export styles */
.mobile-settings-section .export-label {
    color: var(--text-dark);
}

.mobile-settings-section .export-date {
    color: var(--text-muted-light, rgba(0,0,0,0.45));
}

.mobile-settings-section .btn-export {
    background: var(--surface);
    color: var(--text-dark);
    border: 1.5px solid var(--border);
}

.mobile-settings-section .btn-export:hover {
    border-color: var(--accent);
    color: var(--accent);
}

body.dark-mode .mobile-settings-section .export-label { color: var(--text-light); }
body.dark-mode .mobile-settings-section .export-date { color: rgba(248,249,247,0.45); }
body.dark-mode .mobile-settings-section .btn-export { background: rgba(255,255,255,0.04); color: var(--text-light); }

/* ==================== TASK BUTTON STYLE ==================== */

.btn-task {
    background: transparent;
    color: var(--text-teal);
    border: 1.5px solid var(--border);
}
.btn-task:hover {
    background: var(--bg-teal);
    color: var(--text-light);
    border-color: var(--bg-teal);
}
body.dark-mode .btn-task {
    color: var(--text-light);
    border-color: var(--border);
}
body.dark-mode .btn-task:hover {
    background: var(--bg-teal-light);
    border-color: var(--bg-teal-light);
}

/* ==================== RESPONSIVE ==================== */

/* --- Tablet (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .container { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .action-buttons { gap: 8px; }
    .main-content { padding: 28px; }
    .header h1 { font-size: 24px; }

    .message-source {
        flex-wrap: wrap;
        gap: 8px;
    }
    .source-info { flex-wrap: wrap; gap: 6px; }
}

/* --- Small tablet / large phone (max-width: 768px) --- */
@media (max-width: 768px) {
    /* App shell mobile mode */
    .app-header { display: flex; }
    .bottom-nav { display: flex; }
    .sidebar { display: none; }
    .desktop-only { display: none; }

    .container {
        padding: 0;
        gap: 0;
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 12px;
        border-radius: 0;
        background: var(--bg-dark);
        box-shadow: none;
        padding-bottom: 80px; /* space for bottom nav */
    }
    body.dark-mode .main-content { background: var(--bg-dark); }

    /* Filter bar: horizontal scroll */
    .priority-filter-bar {
        gap: 4px;
        margin-bottom: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .priority-filter-bar::-webkit-scrollbar { display: none; }
    .source-filter-bar {
        margin-bottom: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .source-filter-bar::-webkit-scrollbar { display: none; }
    .source-filter {
        padding: 4px 9px;
        font-size: 11px;
        flex-shrink: 0;
    }
    .priority-filter {
        padding: 5px 10px;
        font-size: 11px;
        flex-shrink: 0;
    }
    .filter-refresh-btn {
        flex-shrink: 0;
        margin-left: 4px;
    }

    .message-counter { margin-bottom: 12px; }
    .message-counter-pill {
        font-size: 12px;
        padding: 6px 16px;
        gap: 10px;
    }

    .message-card {
        border-radius: 14px;
        border: none;
        box-shadow: var(--shadow);
    }

    .message-source {
        padding: 12px 14px;
        border-radius: 14px 14px 0 0;
        flex-wrap: wrap;
        gap: 6px;
    }
    .source-info {
        flex-wrap: wrap;
        gap: 6px;
    }
    #sender-name { font-size: 14px; }
    #channel-name { font-size: 12px; }
    .timestamp { font-size: 12px; width: 100%; margin-top: 2px; }

    .meta-info, .message-content, .response-section, .custom-response, .feedback-section, .context-panel {
        margin-left: 14px;
        margin-right: 14px;
    }

    .meta-info { padding: 12px 14px; margin-top: 14px; }
    .meta-row { flex-wrap: wrap; }
    .meta-label { min-width: 60px; font-size: 12px; }
    .meta-row span:not(.meta-label) { font-size: 12px; word-break: break-all; }

    .context-panel { padding: 12px 14px; margin-top: 8px; }
    .urgency-row { flex-wrap: wrap; gap: 6px; }
    .context-summary { font-size: 12px; }
    .warning-bar { font-size: 12px; padding: 8px 12px; }
    .suggested-action { font-size: 12px; }

    .message-content { padding: 14px; margin-top: 10px; font-size: 13px; }
    .response-section { margin-top: 14px; }
    .custom-response { margin-top: 12px; padding: 12px; }
    .feedback-section { margin-top: 14px; }

    /* Action buttons: wrap with flex */
    .action-buttons {
        gap: 8px;
        padding: 14px;
    }
    .action-buttons .btn {
        flex: 1 1 calc(50% - 4px);
    }

    /* Modal full width on mobile */
    .modal-overlay { padding: 10px; }
    .modal-panel {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px;
    }
    .modal-header { padding: 18px 18px 14px; }
    .modal-body { padding: 16px 18px; }
    .modal-footer { padding: 14px 18px 18px; }
    .modal-header h2 { font-size: 16px; }

    .btn {
        padding: 12px 14px;
        font-size: 12px;
    }

    .feedback-buttons { gap: 8px; }
    .feedback-btn { padding: 8px 18px; font-size: 18px; }

    .header-actions { display: none; } /* use app-header instead */

    /* Mobile stats & settings cards */
    .mobile-stats-card, .mobile-settings-section {
        border: none;
        box-shadow: var(--shadow);
    }

    .response-option { padding: 12px 14px; margin-bottom: 8px; font-size: 13px; }

    /* Notification on mobile */
    .notification {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 70px;
        font-size: 13px;
        padding: 12px 16px;
    }
}

/* --- Mobile (max-width: 480px) --- */
@media (max-width: 480px) {
    .main-content { padding: 8px; }

    .priority-filter-bar { gap: 3px; }
    .priority-filter { padding: 4px 8px; font-size: 10px; }
    .filter-refresh-btn { padding: 4px 10px; font-size: 10px; }

    .message-counter-pill {
        font-size: 11px;
        padding: 5px 12px;
        gap: 8px;
    }

    .message-source { padding: 10px 12px; }
    .source-badge { font-size: 9px; padding: 3px 8px; }
    #sender-name { font-size: 13px; }
    .priority-badge { font-size: 9px; padding: 2px 8px; }
    .vip-badge { font-size: 9px; padding: 2px 8px; }

    .meta-info, .message-content, .response-section, .custom-response, .feedback-section, .context-panel {
        margin-left: 10px;
        margin-right: 10px;
    }
    .meta-info { padding: 10px 12px; }
    .meta-label { min-width: 55px; font-size: 11px; }
    .meta-row span:not(.meta-label) { font-size: 11px; }

    .context-panel { padding: 10px 12px; }
    .message-content { padding: 12px; font-size: 12px; }

    /* Action buttons compact */
    .action-buttons {
        gap: 6px;
        padding: 10px;
    }
    .action-buttons .btn {
        flex: 1 1 calc(50% - 3px);
    }
    .btn {
        padding: 10px 8px;
        font-size: 11px;
        border-radius: var(--radius);
    }

    .response-option { padding: 10px 12px; font-size: 12px; }

    .feedback-buttons { gap: 6px; }
    .feedback-btn { padding: 6px 14px; font-size: 16px; }

    /* Mobile stats */
    .mobile-stats-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .mobile-stat { padding: 10px 6px; }
    .mobile-stat-value { font-size: 22px; }
    .mobile-stat-label { font-size: 9px; }

    /* Mobile settings */
    .mobile-settings-section { padding: 14px; }
    .integration-card { padding: 10px 12px; }
    .ic-detail { max-width: 150px; font-size: 10px; }

    .custom-response textarea { min-height: 60px; font-size: 13px; }

    /* Notification compact */
    .notification {
        left: 8px;
        right: 8px;
        bottom: 65px;
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* --- Task List --- */
.task-list-item {
    background: var(--card-bg, rgba(34, 59, 62, 0.5));
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid var(--accent, #D1F459);
}
.task-list-item.task-done {
    opacity: 0.5;
    border-left-color: var(--mint);
}
.task-list-item.task-progress {
    border-left-color: var(--accent);
}
.task-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin-bottom: 6px;
}
.task-list-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: var(--text-muted, #ccc);
}
.task-list-desc {
    font-size: 12px;
    color: var(--text-muted, #ccc);
    line-height: 1.4;
    margin-bottom: 8px;
}
.task-list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.task-list-date {
    font-size: 11px;
    color: var(--text-muted-dark, #888);
}
.task-list-actions {
    display: flex;
    gap: 6px;
}
.task-action-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text-primary, #fff);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.task-action-btn:hover {
    background: rgba(255,255,255,0.15);
}

/* --- Very small mobile (max-width: 320px) --- */
@media (max-width: 320px) {
    .main-content { padding: 6px; }

    .source-filter { padding: 3px 6px; font-size: 9px; }
    .priority-filter { padding: 3px 6px; font-size: 9px; }
    .filter-count { font-size: 8px; padding: 1px 5px; }
    .filter-refresh-btn { padding: 3px 8px; font-size: 9px; }

    .message-counter-pill { font-size: 10px; padding: 4px 10px; }

    .message-source { padding: 8px 10px; }
    .source-badge { font-size: 8px; padding: 2px 6px; }
    #sender-name { font-size: 12px; }

    .meta-info, .message-content, .response-section, .custom-response, .feedback-section, .context-panel {
        margin-left: 8px;
        margin-right: 8px;
    }

    .action-buttons { padding: 8px; gap: 4px; }
    .btn { padding: 8px 6px; font-size: 10px; }

    .mobile-stat-value { font-size: 18px; }

    .app-header-title { font-size: 15px; }
    .app-header-logo { width: 28px; height: 28px; font-size: 12px; }
}


/* === Response Generate Bar === */
.response-generate-bar {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    justify-content: center;
}

.btn-generate {
    background: var(--accent);
    color: var(--text-dark);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-generate:hover { background: var(--accent-hover); }

.btn-generate-sonnet {
    background: rgba(194, 136, 64, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-generate-sonnet:hover { background: rgba(194, 136, 64, 0.2); }

/* === Task Prompt Options === */
.task-prompt-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.task-prompt-option {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    background: var(--card-bg);
}
.task-prompt-option:hover { border-color: var(--accent); }
.task-prompt-option.selected {
    border-color: var(--accent);
    background: rgba(194, 136, 64, 0.06);
}

.task-prompt-number {
    background: var(--accent);
    color: var(--text-dark);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.task-prompt-text {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-dark);
}

.task-prompt-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: var(--text-muted-dark);
    font-size: 13px;
}

/* === Log status for read/skip === */
.log-status-read { color: var(--mint); }
.log-status-skip { color: var(--text-muted-dark); }

/* ==================== FIREFLIES DASHBOARD ==================== */

.ff-dashboard { padding: 0 0 20px; }

.ff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.ff-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.ff-header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.ff-last-sync {
    font-size: 12px;
    color: var(--text-muted-dark);
}

.ff-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ff-period-select {
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-dark);
    font-size: 13px;
    font-family: inherit;
}

.ff-sync-btn {
    background: var(--accent) !important;
    color: #fff !important;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.ff-sync-btn:hover {
    background: var(--accent-hover) !important;
}

/* KPI Grid */
.ff-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.ff-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ff-kpi-label {
    font-size: 11px;
    color: var(--text-muted-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ff-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.ff-kpi-trend {
    font-size: 12px;
    font-weight: 500;
}
.ff-kpi-trend.positive { color: var(--mint); }
.ff-kpi-trend.negative { color: var(--danger); }
.ff-kpi-trend.neutral { color: var(--text-muted-dark); }

/* Charts */
.ff-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.ff-chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.ff-chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 12px;
}

.ff-chart-card canvas {
    width: 100% !important;
    max-height: 220px;
}

/* Topics & Meetings */
.ff-bottom-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    margin-bottom: 20px;
}

.ff-topics-card,
.ff-meetings-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.ff-topics-card h3,
.ff-meetings-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 12px;
}

.ff-topic-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ff-topic-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.ff-topic-tag.hot {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.ff-no-data {
    font-size: 13px;
    color: var(--text-muted-dark);
    font-style: italic;
}

/* Meeting rows */
.ff-meetings-list {
    display: flex;
    flex-direction: column;
}

.ff-meeting-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
}
.ff-meeting-row:last-child { border-bottom: none; }
.ff-meeting-row:hover { opacity: 0.7; }

.ff-meeting-title {
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ff-meeting-date,
.ff-meeting-duration,
.ff-meeting-speakers {
    font-size: 12px;
    color: var(--text-muted-dark);
    white-space: nowrap;
}

/* Low-value alert */
.ff-alert {
    background: #FFF3E0;
    border: 1px solid #FFB74D;
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #E65100;
}
body.dark-mode .ff-alert {
    background: #3E2723;
    border-color: #795548;
    color: #FFAB91;
}

/* Detail panel */
.ff-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 100%;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-strong);
    z-index: 1000;
    overflow-y: auto;
    animation: ff-slide-in 0.2s ease;
}

@keyframes ff-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.ff-detail-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card-bg);
}

.ff-detail-close {
    float: right;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted-dark);
    padding: 0;
    line-height: 1;
}

.ff-detail-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 8px 0 6px;
}

.ff-detail-meta {
    font-size: 12px;
    color: var(--text-muted-dark);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ff-detail-body { padding: 20px; }

.ff-detail-section { margin-bottom: 20px; }

.ff-detail-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px;
}

.ff-detail-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    margin: 0;
    white-space: pre-wrap;
}

.ff-detail-speaker-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.ff-detail-speaker-name {
    min-width: 100px;
    color: var(--text-dark);
}

.ff-detail-speaker-fill {
    flex: 1;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
}

.ff-detail-speaker-fill-inner {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}

.ff-detail-speaker-count {
    color: var(--text-muted-dark);
    min-width: 40px;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .ff-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ff-charts-row {
        grid-template-columns: 1fr;
    }
    .ff-bottom-row {
        grid-template-columns: 1fr;
    }
    .ff-kpi-value {
        font-size: 22px;
    }
    .ff-detail-panel {
        width: 100%;
    }
    .ff-meeting-row {
        grid-template-columns: 1fr auto;
    }
    .ff-meeting-duration,
    .ff-meeting-speakers {
        display: none;
    }
}
