/* ═══════════════════════════════════════════════════════════════
   Hermes Workspace v3 – Dark Theme (Überarbeitet)
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #222540;
    --bg-hover: #2a2d48;
    --bg-input: #1a1d27;
    --text-primary: #e2e4ec;
    --text-secondary: #9195a8;
    --text-muted: #6b6f84;
    --border-color: #2e3150;
    --accent-primary: #6c5ce7;
    --accent-hover: #7c6ef7;
    --accent-success: #00b894;
    --accent-danger: #e17055;
    --accent-warning: #fdcb6e;
    --accent-info: #74b9ff;
    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);

    /* Status-Dot-Farben */
    --dot-personal: #6c5ce7;
    --dot-info: #00b894;
    --dot-job: #fdcb6e;
    --dot-invoice: #e17055;
    --dot-ads: #636e72;
}

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

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

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

/* ═══ App Layout ═══════════════════════════════════════════════ */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ═══ Sidebar ══════════════════════════════════════════════════ */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    font-size: 24px;
    line-height: 1;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    font-size: 14px;
    position: relative;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-link.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-primary);
    font-weight: 500;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-primary);
    color: #fff;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    line-height: 1.3;
}

.nav-badge.warning {
    background: var(--accent-warning);
    color: #1a1d27;
}

.nav-badge.danger {
    background: var(--accent-danger);
    color: #fff;
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--accent-danger);
    transition: background 0.15s;
    text-decoration: none;
}

.sidebar-logout:hover {
    background: rgba(225, 112, 85, 0.1);
    text-decoration: none;
    color: var(--accent-danger);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ═══ Mobile Topbar (Hamburger only) ═══════════════════════════ */

.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 50px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    padding: 0 14px;
    gap: 10px;
}

.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.hamburger-btn:hover {
    background: var(--bg-hover);
}

.mobile-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-primary);
}

/* ═══ Main Content ═════════════════════════════════════════════ */

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ═══ Page Header ══════════════════════════════════════════════ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ═══ Empty State ══════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* ═══ Status Dots ══════════════════════════════════════════════ */

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.status-dot.personal { background: var(--dot-personal); box-shadow: 0 0 6px rgba(108,92,231,0.4); }
.status-dot.info     { background: var(--dot-info); box-shadow: 0 0 6px rgba(0,184,148,0.4); }
.status-dot.job      { background: var(--dot-job); box-shadow: 0 0 6px rgba(253,203,110,0.4); }
.status-dot.invoice  { background: var(--dot-invoice); box-shadow: 0 0 6px rgba(225,112,85,0.4); }
.status-dot.ads      { background: var(--dot-ads); box-shadow: 0 0 6px rgba(99,110,114,0.3); }
.status-dot.other    { background: var(--text-muted); }
.status-dot.unsure   { background: var(--text-muted); }

/* ═══ Classification Tags ══════════════════════════════════════ */

.classification-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: lowercase;
    letter-spacing: 0.3px;
}

.classification-tag.personal { background: rgba(108,92,231,0.2); color: #a29bfe; }
.classification-tag.info     { background: rgba(0,184,148,0.2); color: #00b894; }
.classification-tag.job      { background: rgba(253,203,110,0.2); color: #fdcb6e; }
.classification-tag.invoice  { background: rgba(225,112,85,0.2); color: #e17055; }
.classification-tag.other    { background: rgba(145,149,168,0.2); color: var(--text-secondary); }
.classification-tag.unsure   { background: rgba(253,203,110,0.2); color: #fdcb6e; }

/* ═══ Tag Badges (verbesserte Klassifizierungs-Anzeige) ════════ */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.tag-personal {
    background: rgba(108, 92, 231, 0.2);
    color: #a29bfe;
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.tag-info {
    background: rgba(0, 184, 148, 0.2);
    color: #00b894;
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.tag-other {
    background: rgba(145, 149, 168, 0.2);
    color: var(--text-secondary);
    border: 1px solid rgba(145, 149, 168, 0.3);
}

.tag-unsure {
    background: rgba(253, 203, 110, 0.2);
    color: #fdcb6e;
    border: 1px solid rgba(253, 203, 110, 0.3);
}

/* ═══ Mail Cards (Inbox + Archive) ═════════════════════════════ */

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

.mail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: all 0.15s ease;
    cursor: pointer;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.mail-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-card);
}

.mail-card.archived {
    opacity: 0.6;
}

.mail-card.archived:hover {
    opacity: 0.85;
}

.mail-card-body {
    flex: 1;
    min-width: 0;
}

.mail-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 8px;
}

.mail-sender {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.mail-subject {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-preview {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.mail-card-footer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* ═══ Mail Detail (Accordion / Full) ═══════════════════════════ */

.mail-detail-container {
    margin-top: 8px;
}

.mail-detail {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 8px;
}

.mail-detail-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.detail-subject {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

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

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-label {
    color: var(--text-muted);
}

.meta-value {
    color: var(--text-primary);
}

.detail-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.detail-section:last-of-type {
    border-bottom: none;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-icon {
    font-size: 16px;
}

.summary-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

/* Todo List */
.todo-list {
    list-style: none;
    padding: 0;
}

.todo-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 10px;
    font-size: 14px;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: background 0.1s;
}

.todo-list li:hover {
    background: var(--bg-hover);
}

.todo-list input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.todo-list label {
    cursor: pointer;
    line-height: 1.5;
}

/* Chat */
.chat-container {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.chat-messages {
    padding: 12px;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
}

.chat-msg.hermes {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    align-self: flex-end;
    background: rgba(108, 92, 231, 0.15);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-bottom-right-radius: 4px;
}

.msg-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 2px;
}

.chat-msg.user .msg-sender {
    color: var(--accent-success);
}

.chat-input-row {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-input-row input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    min-height: 36px;
}

.chat-input-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Draft Textarea */
.draft-textarea {
    width: 100%;
    min-height: 140px;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
}

.draft-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.draft-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Footer Actions */
.footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 0;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
    flex-wrap: wrap;
}

.footer-actions .spacer {
    flex: 1;
}

/* ═══ Buttons ══════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    background: transparent;
    color: var(--text-primary);
    line-height: 1;
    text-decoration: none;
    min-height: 36px;
}

.btn:hover { text-decoration: none; }

.btn-sm { padding: 5px 12px; font-size: 12px; min-height: 30px; }
.btn-lg { padding: 12px 24px; font-size: 15px; min-height: 44px; }

.btn-primary { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-hover); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-card); }

.btn-outline { background: transparent; border-color: var(--border-color); }
.btn-outline:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }

.btn-success { background: var(--accent-success); color: #fff; }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--accent-danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
    min-height: 44px;
}

/* ═══ Forms ════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.15s;
    min-height: 40px;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ═══ Login ════════════════════════════════════════════════════ */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    overflow: auto;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 32px 28px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-form .form-label {
    color: var(--text-secondary);
}

.login-form input {
    background: var(--bg-primary);
}

.error-message {
    background: rgba(225, 112, 85, 0.1);
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.forgot-link {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
}

.forgot-link:hover {
    color: var(--accent-info);
    text-decoration: underline;
}

/* ═══ Job Cards ════════════════════════════════════════════════ */

.job-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: border-color 0.15s;
}

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

.job-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 8px;
}

.job-company {
    font-weight: 600;
    color: var(--accent-success);
    font-size: 14px;
}

.job-relevance {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.relevance-stars { font-size: 12px; }

.relevance-score {
    font-size: 12px;
    color: var(--text-muted);
}

.job-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
}

.job-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.job-meta-item {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.job-source {
    font-size: 11px;
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text-muted);
}

.job-summary {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.job-card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.job-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.job-actions .btn-primary {
    background: var(--accent-primary);
    color: #fff;
    border: 1px solid var(--accent-primary);
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
    transition: all 0.2s ease;
}

.job-actions .btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
    transform: translateY(-1px);
    text-decoration: none;
}

/* ═══ Reminder Cards ═══════════════════════════════════════════ */

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

.reminder-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-warning);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: border-color 0.15s;
}

.reminder-item:hover {
    border-color: var(--accent-primary);
}

.reminder-item.priority-high {
    border-left-color: var(--accent-danger);
}

.reminder-item.priority-low {
    border-left-color: var(--text-muted);
}

.reminder-check {
    margin-top: 3px;
    accent-color: var(--accent-primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.reminder-body {
    flex: 1;
    min-width: 0;
}

.reminder-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.reminder-date {
    font-size: 12px;
    color: var(--text-muted);
}

.reminder-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.4;
}

.reminder-priority {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.reminder-priority.high {
    background: rgba(225, 112, 85, 0.2);
    color: #e17055;
}

.reminder-priority.normal {
    background: rgba(253, 203, 110, 0.2);
    color: #fdcb6e;
}

.reminder-priority.low {
    background: rgba(145, 149, 168, 0.2);
    color: var(--text-muted);
}

/* ═══ Action Table ═════════════════════════════════════════════ */

.action-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.action-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.action-table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: top;
}

.action-table tr:hover td {
    background: var(--bg-hover);
}

.action-type {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    background: rgba(108, 92, 231, 0.15);
    color: #a29bfe;
}

.action-desc {
    color: var(--text-primary);
    line-height: 1.5;
}

.action-date {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.action-mail-ref {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* ═══ Note Editor ══════════════════════════════════════════════ */

.note-editor {
    max-width: 800px;
}

.note-editor textarea {
    width: 100%;
    min-height: 280px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.7;
    resize: vertical;
}

.note-editor textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.note-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

/* ═══ Compose Modal ════════════════════════════════════════════ */

.compose-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.compose-window {
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.compose-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.compose-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.compose-form {
    padding: 20px;
}

.compose-field {
    margin-bottom: 12px;
}

.compose-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.compose-textarea {
    width: 100%;
    min-height: 280px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
}

.compose-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.compose-attachments {
    margin: 12px 0;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.compose-attachments label {
    font-size: 13px;
}

.attachment-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    cursor: pointer;
}

.compose-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* ═══ Pagination ═══════════════════════════════════════════════ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 0;
}

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

/* ═══ Loading Spinner ══════════════════════════════════════════ */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px;
    color: var(--text-muted);
    font-size: 14px;
}

.loading-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ═══ Badges (generic) ═════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--accent-primary);
    color: #fff;
    min-width: 20px;
    text-align: center;
    line-height: 1.3;
}

.badge-success { background: var(--accent-success); }
.badge-warning { background: var(--accent-warning); color: #1a1d27; }
.badge-danger  { background: var(--accent-danger); }
.badge-muted   { background: var(--text-muted); }

/* ═══ Scrollbar ════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══ Responsive (Mobile < 768px) ══════════════════════════════ */

@media (max-width: 767px) {
    /* Sidebar hidden, turned into overlay */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    /* Mobile topbar visible */
    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 66px; /* space for mobile topbar */
    }

    .page-header h2 {
        font-size: 18px;
    }

    /* Mail cards - stack properly */
    .mail-card {
        padding: 12px 14px;
    }

    .mail-subject {
        font-size: 13px;
    }

    /* Job cards */
    .job-card {
        padding: 14px;
    }

    .job-title {
        font-size: 15px;
    }

    .job-meta {
        gap: 10px;
    }

    /* Reminders */
    .reminder-item {
        padding: 12px 14px;
    }

    /* Compose modal fullscreen */
    .compose-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .compose-window {
        max-height: 95vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    /* Action table scroll */
    .action-table {
        font-size: 12px;
    }

    .action-table th,
    .action-table td {
        padding: 8px 10px;
    }

    /* Mail detail */
    .mail-detail {
        padding: 14px;
    }

    .detail-meta {
        flex-direction: column;
        gap: 4px;
    }

    .chat-msg {
        max-width: 90%;
    }

    /* Login */
    .login-container {
        padding: 16px;
    }

    .login-card {
        padding: 28px 20px 24px;
    }

    /* Buttons larger for touch */
    .btn {
        min-height: 44px;
        padding: 10px 18px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 7px 14px;
    }
}

/* ═══ Small adjustments for very narrow screens ════════════════ */

@media (max-width: 480px) {
    .job-card-header-row {
        flex-direction: column;
    }

    .footer-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-actions .btn {
        justify-content: center;
    }

    .draft-actions {
        flex-direction: column;
    }

    .draft-actions .btn {
        justify-content: center;
    }

    .job-actions {
        flex-direction: column;
    }

    .job-actions .btn {
        justify-content: center;
        width: 100%;
    }

    .compose-actions {
        flex-direction: column;
    }

    .compose-actions .btn {
        justify-content: center;
    }
}