/* ================================================================
   StaffHub 2.0 — Enterprise theme (company, admin, client portals)
   File: /v2/css/theme-enterprise.css   Version 2.0.0-beta.1 (2026-10-11)

   A layer loaded LAST on each page. It doesn't replace the portal
   stylesheets; it (1) points their CSS variables at one token set and
   (2) restyles the shared components (header, sidebar, buttons, forms,
   tables, cards, modals, badges). Page-specific CSS keeps working.

   Look: neutral slate surfaces, one deep-blue accent, Inter, 8px grid,
   hairline borders rather than heavy shadows, compact readable tables.
   Light only for now — the portals have too many hard-coded whites in
   JS-built markup for a dark mode that doesn't leak.
   ================================================================ */

:root {
    /* ── Tokens ─────────────────────────────────────────── */
    --sh-font:        'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --sh-mono:        'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --sh-accent:      #2950c8;
    --sh-accent-hover:#1f3fa6;
    --sh-accent-soft: #eef2fc;
    --sh-accent-ring: rgba(41, 80, 200, .22);

    --sh-ink:         #0d1424;   /* headings */
    --sh-text:        #1f2737;   /* body */
    --sh-muted:       #5a6474;
    --sh-subtle:      #6b7484;   /* 4.7:1 on white — lightest text allowed */

    --sh-bg:          #f5f6f8;
    --sh-surface:     #ffffff;
    --sh-surface-2:   #f9fafb;
    --sh-hover:       #f2f4f7;
    --sh-border:      #e3e6eb;
    --sh-border-strong:#cfd4dc;

    --sh-success:     #13805b;  --sh-success-soft: #e8f5ef;
    --sh-warning:     #b45309;  --sh-warning-soft: #fdf3e5;
    --sh-danger:      #c0352b;  --sh-danger-soft:  #fcebea;
    --sh-info:        #1d6fb8;  --sh-info-soft:    #e8f1fa;

    --sh-r-sm: 6px;  --sh-r: 8px;  --sh-r-lg: 12px;
    --sh-shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --sh-shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
    --sh-shadow-lg: 0 20px 40px -8px rgba(16, 24, 40, .18);

    /* ── company-dashboard.css variables ───────────────── */
    --primary:        var(--sh-accent);
    --primary-dark:   var(--sh-accent-hover);
    --primary-light:  var(--sh-accent-soft);
    --secondary:      var(--sh-muted);
    --success-color:  var(--sh-success);
    --warning-color:  var(--sh-warning);
    --danger-color:   var(--sh-danger);
    --info-color:     var(--sh-info);
    --bg-color:       var(--sh-bg);
    --card-bg:        var(--sh-surface);
    --text-color:     var(--sh-text);
    --text-muted:     var(--sh-muted);
    --border-color:   var(--sh-border);
    --sidebar-bg:     var(--sh-surface);
    --sidebar-text:   #3d4656;
    --sidebar-active: var(--sh-accent);
    --header-height:  56px;
    --sidebar-width:  248px;
    --transition:     .15s ease;

    /* ── admin.css variables ───────────────────────────── */
    --success:        var(--sh-success);
    --success-light:  var(--sh-success-soft);
    --warning:        var(--sh-warning);
    --warning-light:  var(--sh-warning-soft);
    --danger:         var(--sh-danger);
    --danger-light:   var(--sh-danger-soft);
    --info:           var(--sh-info);
    --info-light:     var(--sh-info-soft);
    --text-dark:      var(--sh-ink);
    --text-mid:       var(--sh-text);
    --text-light:     var(--sh-muted);
    --border:         var(--sh-border);
    --border-light:   var(--sh-hover);
    --bg-page:        var(--sh-bg);
    --bg-card:        var(--sh-surface);
    --radius-sm:      var(--sh-r-sm);
    --radius-md:      var(--sh-r);
    --radius-lg:      var(--sh-r-lg);
    --shadow-sm:      var(--sh-shadow-xs);
    --shadow-md:      var(--sh-shadow-xs);
    --shadow-lg:      var(--sh-shadow-md);
    --shadow-xl:      var(--sh-shadow-lg);
    --mono:           var(--sh-mono);

    /* ── client-portal.css variables ───────────────────── */
    --ink:     var(--sh-ink);
    --shell:   #111a2e;
    --shell-2: #1a2540;
    --shell-3: #26324f;
    --paper:   var(--sh-bg);
    --card:    var(--sh-surface);
    --line:    var(--sh-border-strong);
    --line-soft: var(--sh-border);
    --on:      var(--sh-success);
    --warn:    var(--sh-warning);
    --crit:    var(--sh-danger);
    --display: var(--sh-font);
    --body:    var(--sh-font);
    --r:       var(--sh-r);
}

/* ── Base ─────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--sh-font) !important;
    font-feature-settings: 'cv11', 'ss01', 'tnum' 0;
    color: var(--sh-text);
    background: var(--sh-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
}
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, h4 { color: var(--sh-ink); letter-spacing: -0.015em; }
code, kbd, pre, .mono { font-family: var(--sh-mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--sh-accent); outline-offset: 2px; }
::selection { background: var(--sh-accent-soft); }
table td, .stat-value, .stat-number, .amount, .money { font-variant-numeric: tabular-nums; }

/* ── Top bar (company) / header (admin) ─────────────────────── */
.dashboard-header {
    background: var(--sh-surface);
    border-bottom: 1px solid var(--sh-border);
    box-shadow: none;
}
.dashboard-header .header-content { padding: 0 20px; }
.dashboard-header .logo img { height: 46px; display: block; }
.dashboard-header .user-name { font-weight: 600; font-size: .875rem; color: var(--sh-ink); }
.dashboard-header .company-name { font-size: .75rem; color: var(--sh-muted); }
.notification-bell {
    width: 36px; height: 36px; border-radius: var(--sh-r);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--sh-muted); background: transparent; border: 1px solid transparent;
}
.notification-bell:hover { background: var(--sh-hover); color: var(--sh-ink); }
.btn-logout {
    background: var(--sh-surface) !important; color: var(--sh-text) !important;
    border: 1px solid var(--sh-border) !important; border-radius: var(--sh-r) !important;
    font-weight: 500; font-size: .8125rem; padding: 7px 12px !important; box-shadow: none !important;
}
.btn-logout:hover { background: var(--sh-hover) !important; }

/* ── Sidebar (company) ───────────────────────────────────── */
.sidebar {
    background: var(--sh-surface);
    border-right: 1px solid var(--sh-border);
}
.sidebar-content { padding: 12px 10px; }
.nav-item {
    border-left: 0;
    border-radius: var(--sh-r-sm);
    padding: 7px 10px;
    min-height: 36px;
    margin: 1px 0;
    font-size: .8438rem;
    font-weight: 500;
    gap: 10px;
    color: var(--sidebar-text);
}
.nav-item:visited { color: var(--sidebar-text); }
.nav-item i { font-size: .875rem; width: 18px; color: var(--sh-subtle); }
.nav-item:hover { background: var(--sh-hover); color: var(--sh-ink); }
.nav-item:hover i { color: var(--sh-muted); }
.nav-item.active {
    background: var(--sh-accent-soft);
    color: var(--sh-accent);
    font-weight: 600;
}
.nav-item.active i { color: var(--sh-accent); }
.nav-badge { background: var(--sh-danger); font-size: .6875rem; height: 18px; min-width: 18px; border-radius: 9px; }

/* ── Content area ────────────────────────────────────────── */
.main-content { padding: 28px 32px 48px; }
.section-header { margin-bottom: 20px; align-items: flex-end; }
.section-header h1,
.section-header > div h1 { font-size: 1.375rem; font-weight: 650; color: var(--sh-ink); letter-spacing: -0.02em; }
.section-header p,
.section-header > div p,
.date { font-size: .8125rem; color: var(--sh-muted); }
.content-section.active { animation: none; }

/* ── Cards ───────────────────────────────────────────────── */
.stat-card, .summary-card, .report-card, .activity-card, .form-card, .pending-card,
.card, .content-card, .section-card, .dashboard-card, .panel {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-lg);
    box-shadow: var(--sh-shadow-xs);
}
.stat-card { padding: 16px 18px; gap: 14px; }
.stat-card:hover { transform: none; box-shadow: var(--sh-shadow-xs); border-color: var(--sh-border-strong); }
.stat-icon { width: 40px; height: 40px; border-radius: var(--sh-r); font-size: 1rem; }
.stat-info h3, .stat-value, .stat-number { font-weight: 650; color: var(--sh-ink); letter-spacing: -0.02em; }
.stat-info p, .stat-label { color: var(--sh-muted); font-size: .75rem; font-weight: 500; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    border-radius: var(--sh-r);
    font-size: .8438rem;
    font-weight: 550;
    padding: 0 14px;
    min-height: 36px;
    gap: 6px;
    border: 1px solid transparent;
    box-shadow: var(--sh-shadow-xs);
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn i { font-size: .8125rem; }
.btn:active { transform: none; }
.btn-primary,  .btn-primary:hover  { background: var(--sh-accent); color: #fff; box-shadow: var(--sh-shadow-xs); }
.btn-primary:hover  { background: var(--sh-accent-hover); }
.btn-secondary, .btn-outline, .btn-light {
    background: var(--sh-surface); color: var(--sh-text); border-color: var(--sh-border-strong);
}
.btn-secondary:hover, .btn-outline:hover, .btn-light:hover { background: var(--sh-hover); box-shadow: var(--sh-shadow-xs); }
.btn-success { background: var(--sh-success); color: #fff; }
.btn-success:hover { background: #0f6b4c; box-shadow: var(--sh-shadow-xs); }
.btn-danger  { background: var(--sh-danger);  color: #fff; }
.btn-danger:hover  { background: #a32c23; box-shadow: var(--sh-shadow-xs); }
.btn-warning { background: var(--sh-warning); color: #fff; }
.btn-sm, .btn-small { min-height: 30px; padding: 0 10px; font-size: .78rem; }
.btn-icon-only, .btn-icon {
    border-radius: var(--sh-r-sm);
    border: 1px solid transparent;
    transition: background .12s, border-color .12s;
}
.btn-icon-only:hover, .btn-icon:hover { background: var(--sh-hover); border-color: var(--sh-border); }
.btn:disabled, .btn[disabled] { opacity: .5; box-shadow: none; }

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-input, .form-select,
input[type="text"]:not([class]), input[type="email"]:not([class]), input[type="number"]:not([class]),
input[type="date"]:not([class]), input[type="search"]:not([class]), select:not([class]), textarea:not([class]) {
    border: 1px solid var(--sh-border-strong);
    border-radius: var(--sh-r);
    background: var(--sh-surface);
    color: var(--sh-text);
    font-size: .875rem;
    min-height: 36px;
    padding: 7px 10px;
    box-shadow: var(--sh-shadow-xs);
    transition: border-color .12s, box-shadow .12s;
}
textarea.form-control, textarea:not([class]) { min-height: 72px; }
.form-control:focus, .form-input:focus, .form-select:focus,
input:not([class]):focus, select:not([class]):focus, textarea:not([class]):focus {
    outline: none;
    border-color: var(--sh-accent);
    box-shadow: 0 0 0 3px var(--sh-accent-ring);
}
.form-control::placeholder { color: var(--sh-subtle); }
.form-control:invalid:not(:placeholder-shown),
.form-control:valid:not(:placeholder-shown) { border-color: var(--sh-border-strong); }
.form-group label, .filter-group label {
    font-size: .78rem; font-weight: 550; color: var(--sh-text); letter-spacing: 0; text-transform: none;
}
.filter-bar, .filters {
    background: var(--sh-surface); border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-lg); box-shadow: var(--sh-shadow-xs);
}

/* ── Tables ──────────────────────────────────────────────── */
.data-table-container, .table-container, .table-responsive {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-lg);
    box-shadow: var(--sh-shadow-xs);
}
.data-table th, .data-table td { padding: 10px 14px; font-size: .8125rem; border-bottom-color: var(--sh-border); }
.data-table th {
    background: var(--sh-surface-2);
    color: var(--sh-muted);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
}
.data-table tbody tr:hover { background: var(--sh-surface-2); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 8px;
    letter-spacing: .01em;
    border: 1px solid transparent;
}
.badge-success { background: var(--sh-success-soft); color: var(--sh-success); border-color: #c4e6d6; }
.badge-warning { background: var(--sh-warning-soft); color: var(--sh-warning); border-color: #f5dcb8; }
.badge-danger  { background: var(--sh-danger-soft);  color: var(--sh-danger);  border-color: #f3c9c5; }
.badge-info    { background: var(--sh-info-soft);    color: var(--sh-info);    border-color: #c6dcf1; }
.badge-secondary { background: var(--sh-hover); color: var(--sh-muted); border-color: var(--sh-border); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay { background: rgba(13, 20, 36, .45); backdrop-filter: blur(2px); }
.modal, .modal-content {
    border-radius: var(--sh-r-lg);
    border: 1px solid var(--sh-border);
    box-shadow: var(--sh-shadow-lg);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--sh-border); }
.modal-header h2, .modal-header h3 { font-size: 1rem; font-weight: 650; color: var(--sh-ink); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--sh-border); background: var(--sh-surface-2); }
.modal-close { border-radius: var(--sh-r-sm); color: var(--sh-muted); }
.modal-close:hover { background: var(--sh-hover); }

/* ── Tabs (admin / section tabs) ─────────────────────────── */
.tab-btn, .tab-button, .sub-tab, .section-tab {
    font-weight: 550; font-size: .8125rem; color: var(--sh-muted);
}
.tab-btn.active, .tab-button.active, .sub-tab.active, .section-tab.active { color: var(--sh-accent); }

/* ── Empty / loading / toast ─────────────────────────────── */
.empty-state { color: var(--sh-muted); }
.spinner, .loading-spinner { border-top-color: var(--sh-accent) !important; }
.toast { border-radius: var(--sh-r); box-shadow: var(--sh-shadow-md); font-size: .8438rem; }

/* ── Admin dashboard header ──────────────────────────────── */
body > .header, .container > .header {
    background: var(--sh-surface);
    border-bottom: 1px solid var(--sh-border);
    box-shadow: none;
}

/* ── Scrollbars (desktop) ────────────────────────────────── */
@media (hover: hover) {
    ::-webkit-scrollbar { width: 10px; height: 10px; }
    ::-webkit-scrollbar-thumb { background: #d3d8df; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
    ::-webkit-scrollbar-thumb:hover { background-color: #b9c0ca; }
    ::-webkit-scrollbar-track { background: transparent; }
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-content { padding: 16px; }
    .sidebar { box-shadow: var(--sh-shadow-lg); }
    .btn { min-height: 40px; }
    .nav-item { min-height: 42px; }
}

/* ── Section titles inside the content area ──────────────── */
.main-content .section-header h2,
.main-content .content-section > h2,
.main-content .section-title,
.main-content .dashboard-section h2,
.main-content .card-header h2, .main-content .card-header h3 {
    font-size: 1.0625rem; font-weight: 650; color: var(--sh-ink); letter-spacing: -0.01em;
}
