/* timinews API: AdminKit stiliaus tamsi/šviesi schema ant Bootstrap 6. Paletė pagal dashboard spalvų principus:
   1) kanvas (~60%) 2) paviršiai (~20-30%) 3) akcentas (~10%) 4) semantinės būsenos 5) duomenų serijos.
   Tamsiame režime: ne grynai juodas fonas, prislopintas akcentas, gylis paviršių šviesumu ir rėmeliais (ne šešėliais). */
html { font-size: 14px; }
:root {
  --app-canvas: light-dark(#f4f6fa, #131a27);
  --app-surface: light-dark(#ffffff, #1c2635);
  --app-surface-2: light-dark(#f1f5f9, #243247);
  --app-surface-3: light-dark(#e6ecf4, #2d3c54);
  --app-border: light-dark(#e2e8f0, #2d3b52);
  --app-text: light-dark(#1e293b, #e2e8f0);
  --app-text-2: light-dark(#334155, #cbd5e1);
  --app-muted: light-dark(#5b6b82, #9aa9bf);
  --app-accent: light-dark(#2563eb, #7db0ff);
  --app-accent-bg: #2f6fdb;
  --app-shadow: light-dark(0 1px 2px rgb(15 23 42 / .06), none);
  --app-radius: .5rem;
  --app-gap: 1.5rem;

  --bs-bg-body: var(--app-surface); --bs-bg-1: var(--app-canvas); --bs-bg-2: var(--app-surface-2); --bs-bg-3: var(--app-surface-3); --bs-bg-4: var(--app-surface-3);
  --bs-fg-body: var(--app-text); --bs-fg-1: var(--app-text); --bs-fg-2: var(--app-text-2); --bs-fg-3: var(--app-muted); --bs-fg-4: var(--app-muted);
  --bs-border-color: var(--app-border);
  --bs-primary-bg: var(--app-accent-bg); --bs-primary-fg: var(--app-accent);
}
/* spalvų schema: sistemos nuostata, kol nenurodytas data-bs-theme (jį nustato theme.js) */
:root { color-scheme: light dark; }
[data-bs-theme="light"] { color-scheme: light; }
[data-bs-theme="dark"] { color-scheme: dark; }
body { background: var(--app-canvas); color: var(--app-text); }
a { text-underline-offset: .15em; }
.app-icon { flex: none; vertical-align: -.2em; }

/* ---------- karkasas ---------- */
.app-shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; }
.app-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 1.5rem 0; color-scheme: dark; background: var(--app-surface); color: var(--app-text); border-inline-end: 1px solid var(--app-border); z-index: 30; }
.app-brand { display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem 1rem; font-weight: 700; font-size: 1.15rem; color: var(--app-text); text-decoration: none; }
.app-brand-accent { color: var(--app-accent); }
.app-logo { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: .6rem; background: var(--app-accent-bg); color: #fff; }
.app-logo-lg { width: 3rem; height: 3rem; border-radius: .8rem; }
.app-nav-title { padding: 1.5rem 1.5rem .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--app-muted); font-weight: 600; }
.app-nav a { display: flex; align-items: center; gap: .85rem; padding: .7rem 1.5rem; color: var(--app-text-2); text-decoration: none; border-inline-start: 3px solid transparent; }
.app-nav a:hover { background: var(--app-surface-2); color: var(--app-text); }
.app-nav a.active { background: color-mix(in oklab, var(--app-accent) 12%, transparent); color: var(--app-accent); border-inline-start-color: var(--app-accent); font-weight: 600; }
.app-main { min-width: 0; }
.app-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.25rem; padding: .85rem 2rem; background: var(--app-canvas); border-bottom: 1px solid var(--app-border); }
.app-top-spacer { flex: 1; }
.app-icon-btn { display: inline-grid; place-items: center; width: 2.3rem; height: 2.3rem; border: 0; border-radius: var(--app-radius); background: transparent; color: var(--app-text-2); cursor: pointer; }
.app-icon-btn:hover { background: var(--app-surface-2); color: var(--app-text); }
.app-menu-btn { display: none; }
.app-theme { display: inline-flex; padding: .2rem; gap: .15rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); background: var(--app-surface); }
.app-theme button { display: inline-grid; place-items: center; width: 2rem; height: 1.8rem; border: 0; border-radius: calc(var(--app-radius) - .15rem); background: transparent; color: var(--app-muted); cursor: pointer; }
.app-theme button:hover { color: var(--app-text); }
.app-theme button.active { background: var(--app-surface-3); color: var(--app-text); }
.app-user { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--app-text); }
.app-avatar { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--app-accent-bg); color: #fff; font-weight: 600; }
.app-user-text { display: flex; flex-direction: column; line-height: 1.2; }
.app-user-name { font-weight: 600; }
.app-user-role { font-size: .8rem; color: var(--app-muted); }
.app-content { padding: 2rem; }
.app-scrim { display: none; }

/* ---------- tipografija ir kortelės ---------- */
.app-title { font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.app-page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.card-header { padding: 1.1rem 1.5rem; font-weight: 600; background: transparent; border-bottom: 1px solid var(--app-border); }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; background: transparent; border-top: 1px solid var(--app-border); }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); font-weight: 600; border-bottom-color: var(--app-border); }
.table th, .table td { padding: .9rem 1rem; }
.table th:first-child, .table td:first-child { padding-inline-start: 1.5rem; }
.table th:last-child, .table td:last-child { padding-inline-end: 1.5rem; }
.table-responsive { overflow-x: auto; max-width: 100%; }
.alert, dialog.dialog { border-radius: var(--app-radius); }
dialog.dialog { background: var(--app-surface); border: 1px solid var(--app-border); }
dialog.dialog:not([open]) { display: none; }
.form-control { background-color: var(--app-surface-2); border-color: var(--app-border); }
.form-field > .form-label { color: var(--app-text-2); font-weight: 500; }
.app-badge { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.app-bare { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.app-login { width: 100%; max-width: 24rem; }
.app-narrow { max-width: 32rem; }
.app-narrow-xl { max-width: 64rem; }
pre.app-pre { background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 1rem; max-height: 26rem; overflow: auto; white-space: pre; margin: 0; font-size: .85em; }
pre.app-pre.wrap { white-space: pre-wrap; }
.app-file { overflow-wrap: normal; word-break: normal; }
.app-minw-file { min-width: 12rem; }
.spark { display: block; width: 100%; max-width: 24rem; height: 3.75rem; color: var(--app-accent); }

/* ---------- apžvalgos kortelės ---------- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--app-gap); margin-bottom: var(--app-gap); }
.app-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: var(--app-gap); margin-bottom: var(--app-gap); }
.app-stack { display: flex; flex-direction: column; gap: var(--app-gap); }
.app-stat { padding: 1.5rem; }
.app-stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.app-stat-label { font-weight: 600; }
.app-stat-value { font-size: 1.1rem; font-weight: 600; margin: 1.1rem 0 .9rem; line-height: 1.35; min-height: 2.9rem; }
.app-stat-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; color: var(--app-muted); font-size: .85rem; }
.app-stat-icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; color: var(--tone, var(--app-accent)); background: color-mix(in oklab, var(--tone, var(--app-accent)) 16%, transparent); }
.app-tone-ok { --tone: var(--bs-success-fg); } .app-tone-warn { --tone: var(--bs-warning-fg); } .app-tone-fail { --tone: var(--bs-danger-fg); } .app-tone-skip { --tone: var(--app-muted); }
.app-counters { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.app-counter-value { font-size: 2rem; font-weight: 600; line-height: 1.1; }
.fg-ok { color: var(--bs-success-fg); } .fg-bad { color: var(--bs-danger-fg); }

/* ---------- redaktorius (variantas B „Studija“) ---------- */
.app-poster-btn { position: relative; display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--app-radius); overflow: hidden; width: 100%; }
.app-poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; }
.app-poster-cap { position: absolute; inset-inline: 0; bottom: 0; padding: .5rem; text-align: center; font-size: .85rem; font-weight: 600; background: var(--app-surface); color: var(--app-text); opacity: 0; transition: opacity .15s; }
.app-poster-btn:hover .app-poster-cap, .app-poster-btn:focus-visible .app-poster-cap { opacity: .95; }
.app-studio { display: grid; grid-template-columns: 16rem minmax(0, 1fr) 22rem; gap: var(--app-gap); align-items: start; }
.app-studio-left, .app-studio-right { position: sticky; top: 5.5rem; }
.app-studio-right { display: flex; flex-direction: column; gap: 1rem; }
.app-acc { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.app-acc > summary { cursor: pointer; padding: 1rem 1.5rem; font-weight: 600; list-style-position: inside; }
.app-acc-body { padding: .25rem 1.5rem 1.5rem; }
.app-dirty { display: none; }
.app-dirty.is-on { display: inline-flex; }
.app-counter-note { text-align: end; color: var(--app-muted); font-size: .8rem; margin-top: .35rem; }
.app-seg { position: relative; display: inline-flex; border: 1px solid var(--app-border); border-radius: var(--app-radius); overflow: hidden; background: var(--app-surface-2); }
.app-seg input { position: absolute; opacity: 0; pointer-events: none; }
.app-seg label { padding: .45rem 1.25rem; cursor: pointer; color: var(--app-text-2); user-select: none; margin: 0; }
.app-seg input + label + input + label { border-inline-start: 1px solid var(--app-border); }
.app-seg input:checked + label { background: var(--app-accent-bg); color: #fff; font-weight: 600; }
.app-seg input:disabled + label { cursor: not-allowed; }
.app-seg input:disabled:not(:checked) + label { opacity: .45; }
.app-seg input:focus-visible + label { outline: 2px solid var(--app-accent); outline-offset: -2px; }
.app-drop { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 2.5rem 1rem; border: 2px dashed var(--app-border); border-radius: var(--app-radius); cursor: pointer; text-align: center; background: var(--app-surface-2); }
.app-drop:hover, .app-drop.is-over { border-color: var(--app-accent); }
.app-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 1rem; }
.app-thumb { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .6rem; border: 1px solid var(--app-border); border-radius: var(--app-radius); cursor: pointer; position: relative; background: var(--app-surface-2); text-align: center; }
.app-thumb img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: .3rem; background: var(--app-surface-3); }
.app-thumb .check { position: absolute; top: .9rem; left: .9rem; }
.app-thumb:has(input:checked), .app-thumb.is-selected { border-color: var(--app-accent); box-shadow: 0 0 0 1px var(--app-accent); }
.app-thumb-tag { position: absolute; top: .9rem; right: .9rem; }
.app-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.app-chip { border: 1px solid var(--app-border); background: var(--app-surface-2); color: var(--app-text-2); border-radius: 999px; padding: .3rem .85rem; cursor: pointer; font: inherit; }
.app-chip.active { background: var(--app-accent-bg); border-color: var(--app-accent-bg); color: #fff; }

/* ---------- maži ekranai ---------- */
@media (max-width: 1199.98px) {
  .app-studio { grid-template-columns: 14rem minmax(0, 1fr); }
  .app-studio-right { grid-column: 1 / -1; position: static; }
}
@media (max-width: 991.98px) {
  .app-shell { display: block; }
  .app-side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 16.5rem; transform: translateX(-100%); transition: transform .2s ease; z-index: 50; }
  .app-side.is-open { transform: none; }
  .app-scrim.is-open { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .55); z-index: 40; }
  .app-menu-btn { display: inline-grid; }
  .app-user-text { display: none; }
  .app-top { padding: .6rem 1rem; gap: .75rem; }
  .app-content { padding: 1.25rem 1rem; }
  .app-studio-left { position: static; }
}
@media (max-width: 767.98px) {
  .app-studio { grid-template-columns: 1fr; }
  .app-page-head { margin-bottom: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { .app-side, .app-poster-cap { transition: none; } }
.app-w-8 { width: 8rem; }
.app-content > .app-title { margin-bottom: 1.75rem; }
.app-content > p { margin-bottom: 1.5rem; }

/* Kontrastas (WCAG AA ≥ 4,5:1): subtle ženkliukų tekstas – „emphasis“ atspalvis */
.badge-subtle { color: var(--bs-theme-fg-emphasis, var(--bs-theme-fg)); }

a { color: var(--app-accent); }
a:hover { color: color-mix(in oklab, var(--app-accent) 80%, var(--app-text)); }
.app-thumb .badge { white-space: normal; text-align: center; max-width: 100%; margin-top: .25rem; }
