/* =============================================================================
   Vitruvex Global Stylesheet
   Design reference: claim_detail.html / progress_claims.html
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Variables (Design Tokens)
   ----------------------------------------------------------------------------- */
:root {
    /* Brand colors */
    --color-primary: #1e7bb8;
    --color-primary-dark: #155a8a;
    --color-header: #0c496d;
    --color-accent: #d4a574;

    /* Backgrounds */
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f9fafb;

    /* Text */
    --color-text: #333333;
    --color-text-secondary: #666666;
    --color-text-muted: #999999;

    /* Borders */
    --color-border: #e0e0e0;
    --color-border-light: #f0f0f0;

    /* Table */
    --color-table-header-bg: #f8f9fa;
    --color-table-header-border: #e9ecef;

    /* Status */
    --status-draft-bg: #fef3c7;
    --status-draft-text: #92400e;
    --status-submitted-bg: #dbeafe;
    --status-submitted-text: #1e3a8a;
    --status-certified-bg: #d1fae5;
    --status-certified-text: #065f46;
    --status-paid-bg: #e0e7ff;
    --status-paid-text: #3730a3;
    --status-rejected-bg: #fee2e2;
    --status-rejected-text: #991b1b;
    --status-approved-bg: #d4edda;
    --status-approved-text: #155724;
    --status-under-review-bg: #cce5ff;
    --status-under-review-text: #004085;

    /* Feedback */
    --color-success: #4caf50;
    --color-error: #d32f2f;
    --color-warning: #ff9800;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

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

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--color-primary-dark);
}

/* -----------------------------------------------------------------------------
   Material Symbols – Sizing Defaults
   ----------------------------------------------------------------------------- */
.nav-icon {
    display: flex;
    align-items: center;
}

.nav-icon .material-symbols-outlined {
    font-size: 18px;
}

.module-card .icon .material-symbols-outlined {
    font-size: 28px;
}

.stat-icon .material-symbols-outlined {
    font-size: 24px;
}

.empty-state .material-symbols-outlined,
.empty-icon .material-symbols-outlined,
.no-claims-icon .material-symbols-outlined {
    font-size: 48px;
    color: var(--color-text-muted);
}

/* -----------------------------------------------------------------------------
   Page Header
   ----------------------------------------------------------------------------- */
.page-header {
    background: var(--color-header);
    padding: 20px 40px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 101;
}

.logo-link {
    display: inline-block;
    margin-bottom: 12px;
    background: var(--color-surface);
    padding: 8px 16px;
    box-shadow: var(--shadow);
}

.logo-link img {
    height: 40px;
    width: auto;
    display: block;
    transition: opacity 0.3s;
}

.logo-link:hover img {
    opacity: 0.8;
}

/* -----------------------------------------------------------------------------
   Breadcrumbs
   ----------------------------------------------------------------------------- */
.breadcrumb {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:first-child {
    font-weight: 600;
    color: white;
}

.breadcrumb a:hover {
    color: white;
}

.breadcrumb-separator {
    margin: 0 6px;
}

.breadcrumb-current {
    color: white;
}

/* -----------------------------------------------------------------------------
   Contract Admin Navigation
   ----------------------------------------------------------------------------- */
.contract-admin-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-surface);
    display: flex;
    gap: 0;
    padding: 6px 20px 0;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.contract-admin-nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
    /* Reset for <button> elements */
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
}

.contract-admin-nav-link:hover {
    color: var(--color-text);
    background: var(--color-bg);
}

.contract-admin-nav-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Container / Main Content
   ----------------------------------------------------------------------------- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* -----------------------------------------------------------------------------
   Global Header Search
   ----------------------------------------------------------------------------- */
.header-search {
    position: absolute;
    bottom: 16px;
    right: 40px;
    z-index: 102;
}

.header-search-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.header-search-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
}

.header-search-trigger:active {
    transform: scale(0.97);
}

.header-search-trigger .material-symbols-outlined {
    font-size: 17px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.header-search-trigger:hover .material-symbols-outlined {
    opacity: 1;
}

.header-search-trigger kbd {
    font-size: 10px;
    padding: 1px 5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    font-family: inherit;
    opacity: 0.5;
    margin-left: 4px;
    line-height: 1.4;
}

/* Expanded overlay */
.header-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.header-search-overlay.open {
    display: block;
}

.header-search-panel {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 580px;
    max-width: calc(100vw - 40px);
    z-index: 1000;
    display: none;
}

.header-search-panel.open {
    display: block;
    animation: headerSearchIn 0.15s ease-out;
}

@keyframes headerSearchIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.header-search-input-wrap {
    background: var(--color-surface);
    border-radius: 6px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.header-search-input-row {
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    border-bottom: 1px solid var(--color-border-light, #f0f0f0);
}

.header-search-input-row .material-symbols-outlined {
    font-size: 20px;
    color: var(--color-text-muted, #999);
    flex-shrink: 0;
}

.header-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 0;
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--color-text);
}

.header-search-input::placeholder {
    color: var(--color-text-muted, #999);
}

.header-search-filters {
    display: flex;
    gap: 2px;
    padding: 10px 16px;
    justify-content: space-between;
}

.header-search-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 0;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.3px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--color-primary, #1e7bb8);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.header-search-chip:hover {
    background: rgba(30, 123, 184, 0.06);
}

.header-search-chip:not(.active) {
    color: var(--color-text-muted, #999);
}

.header-search-chip:not(.active) .material-symbols-outlined {
    opacity: 0.4;
}

.header-search-chip .material-symbols-outlined {
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.header-search-chip-divider {
    width: 1px;
    height: 14px;
    background: var(--color-border, #e0e0e0);
    align-self: center;
    flex-shrink: 0;
}

/* Results dropdown */
.header-search-results {
    max-height: 630px;
    overflow-y: auto;
    border-top: 1px solid var(--color-border-light, #f0f0f0);
}

.header-search-results:empty {
    display: none;
}

.header-search-results .hs-section-header {
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted, #999);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-search-results .hs-section-header .material-symbols-outlined {
    font-size: 15px;
}

.header-search-results .hs-result {
    padding: 8px 16px 8px 38px;
    cursor: pointer;
    transition: background 0.1s;
}

.header-search-results .hs-result:hover {
    background: var(--color-surface-alt, #f9fafb);
}

.header-search-results .hs-result.hs-active {
    background: rgba(30, 123, 184, 0.08);
    box-shadow: inset 3px 0 0 var(--color-primary, #1e7bb8);
}

.header-search-results .hs-result-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-search-results .hs-result-meta {
    font-size: 11px;
    color: var(--color-text-muted, #999);
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 1px;
}

.header-search-results .hs-result-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
    background: rgba(30, 123, 184, 0.1);
    color: var(--color-primary, #1e7bb8);
}

.header-search-results .hs-result-path {
    font-size: 11px;
    color: var(--color-text-muted, #999);
    margin-top: 1px;
}

.header-search-results .hs-section[data-filtered="true"] {
    display: none;
}

.header-search-results .hs-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--color-text-muted, #999);
    font-size: 13px;
}

/* -----------------------------------------------------------------------------
   Content Search Results (shared by project Quick Search + header search)
   ----------------------------------------------------------------------------- */
.cs-section-header {
    padding: 10px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted, #999);
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--color-border-light, #f0f0f0);
}
.cs-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-border, #e0e0e0);
    border-top-color: var(--color-primary, #1e7bb8);
    border-radius: 50%;
    animation: cs-spin 0.6s linear infinite;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }
.cs-item {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-light, #f0f0f0);
    transition: background 0.1s;
}
.cs-item:hover {
    background: var(--color-surface-alt, #f9fafb);
}
.cs-item:last-child {
    border-bottom: none;
}
.cs-snippet {
    font-style: italic;
    color: var(--color-text-secondary, #666);
    font-size: 12.5px;
    line-height: 1.5;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cs-snippet mark {
    background: rgba(30, 123, 184, 0.15);
    color: var(--color-primary-dark, #155a8a);
    font-weight: 600;
    font-style: normal;
    border-radius: 2px;
    padding: 0 1px;
}
.cs-meta {
    font-size: 11px;
    color: var(--color-text-muted, #999);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}
.cs-page {
    font-weight: 600;
    color: var(--color-primary, #1e7bb8);
}
.cs-badge {
    background: rgba(30, 123, 184, 0.08);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 500;
    color: var(--color-primary, #1e7bb8);
}

.header-search-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--color-border-light, #f0f0f0);
    font-size: 11px;
    color: var(--color-text-muted, #999);
    text-align: center;
}

.header-search-footer kbd {
    font-size: 10px;
    padding: 1px 5px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-surface-alt, #f9fafb);
    font-family: inherit;
}

/* -----------------------------------------------------------------------------
   User Actions (header buttons)
   ----------------------------------------------------------------------------- */
.user-actions {
    position: absolute;
    top: 20px;
    right: 40px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.user-info {
    color: white;
    font-size: 13px;
    text-align: right;
    margin-right: 6px;
    padding-right: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.user-info .user-name {
    font-weight: 600;
}

.user-info .user-role {
    opacity: 0.7;
    font-size: 11px;
}

.switch-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.switch-user-btn .material-symbols-outlined {
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.switch-user-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
}

.switch-user-btn:hover .material-symbols-outlined {
    opacity: 1;
}

.switch-user-btn:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.97);
}

.logout-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.logout-btn:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* -----------------------------------------------------------------------------
   Page Title Bar (below header, holds page title + action buttons)
   ----------------------------------------------------------------------------- */
.page-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.page-title-bar h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.page-title-bar .title-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid #ddd;
}

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

.btn-danger {
    background: var(--color-error);
    color: white;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -----------------------------------------------------------------------------
   Cards / Sections
   ----------------------------------------------------------------------------- */
.card,
.claim-section,
.summary-section {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2,
.claim-section h2,
.summary-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 8px;
}

/* -----------------------------------------------------------------------------
   Data Tables
   ----------------------------------------------------------------------------- */
.data-table,
.claims-table,
.line-items-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead,
.claims-table thead,
.line-items-table thead,
.variations-table thead,
.rfis-table thead,
.cis-table thead,
.ps-table thead,
.content-table thead,
.contacts-table thead {
    background: var(--color-table-header-bg);
    border-bottom: 2px solid var(--color-table-header-border);
}

.data-table thead th,
.claims-table thead th,
.line-items-table thead th,
.variations-table thead th,
.rfis-table thead th,
.cis-table thead th,
.ps-table thead th,
.content-table thead th,
.contacts-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table thead th.money-col,
.claims-table thead th.money-col,
.line-items-table thead th.money-col,
.variations-table thead th.money-col,
.rfis-table thead th.money-col,
.cis-table thead th.money-col,
.ps-table thead th.money-col,
.content-table thead th.money-col,
.contacts-table thead th.money-col {
    text-align: right;
}

.data-table tbody td,
.claims-table tbody td,
.line-items-table tbody td,
.variations-table tbody td,
.rfis-table tbody td,
.cis-table tbody td,
.ps-table tbody td,
.content-table tbody td,
.contacts-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 13px;
    vertical-align: top;
    color: var(--color-text-secondary);
}

/* Clickable entity IDs (e.g. VAR-0001, RFI-0003, PS-0012, DEF-0004) */
.entity-link {
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s;
}

.entity-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Monospace money cells — works inside any table or standalone */
.money-cell {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: nowrap;
}

.data-table tbody tr,
.claims-table tbody tr,
.line-items-table tbody tr,
.variations-table tbody tr,
.rfis-table tbody tr,
.cis-table tbody tr,
.ps-table tbody tr,
.content-table tbody tr,
.contacts-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover,
.claims-table tbody tr:hover,
.line-items-table tbody tr:hover,
.variations-table tbody tr:hover,
.rfis-table tbody tr:hover,
.cis-table tbody tr:hover,
.ps-table tbody tr:hover,
.content-table tbody tr:hover,
.contacts-table tbody tr:hover {
    background: var(--color-table-header-bg);
}

.data-table tfoot,
.claims-table tfoot,
.line-items-table tfoot {
    background: var(--color-table-header-bg);
    border-top: 2px solid var(--color-primary);
    font-weight: 600;
}

.data-table tfoot td,
.claims-table tfoot td,
.line-items-table tfoot td {
    padding: 14px 16px;
}

/* Monospace value helper */
.mono-value {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Status Badges
   ----------------------------------------------------------------------------- */
.status-badge,
.claim-status,
.claim-status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-lg);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.draft,
.claim-status.draft,
.claim-status-badge.draft {
    background: var(--status-draft-bg);
    color: var(--status-draft-text);
}

.status-badge.submitted,
.claim-status.submitted,
.claim-status-badge.submitted {
    background: var(--status-submitted-bg);
    color: var(--status-submitted-text);
}

.status-badge.certified,
.claim-status.certified,
.claim-status-badge.certified {
    background: var(--status-certified-bg);
    color: var(--status-certified-text);
}

.status-badge.paid,
.claim-status.paid,
.claim-status-badge.paid {
    background: var(--status-paid-bg);
    color: var(--status-paid-text);
}

.status-badge.rejected,
.claim-status.rejected,
.claim-status-badge.rejected {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-text);
}

.status-badge.approved,
.claim-status.approved,
.claim-status-badge.approved {
    background: var(--status-approved-bg);
    color: var(--status-approved-text);
}

.status-badge.under_review,
.claim-status.under_review,
.claim-status-badge.under_review {
    background: var(--status-under-review-bg);
    color: var(--status-under-review-text);
}

/* -----------------------------------------------------------------------------
   Forms
   ----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: " *";
    color: var(--color-error);
}

.form-input,
.form-control {
    width: 100%;
    border: 1px solid #ddd;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-input:focus,
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

textarea.form-control,
textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* -----------------------------------------------------------------------------
   Modals
   ----------------------------------------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-header);
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.modal-close:hover {
    color: white;
    background: var(--color-bg);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* -----------------------------------------------------------------------------
   Action Bar
   ----------------------------------------------------------------------------- */
.action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* -----------------------------------------------------------------------------
   Stats Bar
   ----------------------------------------------------------------------------- */
.stats-bar {
    background: var(--color-surface);
    padding: 16px 20px;
    margin-bottom: 2px;
    display: flex;
    gap: 32px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    font-size: 24px;
    color: var(--color-primary);
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
}

.stat-value.warning {
    color: var(--color-warning);
}

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

.stat-value.money {
    color: var(--color-primary);
}

/* -----------------------------------------------------------------------------
   Stat Card Grid  (modern card-based stats — replaces inline stats-bar)
   ----------------------------------------------------------------------------- */
.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}

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

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(30, 123, 184, 0.08);
    color: var(--color-primary);
}

.stat-card-icon .material-symbols-outlined {
    font-size: 20px;
}

.stat-card-icon.accent {
    background: rgba(212, 165, 116, 0.12);
    color: var(--color-accent);
}

.stat-card-icon.success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--color-success);
}

.stat-card-icon.warning {
    background: rgba(255, 152, 0, 0.1);
    color: var(--color-warning);
}

.stat-card-icon.danger {
    background: rgba(211, 47, 47, 0.1);
    color: var(--color-error);
}

.stat-card-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.stat-card-value.money {
    color: var(--color-primary);
    font-family: var(--font-mono);
    font-size: 18px;
}

.stat-card-value.warning {
    color: var(--color-warning);
}

.stat-card-value.success {
    color: var(--color-success);
}

.stat-card-value.danger {
    color: var(--color-error);
}

.stat-card-note {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 3px;
    display: none;
}

@media (max-width: 1100px) {
    .stat-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .stat-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* -----------------------------------------------------------------------------
   Search Box
   ----------------------------------------------------------------------------- */
.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
}

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

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 18px;
    pointer-events: none;
}

/* -----------------------------------------------------------------------------
   Empty States
   ----------------------------------------------------------------------------- */
.empty-state,
.no-claims {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

.empty-icon,
.no-claims-icon,
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--color-text-muted);
}

/* -----------------------------------------------------------------------------
   Loading & Error States
   ----------------------------------------------------------------------------- */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-secondary);
}

.error {
    background: var(--status-rejected-bg);
    color: var(--status-rejected-text);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

/* -----------------------------------------------------------------------------
   Module Title
   ----------------------------------------------------------------------------- */
.module-title {
    color: var(--color-text);
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
}

.module-subtitle {
    color: var(--color-text-secondary);
    font-size: 16px;
    margin-bottom: 30px;
}

/* -----------------------------------------------------------------------------
   Dialog System (showConfirm, showError, showToast)
   ----------------------------------------------------------------------------- */

/* --- Backdrop --- */
.vx-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: vxBackdropIn 0.2s ease-out;
}

.vx-dialog-backdrop.vx-closing {
    animation: vxBackdropOut 0.15s ease-in forwards;
}

/* --- Dialog Card --- */
.vx-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: vxDialogIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.vx-dialog-backdrop.vx-closing .vx-dialog {
    animation: vxDialogOut 0.15s ease-in forwards;
}

.vx-dialog.vx-dialog--error {
    max-width: 520px;
}

/* Accent stripe */
.vx-dialog::before {
    content: '';
    display: block;
    height: 3px;
    background: var(--color-primary);
}

.vx-dialog.vx-dialog--error::before {
    background: var(--color-error);
}

.vx-dialog.vx-dialog--warning::before {
    background: var(--color-warning);
}

/* --- Dialog Header --- */
.vx-dialog-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

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

.vx-dialog-icon .material-symbols-outlined {
    font-size: 22px;
}

.vx-dialog-icon--confirm {
    background: rgba(30, 123, 184, 0.08);
    color: var(--color-primary);
}

.vx-dialog-icon--error {
    background: rgba(211, 47, 47, 0.08);
    color: var(--color-error);
}

.vx-dialog-icon--warning {
    background: rgba(255, 152, 0, 0.08);
    color: var(--color-warning);
}

.vx-dialog-header-text {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.vx-dialog-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
    margin-bottom: 6px;
}

.vx-dialog-message {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.55;
}

/* --- Details (expandable, error dialog only) --- */
.vx-dialog-details {
    margin: 16px 24px 0;
}

.vx-dialog-details summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 6px 0;
    user-select: none;
    transition: color 0.15s;
}

.vx-dialog-details summary:hover {
    color: var(--color-text-secondary);
}

.vx-dialog-details pre {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 8px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text-secondary);
    max-height: 160px;
    overflow-y: auto;
}

/* --- Dialog Actions --- */
.vx-dialog-actions {
    padding: 20px 24px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.vx-dialog-btn {
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    min-width: 88px;
    text-align: center;
}

.vx-dialog-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.vx-dialog-btn--primary {
    background: var(--color-primary);
    color: white;
}

.vx-dialog-btn--primary:hover {
    background: var(--color-primary-dark);
}

.vx-dialog-btn--danger {
    background: var(--color-error);
    color: white;
}

.vx-dialog-btn--danger:hover {
    background: #b71c1c;
}

.vx-dialog-btn--secondary {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.vx-dialog-btn--secondary:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* --- Dialog Animations --- */
@keyframes vxBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes vxBackdropOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes vxDialogIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes vxDialogOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
}

/* --- Toast Container --- */
.vx-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 400px;
}

/* --- Toast --- */
.vx-toast {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    pointer-events: auto;
    animation: vxToastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    position: relative;
    border-left: 3px solid var(--color-primary);
}

.vx-toast.vx-closing {
    animation: vxToastOut 0.25s ease-in forwards;
}

.vx-toast--success { border-left-color: var(--color-success); }
.vx-toast--error   { border-left-color: var(--color-error); }
.vx-toast--warning { border-left-color: var(--color-warning); }
.vx-toast--info    { border-left-color: var(--color-primary); }

.vx-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-top: 1px;
}

.vx-toast-icon .material-symbols-outlined {
    font-size: 20px;
}

.vx-toast--success .vx-toast-icon { color: var(--color-success); }
.vx-toast--error .vx-toast-icon   { color: var(--color-error); }
.vx-toast--warning .vx-toast-icon { color: var(--color-warning); }
.vx-toast--info .vx-toast-icon    { color: var(--color-primary); }

.vx-toast-body {
    flex: 1;
    min-width: 0;
}

.vx-toast-message {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.45;
}

.vx-toast-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.vx-toast-dismiss:hover {
    color: var(--color-text);
}

.vx-toast-dismiss .material-symbols-outlined {
    font-size: 18px;
}

/* Toast progress bar */
.vx-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    transform-origin: left;
    animation: vxToastProgress linear forwards;
}

.vx-toast--success .vx-toast-progress { background: var(--color-success); }
.vx-toast--error .vx-toast-progress   { background: var(--color-error); }
.vx-toast--warning .vx-toast-progress { background: var(--color-warning); }
.vx-toast--info .vx-toast-progress    { background: var(--color-primary); }

/* --- Toast Animations --- */
@keyframes vxToastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    60% {
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes vxToastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes vxToastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* -----------------------------------------------------------------------------
   Responsive Breakpoints
   ----------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .container {
        padding: 16px;
    }
}

@media (max-width: 900px) {
    .page-header {
        padding: 12px 16px;
    }

    .container {
        padding: 12px;
    }

    .action-bar {
        gap: 8px;
    }
}

@media (max-width: 600px) {
    .contract-admin-nav {
        gap: 4px;
    }

    .contract-admin-nav-link {
        font-size: 11px;
        padding: 4px 8px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}
