/* ClaimCure Business Portal — Design Token Layer
 *
 * Source: ops/gemini_design_tokens_2026-05-06.css (color/font kernel) +
 *         claimcure_business_design_assets.md §2 (full token spec, 2026-05-03).
 *
 * Light-mode-only by intent. The Gemini brief explicitly drops dark mode for
 * the business portal because the consumer/business consumer needs differ:
 * pros want density and consistency, not aesthetic novelty. Dark-mode classes
 * in inheriting templates render fine but are no-ops here.
 *
 * Layered with Tailwind utility classes — these tokens provide CSS variables
 * for things Tailwind can't express cleanly (semantic status colors used in
 * status badges, font-face rules for self-hosted Inter).
 */

/* ============ Self-hosted Inter (variable axis 100-900) ============
 * Vendored at web/static/fonts/. Eliminates referer leak to fonts.gstatic.com
 * on every page. SecurityHeadersMiddleware adds strict-origin Referrer-Policy
 * as belt-and-suspenders; this self-host is the underlying fix.
 */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============ Color tokens (light-mode-only, indigo bridge) ============ */
:root {
    /* Brand bridge — same indigo as consumer */
    --color-indigo-50:  #EEF2FF;
    --color-indigo-100: #E0E7FF;
    --color-indigo-200: #C7D2FE;
    --color-indigo-500: #6366F1;
    --color-indigo-600: #4F46E5;   /* Primary CTA — matches consumer site */
    --color-indigo-700: #4338CA;
    --color-indigo-900: #312E81;

    /* Neutrals (stone palette — warmer than slate, easier on long-session eyes) */
    --color-bg:            #FAFAF9;  /* Stone-50, page background */
    --color-surface:       #FFFFFF;  /* Card/panel background */
    --color-surface-alt:   #F5F5F4;  /* Subtle row stripe, sidebar bg */
    --color-border:        #E7E5E4;  /* Stone-200, default border */
    --color-border-strong: #D6D3D1;  /* Stone-300, focused inputs / dividers */

    /* Text */
    --color-text-primary:   #1C1917;  /* Stone-900, headings */
    --color-text-secondary: #44403C;  /* Stone-700, body */
    --color-text-tertiary:  #78716C;  /* Stone-500, labels / timestamps */
    --color-text-disabled:  #A8A29E;  /* Stone-400, disabled inputs */
    --color-text-inverse:   #FFFFFF;  /* On indigo backgrounds */

    /* Semantic status (saturated enough to scan, muted enough not to feel marketing-y) */
    --color-success-bg:    #ECFDF5;
    --color-success-text:  #047857;
    --color-success-dot:   #10B981;
    --color-warning-bg:    #FEF3C7;
    --color-warning-text:  #92400E;
    --color-warning-dot:   #F59E0B;
    --color-danger-bg:     #FEF2F2;
    --color-danger-text:   #B91C1C;
    --color-danger-dot:    #EF4444;
    --color-info-bg:       #EFF6FF;
    --color-info-text:     #1D4ED8;
    --color-info-dot:      #3B82F6;
    --color-neutral-bg:    #F5F5F4;
    --color-neutral-text:  #44403C;
    --color-neutral-dot:   #A8A29E;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', Consolas, monospace;

    /* Type scale (denser than consumer — see design_assets §2.2) */
    --text-xs:   12px;   /* Timestamps, badges, secondary labels */
    --text-sm:   14px;   /* Default body text in portal */
    --text-base: 16px;   /* Form inputs, primary content */
    --text-lg:   18px;   /* Card titles */
    --text-xl:   22px;   /* Page H1 */
    --text-2xl:  28px;   /* Hero KPI numbers */

    /* Spacing scale (4px grid, denser than consumer's 8px) */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;   /* Buttons, inputs */
    --radius-lg: 8px;   /* Cards, panels */
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* ============ Body baseline ============ */
body {
    font-family: var(--font-sans);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";  /* Inter typographic refinements */
    color: var(--color-text-secondary);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============ Scrollbar (subtle stone, narrow) ============ */
.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-sm);
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

/* ============ Status badge component (used in tables + lists) ============
 * Render: <span class="cc-badge cc-badge-success"><span class="cc-badge-dot"></span> Generated</span>
 */
.cc-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.4;
}
.cc-badge-dot {
    height: 6px;
    width: 6px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
.cc-badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.cc-badge-success .cc-badge-dot { background: var(--color-success-dot); }
.cc-badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.cc-badge-warning .cc-badge-dot { background: var(--color-warning-dot); }
.cc-badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger-text); }
.cc-badge-danger  .cc-badge-dot { background: var(--color-danger-dot); }
.cc-badge-info    { background: var(--color-info-bg);    color: var(--color-info-text); }
.cc-badge-info    .cc-badge-dot { background: var(--color-info-dot); }
.cc-badge-neutral { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.cc-badge-neutral .cc-badge-dot { background: var(--color-neutral-dot); }

/* ============ Role badge component (without dot, with border) ============
 * Render: <span class="cc-role cc-role-admin">Admin</span>
 */
.cc-role {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    border: 1px solid transparent;
}
.cc-role-admin {
    background: var(--color-indigo-50);
    color: var(--color-indigo-700);
    border-color: var(--color-indigo-200);
    font-weight: 600;
}
.cc-role-member {
    background: var(--color-neutral-bg);
    color: var(--color-text-secondary);
    border-color: var(--color-border);
}
.cc-role-viewer {
    background: var(--color-bg);
    color: var(--color-text-tertiary);
    border-color: var(--color-border);
}

/* ============ Button components ============ */
.cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.25;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
    text-decoration: none;
    white-space: nowrap;
}
.cc-btn:focus-visible {
    outline: 2px solid var(--color-indigo-500);
    outline-offset: 2px;
}
.cc-btn:disabled, .cc-btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cc-btn-primary {
    background: var(--color-indigo-600);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-sm);
}
.cc-btn-primary:hover:not(:disabled):not(.is-disabled) {
    background: var(--color-indigo-700);
}

.cc-btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
    font-weight: 500;
}
.cc-btn-secondary:hover:not(:disabled):not(.is-disabled) {
    background: var(--color-surface-alt);
}

.cc-btn-ghost {
    background: transparent;
    color: var(--color-indigo-600);
    font-weight: 500;
    padding: 4px 8px;
}
.cc-btn-ghost:hover:not(:disabled):not(.is-disabled) {
    background: var(--color-indigo-50);
    color: var(--color-indigo-700);
}

.cc-btn-danger {
    background: var(--color-surface);
    color: var(--color-danger-text);
    border-color: #FECACA;
    font-weight: 500;
}
.cc-btn-danger:hover:not(:disabled):not(.is-disabled) {
    background: var(--color-danger-bg);
}

/* ============ Form input baseline ============ */
.cc-input,
.cc-select,
.cc-textarea {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    line-height: 1.4;
    font-family: var(--font-sans);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.cc-input::placeholder,
.cc-textarea::placeholder { color: var(--color-text-disabled); }

.cc-input:focus,
.cc-select:focus,
.cc-textarea:focus {
    outline: none;
    border-color: var(--color-indigo-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.cc-input:disabled,
.cc-select:disabled,
.cc-textarea:disabled {
    background: var(--color-surface-alt);
    color: var(--color-text-tertiary);
    cursor: not-allowed;
}

.cc-input.is-error,
.cc-select.is-error,
.cc-textarea.is-error {
    border-color: var(--color-danger-dot);
}
.cc-input.is-error:focus,
.cc-select.is-error:focus,
.cc-textarea.is-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.cc-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-1);
}
.cc-label-required::after {
    content: " *";
    color: var(--color-danger-text);
}
.cc-help {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}
.cc-error {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-danger-text);
}

/* ============ Card / panel surfaces ============ */
.cc-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.cc-card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}
.cc-card-body { padding: var(--space-5); }
.cc-card-footer {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

/* ============ Data table ============ */
.cc-table {
    width: 100%;
    border-collapse: collapse;
}
.cc-table thead {
    background: var(--color-surface-alt);
}
.cc-table thead th {
    padding: 10px var(--space-5);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--color-border);
}
.cc-table tbody tr {
    border-bottom: 1px solid var(--color-surface-alt);
    transition: background-color 80ms ease;
}
.cc-table tbody tr:hover {
    background: var(--color-surface-alt);
}
.cc-table tbody td {
    padding: 12px var(--space-5);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    vertical-align: middle;
}
.cc-table .cc-mono { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ============ Sidebar nav ============ */
.cc-sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 8px var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background-color 80ms ease, color 80ms ease;
}
.cc-sidebar-link:hover {
    background: var(--color-surface-alt);
    color: var(--color-text-primary);
}
.cc-sidebar-link.is-active {
    background: var(--color-indigo-50);
    color: var(--color-indigo-700);
    font-weight: 600;
}

/* ============ Plan usage meter ============ */
.cc-meter {
    height: 6px;
    width: 100%;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.cc-meter-bar {
    height: 100%;
    background: var(--color-indigo-600);
    border-radius: var(--radius-full);
    transition: width 200ms ease;
}
.cc-meter-bar.is-warning { background: var(--color-warning-dot); }
.cc-meter-bar.is-danger  { background: var(--color-danger-dot); }

/* ============ Disclaimer / footer note ============ */
.cc-disclaimer {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    line-height: 1.5;
    max-width: 640px;
}

/* ============ Visually-hidden (a11y) ============ */
.cc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
