/* STKGO Authority Stylesheet */
:root {
    /* ── STKGo v2 "Ink & Signal" design tokens ──────────────────────────
       WCAG AA + deuteranopia/protanopia/tritanopia validated.
       Rule: status = colour + icon + label, never colour alone.
       Full spec: /design/stkgo-v2-design-spec.md
       ------------------------------------------------------------------- */

    /* Legacy aliases — names kept so existing rules keep working, remapped to v2 */
    --dark: #0D1826;
    --light: #F6F8FA;
    --text-muted: #5B6B7C;

    /* Brand */
    --color-primary: #0C6B70; /* locked petrol-teal brand token */
    --primary:       var(--color-primary); /* alias — prefer --color-primary in new code */
    --primary-hover: #095458;
    --primary-tint:  #E4F1F1;
    --ink: #0D1826;
    --ink-2: #16233A;
    --ink-line: #243349;
    --ink-muted: #8494AB;

    /* Neutrals */
    --canvas: #F6F8FA;
    --surface: #FFFFFF;
    --surface-sunk: #EEF2F6;
    --border: #D3DAE3;
    --border-strong: #C4CDD8;
    --text: #0F1B2D;
    --text-secondary: #42505F;

    /* Semantic states */
    --success: #117A4D; --success-bg: #E4F4EC;
    --warning: #8F5207; --warning-bg: #FBEFDD;
    --danger:  #A82B1D; --danger-bg:  #FBE7E4;
    --info:    #1F6FB2; --info-bg:    #E4F0F9;

    /* Categorical — CRM lead-quality pins (pair with letter H/W/C/S/D) */
    --lead-hot:  #C0362C;
    --lead-warm: #A85E00;
    --lead-cold: #1F6FB2;
    --lead-stag: #B23A86;
    --lead-dead: #3F4753;

    /* Type scale */
    --t-xs: 12px; --t-sm: 13px; --t-base: 14px; --t-lg: 16px; --t-xl: 20px; --t-2xl: 28px;
    /* Spacing scale */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px;
    /* Radius + elevation */
    --r-sm: 6px; --r-md: 10px;
    --shadow-sm: 0 1px 2px rgba(15,27,45,.06), 0 1px 3px rgba(15,27,45,.04);
    --shadow-md: 0 8px 24px rgba(15,27,45,.12);
}

body { font-family: 'Inter', sans-serif; background: #f0f2f5; color: #1e293b; margin: 0; }

/* Auth Views */
.hidden { display: none !important; }
.auth-card { max-width: 400px; margin: 50px auto; padding: 2rem; background: white; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.input-group { margin-bottom: 1rem; }
.input-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.input-group input { width: 100%; padding: 10px; border: 1px solid #CBD5E1; border-radius: 6px; box-sizing: border-box; }

/* Buttons */
.btn { border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 600; width: 100%; }
.btn-primary { background: var(--primary); color: white; }

/* Dashboard Layout */
.dashboard-layout { display: flex; height: 100vh; }
.dashboard-sidebar { width: 250px; background: var(--dark); color: white; padding: 1rem; }
.dashboard-content { flex: 1; padding: 2rem; }

/* Spinner Overlay */
#spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#spinner::after {
    content: "";
    width: 50px;
    height: 50px;
    border: 5px solid #CBD5E1;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ── Clickable stat cards ─────────────────────────────────────────────────── */
.dp-clickable {
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}
.dp-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(12, 107, 112, 0.15);
}
.dp-clickable::after {
    content: '↗';
    font-size: 0.65rem;
    opacity: 0.4;
    position: absolute;
    top: 8px;
    right: 10px;
}
.stat-card { position: relative; }

/* ── Admin Detail Drill Panel ────────────────────────────────────────────── */
#admin-detail-section {
    margin-top: 0;
}

.dp-panel {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
    overflow: hidden;
}

.dp-panel-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
}
.dp-panel-title { font-size: 1rem; font-weight: 700; color: #0f172a; }
.dp-panel-sub   { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }

.dp-bank-section + .dp-bank-section { border-top: 1px solid #e2e8f0; }
.dp-bank-section-hdr {
    padding: 14px 24px 8px;
    font-size: 0.78rem; font-weight: 700; color: #475569;
    text-transform: uppercase; letter-spacing: 0.03em;
}

.dp-back-btn {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.dp-back-btn:hover { background: #f1f5f9; }

/* Table */
.dp-table-wrap { overflow-x: auto; }
.dp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.dp-table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.dp-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background 0.1s; }
.dp-table tbody tr:hover { background: #f8fafc; }
.dp-table tbody td { padding: 10px 16px; color: #1e293b; vertical-align: middle; }

.dp-row-gap td { background: #fffbeb; }
.dp-row-gap:hover td { background: #fef9c3 !important; }
.dp-gap-val { color: #d97706 !important; font-weight: 600; }
.dp-id      { color: var(--color-primary); font-weight: 700; }
.dp-num     { text-align: right; font-variant-numeric: tabular-nums; }
.dp-mono    { font-family: monospace; font-size: 0.78rem; color: #64748b; }
.dp-batch   { color: #94a3b8; font-size: 0.75rem; }
.dp-empty   { text-align: center; color: #94a3b8; padding: 2.5rem !important; }

/* Badges */
.dp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: capitalize;
    white-space: nowrap;
}
.dp-badge-processing  { background: var(--primary-tint); color: var(--primary-hover); }
.dp-badge-sent        { background: var(--primary-tint); color: #4338ca; }
.dp-badge-confirmed   { background: #d1fae5; color: #065f46; }
.dp-badge-completed   { background: #dcfce7; color: #15803d; }
.dp-badge-cancelled   { background: #fee2e2; color: #b91c1c; }

/* Order detail meta row */
.dp-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
}
.dp-meta-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 110px;
}
.dp-meta-gap { background: #fffbeb; }
.dp-meta-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
.dp-meta-val   { font-size: 1rem; font-weight: 700; color: #0f172a; margin-top: 2px; }
.dp-meta-sub   { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }
.dp-blue  { color: var(--color-primary); }
.dp-green { color: #059669; }
.dp-amber { color: #d97706; }

/* Status update action bar */
.dp-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.dp-action-label { font-size: 0.78rem; font-weight: 600; color: #475569; }
.dp-status-select {
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #1e293b;
    background: #fff;
}
.dp-btn {
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.dp-btn-primary { background: var(--color-primary); color: #fff; }
.dp-btn-primary:hover { background: var(--primary-hover); }
.dp-status-msg { font-size: 0.78rem; color: #059669; font-weight: 600; }

.dp-section-title {
    padding: 14px 24px 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
}
.dp-supplied { color: #94a3b8; }
.dp-supplied-yes { color: #059669; font-weight: 700; }

/* Basket Queue */
.dp-basket-list { display: flex; flex-direction: column; gap: 0; }
.dp-basket-card {
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
}
.dp-basket-card:hover { background: #f8fafc; }
.dp-basket-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dp-basket-items { margin: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.dp-basket-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    font-size: 0.78rem;
    color: #475569;
    padding: 4px 0;
}
.dp-basket-item > span:first-child { flex: 1; min-width: 160px; text-align: left; }
.dp-basket-item-warn { color: #b45309; }
.dp-basket-item-removed { color: #059669; font-weight: 600; }
.dp-basket-item-removed-row { opacity: 0.75; }
.dp-remove-item-btn {
    border: 1px solid #dc2626;
    background: #fff;
    color: #dc2626;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.dp-remove-item-btn:hover { background: #fee2e2; }
.dp-remove-item-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.dp-basket-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}
.dp-basket-warn { font-size: 0.75rem; color: #b91c1c; font-weight: 600; }
.dp-split-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-primary);
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}
.dp-split-btn:hover { background: var(--primary-hover); }
.dp-split-btn--ghost {
    background: transparent; color: #64748b;
    border: 1px solid #cbd5e1; padding: 6px 12px;
}
.dp-split-btn--ghost:hover { background: #f1f5f9; color: #334155; }
.dp-split-btn:disabled { background: #cbd5e1; cursor: not-allowed; }

/* Directory */
.dp-dir-list { display: flex; flex-direction: column; gap: 0; }
.dp-dir-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}
.dp-dir-card:hover { background: #f8fafc; }
.dp-dir-card--grace { opacity: 0.7; }
.dp-dir-card--grace:hover { background: transparent; }
.dp-grace-badge {
    font-size: 0.72rem; font-weight: 600; color: #64748b;
    background: #f1f5f9; padding: 5px 10px; border-radius: 999px;
    white-space: nowrap;
}
.dp-dir-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dp-dir-avatar-green { background: #059669; }
.dp-dir-info { flex: 1; min-width: 0; }
.dp-dir-name    { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.dp-dir-contact { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.dp-dir-stats   { display: flex; gap: 20px; }
.dp-dir-stat    { text-align: right; }
.dp-dir-stat-val { display: block; font-size: 0.88rem; font-weight: 700; color: #1e293b; }
.dp-dir-stat-lbl { display: block; font-size: 0.65rem; color: #94a3b8; text-transform: uppercase; }
.dp-dir-stat-warn .dp-dir-stat-val { color: #d97706; }
.dp-dir-arrow { font-size: 1.4rem; color: #cbd5e1; margin-left: 8px; }

/* ── Quick Nav Footer ────────────────────────────────────────────────────── */
body { padding-bottom: 64px; }

.qnf {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    z-index: 1000;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.07);
}
.qnf-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    border-right: 0.5px solid #f1f5f9;
    cursor: pointer;
    padding: 8px 4px 10px;
    transition: background 0.12s;
    color: #64748b;
}
.qnf-item:last-child { border-right: none; }
.qnf-item:hover { background: #f8fafc; color: #334155; }
.qnf-item.active { background: var(--primary-tint); color: var(--color-primary); }
.qnf-item svg { flex-shrink: 0; }
.qnf-item span { font-size: 0.67rem; font-weight: 600; color: inherit; white-space: nowrap; }

/* Quick nav placeholder panel */
.qnf-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 3rem 2rem;
    min-height: 320px;
    text-align: center;
}
.qnf-placeholder-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qnf-placeholder-title { font-size: 1.2rem; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.qnf-placeholder-desc  { font-size: 0.88rem; color: #94a3b8; }
.qnf-placeholder-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #f1f5f9;
    color: #64748b;
    margin-top: 6px;
}

/* ── Messenger Panel ─────────────────────────────────────────────────────── */
.msn-panel { background: #fff; border-radius: 14px; box-shadow: 0 2px 16px rgba(0,0,0,0.07); overflow: hidden; }

.msn-compose { padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.msn-compose-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #94a3b8; margin-bottom: 16px; }

.msn-field-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.msn-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.msn-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }

.msn-pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.msn-pill {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.12s;
}
.msn-pill:hover { background: #f8fafc; border-color: #cbd5e1; }
.msn-pill.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.msn-pill-offer.active  { background: #059669; border-color: #059669; }
.msn-pill-alert.active  { background: #d97706; border-color: #d97706; }
.msn-pill-notice.active { background: var(--color-primary); border-color: var(--color-primary); }

.msn-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.88rem;
    color: #1e293b;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.12s;
}
.msn-input:focus { outline: none; border-color: var(--color-primary); }

.msn-textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.88rem;
    color: #1e293b;
    background: #fff;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.12s;
}
.msn-textarea:focus { outline: none; border-color: var(--color-primary); }

.msn-send-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.msn-preview-tag { font-size: 0.8rem; color: #64748b; }
.msn-preview-type { font-weight: 700; color: var(--color-primary); }

.msn-send-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s;
}
.msn-send-btn:hover { background: var(--primary-hover); }
.msn-send-btn:disabled { background: var(--primary-tint); cursor: not-allowed; }

.msn-send-status { font-size: 0.8rem; font-weight: 600; color: #059669; margin-top: 8px; min-height: 18px; }

.msn-history-title {
    padding: 14px 24px 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
}

/* ── Recipient Popup Banner ───────────────────────────────────────────────── */
#msn-popup-stack {
    position: fixed;
    top: 72px;
    right: 20px;
    width: 360px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msn-popup {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    border-left: 4px solid var(--color-primary);
    padding: 14px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: msnSlideIn 0.25s ease;
}
@keyframes msnSlideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

.msn-popup-offer  { border-left-color: #059669; }
.msn-popup-alert  { border-left-color: #d97706; }
.msn-popup-notice { border-left-color: var(--color-primary); }

.msn-popup-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.msn-popup-body { flex: 1; min-width: 0; }
.msn-popup-from    { font-size: 0.68rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.msn-popup-subject { font-size: 0.88rem; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.msn-popup-text    { font-size: 0.8rem; color: #475569; line-height: 1.45; }
.msn-popup-dismiss {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.msn-popup-dismiss:hover { color: #475569; }

/* ═══════════════════════════════════════════════════════════════
   EMAIL CLIENT
   ═══════════════════════════════════════════════════════════════ */

/* ── Outer panel wrapper ──────────────────────────────────────── */
.eml-panel {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

/* ── Three-column body ──────────────────────────────────────────
   sidebar | list | detail
   Fixed sidebar, fixed list, detail fills remainder              */
.eml-body {
    display: grid;
    grid-template-columns: 180px 300px 1fr;
    height: calc(100vh - 220px);
    min-height: 480px;
    overflow: hidden;
    border-top: 1px solid #f1f5f9;
}

/* ── Folder sidebar ─────────────────────────────────────────── */
.eml-sidebar {
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    gap: 4px;
    overflow-y: auto;
}
.eml-compose-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.15s;
}
.eml-compose-btn:hover { background: var(--primary-hover); }

.eml-folders { display: flex; flex-direction: column; gap: 2px; }
.eml-folder {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #475569;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}
.eml-folder:hover { background: #e2e8f0; }
.eml-folder.active { background: var(--primary-tint); color: var(--primary-hover); font-weight: 600; }
.eml-folder.active svg { stroke: var(--primary-hover); }
.eml-unread-badge {
    margin-left: auto;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 99px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
}

/* ── Message list pane ──────────────────────────────────────── */
.eml-list-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e2e8f0;
    overflow: hidden;
}
.eml-list-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.eml-search {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 0.82rem;
    outline: none;
    background: #f8fafc;
    transition: border-color 0.15s;
}
.eml-search:focus { border-color: var(--color-primary); background: #fff; }
.eml-refresh-btn {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 7px 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #64748b;
    transition: background 0.12s;
    flex-shrink: 0;
}
.eml-refresh-btn:hover { background: #f1f5f9; color: #0f172a; }

#eml-list-body { flex: 1; overflow-y: auto; }

.eml-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.12s;
}
.eml-row:hover { background: #f8fafc; }
.eml-row.eml-unread { background: var(--primary-tint); }
.eml-row.eml-unread:hover { background: var(--primary-tint); }

.eml-row-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: transparent;
    flex-shrink: 0;
    margin-top: 5px;
    transition: background 0.12s;
}
.eml-unread .eml-row-dot { background: var(--color-primary); }

.eml-row-body { flex: 1; min-width: 0; }
.eml-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 2px;
}
.eml-row-from {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}
.eml-unread .eml-row-from { color: var(--primary-hover); }
.eml-row-date { font-size: 0.72rem; color: #94a3b8; flex-shrink: 0; }
.eml-row-subject {
    font-size: 0.78rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.eml-unread .eml-row-subject { color: #1e40af; font-weight: 500; }

.eml-loading { padding: 24px 16px; text-align: center; color: #94a3b8; font-size: 0.82rem; }
.eml-empty   { padding: 32px 16px; text-align: center; color: #cbd5e1; font-size: 0.82rem; }

/* ── Detail pane ───────────────────────────────────────────── */
.eml-detail-pane {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #fff;
}
.eml-detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #cbd5e1;
    font-size: 0.85rem;
    padding: 40px;
}
.eml-detail-inner { display: flex; flex-direction: column; flex: 1; }

.eml-detail-hdr {
    padding: 20px 24px 14px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.eml-detail-subject {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.3;
}
.eml-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 10px;
}
.eml-detail-meta strong { color: #0f172a; }
.eml-detail-actions { display: flex; gap: 8px; }

.eml-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.eml-btn:hover { background: #e2e8f0; border-color: #cbd5e1; color: #0f172a; }

.eml-detail-body {
    flex: 1;
    padding: 0;
    overflow: auto;
}
.eml-iframe {
    width: 100%;
    min-height: 300px;
    border: none;
    display: block;
}

/* ── Compose pane ──────────────────────────────────────────── */
.eml-compose-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.eml-compose-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    flex-shrink: 0;
}
.eml-compose-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.eml-compose-close:hover { color: #475569; }

.eml-compose-field {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding: 0 20px;
}
.eml-compose-field label {
    width: 56px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.eml-compose-field input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 0;
    font-size: 0.85rem;
    color: #0f172a;
    background: transparent;
}

.eml-compose-body-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
}
.eml-compose-body {
    flex: 1;
    border: none;
    outline: none;
    padding: 16px 20px;
    font-size: 0.85rem;
    color: #0f172a;
    resize: none;
    line-height: 1.6;
    font-family: inherit;
    background: #fff;
}

.eml-compose-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.eml-send-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.eml-send-btn:hover { background: var(--primary-hover); }
.eml-send-btn:disabled { background: #94a3b8; cursor: not-allowed; }
.eml-send-status { font-size: 0.8rem; }

/* ── Responsive: collapse to 2-col on narrow viewports ──────── */
@media (max-width: 900px) {
    .eml-body {
        grid-template-columns: 160px 1fr;
    }
    .eml-detail-pane { display: none; }
    .eml-body.detail-open .eml-detail-pane { display: flex; }
    .eml-body.detail-open .eml-list-pane   { display: none; }
}
/* ═══════════════════════════════════════════════════════════════
   USER MANAGEMENT PANEL
   ═══════════════════════════════════════════════════════════════ */

.um-panel { padding: 0; }

.um-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}
.um-title { font-size: 1.1rem; font-weight: 700; color: #0f172a; margin: 0; }

.um-invite-btn {
    padding: 8px 16px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.um-invite-btn:hover { background: var(--primary-hover); }

.um-search-bar { padding: 14px 24px 10px; }
.um-search {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #0f172a;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.um-search:focus { outline: none; border-color: var(--color-primary); }

/* ── User list ── */
.um-list { padding: 0 24px 24px; }
.um-loading, .um-empty { padding: 32px; text-align: center; color: #94a3b8; font-size: 0.85rem; }

.um-row {
    display: flex;
    flex-direction: column;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.um-row:hover { border-color: var(--primary-tint); box-shadow: 0 2px 8px rgba(12, 107, 112, 0.08); }
.um-row-suspended { background: #fef2f2; border-color: #fca5a5; }

.um-row-main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.um-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary-hover);
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.um-row-info { flex: 1; min-width: 0; }
.um-row-name { font-size: 0.9rem; font-weight: 600; color: #0f172a; }
.um-row-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }

.um-role-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
}
.um-biz { font-size: 0.78rem; color: #64748b; }
.um-email { font-size: 0.78rem; color: #94a3b8; }

.um-perm-strip { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.um-perm {
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 0.66rem;
    font-weight: 600;
    background: #dcfce7;
    color: #15803d;
}

.um-row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.um-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.um-status-active    { background: #dcfce7; color: #15803d; }
.um-status-pending   { background: #fef9c3; color: #854d0e; }
.um-status-suspended { background: #fee2e2; color: #991b1b; }

.um-edit-btn {
    padding: 5px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.um-edit-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ── Drawer overlay ── */
.um-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    z-index: 9000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
@media (min-width: 600px) {
    .um-drawer-overlay { align-items: center; }
}

.um-drawer {
    background: #fff;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
}
@media (min-width: 600px) {
    .um-drawer { border-radius: 16px; max-height: 80vh; }
}

.um-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.um-drawer-close {
    width: 30px; height: 30px;
    border: none; background: #f1f5f9;
    border-radius: 50%;
    font-size: 0.85rem; color: #475569;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.um-drawer-close:hover { background: #e2e8f0; }

.um-drawer-body { padding: 20px 24px 32px; }

/* ── Form styles ── */
.um-form { display: flex; flex-direction: column; gap: 16px; }
.um-label { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; font-weight: 600; color: #475569; }
.um-input {
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #0f172a;
    transition: border-color 0.15s;
}
.um-input:focus { outline: none; border-color: var(--color-primary); }

.um-perm-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.um-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}
.um-check-label input[type="checkbox"] { accent-color: var(--color-primary); width: 16px; height: 16px; cursor: pointer; }

.um-suspend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid #f1f5f9;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}
.um-toggle-suspend-btn {
    padding: 6px 14px;
    border-radius: 7px;
    border: none;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.um-suspend   { background: #fee2e2; color: #991b1b; }
.um-unsuspend { background: #dcfce7; color: #15803d; }

.um-form-err { color: #ef4444; font-size: 0.78rem; padding: 6px 10px; background: #fef2f2; border-radius: 6px; }

.um-submit-btn {
    padding: 11px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.um-submit-btn:hover { background: var(--primary-hover); }
.um-submit-btn:disabled { background: #94a3b8; cursor: not-allowed; }

.um-remove-btn {
    padding: 10px;
    background: #fee2e2;
    color: #991b1b;
    border: none;
    border-radius: 9px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: -4px;
}
.um-remove-btn:hover { background: #fecaca; }

/* ── Invite success ── */
.um-success { text-align: center; }
.um-success-icon { font-size: 2.5rem; color: #15803d; margin-bottom: 10px; }
.um-success p { font-size: 0.85rem; color: #374151; margin: 0 0 14px; }
.um-setup-link { display: flex; gap: 8px; }
.um-copy-btn {
    padding: 8px 14px;
    background: var(--color-primary); color: #fff;
    border: none; border-radius: 8px;
    font-size: 0.8rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
}
.um-note { font-size: 0.75rem; color: #94a3b8; margin: 10px 0 0; }

/* ── WhatsApp UI elements ─────────────────────────────────── */

/* Orders page strip */
.rt-wa-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 12px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-size: 0.78rem;
    color: #15803d;
    font-weight: 600;
}
.rt-wa-strip svg { stroke: #16a34a; flex-shrink: 0; }

/* Invite form note */
.um-wa-invite-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #15803d;
    font-weight: 600;
    margin-bottom: 16px;
}
.um-wa-invite-note svg { stroke: #16a34a; flex-shrink: 0; }

.um-field-hint { font-size: 0.72rem; color: #94a3b8; margin-top: 3px; font-weight: 400; }
.um-optional   { font-size: 0.72rem; color: #94a3b8; font-weight: 400; }

/* Invite success — WhatsApp pending card */
.um-wa-pending {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 12px;
    margin: 14px 0;
    text-align: left;
}
.um-wa-pending-title { font-size: 0.82rem; font-weight: 700; color: #15803d; }
.um-wa-pending-sub   { font-size: 0.78rem; color: #166534; margin-top: 2px; }

/* ── Admin "Create User" form ────────────────────────────────── */
.um-pw-row { display: flex; gap: 8px; }
.um-pw-row .um-input { flex: 1; font-family: 'SFMono-Regular', Consolas, monospace; }
.um-pw-gen-btn {
    padding: 0 14px;
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.um-pw-gen-btn:hover { background: #e2e8f0; }

/* ── Create-user success — credentials handoff ───────────────── */
.um-credentials-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    margin: 14px 0;
    text-align: left;
}
.um-cred-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.um-cred-row span { color: #64748b; font-weight: 600; }
.um-cred-row strong { color: #0f172a; font-family: 'SFMono-Regular', Consolas, monospace; font-size: 0.9rem; }
