/* ForecastFix design system
   Loaded after page CSS to keep colors, type, spacing, and common controls consistent. */

:root {
    color-scheme: light;

    --app-font-family: "Roboto", Arial, sans-serif;

    --ff-color-page: #f6f8fb;
    --ff-color-surface: #ffffff;
    --ff-color-surface-muted: #f8fafc;
    --ff-color-surface-strong: #eef2f7;
    --ff-color-border: #d8dee8;
    --ff-color-border-strong: #c6d0de;
    --ff-color-text: #111827;
    --ff-color-heading: #0f172a;
    --ff-color-muted: #64748b;
    --ff-color-muted-strong: #475569;
    --ff-color-primary: #3f9a5f;
    --ff-color-primary-strong: #2f8550;
    --ff-color-primary-soft: #eaf7ef;
    --ff-color-action: #133752;
    --ff-color-action-hover: #0f2d44;
    --ff-color-link: #1d4ed8;
    --ff-color-success: #166534;
    --ff-color-success-bg: #ecfdf3;
    --ff-color-warning: #92400e;
    --ff-color-warning-bg: #fffbeb;
    --ff-color-danger: #991b1b;
    --ff-color-danger-bg: #fef2f2;

    --ff-font-size-xs: 0.74rem;
    --ff-font-size-sm: 0.82rem;
    --ff-font-size-md: 0.9rem;
    --ff-font-size-lg: 1rem;
    --ff-font-size-xl: 1.22rem;
    --ff-font-size-page-title: 1.55rem;

    --ff-line-tight: 1.18;
    --ff-line-normal: 1.45;

    --ff-space-1: 0.25rem;
    --ff-space-2: 0.5rem;
    --ff-space-3: 0.75rem;
    --ff-space-4: 1rem;
    --ff-space-5: 1.25rem;
    --ff-space-6: 1.5rem;

    --ff-radius-sm: 6px;
    --ff-radius-md: 8px;
    --ff-radius-lg: 10px;

    --ff-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --ff-shadow-md: 0 12px 28px rgba(15, 23, 42, 0.11);
    --ff-focus-ring: 0 0 0 3px rgba(63, 154, 95, 0.2);

    --ff-control-height: 2.08rem;
    --ff-control-padding-x: 0.62rem;
    --ff-table-header-bg: #eef2f7;
    --ff-table-row-alt-bg: #f8fafc;
    --ff-table-row-hover-bg: #edf7f1;
}

html {
    background: var(--ff-color-page);
    text-rendering: optimizeLegibility;
}

body {
    background: var(--ff-color-page);
    color: var(--ff-color-text);
    font-family: var(--app-font-family);
    font-size: var(--ff-font-size-md);
    line-height: var(--ff-line-normal);
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font-family: var(--app-font-family);
    letter-spacing: 0;
}

::selection {
    background: rgba(63, 154, 95, 0.22);
}

.navbar,
.sidebar {
    background: var(--ff-color-primary);
}

.navbar {
    box-shadow: 0 1px 0 rgba(47, 133, 80, 0.35);
}

.sidebar a {
    border-radius: var(--ff-radius-sm);
}

.sidebar a:hover {
    background: var(--ff-color-primary-strong);
}

.main-container,
.embed-view,
.pricing-content {
    color: var(--ff-color-text);
}

:where(.main-container, .embed-view, .pricing-content) :where(h1, h2, h3, h4) {
    color: var(--ff-color-heading);
    font-family: var(--app-font-family);
    font-weight: 800;
    letter-spacing: 0;
}

:where(.main-container, .embed-view, .pricing-content) h1 {
    font-size: var(--ff-font-size-page-title);
    line-height: var(--ff-line-tight);
}

:where(.main-container, .embed-view, .pricing-content) h2 {
    font-size: var(--ff-font-size-xl);
    line-height: 1.22;
}

:where(.main-container, .embed-view, .pricing-content) h3 {
    font-size: var(--ff-font-size-lg);
    line-height: 1.25;
}

:where(.main-container, .embed-view, .pricing-content) p,
:where(.main-container, .embed-view, .pricing-content) li {
    line-height: var(--ff-line-normal);
}

:where(.main-container, .embed-view, .pricing-content) :where(a) {
    color: var(--ff-color-link);
    text-underline-offset: 2px;
}

:where(.main-container, .embed-view, .pricing-content) :where(a:hover, a:focus) {
    color: #1742af;
}

.page-title,
.history-title,
.legal-title,
.saas-home-header h1,
.org-page-title,
.company-page-title,
.fx-page-title,
.tb-page-title,
.journal-page-title,
.fs-page-title,
.coa-query-title-wrap h1,
.dimension-query-title-wrap h1 {
    color: var(--ff-color-heading) !important;
    font-size: var(--ff-font-size-page-title) !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    line-height: var(--ff-line-tight) !important;
}

.muted-text,
.history-subtitle,
.legal-meta,
.saas-home-header p,
.org-subscription-head p,
.refresh-draft-warning-head p,
.refresh-draft-warning-main small,
.navbar-user-menu-org-label,
.navbar-settings-label {
    color: var(--ff-color-muted) !important;
}

:where(.main-container, .embed-view) :is(
    .app-card,
    .history-panel,
    .legal-panel,
    .auth-card,
    .pricing-card,
    .org-subscription-section,
    .org-disclosures-card,
    .org-disclosures-panel,
    .company-panel,
    .company-query-window,
    .coa-query-window,
    .dimension-query-window,
    .tb-query-window,
    .journal-query-window,
    .fs-report-library,
    .fs-create-panel,
    .fs-create-panel-wide,
    .fx-panel,
    .refresh-history-panel,
    .refresh-settings-panel,
    .periods-panel
) {
    background: var(--ff-color-surface);
    border-color: var(--ff-color-border);
    border-radius: var(--ff-radius-md);
    box-shadow: var(--ff-shadow-sm);
}

:where(.main-container, .embed-view) :is(
    .history-panel,
    .coa-query-window,
    .dimension-query-window,
    .tb-query-window,
    .journal-query-window,
    .company-query-window,
    .fs-create-panel-wide
) {
    box-shadow: var(--ff-shadow-md);
}

:where(.main-container, .embed-view) :is(.app-warning-card, .warning-card, .warning-panel) {
    background: var(--ff-color-warning-bg);
    border-color: #fde68a;
    color: var(--ff-color-warning);
}

:where(.main-container, .embed-view) :is(.app-danger-alert, .auth-errors, .coa-form-alert, .coa-grid-warning) {
    background: var(--ff-color-danger-bg);
    border-color: #fecaca;
    color: var(--ff-color-danger);
}

:where(.main-container, .embed-view, .pricing-content) :is(
    .button,
    .auth-button,
    .history-btn,
    .coa-form-button,
    .coa-remove-mapping,
    .refresh-draft-warning-secondary,
    .refresh-draft-warning-primary,
    .journal-menu-item,
    .journal-action-button,
    .fx-action-button,
    .company-action-button,
    .org-admin-button,
    .fs-action-button
) {
    align-items: center;
    border-radius: var(--ff-radius-sm);
    box-sizing: border-box;
    display: inline-flex;
    font-size: var(--ff-font-size-sm);
    font-weight: 700;
    justify-content: center;
    line-height: 1.2;
    min-height: var(--ff-control-height);
    padding: 0.45rem 0.72rem;
    text-decoration: none;
}

:where(.main-container, .embed-view, .pricing-content) :is(
    .auth-button,
    .coa-form-button-primary,
    .history-btn.is-primary,
    .refresh-draft-warning-primary,
    .button-primary
) {
    background: var(--ff-color-primary);
    border-color: var(--ff-color-primary);
    color: #ffffff;
}

:where(.main-container, .embed-view, .pricing-content) :is(
    .auth-button,
    .coa-form-button-primary,
    .history-btn.is-primary,
    .refresh-draft-warning-primary,
    .button-primary
):hover,
:where(.main-container, .embed-view, .pricing-content) :is(
    .auth-button,
    .coa-form-button-primary,
    .history-btn.is-primary,
    .refresh-draft-warning-primary,
    .button-primary
):focus {
    background: var(--ff-color-primary-strong);
    border-color: var(--ff-color-primary-strong);
    color: #ffffff;
}

:where(.main-container, .embed-view, .pricing-content) :is(
    .history-btn,
    .coa-form-button-secondary,
    .refresh-draft-warning-secondary,
    .legal-switch-link,
    .auth-link-button
) {
    border-color: var(--ff-color-border-strong);
    color: var(--ff-color-text);
}

:where(.main-container, .embed-view, .pricing-content) :is(
    .history-btn,
    .coa-form-button-secondary,
    .refresh-draft-warning-secondary,
    .legal-switch-link
):hover,
:where(.main-container, .embed-view, .pricing-content) :is(
    .history-btn,
    .coa-form-button-secondary,
    .refresh-draft-warning-secondary,
    .legal-switch-link
):focus {
    background: var(--ff-color-surface-muted);
    border-color: #aab7c8;
    color: var(--ff-color-heading);
}

:where(.main-container, .embed-view) :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
    select,
    textarea
) {
    background: var(--ff-color-surface);
    border-color: var(--ff-color-border-strong);
    border-radius: var(--ff-radius-sm);
    box-sizing: border-box;
    color: var(--ff-color-text);
    font-size: var(--ff-font-size-sm);
    min-height: var(--ff-control-height);
}

:where(.main-container, .embed-view) :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
    select,
    textarea
):focus {
    border-color: var(--ff-color-primary);
    box-shadow: var(--ff-focus-ring);
    outline: none;
}

:where(.main-container, .embed-view) :is(input[type="checkbox"], input[type="radio"]) {
    accent-color: var(--ff-color-primary);
}

:where(.main-container, .embed-view) :is(table) {
    color: var(--ff-color-text);
}

:where(.main-container, .embed-view) :is(
    .history-table,
    .coa-grid,
    .coa-list,
    .company-grid,
    .dimension-grid,
    .tb-grid,
    .journal-grid,
    .manual-grid,
    .intercompany-grid,
    .fx-grid,
    .fs-map-grid
) {
    font-size: var(--ff-font-size-sm);
}

:where(.main-container, .embed-view) :is(
    .history-table th,
    .coa-grid th,
    .coa-list th,
    .company-grid th,
    .dimension-grid th,
    .tb-grid th,
    .journal-grid th,
    .manual-grid th,
    .intercompany-grid th,
    .fx-grid th,
    .fs-map-grid th
) {
    background: var(--ff-table-header-bg);
    border-color: var(--ff-color-border);
    color: #1f2937;
    font-weight: 700;
}

:where(.main-container, .embed-view) :is(
    .history-grid-head th,
    .coa-grid-head th,
    .company-grid-head th,
    .dimension-grid-head th,
    .tb-grid-head th,
    .journal-grid-head th
) {
    background: var(--ff-table-header-bg) !important;
    color: #1f2937 !important;
}

:where(.main-container, .embed-view) :is(
    .history-table td,
    .coa-grid td,
    .coa-list td,
    .company-grid td,
    .dimension-grid td,
    .tb-grid td,
    .journal-grid td,
    .manual-grid td,
    .intercompany-grid td,
    .fx-grid td,
    .fs-map-grid td
) {
    border-color: var(--ff-color-border);
}

:where(.main-container, .embed-view) :is(
    .history-row:nth-child(odd) td,
    .coa-grid tbody tr:nth-child(odd) td,
    .company-grid tbody tr:nth-child(odd) td,
    .dimension-grid tbody tr:nth-child(odd) td,
    .tb-grid tbody tr:nth-child(odd) td,
    .journal-grid tbody tr:nth-child(odd) td,
    .fx-grid tbody tr:nth-child(odd) td
) {
    background: var(--ff-table-row-alt-bg);
}

:where(.main-container, .embed-view) :is(
    .history-row:hover td,
    .coa-grid-row:hover td,
    .company-grid-row:hover td,
    .dimension-grid-row:hover td,
    .tb-grid-row:hover td,
    .journal-grid-row:hover td,
    .fx-grid-row:hover td
) {
    background: var(--ff-table-row-hover-bg) !important;
}

:where(.main-container, .embed-view) :is(
    .badge,
    .coa-kind-pill,
    .ff-admin-pill,
    .navbar-org-menu-current,
    .refresh-menu-status span
) {
    border-radius: 999px;
    font-size: var(--ff-font-size-xs);
    font-weight: 700;
    letter-spacing: 0;
}

:where(.main-container, .embed-view) :is(
    .coa-actions-menu-dropdown,
    .journal-actions-menu-dropdown,
    .fs-menu,
    .fs-multi-filter-menu,
    .app-cell-context-menu
) {
    background: var(--ff-color-surface);
    border-color: var(--ff-color-border);
    border-radius: var(--ff-radius-md);
    box-shadow: var(--ff-shadow-md);
}

.navbar-icon-menu-content,
.navbar-user-menu-content {
    background: var(--ff-color-surface);
    border-color: var(--ff-color-border);
    border-radius: var(--ff-radius-md);
    box-shadow: var(--ff-shadow-md);
}

.navbar-user-menu-content :is(button, a),
.navbar-icon-menu-content :is(button, a, select) {
    font-family: var(--app-font-family);
    letter-spacing: 0;
}

.refresh-draft-warning-panel,
.session-expired-dialog,
.ai-chat-panel {
    border-color: var(--ff-color-border);
    border-radius: var(--ff-radius-md);
    box-shadow: var(--ff-shadow-md);
}

.refresh-draft-warning-icon {
    background: var(--ff-color-primary-soft);
    border-color: #b7dec4;
    color: var(--ff-color-primary-strong);
}

.ai-chat-toggle {
    background: var(--ff-color-primary);
}

.ai-chat-toggle:hover {
    background: var(--ff-color-primary-strong);
}

.ai-chat-send {
    background: var(--ff-color-action);
}

.ai-chat-send:hover:not(:disabled) {
    background: var(--ff-color-action-hover);
}

.pricing-card {
    background: var(--ff-color-surface);
    border-color: var(--ff-color-border);
}

.pricing-benefits li::before {
    background: var(--ff-color-primary);
}

.marketing-footer {
    background: #e8edf3;
    border-color: var(--ff-color-border);
}

@media (max-width: 760px) {
    :root {
        --ff-font-size-page-title: 1.4rem;
    }

    :where(.main-container, .embed-view, .pricing-content) h1 {
        font-size: var(--ff-font-size-page-title);
    }
}
