/* web_clientes portal -- "Catalogo" theme (concept_09) :: per-page styles.
   ------------------------------------------------------------------
   Project detail, unit detail, and photo views. Mobile-first.
   Loaded AFTER portal.css, so it inherits every design token from
   portal.css :root (--font-display, --card, --border, --brass*,
   --badge-*-text, --shadow-card, --ring, etc.). The class contract
   from the previous theme is preserved verbatim; only the values
   change. Re-skinned from "Sala Verde" to the "Catalogo" editorial
   design language: ink surfaces, brass hairlines, Termina display
   numbers, tiny tracked uppercase eyebrow labels, catalogo chip
   pills. New surfaces are darker, so AA contrast ratios only improve.

   Mobile-first structure: unprefixed rules target phones; enhance
   upward via min-width:576 / 768 / 992. KPI row 2->3->5 cols;
   .thumbs grid 96px->140px min. Touch targets stay >= 44px.
   ------------------------------------------------------------------ */

/* ============================================================ Utility classes
   Tiny shared helpers replacing inline style="..." in templates, so
   the CSP path stays clean (no 'unsafe-inline' for one-off values). */
.icon-tiny { font-size: 8px; }
.spacer-60 { height: 60px; }

/* Catalogo card recipe -- the .cotiza-card signature from concept_09:
   a 165deg ink gradient, brass hairline border, lg radius, catalogo
   shadow. Shared by the mini-card, KPI cards, accordion buttons,
   history panel and photo surfaces below. */
.mini-card {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 18px;
    background: var(--gradient-card);
    box-shadow: var(--shadow-card);
    color: var(--text);
}
.mini-card h3 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.012em; color: var(--text); }
/* The mini-card stat row places TWO .avance-big numbers side by side in
   an inline-styled flex row (frozen template markup); the dashboard
   hero number's 40px clamp floor overflows that row on 360px phones,
   so scope a smaller floor here. */
.mini-card .avance-big { font-size: clamp(28px, 9vw, 40px); }

/* Breadcrumb -- catalogo section-header affordance: brass-lt links with
   a cream/white hover and the underline-grow underline. */
.breadcrumb-row {
    padding: 18px 0 0; font-size: 12.5px; color: var(--text-soft);
    letter-spacing: 0.02em;
}
.breadcrumb-row a {
    color: var(--brass-lt); text-decoration: none;
    position: relative;
    /* Underline-grow affordance (concept_09 .nav links): a 1px brass
       rule sweeps to full width on hover/focus. Pure width transition;
       portal.css clamps motion globally, so this degrades to an
       instant underline under reduced-motion -- no new always-on motion. */
    background-image: linear-gradient(var(--brass-hi), var(--brass-hi));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% 1px;
    transition: color 0.15s ease, background-size 0.25s ease;
    padding-bottom: 1px;
}
.breadcrumb-row a:hover,
.breadcrumb-row a:focus-visible {
    color: var(--brass-hi); background-size: 100% 1px;
}
.breadcrumb-row .sep { margin: 0 8px; color: var(--text-muted); }
.breadcrumb-row .current { color: var(--text); font-weight: 500; }

.project-head { padding: 22px 0 30px; }
.project-head h1 {
    font-family: var(--font-display);
    font-size: clamp(26px, 5.2vw, 36px);
    font-weight: 700;
    letter-spacing: 0.012em;
    text-transform: uppercase;
    margin: 0 0 8px;
    line-height: 1.06;
    color: var(--text);
}
.project-head .sub { color: var(--text-soft); font-size: 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.project-head .sub .dot { width: 4px; height: 4px; background: var(--brass-lt); border-radius: 50%; opacity: 0.7; }
.timestamp { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.timestamp i { color: var(--success); }

/* KPI row -- mobile-first: 2 cols base -> 3 at 768px -> 5 at 992px.
   Catalogo editorial cards: ink gradient, brass hairline, Termina cream
   numbers, tiny uppercase tracked brass labels. */
.kpi-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 36px; }
@media (min-width: 768px) { .kpi-row { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 992px) { .kpi-row { grid-template-columns: repeat(5, 1fr); } }
.kpi-card {
    background: var(--gradient-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 18px 18px 16px; position: relative; overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform .18s cubic-bezier(.2,.6,.3,1), box-shadow .2s ease;
    /* min-width:0 lets the 1fr grid track shrink the card instead of
       letting long tracked labels (INSTALACIONES) force overflow at the
       5-col step. */
    min-width: 0;
}
.kpi-card::after {
    /* Brass hairline along the top edge -- a thread of light. */
    content: ''; position: absolute; inset: 0 14px auto 14px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(232,213,174,0.55), transparent);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
/* KPI variant tokens. Each card sets the icon-tile color it needs via a
   single custom property; the shared .ico rule applies it. Brass
   restraint: the accent is a quiet hairline (::after above), the icon
   tile is dark ink with a status-keyed glyph color. */
.kpi-card.k1 { --kpi-ico: var(--warning); }   /* Materia Prima */
.kpi-card.k2 { --kpi-ico: var(--brass-lt); }   /* Producción */
.kpi-card.k3 { --kpi-ico: var(--success); }    /* Instalaciones */
.kpi-card.k4 { --kpi-ico: var(--brass-lt); }   /* Unidades */
.kpi-card.k5 { --kpi-ico: var(--brass-lt); }   /* Fotos */
.kpi-card .ico {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 17px;
    margin-bottom: 14px;
    color: var(--kpi-ico, var(--brass-lt));
    background: var(--night);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.kpi-card .num {
    font-family: var(--font-display);
    font-size: clamp(28px, 4.4vw, 34px);
    font-weight: 700; letter-spacing: 0.012em;
    font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
    line-height: 1.05; color: var(--text);
}
.kpi-card .lbl {
    /* Catalogo eyebrow label: tiny, heavily tracked, uppercase, brass. */
    font-size: 11px; color: var(--brass); text-transform: uppercase;
    letter-spacing: 0.24em; margin-top: 8px; font-weight: 600;
    /* Long Spanish labels (INSTALACIONES, MATERIA PRIMA) must wrap, not
       clip, in the ~180px tracks of the 5-col step at 992px. */
    overflow-wrap: anywhere;
}
/* "Ver Fotos" link on Materia Prima (k1) + Producción (k2) cards. */
.kpi-card .kpi-photos-link {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 2px; font-size: 11px; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--brass-lt); text-decoration: none;
    border-bottom: 1px solid transparent; transition: border-color 0.15s ease, color 0.15s ease;
    /* 44px touch floor like every other action surface; the reduced
       margin-top keeps the card's visual rhythm roughly unchanged. */
    min-height: 44px;
}
.kpi-card .kpi-photos-link:hover,
.kpi-card .kpi-photos-link:focus-visible { border-bottom-color: currentColor; color: var(--brass-hi); }
.kpi-card .kpi-photos-link:focus-visible {
    outline: 2px solid var(--ring); outline-offset: 2px;
}

h2.section-title {
    /* font-family inherited from the global h2 rule in portal.css. */
    font-size: clamp(18px, 2.6vw, 22px);
    font-weight: 700; margin: 6px 0 18px; letter-spacing: 0.03em;
    text-transform: uppercase; color: var(--text);
    display: flex; align-items: center; gap: 10px;
}
h2.section-title .badge-cnt {
    font-family: var(--font-body);
    background: var(--brass-lt); color: var(--night); padding: 3px 11px;
    border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

.ot-block { margin-bottom: 32px; }
.ot-head {
    display: flex; align-items: center; gap: 12px;
    font-family: var(--font-display);
    font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text);
    background: var(--gradient-card);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px 18px; margin-bottom: 14px;
    box-shadow: var(--shadow-card);
}
.ot-head > i { color: var(--brass-lt); }
.ot-head .badge-count {
    /* Catalogo chip pill: tinted brass-ink bg, tracked uppercase. */
    background: var(--brass-fill); color: var(--brass-lt);
    padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 600;
    letter-spacing: 0.06em;
    margin-left: auto;
    border: 1px solid var(--border-soft);
}

/* Nivel block -- a brass hairline left rail instead of a green-tinted one. */
.nivel-block { margin: 14px 0 20px 12px; padding-left: 14px; border-left: 2px solid rgba(176,141,87,0.22); }
.nivel-head {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-body);
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em;
    color: var(--text); margin-bottom: 12px;
}
.nivel-head > i { color: var(--brass-lt); }
.nivel-head .badge-count {
    background: var(--brass-lt); color: var(--night); padding: 4px 10px;
    border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
    margin-left: auto;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

/* REF accordion (Bootstrap .accordion). Themed via Bootstrap's own
   accordion vars where possible, so we set the source of truth rather
   than fight specificity. The chevron icons are re-declared as the same
   SVG, retuned for the catalogo ink surfaces: cream (%23F4F1EA)
   collapsed / brass (%23C9A874) active. */
.ref-list {
    --bs-accordion-bg: transparent;
    --bs-accordion-color: var(--text);
    --bs-accordion-border-color: var(--border);
    --bs-accordion-btn-color: var(--text);
    --bs-accordion-active-color: var(--text);
    --bs-accordion-active-bg: var(--card-hi);
    --bs-accordion-btn-focus-border-color: var(--brass-lt);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 4px var(--ring);
    /* Chevron, cream (%23F4F1EA) collapsed / brass (%23C9A874) active. */
    --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23F4F1EA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23C9A874' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}
.ref-list .accordion-item {
    background: transparent; border: none; margin-bottom: 8px;
}
.ref-list .accordion-button {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    /* Two-class specificity beats Bootstrap's single-class radius rules
       without !important. */
    border-radius: var(--radius-md);
    color: var(--text);
    padding: 15px 18px; min-height: 44px;
    font-family: var(--font-body);
    font-size: 14px; font-weight: 600; letter-spacing: 0.01em;
    box-shadow: var(--shadow-card);
    transition: border-color .15s ease, background .15s ease, box-shadow .2s ease;
    flex-wrap: wrap; row-gap: 6px;
}
.ref-list .accordion-button:hover { border-color: rgba(201,168,116,0.4); }
.ref-list .accordion-button:not(.collapsed) {
    background: linear-gradient(165deg, var(--card-hi), var(--card-2));
    color: var(--text); border-color: rgba(201,168,116,0.4);
    box-shadow: var(--shadow-card-hover);
}
.ref-list .accordion-button:focus-visible {
    outline: none;
    border-color: var(--brass-lt);
    box-shadow: 0 0 0 4px var(--ring);
}
.ref-list .ref-name {
    flex: 1; font-family: var(--font-display); font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase; color: var(--text); font-size: 14px;
}
.ref-list .ref-units {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600; color: var(--text-soft);
    background: var(--brass-fill); border: 1px solid var(--border-soft);
    padding: 5px 10px; border-radius: 20px; margin-right: 10px;
    font-variant-numeric: tabular-nums;
}
.ref-list .ref-units i { color: var(--brass-lt); }

/* Per-REF progress badges on the accordion button. Pushed right of the
   units pill via margin-left:auto; ~30px right margin keeps them clear
   of Bootstrap's chevron (::after, ~1.25rem wide at right:1.25rem) even
   above 100% zoom. Catalogo chip pills (20px radius, tracked). */
.ref-list .ref-badges {
    display: inline-flex; align-items: center; gap: 6px;
    margin-left: auto;
    margin-right: 30px;
    flex-wrap: wrap;
}
.ref-list .ref-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600;
    padding: 4px 9px; border-radius: 20px;
    font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; line-height: 1.4;
    border: 1px solid transparent;
    letter-spacing: 0.01em;
}
.ref-list .ref-badge i { font-size: 11px; }
/* Badge tints -- low-alpha status color on dark, light tinted text token
   (AA: each --badge-*-text is a light tint of the hue, >=4.5:1 on its
   tinted pill over the dark panel). */
.ref-list .badge-materia-prima {
    color: var(--badge-materia-prima-text, #E0BD8F);
    background: color-mix(in srgb, var(--warning) 16%, transparent);
    border-color: color-mix(in srgb, var(--warning) 38%, transparent);
}
.ref-list .badge-completion {
    color: var(--badge-completion-text, #E3C893);
    background: color-mix(in srgb, var(--brass-lt) 16%, transparent);
    border-color: color-mix(in srgb, var(--brass-lt) 38%, transparent);
}
.ref-list .badge-installation {
    color: var(--badge-installation-text, #A8CFB2);
    background: color-mix(in srgb, var(--success) 16%, transparent);
    border-color: color-mix(in srgb, var(--success) 38%, transparent);
}
.ref-list .badge-blocked {
    color: var(--badge-blocked-text, #EBA897);
    background: color-mix(in srgb, var(--danger) 16%, transparent);
    border-color: color-mix(in srgb, var(--danger) 42%, transparent);
}

/* Mobile: badges drop to a full new line below the REF name + units. */
@media (max-width: 575px) {
    .ref-list .ref-badges { margin-left: 0; margin-right: 0; width: 100%; }
}

.units-panel {
    padding: 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    margin-top: 4px;
}

.unit-card {
    background: var(--card); border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 12px 14px; display: flex; align-items: center; gap: 14px;
    margin-bottom: 8px; text-decoration: none; color: var(--text);
    min-height: 44px;
    transition: border-color .15s ease, box-shadow .2s ease, transform .15s ease, background .15s ease;
}
.unit-card:hover {
    border-color: var(--border);
    background: var(--card-2);
    box-shadow: 0 8px 22px -14px rgba(2,5,3,0.7);
    transform: translateX(2px);
}
.unit-card:focus-visible {
    outline: none; border-color: var(--brass-lt);
    box-shadow: 0 0 0 4px var(--ring);
}
/* Admin-defined status colors are chosen for a LIGHT theme; remap them
   for the dark ink panel via color-mix (text lightened toward cream, bg
   a faint tint). A non-color-mix fallback precedes each so older browsers
   (Safari < 16.2) still get a legible cream-tinted pill. Catalogo chip
   pill geometry (20px radius). */
.status-tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-body);
    font-size: 11px; font-weight: 600; padding: 6px 11px; border-radius: 20px;
    min-width: 118px; justify-content: center;
    letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
    /* Fallback (no color-mix): cream-tinted dark pill + raw status color text. */
    background: rgba(176,141,87,0.16);
    color: var(--status-color, var(--brass-lt));
    border: 1px solid var(--border-soft);
    /* Enhanced (color-mix capable): lighten text toward cream for AA on dark. */
    background: color-mix(in srgb, var(--status-color, #94a3b8) 16%, transparent);
    color: color-mix(in srgb, var(--status-color, #94a3b8) 55%, #F4F1EA);
    border-color: color-mix(in srgb, var(--status-color, #94a3b8) 40%, transparent);
}
.status-tag-lg {
    font-size: 12.5px; padding: 8px 14px; border-radius: 20px; min-width: auto;
}
.unit-card .unit-name { flex: 1; font-size: 13px; color: var(--text); }
.unit-card .unit-name .code {
    font-family: var(--font-display); color: var(--brass-lt); font-size: 11px;
    margin-left: 8px; letter-spacing: 0.08em; font-feature-settings: "tnum";
}
.unit-card .chevron { color: var(--text-muted); }

/* ============================================================ History / unit head */
.ref-head { padding: 18px 0 28px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.ref-head h1 {
    font-family: var(--font-display);
    font-size: clamp(22px, 4.6vw, 28px); font-weight: 700; letter-spacing: 0.012em;
    text-transform: uppercase; margin: 0 0 6px; color: var(--text);
}
.ref-head .sub { color: var(--text-soft); font-size: 13px; }
.ref-head .code { font-family: var(--font-display); color: var(--brass-lt); letter-spacing: 0.08em; font-feature-settings: "tnum"; }

.history-panel {
    background: var(--gradient-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 22px 20px; margin: 24px 0 32px;
    box-shadow: var(--shadow-card);
}
@media (min-width: 576px) { .history-panel { padding: 22px 24px; } }
.history-panel .ph-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.history-panel .ph-head .badge-unit {
    font-family: var(--font-display);
    background: var(--brass-fill); color: var(--brass-lt);
    padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em; border: 1px solid var(--border-soft);
}
.history-panel h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; margin: 0; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text); }

/* Timeline -- brass node accents on ink panels; the rail is a retuned
   brass hairline (was a green-tinted border). */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px;
    width: 2px; background: rgba(176,141,87,0.35);
}
.tl-item { position: relative; padding-bottom: 18px; }
/* Timeline dot. --tl-color is an admin LIGHT-theme hex; remap for dark
   via color-mix with a non-color-mix fallback declared first. The dot
   border picks up the ink card surface so the node reads as a brass
   bead on the rail. */
.tl-item::before {
    content: ''; position: absolute; left: -23px; top: 4px;
    width: 14px; height: 14px; border-radius: 50%;
    border: 3px solid var(--card);
    /* Fallback (no color-mix). */
    background: var(--tl-color, var(--brass-lt));
    box-shadow: 0 0 0 2px var(--tl-color, var(--text-muted));
    /* Enhanced: tinted fill + lightened ring, legible on the dark rail. */
    background: color-mix(in srgb, var(--tl-color, #94a3b8) 35%, var(--card));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--tl-color, #94a3b8) 60%, #F4F1EA);
}
.tl-item .status { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; letter-spacing: 0.04em; text-transform: uppercase; }
.tl-item .when { font-size: 12px; color: var(--text-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.tl-item .who { font-size: 11px; color: var(--brass-lt); margin-top: 3px; letter-spacing: 0.04em; }

/* Inline "Bloqueo" badge on a timeline entry. Brick-amber tint matches
   the per-REF .badge-blocked palette; text uses the AA light token.
   Catalogo chip pill (20px radius, heavily tracked). */
.tl-block-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--font-body);
    font-size: 10px; font-weight: 700;
    padding: 3px 9px; border-radius: 20px;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--badge-blocked-text, #EBA897);
    background: color-mix(in srgb, var(--danger) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 42%, transparent);
}
.tl-block-badge i { font-size: 11px; }
.tl-item-blocked::before {
    /* Stronger brick ring so a block is scannable before reading the comment. */
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 55%, transparent) !important;
}

/* Operator comment under the timestamp + actor lines -- quoted speech,
   left-rail accent. */
.tl-item .tl-comment {
    margin-top: 10px; padding: 12px 14px;
    background: color-mix(in srgb, var(--danger) 8%, var(--card));
    border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
    border-left: 3px solid var(--danger);
    border-radius: 0 10px 10px 0;
    font-size: 13px; color: var(--text);
    line-height: 1.45; font-weight: 300;
    display: flex; gap: 8px; align-items: flex-start;
}
.tl-item .tl-comment i {
    color: var(--danger); font-size: 14px;
    flex-shrink: 0; margin-top: 1px;
}
.tl-item .tl-comment span { font-style: italic; }
.tl-item-blocked .tl-comment {
    background: color-mix(in srgb, var(--danger) 9%, var(--card));
    border-left-color: var(--danger);
}
.tl-item-blocked .tl-comment i { color: var(--badge-blocked-text, #EBA897); }

/* Attachment thumbnails on a blocking transition. Reset native button
   chrome; the tile visual is shared with the Fotos .thumb styling --
   ink surface, brass hairline, lift+brighten on hover. */
.tl-item .tl-attachments {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
    max-width: 320px;
}
.tl-item .tl-attachment {
    /* button reset */
    font: inherit; color: inherit; padding: 0; appearance: none;
    /* tile shape -- consistent with Fotos .thumb */
    display: block; position: relative;
    aspect-ratio: 1 / 1;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    min-height: 44px;
    box-shadow: 0 8px 18px -10px rgba(2,5,3,0.7);
    transition: border-color .15s ease, transform .15s ease;
}
.tl-item .tl-attachment:hover { border-color: var(--brass-lt); transform: scale(1.02); }
.tl-item .tl-attachment:focus-visible {
    outline: none; border-color: var(--brass-lt);
    box-shadow: 0 0 0 3px var(--ring);
}
.tl-item .tl-attachment img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
@media (prefers-reduced-motion: reduce) {
    .tl-item .tl-attachment { transition: none !important; }
    .tl-item .tl-attachment:hover { transform: none !important; }
}

/* ============================================================ Photos */
.photos-section { margin-bottom: 60px; }
.phase-group { margin-bottom: 26px; }
.phase-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
    font-family: var(--font-body);
    font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
    color: var(--brass-lt); text-transform: uppercase;
}
.phase-head .ph-ico {
    width: 26px; height: 26px; border-radius: 7px;
    background: var(--night); color: var(--brass-lt);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.phase-head .ph-count {
    font-family: var(--font-body);
    background: var(--brass-fill); color: var(--text-soft);
    border: 1px solid var(--border-soft);
    padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500;
    letter-spacing: 0.04em; text-transform: none;
}
/* Thumbs grid -- mobile-first: 96px min -> 140px at 768px. */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
@media (min-width: 768px) {
    .thumbs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
.thumb {
    aspect-ratio: 1/1; background: var(--surface-muted);
    border-radius: var(--radius-md); position: relative; overflow: hidden;
    display: block; padding: 0; border: 1px solid var(--border);
    color: var(--text-muted); font-size: 28px; text-decoration: none;
    cursor: pointer; width: 100%; min-height: 44px;
    box-shadow: 0 8px 18px -10px rgba(2,5,3,0.7);
}
.thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .25s ease;
    display: block;
}
.thumb:hover { color: var(--brass-lt); border-color: var(--brass-lt); }
.thumb:hover img { transform: scale(1.05); }
.thumb:focus-visible {
    outline: 2px solid var(--brass-lt);
    outline-offset: 2px;
}
/* Match hover affordance for keyboard users. */
.thumb:focus-visible img { transform: scale(1.05); }
.thumb .thumb-fallback-icon {
    position: absolute; inset: 0;
    display: none; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 28px;
    pointer-events: none;
}
.thumb.thumb-fallback .thumb-fallback-icon { display: flex; }
.thumb .timestamp-on-thumb {
    position: absolute; bottom: 6px; left: 8px;
    background: var(--overlay-dark); color: var(--text);
    font-size: 10px; padding: 3px 7px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    font-feature-settings: "tnum"; letter-spacing: 0.04em;
    z-index: 2;
}

/* Reduced motion: drop hover lifts and zoom transitions. */
@media (prefers-reduced-motion: reduce) {
    .thumb img { transition: none !important; }
    .thumb:hover img,
    .thumb:focus-visible img { transform: none !important; }
    .kpi-card,
    .ref-list .accordion-button,
    .unit-card { transition: none !important; }
    .kpi-card:hover,
    .unit-card:hover { transform: none !important; }
    .breadcrumb-row a { transition: none !important; }
}
