/* Octacer.ProposalHub — app-specific layout helpers.
   External stylesheet (strict no-inline-CSS CSP holds). Loaded AFTER octacer-theme.css.
   The design system (oc-*, btn and field-* classes) still owns every component; this only fills
   app-specific layout gaps that the prebuilt (no-build-step) Tailwind set doesn't cover
   (responsive grids, pre-wrap text, sticky form footer). Prefix: .ph-*  */

/* ==========================================================================
   octa-core theme bridge — compatibility layer for the Metronic→Tailwind-CDN
   migration. octacer-theme.css owns the new indigo token set; Metronic's build
   previously generated the color *utilities* below. Under the Tailwind browser
   CDN those custom color utilities are NOT generated, so we define them here
   (app-owned, external CSS — no inline styles) mapped to the new theme tokens.
   Both this app's markup and the shared theme/partials/ depend on them.
   ========================================================================== */

/* 1) Legacy token names still referenced by the .ph-* rules further down. They
      alias to new-theme tokens and re-resolve per light/dark at the use site. */
:root {
    --background: var(--bg);
    --border: var(--line);
    --mono: var(--ink-900);
    --secondary-foreground: var(--ink-500);
}

/* 2) Custom color utilities (outside the stock Tailwind palette) → new tokens. */
.text-mono { color: var(--ink-900); }
.text-foreground { color: var(--ink-900); }
.text-secondary-foreground { color: var(--ink-500); }
.text-muted-foreground { color: var(--ink-500); }
.text-primary { color: var(--primary); }
.hover\:text-primary:hover { color: var(--primary); }
.text-primary-foreground { color: var(--primary-foreground); }
.text-destructive { color: var(--danger); }
.bg-background { background-color: var(--bg); }
.bg-primary { background-color: var(--primary); }
.bg-muted { background-color: var(--surface-muted); }
.bg-muted\/70 { background-color: color-mix(in srgb, var(--surface-muted) 70%, transparent); }
.bg-muted\/60 { background-color: color-mix(in srgb, var(--surface-muted) 60%, transparent); }
.bg-destructive\/10 { background-color: color-mix(in srgb, var(--danger) 10%, transparent); }
.bg-mono\/30 { background-color: color-mix(in srgb, var(--ink-900) 30%, transparent); }
.border-border { border-color: var(--line); }
.border-b-border { border-bottom-color: var(--line); }
.ring-background { --tw-ring-color: var(--bg); }
/* Metronic's extra small text step (not in the stock Tailwind scale). */
.text-2sm { font-size: 0.8125rem; line-height: 1.125rem; }

/* Centered page container (replaces Metronic's kt-container-fixed). */
.ph-container { width: 100%; margin-inline: auto; max-width: 80rem; padding-inline: 1rem; }
@media (min-width: 640px)  { .ph-container { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .ph-container { padding-inline: 2rem; } }

/* Main content vertical rhythm. */
.ph-main { padding-top: 1.5rem; padding-bottom: 2.5rem; }

/* Landing hero. */
.ph-hero {
    max-width: 34rem;
    margin-inline: auto;
    text-align: center;
    padding-top: 4rem;
    padding-bottom: 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

/* Two-column form grid (single column on mobile). */
.ph-form-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 768px) { .ph-form-grid { grid-template-columns: 1fr 1fr; } }
.ph-col-2 { grid-column: 1 / -1; }

/* Detail page: main content + metadata sidebar. */
.ph-detail-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
@media (min-width: 1024px) { .ph-detail-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }

/* Preserve line breaks in long job/proposal text (whitespace-pre-* isn't in the compiled set). */
.ph-prewrap { white-space: pre-wrap; word-break: break-word; }

/* Definition rows in the detail sidebar. */
.ph-dl { display: flex; flex-direction: column; }
.ph-dl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.625rem;
    border-top: 1px solid var(--border, #e2e8f0);
    font-size: 0.875rem;
}
.ph-dl-row dt { flex: 0 1 45%; min-width: 0; }
.ph-dl-row dd { flex: 0 1 55%; min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.ph-dl-row:first-child { border-top: 0; }

/* Sticky form action footer. */
.ph-form-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border, #e2e8f0);
    background: var(--background, #ffffff);
}
.ph-form-footer-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-block: 0.75rem;
}

/* Sticky bottom action bar (detail screens, mobile) — primary action + more.
   Desktop uses the inline actions row under the page title, so this hides ≥768px. */
.ph-actionbar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding-top: 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border, #e2e8f0);
    background: var(--background, #ffffff);
}
@media (min-width: 768px) { .ph-actionbar { display: none; } }
.ph-actionbar .btn { min-height: 2.75rem; }
.ph-actionbar__primary { flex: 1 1 auto; justify-content: center; }

/* List toolbar search width. */
.ph-search { width: 100%; max-width: 22rem; }

/* Alpine: hide x-cloak elements until Alpine initializes (avoids a flash of conditional sections). */
[x-cloak] { display: none !important; }

/* Screen-reader-only text (not in the prebuilt utility set; used here and by shipped partials). */
.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;
}

/* Give the sticky footer clearance so it never overlaps the last field. */
.ph-form-body { padding-bottom: 1.5rem; }

/* ============================================================================
   MOBILE-FIRST APP SHELL
   The prebuilt (no-build-step) Tailwind set has no reliable responsive variants,
   so the shell's show/hide, the fixed bottom nav, and touch sizing live here —
   the sanctioned app layer (never the octa-core theme). Base rules target the
   phone; `@media (min-width: 768px)` restores the desktop portal layout.
   Breakpoint 768px matches .ph-form-grid for one consistent mobile/desktop line.
   ============================================================================ */

/* --- Top bar: inline nav shows on desktop only; comfy touch targets on phone -- */
.ph-topnav { display: none; }
@media (min-width: 768px) {
    .ph-topbar { min-width: 0; }
    .ph-brand { flex: 0 0 auto; }
    .ph-topnav { display: flex; align-items: center; gap: 0.25rem; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
    .ph-topnav::-webkit-scrollbar { display: none; }
    .ph-topnav .btn { flex: 0 0 auto; }
    .ph-topbar > .ms-auto { flex: 0 0 auto; }
}
/* Text that only makes sense with room (e.g. the account name) — hidden on phone. */
.ph-hide-mobile { display: none; }
@media (min-width: 768px) { .ph-hide-mobile { display: inline; } }
/* Top-bar buttons (theme toggle, account) get a ~44px hit area on touch (§167). */
@media (max-width: 767.98px) {
    .ph-topbar .btn { min-height: 2.75rem; }
    .ph-topbar .oc-icon-btn { min-width: 2.75rem; }
}

/* --- Fixed bottom navigation (phone only) ---------------------------------- */
.ph-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;                       /* above content/sticky header, below KTUI overlays + progress bar (100) */
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem calc(0.375rem + env(safe-area-inset-bottom, 0px));
    background: var(--background, #ffffff);
    border-top: 1px solid var(--border, #e2e8f0);
    box-shadow: 0 -6px 20px -12px rgba(15, 23, 42, 0.28);
}
@media (min-width: 768px) { .ph-bottomnav { display: none; } }

.ph-bnav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 3.25rem;              /* ≥44px touch target incl. padding (§167) */
    padding: 0.35rem 0.25rem;
    border-radius: var(--radius, 0.75rem);
    color: var(--secondary-foreground, #64748b);
    font-size: 0.6875rem;            /* ~11px label */
    font-weight: 500;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.ph-bnav-item:hover { color: var(--mono, #0f172a); background: rgba(99, 102, 241, 0.08); }
.ph-bnav-item:focus-visible { outline: 2px solid var(--ring, #6366f1); outline-offset: -2px; }
.ph-bnav-item[aria-current="page"] { color: var(--primary, #4f46e5); }
/* FA renders an <i> webfont glyph — size it via font-size, not width/height, and
   independent of the tiny label font-size set on .ph-bnav-item. */
.ph-bnav-ico { font-size: 1.25rem; line-height: 1; }
.ph-bnav-spacer { flex: 1 1 0; }     /* keeps the New action centred when there's no 3rd tab */

/* Center "New" action rendered as a raised primary circle (app-style FAB). */
.ph-bnav-fab { color: var(--primary, #4f46e5); }
.ph-bnav-fab:hover { background: transparent; }
.ph-bnav-fab-circle {
    width: 2.75rem;                  /* 44px raised circle */
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -1rem;               /* lift above the bar */
    border-radius: 9999px;
    background: var(--primary, #4f46e5);
    color: var(--primary-foreground, #ffffff);
    box-shadow: var(--shadow-md, 0 8px 18px -6px rgba(79, 70, 229, 0.5));
}
.ph-bnav-fab:hover .ph-bnav-fab-circle { background: var(--primary-active, #4338ca); }

/* Clear the fixed bottom nav so it never covers page content / sticky footers. */
@media (max-width: 767.98px) {
    /* A touch more breathing room at the top on phones. */
    .ph-main { padding-top: 2rem; }
    /* Section list pages already have their compact mobile toolbar/header; keep the
       first row close to it instead of creating a large blank band. */
    .ph-has-bnav .ph-main { padding-top: 0.5rem !important; padding-bottom: 5.5rem; }
    /* Sticky Save bar sits flush above the bottom nav: its background extends down
       behind the (opaque, higher-z) nav while its buttons clear it — no content peek. */
    .ph-has-bnav .ph-form-footer { padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px)); }
    /* Footer is redundant on phones — the bottom nav covers navigation. */
    .ph-footer { display: none; }
}

/* --- Touch-friendly form controls & actions on phone ----------------------- */
@media (max-width: 767.98px) {
    .field-input, .field-select { min-height: 2.75rem; }     /* 44px inputs/selects */
    /* Stack the action footer: primary on top (most prominent), full-width, 44px. */
    .ph-form-footer-inner { flex-direction: column-reverse; align-items: stretch; gap: 0.625rem; }
    .ph-form-footer-inner .btn { width: 100%; min-height: 2.75rem; }
}

/* --- List: card list on phone, table on desktop (§96 keeps columns on wide) -- */
.ph-list-cards { display: flex; flex-direction: column; gap: 0.625rem; padding: 0.75rem; }
.ph-list-table { display: none; }
/* Section list view: cards on ALL widths (the board is the desktop alternative, not a table). */
.ph-cardlist { display: flex; flex-direction: column; gap: 0.625rem; padding: 0.75rem; }

/* Non-card list: flat, divided, compact rows. The whole row is a link to Details (board keeps cards). */
.ph-list { display: flex; flex-direction: column; }
.ph-list-head {
    display: grid;
    grid-template-columns: 0.5rem minmax(0, 1fr) 8.5rem 7rem 7.5rem;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--surface-muted, #f8fafc);
    color: var(--secondary-foreground, #64748b);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.ph-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-top: 1px solid var(--border, #e2e8f0);
    text-decoration: none;
    color: inherit;
}
.ph-list > .ph-row:first-child { border-top: 0; }
.ph-row:hover { background: rgba(99, 102, 241, 0.04); }
.ph-row:active { background: rgba(99, 102, 241, 0.08); }
.ph-row:focus-visible { outline: 2px solid var(--ring, #6366f1); outline-offset: -2px; }
.ph-row__dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; flex-shrink: 0; background: var(--secondary-foreground, #94a3b8); }
.ph-row__main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.0625rem; }
.ph-row__title { font-weight: 600; font-size: 0.9375rem; color: var(--mono, #0f172a); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-row__sub { font-size: 0.8125rem; color: var(--secondary-foreground, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-row__end { display: flex; flex-direction: column; align-items: flex-end; gap: 0.0625rem; flex-shrink: 0; }
.ph-row__price { font-weight: 600; font-size: 0.875rem; color: var(--mono, #0f172a); font-variant-numeric: tabular-nums; }
.ph-row__date { font-size: 0.75rem; line-height: 1.3; color: var(--secondary-foreground, #64748b); }
.ph-row__stage { display: inline-flex; justify-self: start; white-space: nowrap; }
@media (max-width: 767.98px) { .ph-row__stage { display: none; } }

/* Compact client + attribution chip strip under each bid (row + board card). Lightweight inline chips
   (not badges) so the row stays scannable; wraps on narrow widths. See _ProposalMeta.cshtml. */
.ph-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1875rem 0.625rem; margin-top: 0.1875rem; }
.ph-meta__chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    min-width: 0; max-width: 100%;
    font-size: 0.75rem; line-height: 1.2; color: var(--secondary-foreground, #64748b);
}
.ph-meta__chip > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ph-meta__chip--num { color: var(--mono, #0f172a); font-variant-numeric: tabular-nums; }
.ph-meta__chip--muted > span { max-width: 10rem; }
.ph-meta__ico { font-size: 0.6875rem; color: var(--secondary-foreground, #94a3b8); flex-shrink: 0; }
.ph-meta__ico--boost { color: var(--warning, #f59e0b); }
.ph-meta__ico--star { color: #f59e0b; }
.ph-meta__ico--ok { color: var(--success, #22c55e); }

@media (min-width: 768px) {
    .ph-list { background: var(--surface, #fff); }
    .ph-row {
        display: grid;
        grid-template-columns: 0.5rem minmax(0, 1fr) 8.5rem 7rem 7.5rem;
        gap: 0.625rem;
        min-height: 4.25rem;
        padding: 0.75rem 1rem;
    }
    .ph-row__stage { grid-column: 3; grid-row: 1; }
    .ph-row__end {
        grid-column: 4 / 6;
        grid-row: 1;
        display: grid;
        grid-template-columns: 7rem 7.5rem;
        align-items: center;
        gap: 0.625rem;
    }
    .ph-row__date { text-align: right; }
}

/* Stage status-dot colours (compact list rows). */
.ph-sdot--submitted { background: var(--secondary-foreground, #94a3b8); }
.ph-sdot--viewed { background: var(--info, #0ea5e9); }
.ph-sdot--lead { background: var(--primary, #4f46e5); }
.ph-sdot--inconversation { background: var(--warning, #f59e0b); }
.ph-sdot--meeting { background: var(--mono, #0f172a); }
.ph-sdot--client { background: var(--success, #22c55e); }
.ph-sdot--lost { background: var(--danger, #ef4444); }
.ph-sdot--noresponse { background: #94a3b8; }

/* Floating action button (mobile add) — bottom-right, above the fixed bottom nav. */
.ph-fab {
    position: fixed;
    right: 1rem;
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 45;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.5rem;                 /* sizes the FA <i> glyph */
    border-radius: 9999px;
    background: var(--primary, #4f46e5);
    color: var(--primary-foreground, #ffffff);
    box-shadow: var(--shadow-lg, 0 14px 30px -8px rgba(79, 70, 229, 0.55));
    text-decoration: none;
}
.ph-fab:hover { background: var(--primary-active, #4338ca); color: var(--primary-foreground, #ffffff); }
.ph-fab:focus-visible { outline: 2px solid var(--ring, #6366f1); outline-offset: 2px; }
@media (min-width: 768px) { .ph-fab { display: none; } }   /* desktop uses the top-bar New button */

/* Show only on desktop (inline-flex) — used for the top-bar New button. */
.ph-desk-inline { display: none; }
@media (min-width: 768px) { .ph-desk-inline { display: inline-flex; } }

/* Show only on desktop (block) — e.g. the Details page header (mobile uses the top bar + a back link). */
.ph-desk-block { display: none; }
@media (min-width: 768px) { .ph-desk-block { display: block; } }

/* Detail actions share the title row on desktop instead of creating a second,
   disconnected block below the header. At narrower desktop widths they fall
   back below the header so a long job title never collides with the buttons. */
.ph-detail-shell { position: relative; }
.ph-detail-header { position: relative; }
.ph-detail-actions {
    display: flex;
    align-items: center;
    margin-bottom: 1.25rem;
}

/* Jobs uses the same flat-row language as the proposal sections. */
.ph-job-list-head { display: none; }
.ph-job-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border, #e2e8f0); color: inherit; text-decoration: none; }
.ph-job-row:first-child { border-top: 0; }
.ph-job-row:hover { background: rgba(99, 102, 241, 0.04); }
.ph-job-row__main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.125rem; }
.ph-job-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; }
.ph-job-row__id, .ph-job-row__tags { display: none; }
.ph-job-row__date { flex: 0 0 auto; color: var(--secondary-foreground, #64748b); font-size: 0.75rem; }
/* Dashboard follows the same compact, single-column mobile rhythm as section pages. */
.ph-dashboard-stats > a { min-width: 0; text-decoration: none; }
.ph-dashboard-grid > .oc-card { min-width: 0; }
.ph-job-detail-sidebar { min-width: 0; }
.ph-quick-mobile-head { display: none; }
.ph-quick-step { min-width: 0; }
/* JS toggles this on the wizard's Back/Continue/Save to show the right pair per step (§153). */
.ph-quick-wizard .is-step-hidden { display: none !important; }
/* Panels are programmatic focus targets (tabindex=-1) for step changes — no focus ring on the box itself. */
.ph-quick-step:focus { outline: none; }
/* Client screenshot-scan widget (upload / drag-drop / paste). Dragover highlight is driven by the
   [data-dragover] attribute set in proposals.js (no inline styles, §4). Works on mobile + desktop. */
.ph-client-scan { transition: border-color 150ms ease, background-color 150ms ease; }
.ph-client-scan[data-dragover="true"] { border-color: var(--primary, #4f46e5); background: var(--accent, rgba(79, 70, 229, 0.06)); }
.ph-client-scan-status { min-width: 0; overflow-wrap: anywhere; }
.ph-job-meta .ph-dl-row { min-width: 0; }
.ph-job-meta dd { min-width: 0; }
.ph-job-id { overflow-wrap: anywhere; word-break: break-word; }
.ph-job-tags { align-content: flex-start; }
.ph-jobs-status { padding: 0.75rem 1rem; color: var(--secondary-foreground, #64748b); font-size: 0.8125rem; }
.ph-jobs-sentinel { height: 1px; }
/* Tag groups use flex gap for both axes; the global card-body stack rule must
   not add an extra margin to every badge after the first one. */
.oc-card-body.ph-job-tags > * + * { margin-top: 0; }
@media (min-width: 1024px) {
    .ph-dashboard-grid { grid-template-columns: minmax(15rem, 0.8fr) minmax(0, 1.2fr); }
}
@media (min-width: 768px) {
    .ph-job-list-head { display: grid; grid-template-columns: minmax(0, 1fr) 10rem; gap: 0.75rem; padding: 0.625rem 1rem; border-bottom: 1px solid var(--border, #e2e8f0); background: var(--surface-muted, #f8fafc); color: var(--secondary-foreground, #64748b); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
    .ph-job-row { display: grid; grid-template-columns: minmax(0, 1fr) 10rem; gap: 0.75rem; min-height: 4.25rem; }
    .ph-job-row__date { align-self: center; text-align: right; }
}
@media (max-width: 767.98px) {
    .ph-quick-mobile-head { display: block; margin-bottom: 1.25rem; }
    .ph-quick-progress { display: flex; gap: 0.375rem; }
    .ph-quick-progress span { height: 0.3125rem; flex: 1; border-radius: 999px; background: var(--border, #e2e8f0); transition: background-color 0.2s ease; }
    .ph-quick-progress span.is-active { background: var(--primary, #4f46e5); }
    .ph-quick-step-count { margin-top: 0.5rem; color: var(--secondary-foreground, #64748b); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

    /* Full-bleed step panels on phones — drop the card box so each step reads as one focused app screen. */
    .ph-quick-wizard .ph-quick-step { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
    .ph-quick-wizard .ph-quick-step > .oc-card-head { padding: 0 0 0.75rem; border-bottom: 0; }
    .ph-quick-wizard .ph-quick-step > .oc-card-body { padding: 0; }
    .ph-quick-wizard .ph-quick-step .oc-card-title { font-size: 1.125rem; }
    .ph-quick-wizard[data-step="1"] .ph-quick-step--2,
    .ph-quick-wizard[data-step="1"] .ph-quick-step--3,
    .ph-quick-wizard[data-step="1"] .ph-quick-step--4,
    .ph-quick-wizard[data-step="2"] .ph-quick-step--1,
    .ph-quick-wizard[data-step="2"] .ph-quick-step--3,
    .ph-quick-wizard[data-step="2"] .ph-quick-step--4,
    .ph-quick-wizard[data-step="3"] .ph-quick-step--1,
    .ph-quick-wizard[data-step="3"] .ph-quick-step--2,
    .ph-quick-wizard[data-step="3"] .ph-quick-step--4,
    .ph-quick-wizard[data-step="4"] .ph-quick-step--1,
    .ph-quick-wizard[data-step="4"] .ph-quick-step--2,
    .ph-quick-wizard[data-step="4"] .ph-quick-step--3 { display: none; }
    .ph-quick-wizard .ph-form-body { gap: 1rem; }
    /* Client-scan actions go full-width + centered on phones so Upload/Paste are easy tap targets. */
    .ph-client-scan label.btn,
    .ph-client-scan [data-oc-client-scan-paste] { flex: 1 1 auto; justify-content: center; }
    .ph-quick-wizard .ph-form-footer-inner { flex-direction: row; align-items: stretch; flex-wrap: wrap; gap: 0.625rem; }
    .ph-quick-wizard .ph-form-footer-inner .btn { width: auto; flex: 1 1 0; min-height: 2.75rem; }
    .ph-detail-grid { gap: 1rem; }
    .ph-job-detail-sidebar { gap: 1rem; }
    .ph-job-detail-sidebar .oc-card { width: 100%; }
    .ph-job-meta .ph-dl-row { align-items: flex-start; }
    .ph-job-meta dd { text-align: right; }
    .ph-job-tags { row-gap: 0.625rem; }
    .ph-dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
    .ph-dashboard-stats > a { padding: 1rem; }
    .ph-dashboard-stats .oc-stat-value { font-size: 1.5rem; }
    .ph-dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .ph-dashboard-grid .oc-card-head { padding: 0.875rem 1rem; }
    .ph-dashboard-grid .oc-card-body { padding: 1rem; }
    .ph-dashboard-grid .ph-row { padding-inline: 1rem; }
    .ph-dashboard-grid .ph-row__title { max-width: 100%; }
}
@media (max-width: 767.98px) {
    .ph-jobs-card { border: 0; box-shadow: none; background: transparent; }
    .ph-jobs-card .oc-card-head { display: none; }
    .ph-job-row { padding-inline: 1rem; min-height: 3.75rem; }
    .ph-jobs-card .ph-job-row { flex-direction: column; align-items: stretch; gap: 0.25rem; padding-block: 0.875rem; }
    .ph-jobs-card .ph-job-row__main { width: 100%; }
    .ph-jobs-card .ph-job-title { font-size: 0.8rem; line-height: 1.25; }
    .ph-jobs-card .ph-job-row__date { font-size: 0.75rem; line-height: 1.25; }
}
@media (min-width: 1100px) {
    .ph-detail-actions {
        position: absolute;
        inset-inline-end: 0;
        top: 2rem;
        margin-bottom: 0;
    }
}

/* Mobile back link (detail screens). */
.ph-back {
    display: none;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary-foreground, #64748b);
    text-decoration: none;
}
.ph-back:hover { color: var(--mono, #0f172a); }
@media (max-width: 767.98px) { .ph-back { display: inline-flex; } }

/* Header back arrow (mobile detail/form screens set ViewData["BackUrl"]). */
.ph-backbtn {
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-left: -0.5rem;
    border-radius: var(--radius, 0.75rem);
    color: var(--mono, #0f172a);
    flex-shrink: 0;
}
.ph-backbtn:active { background: var(--surface, #f1f5f9); }


/* --- Adaptive MOBILE layout (server-rendered when screen=mobile) ------------- */
/* Top bar: desktop shows the brand; mobile shows the current page title. */
.ph-brand { display: none; }
@media (min-width: 768px) { .ph-brand { display: flex; } }
.ph-m-pagetitle {
    display: inline-block;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--mono, #0f172a);
}
@media (min-width: 768px) { .ph-m-pagetitle { display: none; } }
/* Mobile-only inline element (top-bar search / filter icons). */
.ph-mobile-only { display: inline-flex; }
@media (min-width: 768px) { .ph-mobile-only { display: none; } }

/* Applied search / filter chips (mobile), shown at the top of the list. */
.ph-applied { display: flex; flex-wrap: wrap; gap: 0.375rem; padding: 0.625rem 0.875rem 0.25rem; }
.ph-applied__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 100%;
    padding: 0.25rem 0.25rem 0.25rem 0.625rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 9999px;
    background: var(--background, #ffffff);
    font-size: 0.8125rem;
    color: var(--mono, #0f172a);
}
.ph-applied__text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ph-applied__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    color: var(--secondary-foreground, #64748b);
}
.ph-applied__x:hover { background: var(--surface, #f1f5f9); color: var(--mono, #0f172a); }

/* Phone list: a flat list (white surface, hairline dividers) — NOT a card. */
@media (max-width: 767.98px) {
    .ph-list { background: var(--background, #ffffff); }
}

/* Filter bottom sheet (offcanvas bottom → top). */
.ph-sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, 0.45); }
.ph-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    background: var(--background, #ffffff);
    border-top-left-radius: 1.25rem;
    border-top-right-radius: 1.25rem;
    box-shadow: 0 -12px 40px -12px rgba(15, 23, 42, 0.35);
    padding: 0.5rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.ph-sheet.is-open { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .ph-sheet { transition: none; } }
.ph-sheet__grip { width: 2.25rem; height: 0.25rem; border-radius: 9999px; background: var(--line, #e2e8f0); margin: 0.25rem auto 0.75rem; }
.ph-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.ph-sheet__title { font-size: 1rem; font-weight: 700; color: var(--mono, #0f172a); }
.ph-sheet__label { margin-bottom: 0.5rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--secondary-foreground, #64748b); }
.ph-sheet__options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ph-chip {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--background, #ffffff);
    color: var(--mono, #0f172a);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}
.ph-chip.is-active { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); color: var(--primary-foreground, #ffffff); }

/* --- Loading skeleton for the adaptive shell -------------------------------- */
.ph-skeleton { padding: 0.5rem 0; }
.ph-skel { border-radius: 0.5rem; background: var(--line, #e2e8f0); animation: ph-pulse 1.5s ease-in-out infinite; }
.ph-skel-title { height: 1.75rem; width: 40%; margin-bottom: 1rem; }
.ph-skel-row { height: 3.5rem; margin-bottom: 0.625rem; }
@keyframes ph-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .ph-skel { animation: none; } }
@media (min-width: 768px) {
    .ph-list-cards { display: none; }
    .ph-list-table { display: block; }
}
@media (max-width: 767.98px) { .ph-search { max-width: none; } }

/* A single list record as a fully-tappable card (stretched-link pattern). */
.ph-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-lg, 1rem);
    background: var(--background, #ffffff);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ph-card:hover { border-color: var(--line-strong, #cbd5e1); }
.ph-card:focus-within { border-color: var(--primary, #4f46e5); box-shadow: 0 0 0 3px var(--ring, rgba(99, 102, 241, 0.25)); }
.ph-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.ph-card__title { font-weight: 600; font-size: 0.9375rem; color: var(--mono, #0f172a); line-height: 1.3; text-decoration: none; }
/* The title link stretches over the whole card so a tap anywhere opens it. */
.ph-card__title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.ph-card__actions { position: relative; z-index: 2; }        /* sits above the stretched link so the menu still works */
.ph-card__sub { font-size: 0.8125rem; color: var(--secondary-foreground, #64748b); }
.ph-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--secondary-foreground, #64748b);
}
.ph-card__meta-strong { color: var(--mono, #0f172a); font-weight: 500; }

/* --- Pipeline stage filter bar (horizontal scroll, one-tap pills) ----------- */
.ph-stagebar {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--border, #e2e8f0);
    scrollbar-width: none;
}
.ph-stagebar::-webkit-scrollbar { display: none; }
.ph-stage-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--background, #ffffff);
    color: var(--secondary-foreground, #64748b);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ph-stage-pill:hover { border-color: var(--line-strong, #cbd5e1); color: var(--mono, #0f172a); }
.ph-stage-pill:focus-visible { outline: 2px solid var(--ring, #6366f1); outline-offset: 2px; }
.ph-stage-pill.is-active {
    background: var(--primary, #4f46e5);
    border-color: var(--primary, #4f46e5);
    color: var(--primary-foreground, #ffffff);
}
@media (max-width: 767.98px) { .ph-stage-pill { min-height: 2.5rem; } }

/* --- View toggle (List / Board) — desktop only (mobile is always the list) --- */
.ph-viewtoggle { display: none; }
@media (min-width: 768px) { .ph-viewtoggle { display: inline-flex; gap: 0.25rem; } }

/* --- Kanban board: horizontal-scroll columns of sub-stages ------------------ */
.ph-board {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
}
@media (min-width: 768px) {
    .ph-board { padding: 1rem; gap: 1rem; min-height: 32rem; }
    .ph-board .ph-board-col { flex-basis: 19rem; max-height: calc(100vh - 15rem); }
}
.ph-board-col {
    flex: 0 0 17rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.625rem;
    background: var(--surface, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-lg, 1rem);
    max-height: calc(100vh - 17rem);
    overflow-y: auto;
}
.ph-board-col__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.125rem 0.25rem 0.25rem;
}
.ph-board-col__title {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mono, #0f172a);
}
.ph-board-col__count {
    min-width: 1.25rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary-foreground, #64748b);
}
.ph-board-col__empty {
    padding: 0.75rem 0.25rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--secondary-foreground, #64748b);
}
/* Board cards are a touch denser than list cards. */
.ph-board .ph-card { padding: 0.75rem; }

/* --- Landing hero: tighter and full-width CTA on phone ---------------------- */
@media (max-width: 767.98px) {
    .ph-hero { padding-top: 2.5rem; padding-bottom: 2.5rem; }
    .ph-hero .btn { width: 100%; min-height: 2.75rem; }
}


/* App-owned content adapts to the canonical shell's reserved mobile chrome. */
.ph-workspace .ph-form-footer,
.ph-workspace .ph-actionbar {
    bottom: var(--oc-bottom-chrome, 0px);
}
.ph-workspace .ph-fab {
    bottom: calc(var(--oc-bottom-chrome, 0px) + 1rem);
}
.ph-workspace #oc-main { min-width: 0; }
@media (max-width: 767px) {
    .ph-workspace #oc-main { padding-top: 1rem; }
    .ph-workspace #oc-main:has(.ph-fab) { padding-bottom: 5rem; }
}
