/* ==========================================================================
   MD PARTS CRM • Clean Minimalist Light Theme (mdparts.ch)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-main: #f8fafc;
    --surface-card: #ffffff;
    --border-subtle: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    /* Brand Colors */
    --logo-m-red: #dc2626;
    --logo-d-amber: #d97706;
    --logo-parts-slate: #334155;
    
    --primary-btn: #0f172a;
    --primary-btn-hover: #1e293b;
    
    /* Status Badges */
    --status-new-bg: #e0f2fe;
    --status-new-text: #0369a1;
    
    --status-overdue-bg: #fee2e2;
    --status-overdue-text: #991b1b;
    
    --status-waiting-bg: #fef3c7;
    --status-waiting-text: #92400e;
    
    --status-quoted-bg: #f3e8ff;
    --status-quoted-text: #6b21a8;
    
    --status-shipped-bg: #dbeafe;
    --status-shipped-text: #1e40af;
    
    --status-closed-bg: #dcfce7;
    --status-closed-text: #166534;
    
    /* Utility Shadow */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Sync Badge */
.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.775rem;
    font-weight: 700;
}

/* Floating Toast Box */
.auto-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.auto-toast-item {
    background: #ffffff;
    border-left: 4px solid var(--logo-m-red);
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-top: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.auto-toast-item .toast-icon {
    color: var(--logo-m-red);
    font-size: 1.2rem;
    margin-top: 2px;
}

.auto-toast-item .toast-body strong {
    display: block;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.auto-toast-item .toast-body p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.auto-toast-item .toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: auto;
}

/* Container */
.app-container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 20px;
}

/* Top Header Bar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.brand-logo-wrap {
    display: flex;
    align-items: center;
}

.mdparts-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    user-select: none;
}

.mdparts-logo .logo-m {
    color: var(--logo-m-red);
}

.mdparts-logo .logo-d {
    color: var(--logo-d-amber);
}

.mdparts-logo .logo-parts {
    color: var(--logo-parts-slate);
    margin-left: 2px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--primary-btn);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-btn-hover);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-glass {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.btn-glass:hover {
    border-color: var(--border-hover);
    background: #f8fafc;
}

.btn-apple {
    background: #000000;
    color: #ffffff;
}

.btn-apple:hover {
    background: #1e1e1e;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.775rem;
    border-radius: 6px;
}

/* Aging Banner */
.aging-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: #991b1b;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.banner-icon {
    font-size: 1.2rem;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

.nav-tab.active {
    background: var(--surface-card);
    color: var(--text-primary);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.badge {
    padding: 2px 8px;
    font-size: 0.725rem;
    font-weight: 700;
    border-radius: 12px;
}

.badge-count {
    background: #e2e8f0;
    color: var(--text-primary);
}

.badge-tech {
    background: #fef3c7;
    color: #92400e;
}

/* Tab Pages */
.tab-page {
    display: none;
}

.tab-page.active {
    display: block;
}

/* Cards & Layout */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border-subtle);
    padding: 8px 14px;
    border-radius: 8px;
    flex: 1;
}

.search-box input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--surface-card);
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.toggle-btn {
    background: var(--surface-card);
    border: none;
    padding: 7px 12px;
    cursor: pointer;
    color: var(--text-muted);
}

.toggle-btn.active {
    background: var(--primary-btn);
    color: #ffffff;
}

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

.kpi-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.kpi-icon.red { background: #fef2f2; color: #dc2626; }
.kpi-icon.overdue-icon { background: #fee2e2; color: #991b1b; }
.kpi-icon.amber { background: #fef3c7; color: #d97706; }
.kpi-icon.green { background: #dcfce7; color: #166534; }

.kpi-label {
    display: block;
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Inquiries Grid View */
.inquiry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

.inquiry-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.inquiry-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.inquiry-card.is-overdue {
    border-color: #fca5a5;
    background: #fff5f5;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.inquiry-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--logo-m-red);
}

.customer-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.created-timestamp {
    font-size: 0.725rem;
    color: var(--text-muted);
    display: block;
}

/* Status Badges */
.status-badge-lg {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
}

.status-badge-lg.new { background: var(--status-new-bg); color: var(--status-new-text); }
.status-badge-lg.overdue { background: var(--status-overdue-bg); color: var(--status-overdue-text); }
.status-badge-lg.waiting { background: var(--status-waiting-bg); color: var(--status-waiting-text); }
.status-badge-lg.quoted { background: var(--status-quoted-bg); color: var(--status-quoted-text); }
.status-badge-lg.shipped { background: var(--status-shipped-bg); color: var(--status-shipped-text); }
.status-badge-lg.closed { background: var(--status-closed-bg); color: var(--status-closed-text); }

.card-parts-summary {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.825rem;
}

.parts-preview-list {
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    max-height: 80px;
    overflow-y: auto;
}

.btn-view-parts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    margin-top: 6px;
}

.btn-view-parts:hover {
    background: #f8fafc;
    border-color: var(--border-hover);
}

.card-comment {
    font-size: 0.825rem;
    color: var(--text-secondary);
    font-style: italic;
}

.card-followup-box {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 8px;
    padding: 10px 12px;
}

.followup-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    color: #b45309;
}

.followup-action {
    font-size: 0.825rem;
    color: #78350f;
    font-weight: 600;
    margin-top: 2px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.logistics-chip {
    font-size: 0.725rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.logistics-chip.abc { background: #e0f2fe; color: #0369a1; }
.logistics-chip.fedex { background: #f3e8ff; color: #6b21a8; }

.action-btns {
    display: flex;
    gap: 6px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--surface-card);
    border-radius: 12px;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
}

.modal-large {
    max-width: 850px;
}

.modal-xlarge {
    max-width: 1000px;
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-form {
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.span-2 {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    color: var(--text-primary);
}

.req { color: var(--logo-m-red); }

/* Excel Import Container */
.excel-import-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 16px;
    margin: 8px 0;
}

.excel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.excel-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
}

.excel-subtitle {
    font-size: 0.775rem;
    color: var(--text-muted);
}

.excel-paste-area-wrap textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    outline: none;
    background: #ffffff;
    resize: vertical;
}

.excel-table-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    margin-top: 10px;
    background: #ffffff;
}

.excel-parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.825rem;
}

.excel-parts-table th {
    background: #f1f5f9;
    padding: 8px;
    text-align: left;
    font-weight: 700;
    border-bottom: 1px solid var(--border-subtle);
}

.excel-parts-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.excel-parts-table input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

.excel-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.parts-total-chip {
    font-size: 0.775rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 10px;
    border-radius: 12px;
}

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

.hidden {
    display: none !important;
}

/* ==========================================================================
   ADDED — sign in, history, topics, performance, alerts & team
   ========================================================================== */

:root {
    --late: #b91c1c;   --late-bg: #fef2f2;   --late-line: #fecaca;
    --soon: #b45309;   --soon-bg: #fffbeb;   --soon-line: #fde68a;
    --calm: #15803d;   --calm-bg: #f0fdf4;   --calm-line: #bbf7d0;
    --info: #1d4ed8;   --info-bg: #eff6ff;   --info-line: #bfdbfe;
}

[hidden] { display: none !important; }
.muted  { color: var(--text-muted); }
.small  { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.footer-spacer { flex: 1; }
.tiny-note { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }
.field-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.mini-label { display:block; font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--text-muted); margin: 14px 0 6px; }
.section-desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.55; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.btn-icon-only { padding: 8px 10px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.btn-danger-ghost { background: transparent; border: 1px solid var(--late-line); color: var(--late); }
.btn-danger-ghost:hover { background: var(--late-bg); }
body:not(.is-admin) .admin-only { display: none; }

/* ── sign in ─────────────────────────────────────────── */
.login-overlay {
    position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(circle at 30% 0%, #334155 0%, #0f172a 70%);
}
.login-card {
    width: 100%; max-width: 372px; background: var(--surface-card);
    border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; gap: 6px;
}
.login-logo { font-size: 30px; justify-content: center; margin-bottom: 2px; }
.login-sub {
    text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 20px;
}
.login-card .form-group { margin-bottom: 4px; }
.login-error {
    font-size: 12.5px; color: var(--late); background: var(--late-bg);
    border: 1px solid var(--late-line); padding: 9px 12px; border-radius: 8px; margin: 6px 0;
}
.login-foot { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 14px; line-height: 1.55; }

.whoami-chip {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); background: var(--bg-main);
    border: 1px solid var(--border-subtle); padding: 6px 11px; border-radius: 8px;
}
.sync-badge.busy { background: var(--soon-bg); color: var(--soon); border-color: var(--soon-line); }
.sync-badge.err  { background: var(--late-bg); color: var(--late); border-color: var(--late-line); }

/* ── pills ───────────────────────────────────────────── */
.pill {
    display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
    padding: 3px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid transparent;
}
.pill-late { background: var(--late-bg); color: var(--late); border-color: var(--late-line); }
.pill-soon { background: var(--soon-bg); color: var(--soon); border-color: var(--soon-line); }
.pill-calm { background: var(--calm-bg); color: var(--calm); border-color: var(--calm-line); }
.pill-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.pill-mute { background: var(--bg-main); color: var(--text-muted); border-color: var(--border-subtle); }

/* ── inquiry cards ───────────────────────────────────── */
.inquiry-card {
    border-left: 3px solid transparent; cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.inquiry-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.inquiry-card.u-late   { border-left-color: var(--late); }
.inquiry-card.u-soon   { border-left-color: var(--soon); }
.inquiry-card.u-calm   { border-left-color: var(--calm); }
.inquiry-card.u-closed { border-left-color: var(--border-hover); opacity: .62; }

.ic-top   { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ic-who   { min-width: 0; }
.ic-cust  { font-weight: 700; font-size: 14.5px; letter-spacing: -.2px; }
.ic-ref   { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.ic-status{ display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
            color: var(--text-secondary); margin: 11px 0 9px; }
.ic-status .dot { width: 8px; height: 8px; border-radius: 99px; flex: none; background: var(--text-muted); }
.dot.t-info { background: #0369a1; } .dot.t-wait { background: #7c3aed; }
.dot.t-warn { background: #d97706; } .dot.t-good { background: #0d9488; }
.dot.t-done { background: #16a34a; } .dot.t-lost { background: #94a3b8; }
.ic-parts { font-size: 12px; color: var(--text-secondary); line-height: 1.6;
            padding: 9px 11px; background: var(--bg-main); border-radius: 8px; }
.ic-parts b { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.ic-next  { font-size: 12px; color: var(--text-secondary); margin-top: 9px; line-height: 1.5; }
.ic-foot  { display: flex; justify-content: space-between; align-items: center; gap: 8px;
            margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.ic-logi  { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.ic-actions { display: flex; gap: 5px; }

.mini {
    font: inherit; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 7px;
    border: 1px solid var(--border-subtle); background: var(--surface-card);
    color: var(--text-secondary); cursor: pointer; transition: .15s;
}
.mini:hover { border-color: var(--primary-btn); color: var(--primary-btn); }
.mini.danger { color: var(--late); border-color: var(--late-line); }
.mini.danger:hover { background: var(--late-bg); }

.data-table tr.u-late  td:first-child { box-shadow: inset 3px 0 0 var(--late); }
.data-table tr.u-soon  td:first-child { box-shadow: inset 3px 0 0 var(--soon); }
.data-table tr.u-calm  td:first-child { box-shadow: inset 3px 0 0 var(--calm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-muted); padding: 11px 14px; background: var(--bg-main);
    border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table-responsive { overflow-x: auto; }

.empty-state {
    border: 1px dashed var(--border-hover); border-radius: 12px; padding: 40px 24px;
    text-align: center; color: var(--text-muted); font-size: 13px; grid-column: 1 / -1; line-height: 1.6;
}
.empty-state b { display: block; color: var(--text-primary); font-size: 15px; margin-bottom: 6px; }

/* ── update modal: stages, history, the mandatory box ── */
.stage-steps { display: flex; gap: 4px; margin-bottom: 6px; }
.stage-steps .step { flex: 1; height: 5px; border-radius: 99px; background: var(--border-subtle); }
.stage-steps .step.on   { background: #16a34a; }
.stage-steps .step.now  { background: var(--logo-m-red); }
.stage-steps .step.lost { background: var(--border-hover); }
.stage-labels { display: flex; justify-content: space-between; font-size: 10px;
    font-weight: 600; color: var(--text-muted); margin-bottom: 22px; }

.hist-title { font-size: 13px; margin-bottom: 12px; color: var(--text-secondary); }
.timeline { list-style: none; padding-left: 16px; border-left: 2px solid var(--border-subtle); margin-bottom: 22px; }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: ""; position: absolute; left: -22px; top: 5px; width: 9px; height: 9px;
    border-radius: 99px; background: var(--border-hover); border: 2px solid var(--surface-card);
}
.timeline li.hot::before { background: var(--logo-m-red); }
.tl-when  { font-size: 11px; color: var(--text-muted); }
.tl-what  { font-size: 13px; margin-top: 2px; white-space: pre-wrap; line-height: 1.55; }
.tl-stage { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; font-weight: 600; }

.update-box { background: var(--bg-main); border: 1px solid var(--border-subtle);
    border-radius: 12px; padding: 16px; }
.update-box h4 { font-size: 13.5px; margin-bottom: 12px; }
.update-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.update-hint { font-size: 12px; color: var(--soon); }
.update-hint.ok { color: var(--calm); }
.close-row { display: flex; gap: 8px; margin-top: 14px; padding-top: 13px;
    border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ── supplier / quote modal ──────────────────────────── */
.quote-section, .logistics-section { margin-bottom: 16px; }
.inquiry-summary-banner { font-size: 13px; padding: 12px 14px; background: var(--bg-main);
    border-radius: 10px; margin-bottom: 16px; }
.supplier-price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.supplier-card { border: 1px solid var(--border-subtle); border-radius: 10px; padding: 12px;
    display: grid; gap: 8px; background: var(--surface-card); transition: .15s; }
.supplier-card.is-best { border-color: var(--calm); background: var(--calm-bg); }
.supplier-card-header { font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--text-muted); }
.best-note { font-size: 12.5px; color: var(--text-secondary); margin-top: 12px;
    padding: 10px 12px; background: var(--calm-bg); border: 1px solid var(--calm-line);
    border-radius: 8px; line-height: 1.55; }
.best-note:empty { display: none; }
.pricing-calculator-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px; margin-top: 14px; padding: 13px; background: var(--bg-main);
    border: 1px solid var(--border-subtle); border-radius: 10px; }
.calc-group label { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }
.calc-group.highlight input { border-color: var(--logo-m-red); font-weight: 700; }
.logistics-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* ── topics ──────────────────────────────────────────── */
.topics-header, .topic-filter-bar { display: flex; justify-content: space-between;
    align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* Notes — deliberately paper-like, the way the Notes app looks on a phone.
   The yellow rule under the title is the only decoration. */
.note {
    background: #fffdf5; border: 1px solid #efe7cf; border-radius: 14px;
    box-shadow: 0 1px 2px rgba(120,100,40,.06), 0 8px 20px -14px rgba(120,100,40,.35);
    display: flex; flex-direction: column; overflow: hidden;
    transition: box-shadow .18s ease, transform .18s ease;
}
.note:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(120,100,40,.08), 0 16px 28px -16px rgba(120,100,40,.45); }
.note.is-closed { opacity: .6; background: var(--bg-main); border-color: var(--border-subtle); }
.note-paper { padding: 16px 17px 12px; flex: 1; }
.note-title {
    width: 100%; border: 0; background: transparent; font: inherit;
    font-size: 16px; font-weight: 700; letter-spacing: -.3px; color: #2b2513;
    padding: 0 0 8px; border-bottom: 2px solid #f2d98a; border-radius: 0; outline: none;
}
.note-title:focus { background: #fffaea; border-bottom-color: #d9a520; }
.note-title::placeholder { color: #c3b795; }
.bell .rep { color: #8a6d12; background: #fdf3d4; border: 1px solid #eedfa8;
    padding: 0 5px; border-radius: 99px; font-size: 10px; font-weight: 700; margin-left: 2px; }
.note-add select { width: auto; font-size: 11.5px; padding: 5px 22px 5px 8px;
    border: 1px solid #eadfc2; background: #fffaea; border-radius: 7px; color: #6b6045; }
.repeat-note { font-size: 11px; color: #8d7f62; font-style: italic; }
.opt { color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.ship-block { margin-top: 14px; padding: 13px; border-radius: 10px;
    background: var(--info-bg); border: 1px solid var(--info-line); }
.ship-block h5 { font-size: 12.5px; margin-bottom: 10px; color: var(--info); }
.note-date { font-size: 11px; color: #a1937a; margin-top: 8px; }
/* Points — the note itself, one circle per line, the way Notes does it. */
.note-points { list-style: none; margin-top: 12px; display: grid; gap: 1px; }
.note-points li { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.note-points li.is-done .point-text { text-decoration: line-through; color: #a1937a; }
.point-text {
    flex: 1; min-width: 0; border: 0; background: transparent; font: inherit;
    font-size: 13.5px; line-height: 1.5; color: #3a3320; padding: 3px 4px;
    border-radius: 5px; outline: none;
}
.point-text::placeholder { color: #c3b795; }
.point-text:focus { background: #fffaea; box-shadow: inset 0 0 0 1px #ecd9a0; }
.note-points .row-del { opacity: 0; transition: opacity .15s; }
.note-points li:hover .row-del, .note-points li:focus-within .row-del { opacity: 1; }
.check.ghost { border-style: dashed; border-color: #e0d3ad; cursor: default; }
.new-point .point-text { color: #6b6045; }

.note-checks { list-style: none; display: grid; gap: 2px; margin-top: 12px; }
.note-checks li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px;
    padding: 7px 0; border-top: 1px solid #f0e8d2; }
.note-checks li:first-child { border-top: 0; }
.check {
    width: 20px; height: 20px; flex: none; margin-top: 1px; border-radius: 50%;
    border: 1.5px solid #d8c99f; background: transparent; cursor: pointer;
    display: grid; place-items: center; font-size: 12px; color: #fff; line-height: 1; padding: 0;
    transition: .15s;
}
.check:hover { border-color: #c9a227; }
.note-checks li.is-done .check { background: #d9a520; border-color: #d9a520; }
.note-checks li.is-done .check-text { text-decoration: line-through; color: #a1937a; }
.note-checks li.is-late .bell { color: var(--late); font-weight: 700; }
.check-text { flex: 1; line-height: 1.45; color: #3a3320; }
.bell { display: flex; align-items: center; gap: 4px; font-size: 11px;
    color: #a1937a; margin-top: 3px; }
.bell svg { flex: none; }
.row-del { border: 0; background: none; color: #c3b795; cursor: pointer;
    font-size: 17px; line-height: 1; padding: 0 4px; border-radius: 5px; }
.row-del:hover { color: var(--late); background: var(--late-bg); }

.note-add { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.note-add input[type=text] { flex: 1; min-width: 120px; border: 0; background: transparent;
    font-size: 13px; padding: 6px 0; color: #453d29; }
.note-add input[type=text]::placeholder { color: #bfae86; }
.note-add input[type=text]:focus { outline: none; border-bottom: 1.5px solid #e3c766; }
.note-add input[type=datetime-local] { width: auto; font-size: 11.5px; padding: 5px 7px;
    border: 1px solid #eadfc2; background: #fffaea; border-radius: 7px; color: #6b6045; }

.note-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 10px 17px; background: rgba(240,232,210,.45); border-top: 1px solid #efe7cf; flex-wrap: wrap; }
.note-count { font-size: 11.5px; font-weight: 600; color: #8d7f62; }
.note-tools { display: flex; gap: 6px; }
.note .mini { background: #fffdf5; border-color: #e6dcc0; color: #6b6045; }
.note .mini:hover { border-color: #c9a227; color: #8a6d12; }
.note .mini.danger { color: var(--late); border-color: var(--late-line); }

/* ── performance ─────────────────────────────────────── */
.analytics-header { margin-bottom: 16px; }
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.analytics-card h3 { font-size: 14.5px; margin-bottom: 8px; }
.logistics-meter-bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--border-subtle); margin: 12px 0; }
.meter-segment { display: grid; place-items: center; font-size: 11px; font-weight: 700;
    color: #fff; min-width: 0; overflow: hidden; white-space: nowrap; transition: width .3s ease; }
.meter-segment.abc   { background: #0f766e; }
.meter-segment.fedex { background: #6d28d9; }
.logistics-stats-list { display: grid; gap: 8px; }
.stat-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.stat-bullet { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.stat-bullet.abc { background: #0f766e; } .stat-bullet.fedex { background: #6d28d9; }
.stat-name { flex: 1; color: var(--text-secondary); }
.stat-val { font-weight: 700; }
.compliance-box { display: flex; gap: 16px; align-items: center; margin-top: 10px; }
.compliance-ring { width: 92px; height: 92px; border-radius: 99px; display: grid; place-items: center;
    font-size: 21px; font-weight: 800; flex: none; border: 5px solid var(--calm-line); color: var(--calm); }
.compliance-ring.mid { border-color: var(--soon-line); color: var(--soon); }
.compliance-ring.bad { border-color: var(--late-line); color: var(--late); }
.compliance-details h4 { font-size: 13.5px; margin-bottom: 4px; }
.compliance-details p  { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.wl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 10px; }
.wl-box { background: var(--bg-main); border: 1px solid var(--border-subtle);
    border-radius: 10px; padding: 11px 12px; display: flex; flex-direction: column; gap: 3px; }
.wl-box.wide { margin-top: 9px; }
.wl-label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-muted); }
.wl-value { font-size: 22px; font-weight: 800; letter-spacing: -.8px; }
.wl-value.good { color: var(--calm); } .wl-value.bad { color: var(--late); }
.funnel { display: grid; gap: 7px; margin-top: 10px; }
.fun-line { display: grid; grid-template-columns: 1fr 34px; gap: 10px; align-items: center; font-size: 12.5px; }
.fun-line b { text-align: right; }
.fun-bar { position: relative; height: 24px; border-radius: 6px; background: var(--bg-main);
    border: 1px solid var(--border-subtle); overflow: hidden; }
.fun-bar i { position: absolute; inset: 0 auto 0 0; background: var(--info-bg); border-right: 2px solid var(--info); }
.fun-bar span { position: relative; padding-left: 9px; font-size: 11.5px; font-weight: 600;
    line-height: 24px; white-space: nowrap; }

/* ── pipeline board ──────────────────────────────────── */
.board-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.board-cols { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.board-cols::-webkit-scrollbar { height: 9px; }
.board-cols::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 99px; }
.col { flex: 0 0 268px; background: var(--bg-main); border: 1px solid var(--border-subtle);
    border-radius: 12px; display: flex; flex-direction: column; max-height: 74vh; }
.col-head { padding: 11px 13px; border-bottom: 1px solid var(--border-subtle); }
.col-name { font-size: 12.5px; font-weight: 700; display: flex; align-items: center;
    gap: 7px; letter-spacing: -.1px; }
.col-name .sdot { width: 8px; height: 8px; border-radius: 99px; flex: none; background: var(--text-muted); }
.sdot.t-info { background: #0369a1; } .sdot.t-wait { background: #7c3aed; }
.sdot.t-warn { background: #d97706; } .sdot.t-good { background: #0d9488; }
.col-meta { display: flex; align-items: center; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.col-n { font-size: 11px; font-weight: 700; color: var(--text-muted);
    background: var(--surface-card); border: 1px solid var(--border-subtle);
    padding: 1px 8px; border-radius: 99px; }
.col-money { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); margin-left: auto; }
.col-body { padding: 10px; display: grid; gap: 9px; overflow-y: auto; flex: 1;
    align-content: start; min-height: 90px; transition: background .15s; }
.col-body.is-over { background: var(--info-bg); box-shadow: inset 0 0 0 2px var(--info-line); border-radius: 0 0 11px 11px; }
.col-empty { font-size: 11.5px; color: var(--text-muted); text-align: center; padding: 18px 6px; }

.bcard { background: var(--surface-card); border: 1px solid var(--border-subtle);
    border-left: 3px solid transparent; border-radius: 9px; padding: 11px 12px;
    cursor: grab; box-shadow: var(--shadow-sm); transition: .15s; }
.bcard:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.bcard:active { cursor: grabbing; }
.bcard.is-dragging { opacity: .4; transform: rotate(1.5deg); }
.bcard.u-late { border-left-color: var(--late); }
.bcard.u-soon { border-left-color: var(--soon); }
.bcard.u-calm { border-left-color: var(--calm); }
.bcard-cust { font-size: 13px; font-weight: 700; letter-spacing: -.15px; }
.bcard-ref { font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
    color: var(--text-muted); margin-top: 2px; }
.bcard-parts { font-size: 11.5px; color: var(--text-secondary); margin-top: 7px; }
.bcard-foot { display: flex; align-items: center; justify-content: space-between;
    gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.bcard-money { font-size: 12px; font-weight: 700; }

.ul-who { flex: 1; min-width: 0; }
.ul-phone { margin-top: 5px; }

/* ── alerts & team ───────────────────────────────────── */
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.setup-card h3 { font-size: 15px; margin: 10px 0 8px; display: flex; align-items: center; gap: 8px; }
.setup-card p  { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 8px; }
.setup-card.highlight { border: 1px solid var(--calm-line); background: var(--calm-bg); }
.warn-note { border-left: 3px solid var(--soon); padding-left: 11px; }
.feed-row { display: flex; gap: 8px; align-items: stretch; }
.feed-row code { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 11px;
    background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 8px;
    padding: 9px 11px; overflow-x: auto; white-space: nowrap; color: var(--text-secondary); }
.howto { margin-top: 14px; font-size: 12.5px; }
.howto summary { cursor: pointer; font-weight: 600; color: var(--text-secondary); }
.howto ol { margin: 10px 0 0 18px; display: grid; gap: 7px; color: var(--text-secondary); line-height: 1.55; }
.user-list { list-style: none; display: grid; gap: 8px; margin: 12px 0; }
.user-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--bg-main); border: 1px solid var(--border-subtle);
    border-radius: 9px; font-size: 13px; }
.add-user { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }

/* ── toasts ──────────────────────────────────────────── */
.auto-toast-container { position: fixed; top: 16px; right: 16px; z-index: 600;
    display: grid; gap: 9px; max-width: 340px; }
.auto-toast { background: var(--surface-card); border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--logo-m-red); border-radius: 10px; padding: 12px 14px;
    box-shadow: var(--shadow-lg); cursor: pointer; transition: opacity .3s ease;
    animation: toast-in .25s ease; }
.auto-toast b { display: block; font-size: 13px; margin-bottom: 2px; }
.auto-toast span { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.auto-toast.ok   { border-left-color: var(--calm); }
.auto-toast.warn { border-left-color: var(--soon); }
.auto-toast.err  { border-left-color: var(--late); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── phones ──────────────────────────────────────────── */
@media (max-width: 720px) {
    .wl-grid { grid-template-columns: 1fr; }
    .compliance-box { flex-direction: column; align-items: flex-start; }
    .ic-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .whoami-chip { display: none; }
    .auto-toast-container { left: 12px; right: 12px; max-width: none; }
}
