/* ============================================
   QAF Internal Portal — Dark Navy + Champagne Gold
   Premium Corporate Real-Estate CRM Theme
   ============================================ */

:root {
    /* Brand colours */
    --brand-navy: #111827;            /* Sidebar / header deep navy */
    --brand-navy-mid: #1f2937;        /* Slightly lighter navy */
    --brand-navy-soft: #374151;       /* Borders / dividers */
    --brand-gold: #C9A227;            /* Champagne gold (primary) */
    --brand-gold-dark: #A98516;       /* Gold hover */
    --brand-gold-light: #E5C158;      /* Gold highlight */

    /* Status colours (kept separate from gold) */
    --status-green: #16A34A;
    --status-blue: #2563EB;
    --status-amber: #D97706;
    --status-purple: #7C3AED;
    --status-red: #DC2626;
    --status-gray: #6B7280;

    /* Neutrals */
    --bg-warm: #F5F4F1;               /* Main workspace background */
    --white: #FFFFFF;                  /* Cards / content */
    --text-main: #1F2937;              /* Charcoal */
    --text-secondary: #6B7280;         /* Slate gray */
    --border-soft: #E5E7EB;            /* Soft borders */

    /* Gradients */
    --grad-gold: linear-gradient(135deg, #C9A227 0%, #A98516 100%);
    --grad-gold-bright: linear-gradient(135deg, #E5C158 0%, #C9A227 100%);
    --grad-sidebar: linear-gradient(180deg, #111827 0%, #0a0f1a 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-gold: 0 8px 24px rgba(201, 162, 39, 0.3);

    /* Misc */
    --t-base: 0.2s ease;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --side-w: 260px;
    --header-h: 60px;
}

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

html, body { height: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background: var(--bg-warm);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; color: inherit; font-family: inherit; }
ul { list-style: none; }
input, select, textarea {
    font-family: inherit; font-size: 14px; color: var(--text-main);
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
    transition: all var(--t-base); outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
    background: var(--white);
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary);
       text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
select option { background: var(--white); color: var(--text-main); }

/* ============================================
   Layout — Sidebar + Main (Clean Light Theme)
   ============================================ */
.portal-layout {
    display: grid;
    grid-template-columns: var(--side-w) 1fr;
    grid-template-rows: 100vh;
    background: var(--bg-warm);
    align-items: stretch;
}

.main-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-warm);
}

.main-col > main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 28px 32px;
}

.sidebar {
    position: sticky; top: 0; align-self: start;
    height: 100vh;
    background: var(--grad-sidebar);
    border-right: 1px solid #1a2333;
    padding: 20px 14px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 8px 18px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.15);
    margin-bottom: 12px;
}
.sidebar-brand .logo-mark {
    width: 38px; height: 38px; border-radius: 9px;
    background: var(--grad-gold);
    display: flex; align-items: center; justify-content: center;
    color: #111827; font-family: 'Playfair Display', serif;
    font-weight: 800; font-size: 18px;
    box-shadow: var(--shadow-gold);
}
.sidebar-brand .logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar-brand .logo-text strong { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 15px; color: var(--white); }
.sidebar-brand .logo-text small  { font-size: 9.5px; color: var(--brand-gold); letter-spacing: 1.2px; text-transform: uppercase; }

.nav-section { font-size: 10.5px; color: rgba(255, 255, 255, 0.4); font-weight: 700;
               letter-spacing: 1.4px; text-transform: uppercase; padding: 12px 10px 5px;
               display: flex; align-items: center; gap: 6px; cursor: default; }
.nav-section.collapsible { cursor: pointer; user-select: none; transition: color 0.15s;
                          position: relative; padding-right: 28px; }
.nav-section.collapsible:hover { color: rgba(255, 255, 255, 0.7); }
.nav-section .count { background: rgba(201, 162, 39, 0.25); color: var(--brand-gold-light);
                     padding: 1px 6px; border-radius: 8px; font-size: 9.5px; min-width: 18px; text-align: center; }
.nav-section .chev { width: 12px; height: 12px; position: absolute; right: 10px; top: 50%;
                    transform: translateY(-50%) rotate(90deg); opacity: 0.6;
                    transition: transform 0.2s; flex-shrink: 0; pointer-events: none; }
.nav-section.collapsed .chev { transform: translateY(-50%) rotate(0deg); }
.nav-section-items { display: block; }
.nav-section-items.collapsed { display: none; }
.sidebar-search { padding: 8px 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.05);
                  display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.15); }
.sidebar-search input { background: transparent; border: none; padding: 0; font-size: 12.5px;
                        color: #fff; flex: 1; }
.sidebar-search input::placeholder { color: rgba(255,255,255,0.4); }
.sidebar-search input:focus { box-shadow: none; outline: none; }
.main-col main { transition: opacity 0.15s; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: 8px;
    color: rgba(255, 255, 255, 0.7); font-size: 13.5px; font-weight: 500;
    transition: all var(--t-base); cursor: pointer;
    border-left: 3px solid transparent;
}
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--white); }
.nav-item.active {
    background: rgba(201, 162, 39, 0.12);
    color: var(--brand-gold-light);
    border-left-color: var(--brand-gold);
    font-weight: 600;
}
.nav-item .badge { margin-left: auto; background: var(--brand-gold); color: #111827; font-size: 10px; font-weight: 700;
                    padding: 2px 7px; border-radius: 10px; min-width: 18px; text-align: center; }
.nav-item .badge.hidden { display: none; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

.user-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    margin-bottom: 8px;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--grad-gold); color: #111827;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(201, 162, 39, 0.4);
}
.user-pill .name  { font-size: 13px; font-weight: 600; color: var(--white); line-height: 1.1; }
.user-pill .role  { font-size: 10.5px; color: var(--brand-gold); letter-spacing: 1px; text-transform: uppercase; }

/* ============================================
   Top header (above main content)
   ============================================ */
.topbar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    flex-shrink: 0;
}
.topbar .search {
    flex: 1; max-width: 480px;
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-warm);
    border: 1px solid var(--border-soft);
    border-radius: 8px; padding: 8px 14px;
}
.topbar .search input {
    border: none; background: transparent; padding: 0; font-size: 13.5px;
}
.topbar .search input:focus { box-shadow: none; }
.topbar .icon-btn {
    width: 38px; height: 38px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); background: var(--bg-warm);
    border: 1px solid var(--border-soft);
    position: relative; cursor: pointer; transition: all var(--t-base);
}
.topbar .icon-btn:hover { background: var(--white); color: var(--brand-gold); border-color: var(--brand-gold); }
.topbar .icon-btn .dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--status-red); border: 2px solid var(--white);
}
.topbar .menu-btn {
    display: none; width: 38px; height: 38px; border-radius: 8px;
    align-items: center; justify-content: center;
    background: var(--white); border: 1px solid var(--border-soft);
    color: var(--text-main);
}

/* ============================================
   Main content area
   ============================================ */
.main { padding: 28px 32px; min-width: 0; }

.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
}
.page-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.6rem, 2.8vw, 2.1rem); font-weight: 700;
    color: var(--brand-navy); letter-spacing: -0.5px; line-height: 1.1;
}
.page-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

.eyebrow {
    display: inline-block; color: var(--brand-gold-dark);
    font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
    padding: 5px 12px; border-radius: 30px;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    margin-bottom: 10px;
}

/* ============================================
   Cards
   ============================================ */
.glass {
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex; flex-direction: column; gap: 6px;
    transition: all var(--t-base);
    box-shadow: var(--shadow-sm);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--brand-gold); }
.stat-card .label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; }
.stat-card .value { font-family: 'Playfair Display', serif; font-size: 32px; font-weight: 700;
                    color: var(--brand-navy); line-height: 1.05; }
.stat-card .value.gold { color: var(--brand-gold-dark); }
.stat-card .sub { font-size: 12px; color: var(--text-secondary); }
.stat-card .ico { position: absolute; top: 16px; right: 16px; opacity: 0.6; color: var(--brand-gold); }
.stat-card .ico svg { width: 28px; height: 28px; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ============================================
   Tables
   ============================================ */
.table-wrap { background: var(--white); border: 1px solid var(--border-soft);
              border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; color: var(--text-main); }
th, td { padding: 12px 16px; text-align: left; vertical-align: middle; }
th { background: #f9fafb; color: var(--text-secondary); font-size: 11px;
     text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
     border-bottom: 1px solid var(--border-soft); }
tbody tr { border-top: 1px solid var(--border-soft); transition: background var(--t-base); }
tbody tr:hover { background: #fafafa; }
td a { color: var(--brand-gold-dark); font-weight: 600; }
td a:hover { text-decoration: underline; }
td .muted { color: var(--text-secondary); font-size: 12.5px; }
td .right { text-align: right; }

/* ============================================
   Status / role badges
   ============================================ */
.badge-status, .badge-role {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 30px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
    background: rgba(0,0,0,0.04);
}
.badge-status { color: var(--status-color, var(--status-gray)); background: color-mix(in srgb, var(--status-color, var(--status-gray)) 12%, transparent); }
.badge-role-ADMIN    { color: #b91c1c; background: rgba(220, 38, 38, 0.1); }
.badge-role-MANAGER  { color: #7c3aed; background: rgba(124, 58, 237, 0.1); }
.badge-role-BROKER   { color: #2563eb; background: rgba(37, 99, 235, 0.1); }
.badge-role-FINANCIAL{ color: #c2410c; background: rgba(194, 65, 12, 0.1); }
.badge-role-HR       { color: #0e7490; background: rgba(14, 116, 144, 0.1); }

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
    letter-spacing: 0.3px; cursor: pointer;
    transition: all var(--t-base); border: 1px solid transparent;
    text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--brand-gold); color: #111827; font-weight: 700;
               box-shadow: 0 2px 6px rgba(201, 162, 39, 0.3); }
.btn-primary:hover { background: var(--brand-gold-dark); color: var(--white); transform: translateY(-1px);
                    box-shadow: 0 4px 12px rgba(201, 162, 39, 0.5); }
.btn-ghost { background: var(--white); color: var(--text-main); border-color: var(--border-soft); }
.btn-ghost:hover { background: var(--bg-warm); border-color: var(--brand-gold); color: var(--brand-gold-dark); }
.btn-danger { background: var(--white); color: #b91c1c; border-color: rgba(220, 38, 38, 0.3); }
.btn-danger:hover { background: rgba(220, 38, 38, 0.05); border-color: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-block { width: 100%; }

/* ============================================
   Form layout
   ============================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-card { padding: 28px; }
.form-card h3 { font-family: 'Playfair Display', serif; font-size: 18px; margin-bottom: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end; }

/* ============================================
   Filters
   ============================================ */
.filters {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
    padding: 14px 16px; margin-bottom: 18px;
    background: var(--white); border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.filters input, .filters select { padding: 8px 12px; font-size: 13px; min-width: 140px; }
.filters .search-input { flex: 1; min-width: 240px; }

/* ============================================
   Toast
   ============================================ */
.toast {
    position: fixed; bottom: 32px; right: 32px; z-index: 9999;
    padding: 14px 22px; border-radius: 10px; font-size: 14px; font-weight: 500;
    background: var(--white); color: var(--text-main);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-lg);
    opacity: 0; transform: translateY(20px); transition: all var(--t-base);
    pointer-events: none; max-width: 380px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 4px solid var(--status-green); }
.toast-error   { border-left: 4px solid var(--status-red); }

/* ============================================
   Misc
   ============================================ */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-secondary);
    font-size: 14px;
}
.empty-state .ico { font-size: 48px; opacity: 0.4; margin-bottom: 12px; }

.flex { display: flex; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.between { justify-content: space-between; }
.center  { justify-content: center; }
.items-center { align-items: center; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.text-gold { color: var(--brand-gold-dark); }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12.5px; }
.font-bold { font-weight: 700; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 30px; font-size: 11px; font-weight: 600;
       background: rgba(201, 162, 39, 0.1); color: var(--brand-gold-dark);
       border: 1px solid rgba(201, 162, 39, 0.3); }

/* ============================================
   Chat layout
   ============================================ */
.chat-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 18px; height: calc(100vh - 140px); }
.chat-list { background: var(--white); border: 1px solid var(--border-soft);
             border-radius: var(--radius-md); padding: 12px; overflow-y: auto; }
.chat-list h4 { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1.5px;
               padding: 8px 10px; margin: 4px 0; }
.chat-room { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
             border-radius: 8px; cursor: pointer; transition: all var(--t-base); }
.chat-room:hover { background: var(--bg-warm); }
.chat-room.active { background: rgba(201, 162, 39, 0.1); border-left: 3px solid var(--brand-gold); }
.chat-room .av { width: 32px; height: 32px; border-radius: 50%; background: var(--grad-gold); color: #111827;
                 display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px; flex-shrink: 0; }
.chat-room .meta { flex: 1; min-width: 0; }
.chat-room .name { font-size: 13.5px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room .preview { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room .unread { background: var(--brand-gold); color: #111827; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 10px; }
.chat-room .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chat-room .dot.online { background: var(--status-green); box-shadow: 0 0 8px rgba(22, 163, 74, 0.4); }
.chat-room .dot.offline { background: var(--text-secondary); }

.chat-panel { display: flex; flex-direction: column;
              background: var(--white); border: 1px solid var(--border-soft);
              border-radius: var(--radius-md); overflow: hidden; }
.chat-head { padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
             display: flex; align-items: center; justify-content: space-between; }
.chat-head h3 { font-size: 16px; color: var(--text-main); }
.chat-head .meta { font-size: 12px; color: var(--text-secondary); }
.chat-msgs { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
             background: var(--bg-warm); }
.chat-bubble { max-width: 75%; padding: 12px 16px; border-radius: 14px; background: var(--white);
               border: 1px solid var(--border-soft); font-size: 14px; line-height: 1.5; color: var(--text-main); }
.chat-bubble.me { align-self: flex-end; background: var(--brand-gold);
                   border-color: var(--brand-gold); color: #111827; font-weight: 500; }
.chat-bubble .who { font-size: 11px; color: var(--brand-gold-dark); font-weight: 700; margin-bottom: 4px; }
.chat-bubble .when { font-size: 10px; color: var(--text-secondary); margin-top: 4px; text-align: right; }
.chat-input { padding: 14px 18px; border-top: 1px solid var(--border-soft);
              display: flex; gap: 10px; align-items: center; background: var(--white); }
.chat-input input { flex: 1; }

/* ============================================
   Case detail layout
   ============================================ */
.case-head-card { display: flex; align-items: center; gap: 20px; padding: 22px 26px; margin-bottom: 20px; }
.case-head-card .id { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 700;
                      color: var(--brand-gold-dark); }
.case-head-card .title { font-size: 14px; color: var(--text-secondary); }
.case-detail { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.case-detail .full { grid-column: 1 / -1; }
.section-h {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 12px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}
.section-h h2 { font-family: 'Playfair Display', serif; font-size: 17px; color: var(--brand-navy); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-secondary); }
.kv dd { color: var(--text-main); font-weight: 500; }

.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-item { display: flex; gap: 12px; padding: 12px; border-radius: 10px;
                 background: var(--bg-warm); border: 1px solid var(--border-soft); }
.timeline-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-gold);
                       margin-top: 7px; box-shadow: 0 0 6px rgba(201, 162, 39, 0.4); flex-shrink: 0; }
.timeline-item .body { flex: 1; }
.timeline-item .action { font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.timeline-item .when { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.timeline-item .details { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px;
                          font-family: ui-monospace, monospace; background: var(--white);
                          padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-soft); }

.match-card { padding: 16px; border: 1px solid var(--border-soft); border-radius: 12px;
              background: var(--bg-warm); margin-bottom: 12px; }
.match-card .price { color: var(--brand-gold-dark); font-weight: 700; font-size: 16px; }
.match-card .meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.match-card a { color: var(--brand-gold-dark); font-size: 12px; font-weight: 600; }

.comment { display: flex; gap: 12px; padding: 12px; border-radius: 10px;
           background: var(--bg-warm); border: 1px solid var(--border-soft);
           margin-bottom: 10px; }
.comment .who { font-size: 13px; font-weight: 700; color: var(--brand-gold-dark); }
.comment .when { font-size: 11px; color: var(--text-secondary); margin-left: 8px; }
.comment .text { font-size: 13.5px; color: var(--text-main); margin-top: 4px; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ============================================
   Permissions grid
   ============================================ */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.perm-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
             border: 1px solid var(--border-soft); border-radius: 8px; background: var(--white); }
.perm-item input[type="checkbox"] { width: auto; }
.perm-item label { margin: 0; cursor: pointer; font-size: 13px; color: var(--text-main); text-transform: none; letter-spacing: 0; }

/* ============================================
   Mobile (responsive)
   ============================================ */
@media (max-width: 1024px) {
    :root { --side-w: 220px; }
    .case-detail { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .chat-wrap { grid-template-columns: 1fr; height: auto; }
    .chat-list { max-height: 200px; }
}
@media (max-width: 768px) {
    .portal-layout { grid-template-columns: 1fr; }
    .sidebar { position: fixed; top: 0; left: -100%; width: 260px; z-index: 200; transition: left var(--t-base); }
    .sidebar.open { left: 0; }
    .main { padding: 24px 18px; }
    .topbar .menu-btn { display: flex; }
    .topbar { padding: 0 18px; }
}
.menu-toggle {
    display: none; position: fixed; top: 16px; left: 16px; z-index: 300;
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--brand-navy); border: 1px solid var(--brand-gold);
    align-items: center; justify-content: center; cursor: pointer;
    color: var(--white);
}
@media (max-width: 768px) { .menu-toggle { display: flex; } }

/* ============================================
   Modal (employee form, role editor, etc.)
   ============================================ */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px; overflow-y: auto;
}
.modal {
    background: var(--white);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 28px;
    max-width: 520px; width: 100%;
    box-shadow: var(--shadow-lg);
    position: relative;
}
.modal::before {
    content: ''; position: absolute; top: 0; left: 14px; right: 14px; height: 3px;
    background: var(--grad-gold);
    border-radius: 0 0 4px 4px;
}
.modal-wide { max-width: 680px; }
.modal h3 {
    font-family: 'Playfair Display', serif;
    font-size: 20px; color: var(--brand-navy);
    margin: 0 0 4px; font-weight: 700;
}
.modal label {
    display: block; font-size: 11px; font-weight: 700;
    color: var(--text-secondary); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.modal input, .modal select, .modal textarea {
    width: 100%;
    background: rgba(5, 11, 31, 0.6);
    border: 1px solid rgba(245, 176, 74, 0.25);
    color: var(--white);
    padding: 11px 14px; border-radius: 8px;
    font-size: 14px; font-family: inherit;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 14px;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
    outline: none; border-color: var(--brand-gold);
    background: rgba(5, 11, 31, 0.8);
}
.modal input:disabled { opacity: 0.6; cursor: not-allowed; }
.modal .req { color: #fca5a5; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal .form-grid .full { grid-column: 1 / -1; }
.modal .modal-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 18px; padding-top: 18px;
    border-top: 1px solid rgba(245, 176, 74, 0.12);
}
.modal .hint { color: #64748b; font-size: 11px; margin-top: -8px; margin-bottom: 14px; }

/* ============================================
   Employee ID badge
   ============================================ */
.emp-id {
    display: inline-block;
    background: rgba(245, 176, 74, 0.12);
    color: var(--brand-gold-light);
    padding: 3px 10px; border-radius: 6px;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid rgba(245, 176, 74, 0.3);
}

/* ============================================
   Invite card (shown after creating an employee)
   ============================================ */
.invite-card {
    background: rgba(5, 11, 31, 0.6);
    border: 1px solid rgba(245, 176, 74, 0.2);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
}
.invite-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.invite-row:last-child { border-bottom: none; }
.invite-label { color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.invite-value { color: var(--white); font-weight: 600; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; }

/* ============================================
   Form-card (used in new-case.html and others)
   ============================================ */
.form-card { padding: 28px; }
.form-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px; margin: 0 0 18px;
    color: var(--brand-gold-light);
    border-bottom: 1px solid rgba(245, 176, 74, 0.15);
    padding-bottom: 10px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ============================================
   Misc helpers
   ============================================ */
.info-banner {
    background: rgba(245, 176, 74, 0.08);
    border: 1px solid rgba(245, 176, 74, 0.25);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    color: var(--brand-gold-light);
    font-size: 13px;
    line-height: 1.6;
}
.info-banner strong { color: var(--white); display: block; margin-bottom: 6px; font-size: 14px; }
.tag {
    display: inline-block;
    padding: 3px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase;
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-role {
    display: inline-block;
    padding: 4px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-role-ADMIN    { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-role-MANAGER  { background: rgba(168, 85, 247, 0.15); color: #c4b5fd; border: 1px solid rgba(168, 85, 247, 0.35); }
.badge-role-BROKER   { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-role-FINANCIAL{ background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.35); }
