:root {
    /* Resend-inspired obsidian rail + luminous warm-white workspace */
    --rail-bg: #0b0c0f;
    --rail-bg-elevated: #14161b;
    --rail-border: rgba(255, 255, 255, 0.08);
    --rail-hover: rgba(255, 255, 255, 0.06);
    --rail-active: rgba(255, 255, 255, 0.11);
    --rail-text: #f4f4f5;
    --rail-text-muted: #9ca3af;
    --rail-text-faint: #6b7280;

    --bg: #ffffff;
    --bg-canvas: #f7f8fa;
    --bg-subtle: #f3f4f6;
    --bg-hover: #f5f6f8;
    --bg-selected: #f1f4f9;
    --border: #e5e7eb;
    --border-subtle: #eff1f4;
    --text: #0f1115;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;

    --accent: #111318;
    --accent-hover: #232730;
    --emerald: #10b981;
    --blue: #2563eb;
    --amber: #d97706;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --shadow-card: 0 1px 2px rgba(15, 17, 21, 0.04), 0 4px 14px rgba(15, 17, 21, 0.03);
    --shadow-float: 0 12px 32px rgba(15, 17, 21, 0.14);
    --radius: 10px;
    --radius-sm: 7px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted-sm { color: var(--text-muted); font-size: 12px; }
.opt { font-weight: 400; color: var(--text-faint); }
.req { color: var(--danger); }

/* ================= AUTH ================= */
.auth-shell {
    height: 100vh;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: radial-gradient(circle at 50% 0%, #1a1d26 0%, #0b0c0f 65%);
}

.auth-card {
    width: 100%;
    max-width: 396px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 34px 30px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-brand h1 {
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.auth-brand p {
    font-size: 12.5px;
    color: var(--text-muted);
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: linear-gradient(145deg, #272b36 0%, #0f1115 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.brand-icon-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* ================= FULL-BLEED 3-PANE WORKSPACE ================= */
.workspace {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 244px 362px minmax(0, 1fr);
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* ================= TOAST ================= */
.toast {
    position: fixed;
    bottom: 20px;
    right: 22px;
    z-index: 90;
    max-width: 380px;
    padding: 10px 15px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 500;
    background: var(--rail-bg);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-float);
}

.toast.alert-error { background: #991b1b; }
.toast.alert-warning { background: #92400e; }

/* ================= PANE 1: OBSIDIAN LEFT RAIL (RESEND-INSPIRED) ================= */
.rail {
    background: linear-gradient(180deg, #111318 0%, var(--rail-bg) 100%);
    color: var(--rail-text);
    border-right: 1px solid #1d2028;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.rail-header {
    padding: 15px 14px 13px;
    border-bottom: 1px solid var(--rail-border);
}

.rail-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.rail-brand-text { min-width: 0; }

.rail-brand-name {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    line-height: 1.2;
}

.rail-brand-sub {
    font-size: 10.5px;
    color: var(--rail-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.rail-actions {
    padding: 12px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.btn-rail-primary {
    background: #ffffff;
    color: #0b0c0f;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.btn-rail-primary:hover:not(:disabled) {
    background: #f3f4f6;
}

.btn-rail-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.11);
}

.btn-rail-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.rail-scope {
    padding: 4px 12px 10px;
    border-bottom: 1px solid var(--rail-border);
}

.rail-scope-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rail-text-faint);
    margin-bottom: 5px;
}

.rail-scope-select {
    width: 100%;
    height: 32px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--rail-bg-elevated);
    color: #f4f4f5;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    padding: 0 10px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.rail-scope-select:focus,
.rail-scope-select:hover {
    border-color: rgba(255, 255, 255, 0.28);
}

.rail-scope-select option {
    background: #14161b;
    color: #f4f4f5;
}

.rail-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 8px 12px;
}

.rail-section-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.055em;
    color: var(--rail-text-faint);
    padding: 9px 10px 4px;
}

.rail-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rail-item {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--rail-text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 7.5px 10px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.rail-item:hover {
    background: var(--rail-hover);
    color: #ffffff;
}

.rail-item.is-active {
    background: var(--rail-active);
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.rail-item-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.rail-item-left svg {
    color: #71717a;
    flex-shrink: 0;
    transition: color 0.14s ease;
}

.rail-item:hover .rail-item-left svg,
.rail-item.is-active .rail-item-left svg {
    color: #ffffff;
}

.rail-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--rail-text-faint);
    font-variant-numeric: tabular-nums;
}

.rail-item.is-active .rail-count {
    color: #d4d4d8;
}

.rail-count-unread {
    background: #10b981;
    color: #052e16 !important;
    font-weight: 700;
    font-size: 10.5px;
    padding: 0 6px;
    border-radius: 999px;
    line-height: 17px;
}

.rail-count-unread[data-zero="true"] {
    background: transparent;
    color: var(--rail-text-faint) !important;
    padding: 0;
    font-weight: 500;
}

.rail-divider {
    height: 1px;
    background: var(--rail-border);
    margin: 10px 8px 6px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    margin: 0 4px;
}

.dot-neutral { background: #9ca3af; }
.dot-blue { background: #3b82f6; }
.dot-amber { background: #f59e0b; }
.dot-green { background: #10b981; }
.dot-red { background: #ef4444; }

.rail-footer {
    border-top: 1px solid var(--rail-border);
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.22);
}

.rail-sync-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.realtime-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--rail-text-muted);
}

.rt-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b7280;
}

.rt-dot.is-live {
    background: var(--emerald);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.65);
}

.rail-sync-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #d1d5db;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.rail-sync-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.rail-user-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.rail-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rail-user-info {
    min-width: 0;
    flex: 1;
}

.rail-user-name {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail-user-email {
    font-size: 10.5px;
    color: var(--rail-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail-signout-btn {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--rail-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.rail-signout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* ================= PANE 2: MIDDLE LIST ================= */
.list-pane {
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

.list-header {
    padding: 15px 14px 11px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex-shrink: 0;
}

.list-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-title {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.scope-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 1px 8px;
    border-radius: 999px;
}

.member-quick-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    background: var(--bg-subtle);
    padding: 3px;
    border-radius: 8px;
}

.scope-pill {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.14s ease;
}

.scope-pill:hover {
    color: var(--text);
}

.scope-pill.is-active {
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 17, 21, 0.08);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-faint);
    pointer-events: none;
}

.search-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7.5px 10px 7.5px 31px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-canvas);
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
    background: #ffffff;
    border-color: #111318;
    box-shadow: 0 0 0 3px rgba(17, 19, 24, 0.06);
}

.seg-bar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.seg-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.seg-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.seg-btn.is-active {
    background: var(--accent);
    color: #ffffff;
}

/* Status Selector inside All Creators */
.creator-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.creator-filter-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    flex-shrink: 0;
}

.creator-status-select {
    flex: 1;
    min-width: 0;
    height: 31px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 0 9px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.creator-status-select:hover {
    border-color: #cbd5e1;
}

.creator-status-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(17, 19, 24, 0.06);
}

.creator-visible-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-faint);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* ================= REDESIGNED CREATOR CARDS ================= */
.creators-card-list {
    background: var(--bg-canvas);
    padding: 10px 10px 18px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.creator-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 12px 13px 11px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 17, 21, 0.03);
    transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.12s ease;
    flex-shrink: 0;
}

.creator-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(15, 17, 21, 0.06);
}

.creator-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 6px 16px rgba(15, 17, 21, 0.08);
    background: #ffffff;
}

.creator-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 9px;
}

.creator-card-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.creator-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.plat-instagram {
    background: linear-gradient(135deg, #fdf2f8 0%, #fff1f2 100%);
    border-color: #fbcfe8;
    color: #be185d;
}

.plat-youtube {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border-color: #fecaca;
    color: #b91c1c;
}

.plat-tiktok {
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
    border-color: #99f6e4;
    color: #0f766e;
}

.plat-x {
    background: linear-gradient(135deg, #f4f4f5 0%, #e4e4e7 100%);
    border-color: #d4d4d8;
    color: #18181b;
}

.plat-other {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border-color: #c7d2fe;
    color: #4338ca;
}

.creator-card-titles {
    min-width: 0;
    flex: 1;
}

.creator-card-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.creator-card-handle {
    margin-top: 1px;
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.creator-card-email {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-secondary);
    background: var(--bg-canvas);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.creator-card-note {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.creator-card-foot-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.creator-platform-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    padding: 2px 7px;
    border-radius: 5px;
}

.creator-activity-chip {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.st-new { background: #f4f4f5; border-color: #e4e4e7; color: #3f3f46; }
.st-new .status-pill-dot { background: #71717a; }

.st-emailed { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.st-emailed .status-pill-dot { background: #2563eb; }

.st-replied { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.st-replied .status-pill-dot { background: #d97706; }

.st-partnered { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.st-partnered .status-pill-dot { background: #10b981; }

.st-declined { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.st-declined .status-pill-dot { background: #ef4444; }

.list-empty {
    padding: 48px 22px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Conversation & Creator List Rows */
.list-row {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.list-row:hover {
    background: #f9fafb;
}

.list-row.is-selected {
    background: var(--bg-selected);
    box-shadow: inset 2.5px 0 0 var(--accent);
}

.list-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.row-title-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--blue);
    flex-shrink: 0;
}

.row-primary {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-row.is-unread .row-primary,
.list-row.is-unread .row-subject {
    font-weight: 700;
    color: var(--text);
}

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

.row-time {
    font-size: 11px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.star-btn {
    border: none;
    background: transparent;
    color: #d1d5db;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.star-btn:hover,
.star-btn.is-starred {
    color: #eab308;
}

.row-subject {
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-preview {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-meta-line {
    margin-top: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--text-faint);
}

.row-meta-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.row-meta-tag {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Jewel-Toned Restrained Member Tag Chips */
.member-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 1.5px 7px 1.5px 5px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.member-tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mt-0 { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.mt-0 .member-tag-dot { background: #4f46e5; }
.mt-1 { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.mt-1 .member-tag-dot { background: #059669; }
.mt-2 { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.mt-2 .member-tag-dot { background: #d97706; }
.mt-3 { background: #fdf2f8; border-color: #fbcfe8; color: #9d174d; }
.mt-3 .member-tag-dot { background: #db2777; }
.mt-4 { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }
.mt-4 .member-tag-dot { background: #0891b2; }
.mt-unassigned { background: #f3f4f6; border-color: #e5e7eb; color: #6b7280; }
.mt-unassigned .member-tag-dot { background: #9ca3af; }

/* ================= PANE 3: RIGHT WORKSPACE ================= */
.detail-pane {
    background: var(--bg-canvas);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

.detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-glyph {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.detail-empty h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.detail-empty p {
    max-width: 340px;
    font-size: 12.5px;
}

.detail-active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.detail-topbar {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
    background: #ffffff;
}

.detail-topbar-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.detail-heading-wrap { min-width: 0; }

.detail-subject {
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.detail-subline {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    font-size: 12.5px;
}

.detail-sender-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-sender-email {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 29px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.tool-btn:hover {
    background: var(--bg-hover);
    border-color: #d1d5db;
    color: var(--text);
}

.tool-btn.is-starred {
    color: #ca8a04;
    border-color: #fde68a;
    background: #fefce8;
}

.tool-btn-danger:hover {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.creator-strip {
    padding: 8px 24px;
    border-bottom: 1px solid var(--border);
    background: #fbfcfd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    flex-shrink: 0;
}

.creator-strip-left,
.creator-strip-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 6px;
}

.ext-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.ext-link:hover { text-decoration: underline; }

.inline-select {
    height: 29px;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text);
    background: #ffffff;
    cursor: pointer;
    outline: none;
}

.member-assign-select {
    background: #f8fafc;
    border-color: #d1d5db;
}

/* ================= SCROLLABLE FULL-HEIGHT EMAIL THREAD ================= */
.messages-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 26px 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-canvas);
}

.msg-card {
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow-card);
    max-width: 820px;
    width: 100%;
}

.msg-card.is-outbound {
    background: #ffffff;
    border-color: #dfe4ec;
}

.msg-head {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.msg-head:hover {
    background: #fafbfc;
    border-radius: 12px 12px 0 0;
}

.msg-head-left {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text);
}

.msg-avatar-out {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.msg-sender-line {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.msg-sender-addr {
    font-weight: 400;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-left: 4px;
}

.msg-recipient-line {
    font-size: 11.5px;
    color: var(--text-muted);
}

.msg-head-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.msg-time {
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.delivery-tag {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--bg-canvas);
    padding: 1.5px 8px;
    border-radius: 999px;
    text-transform: capitalize;
}

.delivery-delivered {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.delivery-bounced,
.delivery-failed {
    color: var(--danger);
    border-color: var(--danger-border);
    background: var(--danger-bg);
}

.msg-body-wrap {
    padding: 16px 22px 20px 61px;
    border-top: 1px solid var(--border-subtle);
}

.msg-card.is-collapsed .msg-body-wrap { display: none; }

.msg-collapsed-preview {
    display: none;
    padding: 0 18px 13px 61px;
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-card.is-collapsed .msg-collapsed-preview { display: block; }

.msg-text {
    font-size: 14px;
    line-height: 1.72;
    color: #18181b;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-quoted-toggle {
    margin-top: 12px;
    border: 1px solid var(--border);
    background: var(--bg-canvas);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 5px;
    cursor: pointer;
}

.msg-quoted-block {
    margin-top: 8px;
    padding: 10px 12px;
    border-left: 2px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-attachments {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.att-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-canvas);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

.att-chip:hover {
    background: var(--bg-hover);
    border-color: #9ca3af;
}

/* ================= COMPACT EXPANDABLE REPLY DOCK ================= */
.reply-dock {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: #ffffff;
    padding: 12px 26px;
}

.reply-compact-bar {
    width: 100%;
    max-width: 820px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-canvas);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    cursor: text;
    text-align: left;
    transition: all 0.15s ease;
}

.reply-compact-bar:hover {
    border-color: #9ca3af;
    background: #ffffff;
    color: var(--text);
    box-shadow: var(--shadow-card);
}

.reply-compact-kbd {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-faint);
}

.reply-dock.is-compact .reply-expanded { display: none; }
.reply-dock:not(.is-compact) .reply-compact-bar { display: none; }

.reply-expanded {
    max-width: 820px;
    border: 1px solid #d1d5db;
    border-radius: 11px;
    padding: 13px 15px;
    background: #ffffff;
    box-shadow: var(--shadow-card);
}

.reply-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.reply-top-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kbd-hint { font-size: 11px; color: var(--text-faint); }

.reply-expanded textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: vertical;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text);
    min-height: 96px;
    padding: 4px 0;
}

.reply-bottom-row {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.reply-from-field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.reply-name-input {
    width: 124px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4.5px 8px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text);
    outline: none;
}

.reply-name-input:focus { border-color: var(--accent); }

/* ================= CREATOR DETAIL WORKSPACE ================= */
.creator-detail-topbar {
    align-items: center;
}

.cd-hero-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.cd-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.creator-workspace-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 26px 36px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-canvas);
}

.creator-stats-grid {
    max-width: 820px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.creator-stat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 13px 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.creator-stat-val {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 6px;
}

.creator-notes-card {
    max-width: 820px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 14px 18px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.creator-notes-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.kv-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

.kv-value { font-size: 13px; color: var(--text); word-break: break-word; }

.cd-section {
    max-width: 820px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    background: #ffffff;
    box-shadow: var(--shadow-card);
}

.cd-section-head { margin-bottom: 14px; }
.cd-section-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -0.015em; }

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

.cd-thread-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-canvas);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.14s ease, background-color 0.14s ease;
}

.cd-thread-item:hover {
    background: #ffffff;
    border-color: #9ca3af;
}

.tpl-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.tpl-btn {
    padding: 6.5px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.14s ease;
}

.tpl-btn:hover { border-color: #9ca3af; color: var(--text); }

.tpl-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

/* ================= FORMS, BUTTONS & MODALS ================= */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-end { display: flex; justify-content: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.field-hint { font-size: 11.5px; color: var(--text-muted); }

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8.5px 11px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: #ffffff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea { resize: vertical; line-height: 1.65; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(17, 19, 24, 0.06);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 35px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.14s ease;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-sm { height: 31px; padding: 0 12px; font-size: 12px; }

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

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: #d1d5db;
}

.icon-btn-subtle {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn-subtle:hover { background: var(--bg-hover); color: var(--text); }

.alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.alert-error { background: var(--danger-bg); border-color: var(--danger-border); color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 10, 14, 0.55);
    backdrop-filter: blur(4px);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal {
    width: 100%;
    max-width: 530px;
    max-height: 90vh;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-lg { max-width: 630px; }

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

.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.mobile-only { display: none; }

/* ================= RESPONSIVE ================= */
@media (max-width: 1080px) {
    .workspace-grid { grid-template-columns: 214px 312px minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .workspace-grid { grid-template-columns: 1fr; }
    .rail { display: none; }
    .workspace-grid.mobile-reading .list-pane { display: none; }
    .workspace-grid:not(.mobile-reading) .detail-pane { display: none; }
    .mobile-only { display: inline-flex; }
    .form-row-2, .profile-grid { grid-template-columns: 1fr; }
    .msg-body-wrap { padding-left: 18px; }
}
