/*
 * Fleet Desk — customer portal styles (issue #126).
 *
 * Deliberately DieselSS, not wp-admin and not Tavina: rides the
 * dieselss-industrial --di-* tokens (Rajdhani display, Barlow body,
 * ink/steel/blue/amber scale) with literal fallbacks so the desk keeps
 * the brand even if the theme retunes a value. All component classes
 * are fd- prefixed and scoped under .fd-app — nothing leaks to the site.
 */

.fd-app {
    --fd-ink-900: var(--di-ink-900, #070b10);
    --fd-ink-700: var(--di-ink-700, #11161d);
    --fd-ink-600: var(--di-ink-600, #161e28);
    --fd-ink-500: var(--di-ink-500, #1e2933);
    --fd-steel-400: var(--di-steel-400, #64798c);
    --fd-steel-300: var(--di-steel-300, #9fb0c0);
    --fd-steel-100: var(--di-steel-100, #e8eef4);
    --fd-blue-600: var(--di-blue-600, #006ba1);
    --fd-blue-500: var(--di-blue-500, #007cba);
    --fd-amber-500: var(--di-amber-500, #ffb020);
    --fd-amber-600: var(--di-amber-600, #e09a12);
    --fd-focus: var(--di-focus, #4db2ff);
    --fd-font-display: var(--di-font-display, 'Rajdhani', 'Arial Narrow', system-ui, sans-serif);
    --fd-font-body: var(--di-font-body, 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif);
    --fd-ok: #27c07d;
    --fd-warn: var(--di-amber-500, #ffb020);
    --fd-bad: #ef5a5a;
    color: var(--fd-steel-300);
    font-family: var(--fd-font-body);
    font-size: 1rem;
    line-height: 1.55;
}

/* ---- shell ------------------------------------------------------ */

.fd-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.fd-topbar h1 {
    font-family: var(--fd-font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 1.4rem + 1vw, 2.1rem);
    color: var(--fd-steel-100);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.1;
}

.fd-topbar h1 small {
    display: block;
    font-size: 0.5em;
    font-weight: 600;
    color: var(--fd-steel-400);
    letter-spacing: 0.14em;
}

.fd-topbar-spacer { flex: 1 1 auto; }

.fd-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.92rem;
    color: var(--fd-steel-400);
}

.fd-user strong { color: var(--fd-steel-100); font-weight: 600; }

/* ---- buttons, inputs -------------------------------------------- */

.fd-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.05rem;
    border: 1px solid var(--fd-ink-500);
    border-radius: 4px;
    background: var(--fd-ink-600);
    color: var(--fd-steel-100);
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.fd-btn:hover { border-color: var(--fd-amber-500); }
.fd-btn:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; }
.fd-btn[disabled] { opacity: 0.55; cursor: wait; }

.fd-btn--primary { background: var(--fd-blue-600); border-color: var(--fd-blue-600); color: #fff; }
.fd-btn--primary:hover { background: var(--fd-blue-500); border-color: var(--fd-blue-500); }
.fd-btn--amber { background: var(--fd-amber-500); border-color: var(--fd-amber-500); color: #14181d; }
.fd-btn--amber:hover { background: var(--fd-amber-600); border-color: var(--fd-amber-600); }
.fd-btn--ghost { background: transparent; }
.fd-btn--small { padding: 0.3rem 0.7rem; font-size: 0.82rem; }

.fd-input,
.fd-select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--fd-ink-500);
    border-radius: 4px;
    background: var(--fd-ink-700);
    color: var(--fd-steel-100);
    font-family: var(--fd-font-body);
    font-size: 0.95rem;
}

.fd-input:focus,
.fd-select:focus { outline: 2px solid var(--fd-focus); outline-offset: 1px; }

.fd-label {
    display: block;
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fd-steel-400);
    margin-bottom: 0.3rem;
}

.fd-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--fd-steel-300);
}

/* ---- sign-in ---------------------------------------------------- */

.fd-signin {
    max-width: 26rem;
    margin: 3rem auto 0;
    padding: 2rem 2rem 1.6rem;
    border: 1px solid var(--fd-ink-500);
    border-radius: 8px;
    background: var(--fd-ink-700);
}

.fd-signin h2 {
    font-family: var(--fd-font-display);
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--fd-steel-100);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 0.35rem;
}

.fd-signin p {
    margin: 0 0 1.2rem;
    color: var(--fd-steel-400);
    font-size: 0.95rem;
}

.fd-signin .fd-field { margin-bottom: 1rem; }
.fd-signin .fd-field input { width: 100%; box-sizing: border-box; }
.fd-signin .fd-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; }

/* ---- notices, empty states --------------------------------------- */

.fd-note {
    border: 1px solid var(--fd-ink-500);
    border-left: 3px solid var(--fd-blue-500);
    border-radius: 4px;
    background: var(--fd-ink-700);
    padding: 0.9rem 1.1rem;
    margin: 1rem 0;
    color: var(--fd-steel-300);
}

.fd-note--warn { border-left-color: var(--fd-warn); }
.fd-note--bad { border-left-color: var(--fd-bad); }
.fd-note strong { color: var(--fd-steel-100); }

.fd-empty {
    border: 1px dashed var(--fd-ink-500);
    border-radius: 8px;
    padding: 2rem 1.4rem;
    text-align: center;
    color: var(--fd-steel-400);
}

.fd-empty .fd-empty-title {
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--fd-steel-300);
    margin-bottom: 0.3rem;
}

/* ---- tabs -------------------------------------------------------- */

.fd-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--fd-ink-500);
    margin-bottom: 1.25rem;
    overflow-x: auto;
}

.fd-tab {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.55rem 1rem 0.5rem;
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fd-steel-400);
    cursor: pointer;
    white-space: nowrap;
}

.fd-tab:hover { color: var(--fd-steel-100); }
.fd-tab[aria-selected="true"] {
    color: var(--fd-steel-100);
    border-bottom-color: var(--fd-amber-500);
}
.fd-tab:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: -2px; }
.fd-tab .fd-count {
    display: inline-block;
    min-width: 1.4em;
    margin-left: 0.4rem;
    padding: 0.05em 0.4em;
    border-radius: 999px;
    background: var(--fd-ink-600);
    font-size: 0.78em;
    text-align: center;
    color: var(--fd-steel-300);
}

/* ---- cards + grids ----------------------------------------------- */

.fd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: 1rem;
}

.fd-card {
    border: 1px solid var(--fd-ink-500);
    border-radius: 8px;
    background: var(--fd-ink-600);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.fd-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.fd-card-title {
    font-family: var(--fd-font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--fd-steel-100);
    letter-spacing: 0.03em;
}

.fd-card-sub { font-size: 0.85rem; color: var(--fd-steel-400); }

.fd-summary {
    color: var(--fd-steel-300);
    font-size: 0.95rem;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.fd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    font-size: 0.82rem;
    color: var(--fd-steel-400);
}

.fd-card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.2rem; }

/* ---- badges ------------------------------------------------------- */

.fd-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.6rem;
    border-radius: 999px;
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.fd-badge--received { color: var(--fd-steel-100); background: var(--fd-ink-500); border-color: var(--fd-steel-400); }
.fd-badge--in_repair { color: #14181d; background: var(--fd-amber-500); border-color: var(--fd-amber-500); }
.fd-badge--report_ready { color: #0c2b1c; background: var(--fd-ok); border-color: var(--fd-ok); }
.fd-badge--emergency { color: #fff; background: var(--fd-bad); border-color: var(--fd-bad); }
.fd-badge--pm-due { color: #14181d; background: var(--fd-amber-500); border-color: var(--fd-amber-500); }
.fd-badge--pm-approaching { color: var(--fd-steel-100); background: var(--fd-ink-500); border-color: var(--fd-steel-400); }
.fd-badge--new { color: #14181d; background: var(--fd-amber-500); border-color: var(--fd-amber-500); }
/* #143: priority spread badges + report version badge */
.fd-badge--p-critical { color: #fff; background: var(--fd-bad); border-color: var(--fd-bad); }
.fd-badge--p-high { color: #fff; background: #c2410c; border-color: #c2410c; }
.fd-badge--p-medium { color: #14181d; background: var(--fd-amber-500); border-color: var(--fd-amber-500); }
.fd-badge--p-low { color: var(--fd-steel-100); background: var(--fd-ink-500); border-color: var(--fd-steel-400); }
.fd-badge--ver { color: var(--fd-steel-100); background: var(--fd-ink-500); border-color: var(--fd-steel-400); }
/* #143: distilled daily-inspection checklist bullets */
.fd-checklist { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.fd-checklist li { margin: 0.15rem 0; }

/* ---- tables ------------------------------------------------------- */

.fd-table-wrap { overflow-x: auto; border: 1px solid var(--fd-ink-500); border-radius: 8px; }

.fd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
    min-width: 34rem;
}

.fd-table th {
    text-align: left;
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--fd-steel-400);
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--fd-ink-500);
    background: var(--fd-ink-700);
}

.fd-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--fd-ink-500);
    color: var(--fd-steel-300);
    vertical-align: top;
}

.fd-table tr:last-child td { border-bottom: none; }
.fd-table tbody tr:hover td { background: var(--fd-ink-700); }
.fd-table .fd-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- filters row ---------------------------------------------------- */

.fd-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.fd-filters .fd-field { display: flex; flex-direction: column; }
.fd-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.fd-chip {
    appearance: none;
    border: 1px solid var(--fd-ink-500);
    border-radius: 999px;
    background: transparent;
    color: var(--fd-steel-400);
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.25rem 0.85rem;
    cursor: pointer;
}

.fd-chip:hover { color: var(--fd-steel-100); }
.fd-chip[aria-pressed="true"] {
    color: #14181d;
    background: var(--fd-amber-500);
    border-color: var(--fd-amber-500);
}

/* ---- section headings ------------------------------------------------ */

.fd-h2 {
    font-family: var(--fd-font-display);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--fd-steel-100);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 1.6rem 0 0.3rem;
}

.fd-h2 .fd-h2-sub {
    display: block;
    font-family: var(--fd-font-body);
    font-weight: 400;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--fd-steel-400);
}

/* ---- report viewer ---------------------------------------------------- */

.fd-report {
    border: 1px solid var(--fd-ink-500);
    border-radius: 8px;
    background: var(--fd-ink-700);
    padding: 1.6rem 1.8rem;
    max-width: 52rem;
}

.fd-report-head {
    border-bottom: 1px solid var(--fd-ink-500);
    padding-bottom: 1rem;
    margin-bottom: 1.2rem;
}

.fd-report-title {
    font-family: var(--fd-font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--fd-steel-100);
    letter-spacing: 0.03em;
    margin: 0 0 0.4rem;
}

.fd-report-ident {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.fd-report-ident .fd-k { color: var(--fd-steel-400); }
.fd-report-ident .fd-v { color: var(--fd-steel-100); font-weight: 600; }

.fd-report h3 {
    font-family: var(--fd-font-display);
    font-weight: 600;
    font-size: 1.02rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fd-amber-500);
    margin: 1.3rem 0 0.4rem;
}

.fd-report .fd-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--fd-steel-300); }

.fd-report-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.4rem 0 0; }

/* ---- fleet switcher ---------------------------------------------------- */

.fd-switch select { min-width: 12rem; }

/* ---- skeleton / loading ------------------------------------------------ */

.fd-loading {
    color: var(--fd-steel-400);
    font-family: var(--fd-font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 1.2rem 0;
}

/* ---- responsive --------------------------------------------------------- */

@media (max-width: 48rem) {
    .fd-report { padding: 1.1rem 1rem; }
    .fd-table { min-width: 30rem; }
    .fd-signin { margin-top: 1.5rem; padding: 1.4rem 1.2rem; }
    .fd-topbar h1 small { display: none; }
}

/* ---- print: the report, the whole report, nothing but the report ------- */

@media print {
    body.fleet-desk-body .di-header,
    body.fleet-desk-body .di-footer,
    body.fleet-desk-body .di-nav,
    body.fleet-desk-body .di-nav-toggle,
    body.fleet-desk-body .di-site > footer,
    .fd-app .fd-tabs,
    .fd-app .fd-topbar,
    .fd-app .fd-filters,
    .fd-app .fd-signin,
    .fd-app .fd-print-hide,
    .fd-app .fd-not-print { display: none !important; }

    .fd-app {
        background: #fff !important;
        color: #111 !important;
    }

    .fd-app .fd-print-area {
        display: block !important;
    }

    .fd-report {
        border: none !important;
        background: #fff !important;
        color: #111 !important;
        padding: 0 !important;
        max-width: none !important;
    }

    .fd-report .fd-report-title { color: #000 !important; }
    .fd-report .fd-report-ident .fd-v,
    .fd-report .fd-text,
    .fd-report h3 + .fd-text { color: #111 !important; }
    .fd-report h3 { color: #004a59 !important; }
    .fd-report .fd-report-ident .fd-k { color: #555 !important; }
    .fd-report-actions { display: none !important; }

    .fd-report a { color: #005a87 !important; text-decoration: none; }
    .fd-badge { border: 1px solid #666 !important; background: #fff !important; color: #111 !important; }

    a[href]::after { content: "" !important; }
}

/* Shop Technician Notes (issue #140): read-only DSS-authored block on
   ticket detail; hidden entirely when no notes are published. */
.fd-technician-notes {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--fd-accent, #d97706);
    background: var(--fd-surface-muted, rgba(0, 0, 0, 0.04));
    border-radius: 4px;
}
.fd-technician-notes strong {
    display: block;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.fd-technician-notes p {
    margin: 0;
    white-space: normal;
}
