/* ============================================================
   Klinix Capital Insurance — CRM & Portal Design System
   Brand-aligned: professional healthcare insurance aesthetic
   Layout: sidebar + top bar (per CRM spec Section 3.1)
   ============================================================ */

/* Google Fonts — match the professional, authoritative tone of the main site */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties (Design Tokens) ── */
:root {
    /* Brand colors — derived from KlinixCapitalInsurance.com */
    --brand-primary: #1B4D6E;        /* Deep teal-blue — CTA fill, sidebar bg */
    --brand-primary-hover: #15405C;
    --brand-primary-light: #2A6A8F;
    --brand-accent: #2E8B7A;          /* Teal-green — links, active states */
    --brand-accent-hover: #247A6A;
    --brand-accent-light: #E8F5F2;

    /* Portal surfaces — neutral, information-dense */
    --bg-app: #F4F6F8;               /* Portal background */
    --bg-card: #FFFFFF;              /* Cards */
    --bg-sidebar: #0F2D3F;          /* Dark sidebar */
    --bg-sidebar-hover: #183A4F;
    --bg-sidebar-active: #1B4D6E;
    --bg-topbar: #FFFFFF;

    /* Borders */
    --border-subtle: #E2E6EA;
    --border-medium: #CED4DA;
    --border-focus: var(--brand-accent);

    /* Text */
    --text-primary: #1A1D21;
    --text-secondary: #4A5568;
    --text-muted: #8895A7;
    --text-inverse: #FFFFFF;
    --text-sidebar: #B0BEC5;
    --text-sidebar-active: #FFFFFF;

    /* Status colors */
    --success: #0D8A5E;
    --success-bg: #E6F7EF;
    --warning: #C17F24;
    --warning-bg: #FEF5E7;
    --danger: #C53030;
    --danger-bg: #FEE8E8;
    --info: #2B6CB0;
    --info-bg: #E8F0FE;

    /* Typography */
    --font-primary: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Sizing (per CRM spec Section 3.2) */
    --text-xs: 0.75rem;     /* 12px — labels/meta */
    --text-sm: 0.8125rem;   /* 13px — labels/meta semi-bold */
    --text-base: 0.9375rem; /* 15px — body */
    --text-lg: 1.125rem;    /* 18px — section title */
    --text-xl: 1.25rem;     /* 20px — section title */
    --text-2xl: 1.5rem;     /* 24px — page title */
    --text-3xl: 1.75rem;    /* 28px — page title large */

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --card-radius: 12px;
    --input-radius: 8px;
    --input-height: 44px;
    --btn-radius: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    color: var(--text-primary);
    background-color: var(--bg-app);
    line-height: 1.6;
}

a {
    color: var(--brand-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-accent-hover);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.page-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
    font-weight: 400;
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Login Page ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F2D3F 0%, #1B4D6E 50%, #2E8B7A 100%);
    padding: var(--space-4);
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.login-header {
    background: var(--bg-sidebar);
    padding: var(--space-8) var(--space-8) var(--space-6);
    text-align: center;
}

.login-logo {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-inverse);
    letter-spacing: -0.01em;
    margin-bottom: var(--space-1);
}

.login-logo-accent {
    color: var(--brand-accent);
}

.login-logo-sub {
    font-size: var(--text-xs);
    color: var(--text-sidebar);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.login-body {
    padding: var(--space-8);
}

.login-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-6);
    color: var(--text-primary);
}

/* ── Forms ── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    display: block;
    width: 100%;
    height: var(--input-height);
    padding: 0 var(--space-4);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--input-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(46, 139, 122, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.is-invalid {
    border-color: var(--danger);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.form-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-accent);
}

.form-link {
    font-size: var(--text-sm);
    color: var(--brand-accent);
    font-weight: 500;
}

.form-link:hover {
    color: var(--brand-accent-hover);
    text-decoration: underline;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--input-height);
    padding: 0 var(--space-6);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: 600;
    border-radius: var(--btn-radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--brand-primary);
    color: var(--text-inverse);
    width: 100%;
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--brand-primary);
    border: 1.5px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-app);
    border-color: var(--brand-primary);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background: #B52828;
}

.btn-sm {
    height: 36px;
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--input-radius);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

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

/* ── Alerts / Flash Messages ── */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--input-radius);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(13, 138, 94, 0.2);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(197, 48, 48, 0.2);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(193, 127, 36, 0.2);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(43, 108, 176, 0.2);
}

.alert svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* ── Portal Layout (Sidebar + Top Bar) ── */
.portal-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-inverse);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.sidebar-logo-accent {
    color: var(--brand-accent);
}

.sidebar-logo-sub {
    font-size: 0.625rem;
    color: var(--text-sidebar);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) 0;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: var(--space-4);
}

.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(176, 190, 197, 0.5);
    padding: 0 var(--space-5);
    margin-bottom: var(--space-2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: var(--text-sidebar);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-inverse);
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-inverse);
    border-left-color: var(--brand-accent);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-inverse);
    flex-shrink: 0;
}

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

.sidebar-user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-inverse);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--text-xs);
    color: var(--text-sidebar);
}

/* ── Top Bar ── */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-breadcrumb {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.topbar-breadcrumb a {
    color: var(--text-secondary);
}

.topbar-breadcrumb span {
    color: var(--text-primary);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-search {
    position: relative;
}

.topbar-search-input {
    height: 38px;
    width: 280px;
    padding: 0 var(--space-4) 0 38px;
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    outline: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.topbar-search-input:focus {
    border-color: var(--brand-accent);
    background: var(--bg-card);
    width: 340px;
    box-shadow: 0 0 0 3px rgba(46, 139, 122, 0.1);
}

.topbar-search-input::placeholder {
    color: var(--text-muted);
}

.topbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.topbar-notification {
    position: relative;
}

.topbar-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-topbar);
}

.topbar-profile {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--input-radius);
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

.topbar-profile:hover {
    background: var(--bg-app);
}

.topbar-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-inverse);
}

.topbar-profile-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

/* Profile Dropdown */
.profile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    background: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
    min-width: 200px;
    z-index: 200;
    overflow: hidden;
}

.profile-dropdown.show {
    display: block;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.profile-dropdown-item:hover {
    background: var(--bg-app);
    color: var(--text-primary);
}

.profile-dropdown-item svg {
    width: 16px;
    height: 16px;
}

.profile-dropdown-divider {
    border-top: 1px solid var(--border-subtle);
    margin: var(--space-1) 0;
}

.profile-dropdown-item.danger {
    color: var(--danger);
}

.profile-dropdown-item.danger:hover {
    background: var(--danger-bg);
}

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: var(--space-6);
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    margin-bottom: var(--space-6);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.page-header-left {
    flex: 1;
}

.page-header-actions {
    display: flex;
    gap: var(--space-3);
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
}

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

.card-title {
    font-size: var(--text-base);
    font-weight: 600;
}

.card-body {
    padding: var(--space-5);
}

/* ── Dashboard Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    padding: var(--space-5);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: box-shadow var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-icon-blue {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon-green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon-orange {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon-red {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-icon-teal {
    background: var(--brand-accent-light);
    color: var(--brand-accent);
}

.stat-icon-purple {
    background: #F0EBFE;
    color: #6B46C1;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-change {
    font-size: var(--text-xs);
    font-weight: 500;
    margin-top: var(--space-1);
}

.stat-change.up {
    color: var(--success);
}

.stat-change.down {
    color: var(--danger);
}

/* ── Dashboard Content Grid ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

.dashboard-grid-full {
    grid-column: 1 / -1;
}

/* ── Tables ── */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-app);
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tbody td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

tbody tr:hover {
    background: rgba(244, 246, 248, 0.5);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-active {
    background: var(--success-bg);
    color: var(--success);
}

.badge-past-due {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-paused {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-canceled {
    background: #F1F1F1;
    color: var(--text-muted);
}

.badge-prospect {
    background: var(--info-bg);
    color: var(--info);
}

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state-text {
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
}

/* ── Error Page ── */
.error-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-6);
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--border-medium);
    line-height: 1;
    margin-bottom: var(--space-4);
}

.error-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

/* ── Breadcrumbs ── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
}

.breadcrumb-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-link:hover {
    color: var(--brand-accent);
}

.breadcrumb-sep {
    color: var(--border-medium);
    flex-shrink: 0;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ── Alert Toast (dismissible) ── */
.alert-toast {
    position: relative;
    animation: slideDown 0.3s ease;
}

.alert-dismiss {
    position: absolute;
    top: 50%;
    right: var(--space-3);
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: var(--space-1);
    transition: opacity var(--transition-fast);
}

.alert-dismiss:hover {
    opacity: 1;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Filter Tabs ── */
.filter-tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-card);
    border-radius: var(--card-radius);
    padding: var(--space-1);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: 8px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-app);
}

.filter-tab.active {
    color: var(--brand-primary);
    background: rgba(27, 77, 110, 0.08);
    font-weight: 600;
}

.filter-count {
    font-size: var(--text-xs);
    background: var(--bg-app);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.filter-tab.active .filter-count {
    background: rgba(27, 77, 110, 0.15);
    color: var(--brand-primary);
}

/* ── Search Dropdown (person search) ── */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    margin-top: 4px;
}

.search-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-dropdown-item:hover {
    background: var(--bg-app);
}

.search-dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}

.search-dropdown-empty {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* ── Detail View ── */
.detail-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.detail-row {
    display: flex;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    min-width: 140px;
    flex-shrink: 0;
}

.detail-value {
    font-size: var(--text-base);
    color: var(--text-primary);
}

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .topbar-search-input {
        width: 200px;
    }

    .topbar-search-input:focus {
        width: 240px;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar-search {
        display: none;
    }

    .topbar-profile-name {
        display: none;
    }
}
