/* LATVSI case management system */
:root {
  --ocean: #0A2340; --navy: #0B2A4A; --navy-2: #133A63; --ink: #0E1B2E; --ink-2: #3B4A5E; --muted: #66768C;
  --bg: #F3F5F8; --card: #FFFFFF; --line: #E1E7EF; --line-2: #EEF2F6;
  --gold: #E8A93A; --gold-deep: #A86F0E; --sky: #2A6AAB; --female: #E0A12A; --male: #0B2A4A;
  --ok: #1F7A4D; --ok-bg: #E5F4EC; --warn: #8A5A00; --warn-bg: #FDF1D8; --bad: #A33A22; --bad-bg: #FCE7E1;
  --crit: #9E0B23; --crit-bg: #FBDDE2; --info: #1F5690; --info-bg: #E5EFFA; --mute: #55657A; --mute-bg: #EDF1F5;
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--body); color: var(--ink); background: var(--bg); }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; color: var(--ink); }
h1 { font-size: 26px; font-weight: 750; font-stretch: 92%; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ocean); color: #CFDAE7; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side__brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; color: #fff; }
.side__brand:hover { text-decoration: none; }
.side__brand svg { width: 36px; height: 36px; flex: none; }
.side__brand b { display: block; font: 800 17px/1 var(--display); font-stretch: 112%; letter-spacing: .02em; }
.side__brand small { display: block; font-size: 11.5px; color: #9FB3C9; margin-top: 3px; }
.side nav { padding: 6px 10px 16px; flex: 1; }
.side__group { margin-top: 14px; }
.side__group > span { display: block; padding: 0 10px 6px; font-size: 12px; color: #7F95AE; font-weight: 600; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: #DCE6F2; font-weight: 500; font-size: 14.5px; }
.side nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.side nav a.is-active { background: rgba(232,169,58,.14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side nav svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.side nav .count { margin-left: auto; background: var(--gold); color: var(--ink); font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.side nav .count--crit { background: #E0473A; color: #fff; }
.side__foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8EA4BC; }
.side__foot a { color: #DCE6F2; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.top__toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font: 600 14px var(--body); color: var(--ink); }
.top__crumbs { font-size: 13px; color: var(--muted); }
.top__crumbs a { color: var(--muted); }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-2); }
.bell:hover { background: var(--line-2); text-decoration: none; }
.bell svg { width: 18px; height: 18px; }
.bell b { position: absolute; top: -5px; right: -5px; background: #D23A2A; color: #fff; font-size: 10.5px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 8px; color: var(--ink); }
.user:hover { background: var(--line-2); text-decoration: none; }
.user i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; font: 700 12px var(--body); font-style: normal; }
.user span { font-size: 13.5px; line-height: 1.2; }
.user small { display: block; color: var(--muted); font-size: 12px; }
.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }

/* Page header */
.ph { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.ph p { color: var(--muted); margin: 4px 0 0; max-width: 80ch; }
.ph__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 14px/1 var(--body); padding: 10px 14px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--ocean); }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--gold:hover { background: #F0B54C; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: #B9C5D4; }
.btn--danger { background: #fff; color: var(--crit); border-color: #F1C3CB; }
.btn--danger:hover { background: var(--crit-bg); }
.btn--sm { padding: 7px 10px; font-size: 13px; }
.btn--link { background: none; border: 0; color: var(--sky); padding: 0; font-weight: 600; }
.inline { display: inline; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card__head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card__body { padding: 16px 18px; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line-2); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.stack { display: grid; gap: 16px; align-content: start; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.kpi { padding: 16px 18px; border-left: 1px solid var(--line-2); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi span { display: block; font-size: 13px; color: var(--muted); }
.kpi strong { display: block; font: 800 28px/1.1 var(--display); font-stretch: 105%; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi--gold strong { color: var(--gold-deep); }
.kpi--crit strong { color: var(--crit); }
.kpi a { color: inherit; }

/* Work queue */
.queue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.queue a { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); }
.queue a:hover { border-color: #B9C5D4; text-decoration: none; }
.queue b { font: 800 22px/1 var(--display); min-width: 34px; font-variant-numeric: tabular-nums; }
.queue span { font-size: 13.5px; line-height: 1.3; color: var(--ink-2); }
.queue .is-hot { border-color: #F1C3CB; background: #FFF8F9; }
.queue .is-hot b { color: var(--crit); }
.queue .is-zero b { color: #A5B2C2; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.filters label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.filters input, .filters select { font: 14px var(--body); padding: 8px 10px; border: 1px solid #CBD5E1; border-radius: 7px; background: #fff; color: var(--ink); min-width: 150px; }
.filters input[type=search] { min-width: 220px; }
.filters .grow { flex: 1; }
.filters .grow input { width: 100%; }
.filters__period { margin-left: auto; font-size: 13px; color: var(--muted); align-self: center; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th, .t td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t thead th { font-size: 12.5px; font-weight: 600; color: var(--muted); background: #F8FAFC; border-bottom-color: var(--line); white-space: nowrap; }
.t tbody tr:hover { background: #FAFBFD; }
.t td.n, .t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.t .primary { font-weight: 600; color: var(--ink); }
.t .primary small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.t .actions { text-align: right; white-space: nowrap; }
.t .actions a, .t .actions button { font-size: 13px; }
.t tfoot td, .t tfoot th { font-weight: 700; background: #F8FAFC; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Badges */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.badge--crit { background: var(--crit-bg); color: var(--crit); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--mute { background: var(--mute-bg); color: var(--mute); }
.risk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.risk i { width: 8px; height: 8px; border-radius: 2px; }
.risk--low i { background: #8FB3D6; } .risk--medium i { background: #E0A12A; } .risk--high i { background: #D26A4C; } .risk--critical i { background: #C8102E; }
.risk--critical { color: var(--crit); }
.child-flag { display: inline-block; font-size: 11.5px; font-weight: 700; color: #6A3FA0; background: #F1EAFB; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }

/* Charts */
.chart { position: relative; height: 260px; }
.chart--tall { height: 340px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 13.5px; }
.bars .track { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; display: flex; }
.bars .track i { display: block; height: 100%; background: var(--navy); }
.bars .track i.f { background: var(--female); }
.bars .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pipeline div { background: var(--line-2); border-radius: 6px; padding: 10px; text-align: left; }
.pipeline div.has { background: var(--info-bg); }
.pipeline b { display: block; font: 800 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.pipeline span { font-size: 12px; color: var(--ink-2); }

/* Admin map */
.amap { height: 520px; position: relative; }
.amap .lmap__legend { right: 0; top: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 10px; font: 600 12.5px var(--body); color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* Lists */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: #A5B2C2; }
.feed .dot--danger { background: #C8102E; } .feed .dot--warning { background: #E0A12A; } .feed .dot--info { background: var(--sky); } .feed .dot--success { background: var(--ok); }
.feed b { display: block; font-weight: 600; font-size: 14px; }
.feed span { font-size: 13px; color: var(--muted); }
.feed .unread b::after { content: ""; display: inline-block; width: 6px; height: 6px; background: #D23A2A; border-radius: 50%; margin-left: 6px; vertical-align: 2px; }

/* Detail */
.dl { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr); gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 9px 0; border-bottom: 1px solid var(--line-2); margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { font-weight: 500; }
.dl--2 { grid-template-columns: minmax(0, 150px) minmax(0, 1fr) minmax(0, 150px) minmax(0, 1fr); column-gap: 20px; }
.prose-box { white-space: pre-line; font-size: 14.5px; color: var(--ink-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.is-active { border-bottom-color: var(--gold); color: var(--ink); }
.headline-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.note-item { padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.note-item header { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.note-item p { margin: 0; white-space: pre-line; }
.protected { background: #FBF7EC; border: 1px dashed #E6CF97; color: #7A5A12; border-radius: 6px; padding: 2px 8px; font-size: 12.5px; }

/* Forms */
.form { display: grid; gap: 20px; }
.form-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.form-section > header { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.form-section > header p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding: 18px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.f { display: grid; gap: 5px; align-content: start; }
.f--full { grid-column: 1 / -1; }
.f label { font-weight: 600; font-size: 13.5px; }
.f .req { color: var(--crit); }
.f .hint { font-size: 12.5px; color: var(--muted); }
.f input, .f select, .f textarea { font: 14.5px var(--body); padding: 9px 11px; border: 1px solid #C3CEDB; border-radius: 7px; background: #fff; color: var(--ink); width: 100%; }
.f textarea { min-height: 110px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: 3px solid rgba(232,169,58,.4); border-color: var(--navy); }
.f.has-error input, .f.has-error select, .f.has-error textarea { border-color: var(--crit); }
.f .error { color: var(--crit); font-size: 12.5px; font-weight: 600; }
.f-check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.f-check input { width: 16px; height: 16px; accent-color: var(--navy); }
.form-actions { display: flex; gap: 10px; align-items: center; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 0 4px; }

/* Flash */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash--success { background: var(--ok-bg); color: var(--ok); border: 1px solid #BFE3CF; }
.flash--error { background: var(--crit-bg); color: var(--crit); border: 1px solid #F1C3CB; }
.flash ul { margin: 4px 0 0; padding-left: 18px; font-weight: 400; }

/* Pagination */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-2); }
.pager nav { display: flex; gap: 4px; }
.pager a, .pager span.cur, .pager span.dis { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fff; }
.pager span.cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager span.dis { color: #A5B2C2; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); background: var(--ocean); }
.login__art { position: relative; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login__art h1 { color: #fff; font-size: clamp(28px, 3.4vw, 44px); max-width: 16ch; font-stretch: 88%; font-weight: 800; }
.login__art p { color: #B8C7D9; max-width: 46ch; }
.login__map { position: absolute; inset: 4% -18% 22% 28%; opacity: .9; pointer-events: none; }
.login__panel { background: #fff; display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(28px, 5vw, 64px); }
.login__panel h2 { font-size: 24px; margin-bottom: 6px; }
.login__panel form { display: grid; gap: 16px; margin-top: 24px; }
.login__panel .btn { padding: 13px; font-size: 15px; }

/* Print */
@media print {
  .side, .top, .no-print, .form-actions { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { break-inside: avoid; border-color: #ccc; }
}

/* Responsive */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line-2); }
  .g-main, .g-side { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(5,15,30,.45); }
  .top__toggle { display: inline-block; }
  .queue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
  .dl--2 { grid-template-columns: minmax(0, 150px) minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .top { padding: 10px 16px; }
  .user span { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0 !important; border-top: 1px solid var(--line-2); }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
  .amap { height: 420px; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .bars li { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 40px; }
}
.login__map .lmap__legend { display: none; }

/* ---------- v2.4: motion in the staff area ---------- */
.shell { position: relative; z-index: 1; }
.side nav a { transition: background-color .2s, color .2s, box-shadow .25s; }
.side nav a svg { transition: transform .3s var(--ease-spring, ease), opacity .2s; }
.side nav a:hover svg { transform: translateX(2px) scale(1.06); opacity: 1; }
.side nav a.is-active svg { opacity: 1; color: var(--gold); }
.top { transition: box-shadow .3s; }
.top.is-scrolled { box-shadow: 0 8px 24px -16px rgba(5,20,40,.45); }
.btn { transition: background .2s, border-color .2s, color .2s, transform .18s var(--ease-out, ease), box-shadow .2s; }
.btn:hover { transform: translateY(-1px); }
.btn.is-pressed, .btn:active { transform: scale(.97); }
.btn--primary:hover { box-shadow: 0 8px 18px -10px rgba(11,42,74,.8); }
.card, .form-section { transition: box-shadow .3s, border-color .3s; }
table.t tbody tr { transition: background-color .15s; }
.f input, .f select, .f textarea { transition: border-color .2s, box-shadow .2s, outline-color .2s; }
.badge { transition: background .2s; }
@media (prefers-reduced-motion: no-preference) {
  .flash { animation: flash-in .5s var(--ease-spring, ease) both; }
  .bell b { animation: bell-pop .6s var(--ease-spring, ease) .4s both; }
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes bell-pop { from { transform: scale(0); } }
.login__panel { position: relative; overflow: hidden; }
.login__panel > *:not(.wm) { position: relative; z-index: 1; }
.login__panel .wm { position: absolute; right: -35%; bottom: -25%; width: 95%; opacity: .06; }

/* ---------- v2.4: gallery manager ---------- */
.gal-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tabs-pill { display: inline-flex; gap: 4px; padding: 4px; background: #E8EDF3; border-radius: 999px; }
.tabs-pill a { padding: 7px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; transition: background .2s, color .2s; }
.tabs-pill a:hover { text-decoration: none; color: var(--ink); background: rgba(255,255,255,.6); }
.tabs-pill a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(11,42,74,.12); }
.tabs-pill span { color: var(--muted); font-weight: 500; margin-left: 3px; }
.gal-album select { font: 14px var(--body); padding: 8px 10px; border: 1px solid #C3CEDB; border-radius: 8px; background: #fff; }

.gtiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.gtile { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: box-shadow .25s, transform .25s var(--ease-out, ease), border-color .2s, opacity .2s; }
.gtile:hover { box-shadow: 0 14px 30px -18px rgba(11,42,74,.45); transform: translateY(-2px); }
.gtile.is-selected { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy); }
.gtile.is-dragging { opacity: .45; transform: scale(.97); }
.gtile.is-hidden .gtile__img img { filter: grayscale(.8); opacity: .6; }
.gtile__img { display: block; position: relative; aspect-ratio: var(--ar); background: #E3E9F1; overflow: hidden; }
.gtile__img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease-out, ease); }
.gtile:hover .gtile__img img { transform: scale(1.05); }
.gtile__play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 40px; height: 40px; border-radius: 50%; background: rgba(232,169,58,.95); display: grid; place-items: center; color: var(--ink); }
.gtile__play svg { width: 18px; height: 18px; margin-left: 2px; fill: currentColor; stroke: none; }
.gtile__meta { padding: 10px 12px 12px; display: grid; gap: 1px; min-width: 0; }
.gtile__meta b { color: var(--ink); font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtile__meta span { color: var(--muted); font-size: 12.5px; }
.gtile__flags { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.gtile__sel { position: absolute; top: 8px; left: 8px; z-index: 2; cursor: pointer; }
.gtile__sel input { position: absolute; opacity: 0; }
.gtile__sel span { display: block; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff; background: rgba(11,42,74,.35); box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: background .15s, transform .2s var(--ease-spring, ease); opacity: 0; }
.gtile:hover .gtile__sel span, .gtile__sel input:focus-visible + span, .gtile__sel input:checked + span, .gal-admin:has(input:checked) .gtile__sel span { opacity: 1; }
.gtile__sel input:checked + span { background: var(--navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5 6.5 11.5 12.5 4.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; transform: scale(1.08); }
.gtile__sel input:focus-visible + span { outline: 3px solid var(--gold); }
.gtile__grip { position: absolute; right: 8px; bottom: 10px; color: #A5B2C2; cursor: grab; }
.gtile__grip svg { width: 18px; height: 18px; stroke-width: 3.2; }
.gtile[draggable="true"] { cursor: grab; }
.bulkbar { position: sticky; top: 64px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 14px; background: var(--ocean); color: #fff; border-radius: 12px; box-shadow: 0 14px 30px -14px rgba(5,20,40,.6); }
.bulkbar b { margin-right: 8px; }
.bulkbar .btn--link { color: #BFD3EA; }
.bulkbar__album { display: inline-flex; gap: 4px; }
.bulkbar__album input { font: 13px var(--body); padding: 6px 9px; border-radius: 7px; border: 1px solid #C3CEDB; width: 150px; }
.bulkbar.is-in { animation: flash-in .4s var(--ease-spring, ease) both; }

.dropzone { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 34px 20px; margin: 18px; border: 2px dashed #C3CEDB; border-radius: 12px; background: #F8FAFC; color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s, transform .25s var(--ease-out, ease); }
.dropzone b { color: var(--ink); font-size: 16px; }
.dropzone:hover, .dropzone.is-over { border-color: var(--navy); background: #EEF3F9; }
.dropzone.is-over { transform: scale(1.01); }
.dropzone--big { margin: 0; padding: 70px 20px; background: #fff; }
.dropzone__ico { width: 56px; height: 56px; border-radius: 50%; background: #FBEBC9; color: var(--gold-deep); display: grid; place-items: center; margin-bottom: 6px; }
.dropzone__ico svg { width: 26px; height: 26px; }
@media (prefers-reduced-motion: no-preference) { .dropzone:hover .dropzone__ico { animation: hop .6s var(--ease-spring, ease); } }
@keyframes hop { 40% { transform: translateY(-6px); } }
.pending { list-style: none; margin: 0; padding: 0 18px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pending li { position: relative; border-radius: 8px; overflow: hidden; background: #E3E9F1; animation: pend-in .35s var(--ease-spring, ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.pending img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.pending span { display: block; padding: 4px 6px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending__rm { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(4,12,24,.7); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
@keyframes pend-in { from { opacity: 0; transform: scale(.85); } }
@media (prefers-reduced-motion: reduce) { .pending li { animation: none; } }
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 8px; border-radius: 99px; background: #E3E9F1; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), var(--sky)); transform: scaleX(0); transform-origin: left; transition: transform .25s; }
form.is-busy .dropzone, form.is-busy .pending__rm { pointer-events: none; opacity: .6; }
.upveil { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(10,35,64,.82); backdrop-filter: blur(4px); color: #fff; opacity: 0; transition: opacity .2s; }
.upveil.is-on { opacity: 1; }
.upveil > div { display: grid; gap: 8px; justify-items: center; padding: 48px 64px; border: 2px dashed rgba(255,255,255,.5); border-radius: 18px; min-width: min(480px, 90vw); }
.upveil b { font: 800 24px var(--display); }
.upveil .progress { width: 100%; background: rgba(255,255,255,.2); margin-top: 10px; flex: none; }
.upveil .progress i { background: var(--gold); }
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; opacity: 0; z-index: 90; margin: 0; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); transition: opacity .25s, translate .35s var(--ease-spring, ease); pointer-events: none; }
.toast.is-in { opacity: 1; translate: -50% 0; }
.toast--bad { background: var(--crit); }

.yt-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.yt-preview { padding: 18px; border-left: 1px solid var(--line-2); display: grid; gap: 10px; align-content: start; }
.yt-preview__frame { position: relative; aspect-ratio: var(--ar, 16/9); max-height: 520px; border-radius: 10px; overflow: hidden; background: #0B2A4A; margin: 0 auto; width: 100%; }
.yt-preview__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-preview__frame.is-in { animation: flash-in .45s var(--ease-out, ease) both; }
.yt-preview__empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: #9FB3C9; font-size: 13px; }
.yt-preview__empty svg { width: 34px; height: 34px; }
.yt-preview__title { font-weight: 600; margin: 0; }
.yt-preview__photo img { width: 100%; border-radius: 10px; display: block; }
.hint--ok { color: var(--ok) !important; font-weight: 600; }
.hint--bad { color: var(--crit) !important; font-weight: 600; }
@media (max-width: 900px) { .yt-layout { grid-template-columns: 1fr; } .yt-preview { border-left: 0; border-top: 1px solid var(--line-2); } }

/* ---------- v2.4.1: small screens ---------- */
.card__head { flex-wrap: wrap; }
@media (max-width: 640px) {
  .content { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .ph h1 { font-size: 22px; }
  .ph__actions { width: 100%; }
  .ph__actions .btn { flex: 1 1 auto; }
  .queue { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .gtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gtile__meta b { font-size: 13px; }
  .gtile__sel span { opacity: 1; }
  .bulkbar { top: 56px; }
  .bulkbar__album { width: 100%; }
  .bulkbar__album input { flex: 1; width: auto; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; padding: 14px; }
  .form-actions .btn { flex: 1; }
  .top__right .user span { display: none; }
  .dropzone { margin: 12px; padding: 26px 14px; }
}
@media (pointer: coarse) { .side nav a { padding-top: 11px; padding-bottom: 11px; } .btn { min-height: 42px; } }

/* ---------- v2.5: brand settings ---------- */
.brand-prev { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--ocean); color: #fff; min-height: 72px; transition: box-shadow .3s; }
.brand-prev.is-new { box-shadow: 0 0 0 3px var(--gold); }
.brand-prev svg.mark, .brand-prev img.mark { width: auto; height: 44px; }
.brand-prev svg.mark { width: 44px; }
.brand-prev span { font: 800 18px var(--display); letter-spacing: .02em; }
.brand-prev--icon { background: linear-gradient(135deg, #E9EEF5, #F7F9FC); color: var(--ink-2); }
.brand-prev--icon span { font: 500 13px var(--body); }
.brand-prev__app { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 6px 16px -6px rgba(11,42,74,.5); object-fit: cover; }
.brand-prev__tab { width: 20px; height: 20px; border-radius: 4px; padding: 3px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); box-sizing: content-box; }

/* ---------- v2.5: offline and sync ---------- */
.sync-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font: 600 13px var(--body); cursor: pointer; white-space: nowrap; transition: background .25s, border-color .25s, color .25s; }
.sync-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(31,122,77,.15); flex: none; }
.sync-chip--waiting i, .sync-chip--syncing i { background: var(--sky); box-shadow: 0 0 0 3px rgba(42,106,171,.18); }
.sync-chip--offline { background: #FFF6E5; border-color: #F0D49A; color: #7A5200; }
.sync-chip--offline i { background: #D98E04; box-shadow: 0 0 0 3px rgba(217,142,4,.2); }
.sync-chip--fix, .sync-chip--signin { background: var(--crit-bg); border-color: #F1C3CB; color: var(--crit); }
.sync-chip--fix i, .sync-chip--signin i { background: var(--crit); box-shadow: 0 0 0 3px rgba(158,11,35,.15); }
@media (prefers-reduced-motion: no-preference) {
  .sync-chip--syncing i { animation: sync-pulse 1s ease-in-out infinite; }
  .sync-chip--offline i { animation: sync-pulse 2s ease-in-out infinite; }
}
@keyframes sync-pulse { 50% { transform: scale(.6); opacity: .5; } }
@media (max-width: 640px) { .sync-chip span { display: none; } .sync-chip { padding: 0; width: 34px; justify-content: center; } }

.sync-panel { position: fixed; right: max(16px, env(safe-area-inset-right)); top: 64px; z-index: 60; width: min(400px, calc(100vw - 32px)); max-height: min(70vh, 620px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px -20px rgba(5,20,40,.45); }
.sync-panel.is-in { animation: flash-in .35s var(--ease-spring, ease) both; }
.sync-panel__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
.sync-panel__head b { font: 700 16px var(--display); }
.sync-panel__head button { border: 0; background: #EEF2F6; width: 30px; height: 30px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.sync-panel__state { margin: 0 16px 10px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; background: var(--ok-bg); color: var(--ok); }
.sync-panel__state--offline { background: #FFF6E5; color: #7A5200; }
.sync-panel__state--fix, .sync-panel__state--signin { background: var(--crit-bg); color: var(--crit); }
.sync-panel__state--waiting, .sync-panel__state--syncing { background: var(--info-bg); color: var(--info); }
.sync-list { list-style: none; margin: 0; padding: 0 8px; }
.sync-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.sync-list b { display: block; color: var(--ink); }
.sync-list span { color: var(--muted); font-size: 12.5px; }
.sync-list em { display: block; font-style: normal; color: var(--crit); margin-top: 4px; font-size: 12.5px; }
.sync-list__acts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.sync-list__acts a { font-weight: 700; }
.sync-list__acts button { border: 0; background: none; color: var(--muted); font: 600 12px var(--body); cursor: pointer; padding: 0; }
.sync-list__acts button:hover { color: var(--crit); }
.sync-panel__empty { margin: 4px 16px 10px; color: var(--muted); font-size: 13.5px; }
.sync-panel__offline { display: grid; gap: 6px; padding: 12px 16px 16px; border-top: 1px solid var(--line-2); margin-top: 6px; background: #F8FAFC; border-radius: 0 0 14px 14px; }
.sync-panel__offline > span { font-size: 12.5px; color: var(--muted); }
.sync-panel__offline .btn { justify-self: start; }
.sync-panel__bar { display: block; height: 4px; border-radius: 4px; background: #E3E9F1; overflow: hidden; margin-top: 6px; }
.sync-panel__bar i { display: block; height: 100%; background: var(--sky); transform: scaleX(0); transform-origin: left; transition: transform .3s; }

.offline-banner { display: none; align-items: center; gap: 10px; padding: 9px 28px; background: #FFF6E5; color: #7A5200; border-bottom: 1px solid #F0D49A; font-size: 13.5px; font-weight: 500; }
.offline-banner svg { width: 18px; height: 18px; flex: none; }
html.is-offline .offline-banner { display: flex; }
@media (prefers-reduced-motion: no-preference) { html.is-offline .offline-banner { animation: flash-in .4s var(--ease-out, ease) both; } }
@media (max-width: 640px) { .offline-banner { padding: 8px 14px; font-size: 12.5px; } }

.saved-veil { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(10,35,64,.55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s; }
.saved-veil.is-on { opacity: 1; }
.saved-veil > div { display: grid; justify-items: center; text-align: center; gap: 8px; width: min(420px, 100%); padding: 28px 24px 22px; background: #fff; border-radius: 18px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); transform: translateY(14px) scale(.97); transition: transform .4s var(--ease-spring, ease); }
.saved-veil.is-on > div { transform: none; }
.saved-veil b { font: 800 20px var(--display); }
.saved-veil span { color: var(--ink-2); font-size: 14.5px; }
.saved-veil__ico { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); }
.saved-veil__ico svg { width: 30px; height: 30px; }
@media (prefers-reduced-motion: no-preference) { .saved-veil.is-on .saved-veil__ico svg path { stroke-dasharray: 30; animation: tick-draw .6s .15s var(--ease-out, ease) backwards; } }
@keyframes tick-draw { from { stroke-dashoffset: 30; } }
.saved-veil__btns { display: grid; gap: 8px; width: 100%; margin-top: 10px; }
.saved-veil__btns button { padding: 13px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: 600 15px var(--body); cursor: pointer; }
.saved-veil__btns button[data-go] { background: var(--navy); color: #fff; border-color: var(--navy); }
.app-toast--action { display: flex; align-items: center; gap: 12px; }
.app-toast--action button { border: 0; background: var(--gold); color: var(--ink); font: 700 13px var(--body); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
