/* ============================================================
   WorxOrder — design system
   Bluefin brand pack: Space Grotesk display, Hanken Grotesk body,
   Space Mono for data/labels. Tenant-overridable accent via
   --accent (set per-tenant in MainLayout). Module colours come
   from the WorxOrder fin (manage=amber, mobile=teal, integrate=violet).
   ============================================================ */

:root {
    --bg:           #F8FAFC;
    --card:         #FFFFFF;
    --text:         #0E1B2E;             /* Ocean Ink */
    --text-2:       #475569;
    --text-3:       #94A3B8;
    --border:       #E2E8F0;
    --border-soft:  #F1F5F9;
    --hover:        #F8FAFC;

    /* Bluefin / WorxOrder brand palette */
    --brand-blue:      #0E5FD8;          /* Bluefin Blue — the fin */
    --brand-ink:       #0A1626;          /* Ocean Ink — backgrounds */
    --brand-teal:      #0FB5A6;          /* Mobile module */
    --brand-amber:     #F59E0B;          /* Manage module */
    --brand-violet:    #6C5CE7;          /* Integrate module */

    /* Tenant accent — overridden in MainLayout when a tenant is resolved.
       Default to Bluefin Blue so the app feels like a WorxOrder product
       on apex/unresolved surfaces. */
    --accent:       #0E5FD8;
    --accent-soft:  color-mix(in srgb, #0E5FD8 10%, white);
    --accent-text:  #FFFFFF;

    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm:  8px;

    --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 4px 12px rgba(15,23,42,.06);
    --shadow-lg: 0 24px 48px -16px rgba(15,23,42,.18), 0 4px 8px rgba(15,23,42,.04);

    /* Typography stacks */
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body:    'Hanken Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono:    'Space Mono', ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    letter-spacing: -0.01em;
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 600;
}
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============= Login / auth page ============= */

.wo-auth-page {
    min-height: 100vh;
    width: 100%;
    background:
        radial-gradient(ellipse at top right, rgba(14, 95, 216, 0.32) 0%, transparent 55%),
        radial-gradient(ellipse at bottom left, rgba(10, 22, 38, 0.92) 0%, transparent 60%),
        linear-gradient(135deg, #0A1626 0%, #0F1E36 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px 72px;
    position: relative;
    gap: 28px;
}

.wo-auth-brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: #fff;
    text-decoration: none;
    opacity: 0.92;
    transition: opacity 0.15s ease;
}
.wo-auth-brand:hover { opacity: 1; text-decoration: none; }
.wo-auth-brand img { display: block; }

.wo-auth-footer {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}
.wo-auth-footer strong { color: var(--brand-blue); font-weight: 700; letter-spacing: 0.04em; }

.wo-card {
    width: 100%; max-width: 480px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 60px -20px rgba(0,0,0,.45), 0 8px 16px rgba(0,0,0,.18);
    padding: 44px 48px 36px;
}

.wo-tenant-block {
    display: flex; flex-direction: column; align-items: center;
    margin-bottom: 28px;
}
.wo-tenant-logo {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--accent);
    color: var(--accent-text);
    display: grid; place-items: center;
    font-weight: 800; font-size: 22px; letter-spacing: -0.02em;
    box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.wo-tenant-name {
    margin-top: 14px;
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3);
}

.wo-h1 {
    font-family: var(--font-display);
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.025em;
    text-align: center;
    margin: 0 0 6px;
}
.wo-sub {
    font-size: 14px; color: var(--text-2);
    text-align: center;
    margin: 0 0 28px;
}

/* ============= Forms ============= */

.wo-field { margin-bottom: 14px; }
.wo-label {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 13px; font-weight: 500; color: var(--text-2);
    margin-bottom: 6px;
}
.wo-label a {
    font-size: 12px; font-weight: 500;
    color: var(--accent); text-decoration: none;
}
.wo-label a:hover { text-decoration: underline; }

.wo-input,
.wo-select,
.wo-textarea {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit; font-size: 14px;
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.wo-input::placeholder { color: var(--text-3); }
.wo-input:focus,
.wo-select:focus,
.wo-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}
.wo-textarea { resize: vertical; min-height: 80px; font-family: inherit; }

.wo-checkbox-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13.5px; color: var(--text);
    cursor: pointer;
    padding: 6px 0;
}
.wo-checkbox-row input { accent-color: var(--accent); width: 16px; height: 16px; }

.wo-validation {
    color: #B91C1C; font-size: 12px; margin-top: 4px;
}

/* ============= Buttons ============= */

.wo-btn {
    padding: 10px 16px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform .05s, background .15s, box-shadow .15s, border-color .15s;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    line-height: 1;
}
.wo-btn:active { transform: translateY(1px); }
.wo-btn:disabled { opacity: .55; cursor: not-allowed; }
.wo-btn-block { width: 100%; }
.wo-btn-sm { padding: 7px 12px; font-size: 13px; }

.wo-btn-primary {
    background: var(--accent); color: var(--accent-text);
    box-shadow: 0 1px 2px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.15);
}
.wo-btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }

.wo-btn-ghost {
    background: white; color: var(--text);
    border-color: var(--border);
}
.wo-btn-ghost:hover { background: var(--hover); }

.wo-btn-text {
    background: transparent; color: var(--accent); border: none;
    padding: 6px 8px; font-weight: 500;
}
.wo-btn-text:hover { background: var(--accent-soft); }

.wo-error-banner {
    background: #FEF2F2; color: #991B1B;
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13.5px;
}

.wo-info-banner {
    background: var(--accent-soft); color: var(--text);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 13px;
}

.wo-form-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 8px;
}

.wo-back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-2);
    text-decoration: none;
    margin-bottom: 12px;
}
.wo-back-link:hover { color: var(--text); text-decoration: none; }
.wo-back-link svg { width: 14px; height: 14px; }

.wo-table tr.clickable { cursor: pointer; }
.wo-table .nowrap { white-space: nowrap; }

.wo-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px 24px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}
/* Grid cells default to min-content width — long strings (email addresses,
   site addresses) will burst out of their cell without `min-width: 0`.
   Combined with overflow-wrap on the value, long unbroken tokens break
   onto the next line instead of overlapping the neighbour. */
.wo-meta-grid > div { min-width: 0; }
.wo-meta-grid .span-all { grid-column: 1 / -1; }
.wo-meta-label {
    font-size: 11px; font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.wo-meta-value {
    font-size: 14px; color: var(--text); line-height: 1.4;
    overflow-wrap: anywhere;
}
.wo-meta-value.long { color: var(--text-2); line-height: 1.55; }

/* ============= Timeline (Notes) ============= */

.wo-timeline {
    position: relative;
    padding-left: 24px;
    margin: 0 0 16px;
}
.wo-timeline::before {
    content: "";
    position: absolute;
    left: 7px; top: 6px; bottom: 6px;
    width: 2px;
    background: var(--border-soft);
}
.wo-timeline-item {
    margin-bottom: 16px;
    position: relative;
}
.wo-timeline-item:last-child { margin-bottom: 0; }
.wo-timeline-item::before {
    content: "";
    position: absolute;
    left: -22px; top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--accent);
}
.wo-timeline-meta {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 3px;
}
.wo-timeline-meta b {
    color: var(--text);
    font-weight: 600;
}
.wo-timeline-text {
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ============= App shell ============= */

.wo-app-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
}

.wo-sidebar {
    background:
        radial-gradient(ellipse at top right, rgba(30, 58, 95, 0.55) 0%, transparent 55%),
        radial-gradient(ellipse at bottom left, rgba(15, 23, 42, 0.85) 0%, transparent 60%),
        linear-gradient(180deg, #0B1220 0%, #0F1E36 100%);
    color: #CBD5E1;
    padding: 18px 12px 12px;
    display: flex; flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.wo-sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 24px;
    text-decoration: none;
    color: inherit;
}
.wo-sidebar-brand:hover { text-decoration: none; }
.wo-brand-mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--accent);
    color: white;
    display: grid; place-items: center;
    font-weight: 800; font-size: 15px; letter-spacing: -0.02em;
    flex-shrink: 0;
    box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}
.wo-sidebar-brand-name {
    font-weight: 700; font-size: 14px; color: #F8FAFC;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.wo-sidebar-brand-tenant {
    font-size: 11.5px; color: #64748B;
    margin-top: 2px;
    line-height: 1.2;
}

.wo-nav-section { margin-bottom: 16px; }
.wo-nav-label {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-mono);
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.14em;
    color: #94A3B8;
    padding: 6px 12px 4px;
}
.wo-nav-label .wo-module-dot { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.wo-sidebar-brand-name {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
}

.wo-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #94A3B8;
    font-size: 13.5px; font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.wo-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #F8FAFC;
    text-decoration: none;
}
.wo-nav-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    font-weight: 600;
}
.wo-nav-item svg {
    width: 18px; height: 18px;
    color: #64748B;
    flex-shrink: 0;
}
.wo-nav-item:hover svg,
.wo-nav-item.active svg { color: #CBD5E1; }

.wo-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}
.wo-user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.wo-user-card:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.wo-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent);
    color: white;
    display: grid; place-items: center;
    font-weight: 600; font-size: 13px;
    flex-shrink: 0;
}
.wo-user-name {
    font-size: 13px; font-weight: 600; color: #F8FAFC;
    line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wo-user-role {
    font-size: 11px; color: #64748B;
    line-height: 1.3;
}
.wo-user-card svg { color: #475569; flex-shrink: 0; }
.wo-user-card:hover svg { color: #CBD5E1; }

.wo-sidebar-signin {
    margin: 4px 8px 4px;
    padding: 8px 12px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.wo-sidebar-signin:hover { text-decoration: none; filter: brightness(1.05); color: white; }

/* ============= Content area ============= */

.wo-content { overflow-x: hidden; min-width: 0; }

.wo-topbar-app {
    height: 56px;
    background: white;
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky; top: 0; z-index: 10;
}
.wo-topbar-spacer { flex: 1; }
.wo-topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* Site-wide search input in the topbar. Submits a GET to /search?q=… so
   it works in static SSR without any client-side state. */
.wo-search { position: relative; flex: 1; max-width: 360px; }
.wo-search input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    background: var(--border-soft);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.wo-search input::placeholder { color: var(--text-3); }
.wo-search input:focus {
    background: white;
    border-color: var(--border);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.wo-search > svg {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--text-3);
    pointer-events: none;
}

.wo-page { padding: 28px 32px; width: 100%; }

.wo-page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.wo-page-title {
    font-family: var(--font-display);
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
    margin: 0;
}
.wo-page-subtitle {
    font-size: 14px; color: var(--text-2);
    margin-top: 4px;
}

.wo-grid { display: grid; gap: 16px; }
.wo-grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1024px) { .wo-grid-2 { grid-template-columns: 1fr; } }

/* ============= Section card ============= */

.wo-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.wo-section + .wo-section { margin-top: 16px; }
.wo-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    gap: 8px;
}
.wo-section-title {
    font-size: 15px; font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    margin: 0;
}
.wo-section-body { padding: 20px; }
.wo-section-body.flush { padding: 0; }

/* ============= Stat cards ============= */

.wo-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.wo-stat-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    transition: transform .12s, box-shadow .12s;
    cursor: default;
    text-decoration: none;
    color: inherit;
    display: block;
}
.wo-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.wo-stat-card.clickable { cursor: pointer; }
.wo-stat-card.clickable:hover { box-shadow: var(--shadow-md); }
.wo-stat-card.active {
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-md);
    background: var(--accent-soft);
}
.wo-stat-card.active .wo-stat-label { color: var(--accent); }
.wo-stat-label {
    font-size: 11.5px; font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.wo-stat-value {
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.1;
}
.wo-stat-value.outstanding { color: #B91C1C; }
.wo-stat-value.collected   { color: #15803D; }
.wo-stat-trend {
    margin-top: 6px;
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 500;
}
.wo-stat-trend.up   { color: #16A34A; }
.wo-stat-trend.down { color: #DC2626; }
.wo-stat-trend.flat { color: var(--text-3); }

/* Two-row money strip used on Dashboard + /invoices — wider min-cell than
   the default stat grid so the four money cards don't crowd. */
.wo-invoice-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

/* Generic page-grid helpers for multi-column layouts (Dashboard's 2-col body). */
.wo-grid    { display: grid; gap: 16px; }
.wo-grid-2  { grid-template-columns: 2fr 1fr; }
@media (max-width: 1024px) { .wo-grid-2 { grid-template-columns: 1fr; } }

/* ============= Tabs (Section 9 — Job detail tabs) =============
   The Razor markup is <div class="wo-tabs"><div class="wo-tab-headers">
   <a class="wo-tab-header active">…</a></div><div class="wo-tab-body">…</div></div>.
   Header is an <a> link in static SSR so the active state is driven by ?tab=. */

.wo-tabs {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.wo-tab-headers {
    display: flex;
    border-bottom: 1px solid var(--border-soft);
    padding: 0 8px;
    overflow-x: auto;
}
.wo-tab-header {
    padding: 14px 16px;
    font-size: 13px; font-weight: 500;
    color: var(--text-2);
    border: none; background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-family: inherit;
    transition: color .12s, border-color .12s;
    display: inline-flex; align-items: center; gap: 8px;
    white-space: nowrap;
    text-decoration: none;
}
.wo-tab-header:hover { color: var(--text); }
.wo-tab-header.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.wo-tab-header .wo-pill { font-size: 10.5px; padding: 1px 7px; }
.wo-tab-body { padding: 22px 24px; }

/* Flex-fill spacer used inside .wo-filter-bar to push right-side controls away. */
.wo-spacer { flex: 1; }

/* ============= Money strip (Job detail financial summary) =============
   Four-column auto-fit strip sitting between the meta card and the action bar
   on Job detail. Smaller padding + value font than the stat cards used on
   Dashboard / Invoices so the strip stays compact next to the meta. */

.wo-money-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.wo-money-tile {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
}
.wo-money-label {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3);
    margin-bottom: 6px;
}
.wo-money-value {
    font-size: 22px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.1;
}
.wo-money-value.ok   { color: #0F766E; }
.wo-money-value.warn { color: #B45309; }
.wo-money-meta {
    font-size: 11.5px; color: var(--text-3); margin-top: 4px;
}

/* ============= Action bar (status-changing buttons on Job detail) ============= */

.wo-action-bar {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex; align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.wo-action-bar-label {
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-3);
    margin-right: 8px;
    flex-shrink: 0;
}

/* Warn + danger button variants used by Hold / No access / Cancel. */
.wo-btn-warn {
    background: white; color: #B45309;
    border-color: #FCD34D;
}
.wo-btn-warn:hover { background: #FFFBEB; }

.wo-btn-danger {
    background: white; color: #B91C1C;
    border-color: #FCA5A5;
}
.wo-btn-danger:hover { background: #FEF2F2; }

/* ============= Child / nested table row (expandable payments under invoice) ============= */

.wo-child-row td {
    background: #FAFBFD;
    padding: 14px 20px;
}
.wo-child-row .wo-table {
    background: white;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    box-shadow: none;
}

/* ============= Print =============
   Hide chrome (sidebar, topbar, action buttons) so window.print() yields a
   clean record of the invoice / job / detail page the user was looking at.
   Borrowed shadow + background tweaks help laser printers render flat. */
@media print {
    .wo-sidebar,
    .wo-topbar-app,
    .wo-action-bar,
    .wo-back-link,
    form,
    .wo-btn,
    .wo-icon-btn { display: none !important; }

    body, .wo-app-page, .wo-content, .wo-page {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .wo-section, .wo-money-tile, .wo-stat-card, .wo-tabs {
        box-shadow: none !important;
        border: 1px solid #E5E7EB !important;
        break-inside: avoid;
    }

    .clickable { cursor: default !important; }
}

/* ============= Pills ============= */

.wo-pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    font-size: 11.5px; font-weight: 600;
    border-radius: 999px;
    background: #F1F5F9; color: var(--text-2);
    line-height: 1.4;
    white-space: nowrap;
}
.wo-pill-blue   { background: #DBEAFE; color: #1E40AF; }
.wo-pill-cyan   { background: #CFFAFE; color: #155E75; }
.wo-pill-amber  { background: #FEF3C7; color: #92400E; }
.wo-pill-green  { background: #DCFCE7; color: #166534; }
.wo-pill-red    { background: #FEE2E2; color: #991B1B; }
.wo-pill-purple { background: #EDE9FE; color: #5B21B6; }
.wo-pill-slate  { background: #F1F5F9; color: #334155; }
.wo-pill-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
}

/* ============= Table ============= */

.wo-table-wrap {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.wo-filter-bar {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
}

.wo-table {
    width: 100%; border-collapse: collapse;
    font-size: 13.5px;
}
.wo-table th {
    text-align: left;
    font-weight: 500; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-3);
    padding: 11px 16px;
    background: #FAFBFD;
    border-bottom: 1px solid var(--border-soft);
}
.wo-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
    vertical-align: middle;
}
.wo-table tbody tr:last-child td { border-bottom: none; }
.wo-table tbody tr:hover td { background: #FAFBFD; }
.wo-table .text-right { text-align: right; }
.wo-table .text-muted { color: var(--text-2); }
.wo-table .truncate {
    max-width: 1px;
    overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
}

.wo-table-empty {
    padding: 48px 16px; text-align: center;
    color: var(--text-3); font-size: 14px;
}

/* ============= Empty / placeholder ============= */

.wo-empty {
    color: var(--text-3); font-size: 13.5px;
    text-align: center; padding: 24px 0;
}

.wo-placeholder {
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--border-soft);
    color: var(--text-2);
}
.wo-placeholder-title {
    font-weight: 600; color: var(--text);
    margin-bottom: 6px;
}

/* ============= Misc helpers ============= */

.wo-text-muted { color: var(--text-2); }
.wo-text-faint { color: var(--text-3); }
.wo-row { display: flex; align-items: center; gap: 8px; }
.wo-row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wo-spacer { flex: 1; }
.wo-stack { display: flex; flex-direction: column; gap: 4px; }

a.wo-link { color: var(--accent); text-decoration: none; font-weight: 500; }
a.wo-link:hover { text-decoration: underline; }

/* Tenant info strip (used on landing / dashboard before real content) */
.wo-tenant-strip {
    background: var(--accent);
    color: white;
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 60%, transparent);
    max-width: 520px;
}
.wo-tenant-strip-label {
    font-size: 11px; opacity: 0.85;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.wo-tenant-strip-name {
    font-size: 20px; font-weight: 600;
    margin-top: 4px;
}
.wo-tenant-strip-slug {
    font-size: 12px; opacity: 0.8;
    margin-top: 6px;
}
.wo-tenant-strip-slug code {
    background: rgba(255,255,255,0.18);
    padding: 1px 6px; border-radius: 4px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 11px;
}

/* ============= Document explorer ============= */

.wo-explorer {
    display: grid;
    grid-template-columns: 260px 1fr;
    background: white;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-height: 480px;
}

.wo-explorer-tree {
    background: #FAFBFD;
    border-right: 1px solid var(--border-soft);
    padding: 12px 8px;
    overflow-y: auto;
}
.wo-tree-section-title {
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3);
    padding: 8px 10px 6px;
}

.wo-tree-node {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--text-2);
    font-size: 13px;
    text-decoration: none;
    line-height: 1.3;
}
.wo-tree-node:hover {
    background: white;
    color: var(--text);
}
.wo-tree-node.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.wo-tree-node.active .wo-tree-icon { color: var(--accent); }
.wo-tree-chev {
    width: 14px; height: 14px;
    color: var(--text-3);
    flex-shrink: 0;
    transition: transform .12s;
}
.wo-tree-chev.open      { transform: rotate(90deg); }
.wo-tree-chev.placeholder { visibility: hidden; }
.wo-tree-icon {
    width: 16px; height: 16px;
    color: #94A3B8;
    flex-shrink: 0;
}
.wo-tree-label {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wo-tree-count {
    font-size: 11px; color: var(--text-3);
    background: var(--border-soft);
    padding: 1px 6px; border-radius: 999px;
    flex-shrink: 0;
}
.wo-tree-children { padding-left: 20px; }

.wo-explorer-main {
    display: flex; flex-direction: column;
    min-width: 0;
}

.wo-explorer-toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-soft);
}
.wo-breadcrumbs {
    display: flex; align-items: center; gap: 4px;
    font-size: 13.5px; color: var(--text-2);
    flex: 1; min-width: 0;
    overflow: hidden;
}
.wo-breadcrumbs .crumb {
    color: var(--text-2);
    text-decoration: none;
    padding: 4px 6px; border-radius: 6px;
    white-space: nowrap;
}
.wo-breadcrumbs .crumb:hover { background: var(--border-soft); color: var(--text); }
.wo-breadcrumbs .crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.wo-breadcrumbs .crumb.current:hover { background: transparent; }
.wo-breadcrumbs .sep { color: var(--text-3); flex-shrink: 0; }

.wo-explorer-body {
    flex: 1;
    padding: 4px 12px 16px;
    overflow-y: auto;
}

.wo-explorer-row {
    display: grid;
    grid-template-columns: 1fr 110px 100px 150px 80px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
}
.wo-explorer-row .wo-row-actions {
    display: flex; gap: 4px;
    justify-content: flex-end;
}

/* Upload form sits in the toolbar — looks like one logical control. */
.wo-upload-form {
    display: flex; gap: 6px; align-items: center;
}
.wo-upload-form input[type="file"] {
    font-size: 12px;
    color: var(--text-2);
    max-width: 260px;
}
.wo-upload-form input[type="file"]::file-selector-button {
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    padding: 4px 10px;
    margin-right: 8px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
}
.wo-upload-form input[type="file"]::file-selector-button:hover {
    background: var(--border-soft);
}
.wo-explorer-row:last-child { border-bottom: none; }
.wo-explorer-row.head {
    border-bottom: 1px solid var(--border);
    font-size: 11px; font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.04em;
    padding: 8px 12px;
}
.wo-explorer-row.head:hover { background: transparent; }
.wo-explorer-row:not(.head):hover { background: var(--border-soft); }
.wo-explorer-row .text-right { text-align: right; }

.wo-explorer-name {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}
.wo-file-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.wo-file-icon svg { width: 17px; height: 17px; }
.wo-file-icon.folder  { background: #FEF3C7; color: #B45309; }
.wo-file-icon.pdf     { background: #FEE2E2; color: #B91C1C; }
.wo-file-icon.doc     { background: #DBEAFE; color: #1D4ED8; }
.wo-file-icon.xls     { background: #DCFCE7; color: #15803D; }
.wo-file-icon.image   { background: #EDE9FE; color: #6D28D9; }
.wo-file-icon.generic { background: var(--border-soft); color: var(--text-2); }

.wo-file-name {
    font-weight: 500;
    color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wo-file-meta {
    font-size: 11.5px;
    color: var(--text-3);
    margin-top: 1px;
}

.wo-icon-btn {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 8px;
    color: var(--text-2);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.wo-icon-btn:hover { background: var(--border-soft); color: var(--text); }
.wo-icon-btn:disabled,
.wo-icon-btn[aria-disabled="true"] {
    color: var(--text-3);
    cursor: not-allowed;
    opacity: 0.55;
}
.wo-icon-btn:disabled:hover,
.wo-icon-btn[aria-disabled="true"]:hover { background: transparent; }

/* ---------------------------------------------------------------------------
 * Native <dialog> modal. Used by the Job-detail Add task / Add note flows.
 * Native showModal() handles backdrop / Esc / focus trap; we just style the
 * chrome to match wo-section + wo-btn.
 * ------------------------------------------------------------------------- */
.wo-dialog {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    background: #fff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 6px 18px rgba(15, 23, 42, 0.08);
    color: var(--text);
    overflow: hidden;
}
.wo-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}
.wo-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-soft, #F8FAFC);
}
.wo-dialog-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.wo-dialog-close {
    border: 0;
    background: transparent;
    color: var(--text-2);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.wo-dialog-close:hover { background: rgba(15, 23, 42, 0.06); color: var(--text); }
.wo-dialog-body {
    padding: 18px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}
.wo-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}

/* ---------------------------------------------------------------------------
 * Brand surfaces: WorxOrder fin, wordmark, Bluefin attribution.
 * Used on the apex landing, login pages, and any pre-auth marketing surface.
 * ------------------------------------------------------------------------- */
.wo-brand-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wo-brand-wordmark {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--brand-ink);
    line-height: 1;
    margin: 0;
}
.wo-brand-wordmark.sm { font-size: 22px; letter-spacing: -0.035em; }
.wo-brand-wordmark.tiny { font-size: 16px; letter-spacing: -0.03em; }

.wo-brand-footer {
    margin-top: 36px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-3);
}
.wo-brand-footer strong {
    color: var(--brand-blue);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.wo-tenant-card {
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    text-align: center;
    box-shadow: 0 12px 24px -12px rgba(15, 23, 42, 0.22);
}
.wo-tenant-card-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.78;
    margin-bottom: 4px;
}
.wo-tenant-card-name {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Inline brand row used inside the login card and the platform-admin header
   — small fin + wordmark, baseline aligned. */
.wo-brand-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.wo-brand-row img { display: block; }
.wo-brand-row .wo-brand-wordmark { font-size: 20px; letter-spacing: -0.03em; }

/* Module accent dots — used as a small visual cue next to nav items to
   reinforce the four-blade WorxOrder fin. Keep them subtle. */
.wo-module-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.wo-module-dot.manage    { background: var(--brand-amber); }
.wo-module-dot.mobile    { background: var(--brand-teal); }
.wo-module-dot.integrate { background: var(--brand-violet); }
.wo-module-dot.core      { background: var(--brand-blue); }

