/* Today modern dashboard — solid surfaces, light-first, premium scan density */

/* ── Page / chrome ─────────────────────────────────────────── */
.fo-today-page.fo-today-page--modern,
.fo-today-dashboard--modern {
    --fo-today-card-radius: 12px;
    --fo-today-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
    --fo-today-card-border: var(--fo-border, #e2e8f0);
}

.fo-today-page--modern .fo-page-body {
    max-width: min(1560px, 100%);
    padding: 24px 24px 40px;
}

.fo-today-page--modern .fo-today-chrome {
    background: var(--fo-page-bg, #f7f8fa);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--fo-today-card-border);
    box-shadow: none;
}

.fo-today-page--modern .fo-today-command-bar {
    padding: 16px 24px 12px;
    gap: 16px;
}

/* Solid primary cards on the modern Today surface */
.fo-today-dashboard--modern .fo-card,
.fo-today-dashboard--modern .fo-kpi-card,
.fo-today-dashboard--modern .fo-today-kpi-card,
.fo-today-dashboard--modern .fo-today-brief,
.fo-today-dashboard--modern .fo-today-attention,
.fo-today-dashboard--modern .fo-today-schedule-rail,
.fo-today-dashboard--modern .fo-today-work-overview,
.fo-today-dashboard--modern .fo-today-revenue-overview,
.fo-today-dashboard--modern .fo-today-insight-card,
.fo-today-dashboard--modern .ops-intelligence-panel,
.fo-today-dashboard--modern .kpi-card {
    background: var(--fo-card, #ffffff) !important;
    background-image: none !important;
    border: 1px solid var(--fo-today-card-border) !important;
    border-radius: var(--fo-today-card-radius);
    box-shadow: var(--fo-today-card-shadow);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1;
}

/* ── 3-region interior (main + rail; shell owns sidebar) ── */
.fo-today-dashboard--modern {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 24px;
    align-items: start;
}

.fo-today-dashboard--modern .fo-today-dashboard__main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.fo-today-dashboard--modern .fo-today-dashboard__rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    position: sticky;
    top: 0.5rem;
}

.fo-today-dashboard--modern .fo-today-dashboard__hero {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Greeting / brief ──────────────────────────────────────── */
.fo-today-dashboard--modern .fo-today-brief {
    padding: 20px 24px;
    margin: 0;
}

.fo-today-dashboard--modern .fo-today-brief-greeting {
    font-size: clamp(1.55rem, 2.4vw, 1.95rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fo-text-primary);
    line-height: 1.2;
}

.fo-today-dashboard--modern .fo-today-brief-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
}

.fo-today-dashboard--modern .fo-today-brief-snapshot {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fo-today-dashboard--modern .fo-today-brief-fact-link,
.fo-today-dashboard--modern .fo-today-brief-fact-static {
    background: var(--fo-surface-secondary, #f1f5f9);
    border: 1px solid var(--fo-today-card-border);
    border-radius: 10px;
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
}

/* ── Quick actions: compact cards (not giant circles / pills) ── */
.fo-today-page--modern .fo-quick-action,
.fo-today-page--modern .fo-dashboard-action {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.35rem;
    min-width: 7.25rem;
    min-height: 2.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--fo-today-card-border);
    background: var(--fo-card, #ffffff);
    color: var(--fo-text-primary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    white-space: normal;
    font-size: 0.8125rem;
    text-decoration: none;
}

.fo-today-page--modern .fo-quick-action i,
.fo-today-page--modern .fo-dashboard-action i {
    font-size: 1.05rem;
    color: var(--fo-btn-primary-bg, #2563eb);
}

.fo-today-page--modern .fo-dashboard-action--primary,
.fo-today-page--modern .fo-quick-action--primary {
    border-color: var(--fo-btn-primary-bg, #2563eb);
    background: var(--fo-btn-primary-bg, #2563eb);
    color: var(--fo-btn-primary-text, #ffffff) !important;
}

.fo-today-page--modern .fo-dashboard-action--primary i,
.fo-today-page--modern .fo-dashboard-action--primary span,
.fo-today-page--modern .fo-quick-action--primary i,
.fo-today-page--modern .fo-quick-action--primary span {
    /* app.css sets `span { color: var(--fo-text-primary) !important }` */
    color: var(--fo-btn-primary-text, #ffffff) !important;
}

.fo-today-page--modern .fo-quick-action:hover,
.fo-today-page--modern .fo-quick-action:focus-visible,
.fo-today-page--modern .fo-dashboard-action:hover,
.fo-today-page--modern .fo-dashboard-action:focus-visible {
    border-color: var(--fo-btn-primary-bg, #2563eb);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--fo-btn-primary-bg, #2563eb) 25%, transparent);
    outline: none;
    color: var(--fo-text-primary);
}

.fo-today-page--modern .fo-dashboard-action--primary:hover,
.fo-today-page--modern .fo-dashboard-action--primary:focus-visible,
.fo-today-page--modern .fo-quick-action--primary:hover,
.fo-today-page--modern .fo-quick-action--primary:focus-visible {
    color: var(--fo-btn-primary-text, #ffffff) !important;
    filter: brightness(1.05);
}

.fo-today-page--modern .fo-today-quick-action-group__label {
    font-size: 0.7rem;
    letter-spacing: 0.07em;
}

/* ── KPI row ───────────────────────────────────────────────── */
.fo-today-dashboard--modern .fo-today-kpi-strip--ops {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 0;
}

.fo-today-dashboard--modern .fo-today-kpi-card {
    min-height: 6.25rem;
    padding: 14px 16px;
    border-radius: var(--fo-today-card-radius);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fo-today-dashboard--modern .fo-today-kpi-card:hover,
.fo-today-dashboard--modern .fo-today-kpi-card:focus-visible {
    border-color: color-mix(in srgb, var(--fo-btn-primary-bg, #2563eb) 40%, var(--fo-today-card-border)) !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    outline: none;
}

.fo-today-dashboard--modern .fo-kpi-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0;
}

.fo-today-dashboard--modern .fo-kpi-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fo-text-secondary);
    text-transform: none;
    letter-spacing: 0;
}

.fo-today-dashboard--modern .fo-today-kpi-icon,
.fo-today-dashboard--modern .fo-today-kpi-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--fo-btn-primary-bg, #2563eb) 12%, transparent);
    color: var(--fo-btn-primary-bg, #2563eb);
    font-size: 0.95rem;
}

.fo-today-dashboard--modern .fo-kpi-card--danger .fo-today-kpi-icon-badge {
    background: color-mix(in srgb, #dc2626 14%, transparent);
    color: #dc2626;
}

.fo-today-dashboard--modern .fo-kpi-card--warn .fo-today-kpi-icon-badge {
    background: color-mix(in srgb, #d97706 16%, transparent);
    color: #d97706;
}

.fo-today-dashboard--modern .fo-kpi-card--success .fo-today-kpi-icon-badge {
    background: color-mix(in srgb, #15803d 14%, transparent);
    color: #15803d;
}

.fo-today-dashboard--modern .fo-kpi-value {
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--fo-text-primary);
}

.fo-today-dashboard--modern .fo-kpi-card--danger,
.fo-today-dashboard--modern .fo-kpi-card--warn,
.fo-today-dashboard--modern .fo-kpi-card--success,
.fo-today-dashboard--modern .fo-kpi-card--info {
    /* Soft border accent only — keep solid white base */
    background: var(--fo-card, #ffffff) !important;
}

.fo-today-dashboard--modern .fo-kpi-card--danger { border-color: color-mix(in srgb, #dc2626 35%, var(--fo-today-card-border)) !important; }
.fo-today-dashboard--modern .fo-kpi-card--warn { border-color: color-mix(in srgb, #d97706 40%, var(--fo-today-card-border)) !important; }
.fo-today-dashboard--modern .fo-kpi-card--success { border-color: color-mix(in srgb, #15803d 35%, var(--fo-today-card-border)) !important; }
.fo-today-dashboard--modern .fo-kpi-card--info { border-color: color-mix(in srgb, #2563eb 35%, var(--fo-today-card-border)) !important; }

.fo-today-dashboard--modern .fo-kpi-sub {
    font-size: 0.75rem;
    color: var(--fo-text-tertiary);
}

/* ── Charts row ────────────────────────────────────────────── */
.fo-today-overview-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
}

.fo-today-zone-eyebrow {
    margin: 0 0 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fo-text-tertiary);
}

.fo-today-revenue-overview,
.fo-today-work-overview {
    padding: 18px 20px;
}

.fo-today-revenue-overview__title,
.fo-today-work-overview__title {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 650;
}

.fo-today-revenue-overview__bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fo-today-revenue-overview__row {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr) 4.5rem;
    gap: 10px;
    align-items: center;
}

.fo-today-revenue-overview__label {
    font-size: 0.8125rem;
    color: var(--fo-text-secondary);
}

.fo-today-revenue-overview__track {
    height: 8px;
    border-radius: 999px;
    background: var(--fo-surface-secondary, #f1f5f9);
    overflow: hidden;
}

.fo-today-revenue-overview__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--fo-btn-primary-bg, #2563eb);
    min-width: 2px;
}

.fo-today-revenue-overview__fill--month {
    background: #0d9488;
}

.fo-today-revenue-overview__fill--potential {
    background: #7c3aed;
}

.fo-today-revenue-overview__amount {
    font-size: 0.8125rem;
    font-weight: 650;
    text-align: right;
    color: var(--fo-text-primary);
    font-variant-numeric: tabular-nums;
}

.fo-today-revenue-overview__empty,
.fo-today-work-overview .fo-today-insight-card__empty {
    margin: 0;
    color: var(--fo-text-tertiary);
    font-size: 0.875rem;
}

.fo-today-work-overview__total {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.fo-today-work-overview__total-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.fo-today-work-overview__total-label {
    font-size: 0.8125rem;
    color: var(--fo-text-tertiary);
}

.fo-today-work-overview__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fo-today-work-overview__list li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    font-size: 0.875rem;
}

.fo-today-work-overview__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.fo-today-work-overview__dot--completed { background: #15803d; }
.fo-today-work-overview__dot--progress { background: #2563eb; }
.fo-today-work-overview__dot--scheduled { background: #d97706; }
.fo-today-work-overview__dot--pending { background: #94a3b8; }

/* ── Attention + schedule rail ─────────────────────────────── */
.fo-today-dashboard--modern .fo-today-attention {
    padding: 16px 18px;
}

.fo-today-dashboard--modern .fo-today-attention__title {
    font-size: 0.95rem;
    font-weight: 650;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.fo-today-dashboard--modern .fo-today-attention__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.fo-today-dashboard--modern .fo-today-attention__item {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--fo-today-card-border);
    background: var(--fo-surface-secondary, #f8fafc);
    border-left-width: 3px;
}

.fo-today-dashboard--modern .fo-today-attention__item--critical {
    border-left-color: #dc2626;
}

.fo-today-dashboard--modern .fo-today-attention__item--warning {
    border-left-color: #d97706;
}

.fo-today-dashboard--modern .fo-today-attention__item--info {
    border-left-color: #2563eb;
}

.fo-today-dashboard--modern .fo-today-attention__empty {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 0 4px;
    color: var(--fo-text-secondary);
}

.fo-today-dashboard--modern .fo-today-attention__empty i {
    color: #15803d;
    font-size: 1.15rem;
}

.fo-today-dashboard--modern .fo-today-attention__footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--fo-today-card-border);
}

.fo-today-rail-link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fo-btn-primary-bg, #2563eb);
    text-decoration: none;
}

.fo-today-rail-link:hover,
.fo-today-rail-link:focus-visible {
    text-decoration: underline;
    outline: none;
}

.fo-today-rail-link--footer {
    display: inline-block;
    margin-top: 10px;
}

.fo-today-schedule-rail {
    padding: 16px 18px;
}

.fo-today-schedule-rail__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.fo-today-schedule-rail__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 650;
}

.fo-today-schedule-rail__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fo-today-schedule-rail__row {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--fo-today-card-border);
}

.fo-today-schedule-rail__row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.fo-today-schedule-rail__time {
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--fo-text-secondary);
    font-variant-numeric: tabular-nums;
}

.fo-today-schedule-rail__customer {
    display: block;
    font-size: 0.875rem;
    font-weight: 650;
}

.fo-today-schedule-rail__service {
    display: block;
    font-size: 0.78rem;
    color: var(--fo-text-tertiary);
    margin: 2px 0 4px;
}

.fo-today-schedule-rail__status {
    font-size: 0.7rem !important;
}

.fo-today-schedule-rail__status--progress { background: color-mix(in srgb, #2563eb 18%, transparent); color: #1d4ed8; }
.fo-today-schedule-rail__status--completed { background: color-mix(in srgb, #15803d 16%, transparent); color: #166534; }
.fo-today-schedule-rail__status--scheduled { background: color-mix(in srgb, #d97706 18%, transparent); color: #b45309; }
.fo-today-schedule-rail__status--pending { background: color-mix(in srgb, #64748b 16%, transparent); color: #475569; }

.fo-today-schedule-rail__empty {
    color: var(--fo-text-secondary);
    font-size: 0.875rem;
    padding: 4px 0 0;
}

/* ── Insights row ──────────────────────────────────────────── */
.fo-today-insights--row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.fo-today-insight-card {
    padding: 16px 18px;
    min-height: 10rem;
}

.fo-today-insight-card__title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 650;
}

.fo-today-insight-card__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fo-today-insight-card__name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fo-text-primary);
}

.fo-today-insight-card__meta {
    display: block;
    font-size: 0.75rem;
    color: var(--fo-text-tertiary);
    margin-top: 2px;
}

.fo-today-insight-card__empty {
    margin: 0;
    font-size: 0.875rem;
    color: var(--fo-text-tertiary);
}

/* Secondary pack breathe */
.fo-today-dashboard--modern .fo-today-dashboard__pack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.fo-today-dashboard--modern .fo-today-dashboard__secondary {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Dark / night mode mirrors hierarchy with solid elevated cards ── */
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-card,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-kpi-card,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-kpi-card,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-brief,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-attention,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-schedule-rail,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-work-overview,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-revenue-overview,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-insight-card {
    background: var(--fo-card, #1e293b) !important;
    border-color: var(--fo-border, #334155) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

html[data-fo-theme="dark"] .fo-today-page--modern .fo-today-chrome {
    background: var(--fo-page-bg, #0f172a);
}

html[data-fo-theme="dark"] .fo-today-page--modern .fo-quick-action,
html[data-fo-theme="dark"] .fo-today-page--modern .fo-dashboard-action {
    background: var(--fo-card, #1e293b);
    color: var(--fo-text-primary);
}

html[data-fo-theme="dark"] .fo-today-page--modern .fo-dashboard-action--primary,
html[data-fo-theme="dark"] .fo-today-page--modern .fo-quick-action--primary {
    background: var(--fo-btn-primary-bg, #2563eb);
    border-color: var(--fo-btn-primary-bg, #2563eb);
    color: var(--fo-btn-primary-text, #ffffff) !important;
}

html[data-fo-theme="dark"] .fo-today-page--modern .fo-dashboard-action--primary i,
html[data-fo-theme="dark"] .fo-today-page--modern .fo-dashboard-action--primary span,
html[data-fo-theme="dark"] .fo-today-page--modern .fo-quick-action--primary i,
html[data-fo-theme="dark"] .fo-today-page--modern .fo-quick-action--primary span {
    color: var(--fo-btn-primary-text, #ffffff) !important;
}

html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-attention__item,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-brief-fact-link,
html[data-fo-theme="dark"] .fo-today-dashboard--modern .fo-today-brief-fact-static {
    background: rgba(15, 23, 42, 0.55);
}

html[data-fo-theme="dark"] .fo-today-revenue-overview__track {
    background: rgba(15, 23, 42, 0.65);
}

/* Theme toggle control */
.fo-theme-toggle-btn {
    min-width: 2.5rem;
    min-height: 2.5rem;
}

/* Light shell polish */
html[data-fo-theme="light"] .main-sidebar {
    background: #ffffff !important;
}

html[data-fo-theme="light"] .fieldops-topbar {
    background: #ffffff !important;
    border-bottom: 1px solid var(--fo-neutral-200, #e2e8f0) !important;
    box-shadow: none;
}

html[data-fo-theme="light"] .workspace-nav-link--active,
html[data-fo-theme="light"] .workspace-nav-link.active {
    background: color-mix(in srgb, #2563eb 10%, #ffffff);
    color: #1d4ed8;
    border-left: 3px solid #2563eb;
}

/* When theme attribute missing, prefer light scheme (FOUC still sets attr) */
html:not([data-fo-theme]) {
    color-scheme: light;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .fo-today-dashboard--modern {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
        gap: 16px;
    }

    .fo-today-overview-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .fo-today-dashboard--modern {
        grid-template-columns: 1fr;
    }

    .fo-today-dashboard--modern .fo-today-dashboard__rail {
        position: static;
    }

    .fo-today-insights--row {
        grid-template-columns: 1fr;
    }

    .fo-today-dashboard--modern .fo-today-dashboard__pack {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .fo-today-page--modern .fo-page-body {
        padding: 10px 10px 20px;
    }

    .fo-today-dashboard--modern .fo-today-kpi-strip--ops {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .fo-today-dashboard--modern .fo-today-kpi-card {
        min-height: 0;
        padding: 8px 10px;
        gap: 0.15rem;
    }

    .fo-today-insight-card {
        padding: 10px 12px;
        min-height: 0;
    }

    .fo-today-dashboard--modern .fo-today-dashboard__pack {
        gap: 10px;
    }

    .fo-today-page--modern .fo-quick-action {
        min-width: 5.5rem;
        min-height: 44px;
        padding: 0.45rem 0.65rem;
    }

    .fo-today-revenue-overview__row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .fo-today-revenue-overview__amount {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fo-today-dashboard--modern .fo-today-kpi-card,
    .fo-today-page--modern .fo-quick-action {
        transition: none;
    }
}
