/* StackTrellis admin: design system. Loaded after css/style.css; keeps the class names the admin views already use. */
body.admin {
  --a-bg: #f3f5fb; --a-surface: #ffffff; --a-surface-2: #f8f9fd; --a-border: #e3e7f2; --a-border-strong: #cdd4e6;
  --a-text: #0f172a; --a-muted: #5b6579; --a-primary: #4338ca; --a-primary-soft: #eceafd; --a-on-primary: #fff;
  --a-side: #0b1020; --a-side-2: #121a33; --a-side-text: #b8c2d9; --a-side-active: rgba(129, 140, 248, .18);
  --a-ok: #067647; --a-ok-bg: #e7f7ef; --a-warn: #92400e; --a-warn-bg: #fef3c7; --a-bad: #b42318; --a-bad-bg: #fdeceb; --a-info: #1d4ed8; --a-info-bg: #e6efff;
  --a-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .05);
  --a-radius: 14px; --side-w: 272px;
  font-size: 15px; background: var(--a-bg); color: var(--a-text);
}
:root[data-theme="dark"] body.admin {
  --a-bg: #0a0f1e; --a-surface: #121a30; --a-surface-2: #0f1629; --a-border: #222d4a; --a-border-strong: #33415f;
  --a-text: #e8ecf8; --a-muted: #98a4be; --a-primary: #8b93f5; --a-primary-soft: #1e2650; --a-on-primary: #0a0f1e;
  --a-side: #070b17; --a-side-2: #0f1629; --a-side-text: #a9b4cd;
  --a-ok: #6ee7b0; --a-ok-bg: #0f2a1f; --a-warn: #fcd34d; --a-warn-bg: #2d2410; --a-bad: #fca5a5; --a-bad-bg: #2e1517; --a-info: #93c5fd; --a-info-bg: #13244a;
  --a-shadow: 0 0 0 1px #222d4a;
}
body.admin *, body.admin *::before, body.admin *::after { box-sizing: border-box; }
body.admin h1, body.admin h2, body.admin h3 { letter-spacing: -.015em; color: var(--a-text); }
body.admin a { color: var(--a-primary); }
body.admin .muted, body.admin .meta, body.admin .hint { color: var(--a-muted); }
body.admin :focus-visible { outline: 3px solid color-mix(in srgb, var(--a-primary) 55%, transparent); outline-offset: 2px; }

/* ---------- Shell ---------- */
.admin-shell { display: block; min-height: 100vh; background: var(--a-bg); }
.admin-side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 80; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--a-side), var(--a-side-2)); color: var(--a-side-text);
  transform: translateX(-100%); transition: transform .22s ease; border: 0; padding: 0;
}
body.nav-open .admin-side { transform: none; box-shadow: 0 0 0 100vmax rgba(5, 8, 20, .55); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; flex: none; }
.side-brand svg { width: 32px; height: 32px; }
.side-brand { flex-direction: column; align-items: flex-start; gap: 4px; }
.side-brand img { display: block; height: 44px; width: auto; }
.side-brand small { padding-left: 2px; }
.login-art__logo { display: block; height: 60px; width: auto; }
.brand-logo img { display: block; height: 64px; width: auto; }
.brand-logo--dark { display: none; }
:root[data-theme="dark"] .brand-logo--light { display: none; }
:root[data-theme="dark"] .brand-logo--dark { display: block; }
body.admin .side-brand { color: #fff; }
.side-brand .brand__accent { color: #a5b4fc; }
.side-brand small { display: block; font-weight: 500; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #6b7794; margin-top: 1px; }
.side-scroll { overflow-y: auto; flex: 1; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: #2a3556 transparent; }
.side-group { margin: 2px 0; }
.side-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: #8591ad; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; user-select: none; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.side-group[open] > summary::after { transform: rotate(45deg); }
.side-group > summary:hover { color: #d6ddf0; }
body.admin .side-link { display: flex; align-items: center; gap: 11px; padding: 8px 11px; margin: 1px 0; border-radius: 10px; color: var(--a-side-text); text-decoration: none; font-weight: 500; font-size: .93rem; position: relative; }
.side-link svg { flex: none; opacity: .85; }
body.admin .side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
body.admin .side-link[aria-current="page"] { background: var(--a-side-active); color: #fff; }
.side-link[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #818cf8; }
.side-link .count { margin-left: auto; background: #f59e0b; color: #1f1300; font-size: .7rem; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
.side-foot { flex: none; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #22d3ee); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.side-foot .who { min-width: 0; line-height: 1.25; }
.side-foot .who strong { display: block; color: #fff; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { font-size: .75rem; color: #7f8bab; }
.side-foot form { margin-left: auto; }
.icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--a-border); background: var(--a-surface); color: var(--a-text); cursor: pointer; text-decoration: none; }
body.admin .icon-btn:hover { border-color: var(--a-primary); color: var(--a-primary); }
.side-foot .icon-btn { background: transparent; border-color: rgba(255, 255, 255, .12); color: #cbd5e1; }

.admin-body { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: color-mix(in srgb, var(--a-surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--a-border); }
.topbar .crumbs { font-size: .85rem; color: var(--a-muted); display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.topbar .crumbs a { color: var(--a-muted); text-decoration: none; }
body.admin .topbar .crumbs a:hover { color: var(--a-primary); }
.topbar .crumbs strong { color: var(--a-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .only-mobile { display: inline-flex; }
.topbar .theme-ico-sun { display: none; }
:root[data-theme="dark"] .topbar .theme-ico-sun { display: block; }
:root[data-theme="dark"] .topbar .theme-ico-moon { display: none; }
.admin-main { padding: 22px 18px 90px; width: 100%; max-width: 1280px; margin-inline: auto; min-width: 0; background: none; }

@media (min-width: 1024px) {
  .admin-side { transform: none; }
  body.nav-open .admin-side { box-shadow: none; }
  .admin-body { margin-left: var(--side-w); }
  .topbar .only-mobile { display: none; }
  .topbar { padding-inline: 28px; }
  .admin-main { padding: 28px 28px 90px; }
}

/* ---------- Page header, panels, flash ---------- */
.admin-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.admin-top h1 { font-size: clamp(1.35rem, 1rem + 1.2vw, 1.8rem); margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-top > a:not(.btn) { color: var(--a-muted); text-decoration: none; font-size: .9rem; }
body.admin .admin-top > a:not(.btn):hover { color: var(--a-primary); }
.page-sub { color: var(--a-muted); margin: -12px 0 20px; max-width: 70ch; }
.panel { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: var(--a-radius); padding: 22px; margin-bottom: 20px; box-shadow: var(--a-shadow); }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel h2 { font-size: 1.05rem; }
.panel--flush { padding: 0; overflow: hidden; }
body.admin .card { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: var(--a-radius); box-shadow: var(--a-shadow); padding: 18px; }
body.admin .card p { color: var(--a-muted); }
body.admin .card--link:hover { border-color: var(--a-primary); }
body.admin .aside-box { background: var(--a-surface-2); border-color: var(--a-border); }
.flash { display: flex; gap: 10px; align-items: flex-start; background: var(--a-ok-bg); color: var(--a-ok); border: 1px solid color-mix(in srgb, var(--a-ok) 28%, transparent); padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; }
.flash--error { background: var(--a-bad-bg); color: var(--a-bad); border-color: color-mix(in srgb, var(--a-bad) 30%, transparent); }
.flash svg { flex: none; margin-top: 2px; }
.error-text { color: var(--a-bad); font-size: .85rem; margin: 5px 0 0; font-weight: 500; }

/* ---------- Buttons ---------- */
body.admin .btn { min-height: 40px; padding: 8px 16px; border-radius: 10px; font-weight: 600; font-size: .92rem; border-width: 1px; gap: 8px; }
body.admin .btn:hover { transform: none; }
body.admin .btn--primary { background: var(--a-primary); color: var(--a-on-primary); box-shadow: 0 1px 2px rgba(67, 56, 202, .3); }
body.admin .btn--primary:hover { filter: brightness(1.08); color: var(--a-on-primary); }
body.admin .btn--ghost { background: var(--a-surface); border-color: var(--a-border-strong); color: var(--a-text); }
body.admin .btn--ghost:hover { border-color: var(--a-primary); color: var(--a-primary); }
body.admin .btn--danger { background: var(--a-bad-bg); color: var(--a-bad); border-color: color-mix(in srgb, var(--a-bad) 30%, transparent); }
body.admin .btn--danger:hover { background: var(--a-bad); color: #fff; }
body.admin .btn--sm { min-height: 32px; padding: 4px 11px; font-size: .84rem; border-radius: 8px; }
body.admin .btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
body.admin .btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
table.data th { background: var(--a-surface-2); text-align: left; padding: 11px 14px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--a-muted); border-bottom: 1px solid var(--a-border); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--a-border); vertical-align: middle; }
table.data tbody tr:hover td { background: var(--a-surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td a { font-weight: 600; text-decoration: none; }
table.data td a:hover { text-decoration: underline; }
.actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.actions form { margin: 0; }
.table-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--a-border); }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--a-muted); pointer-events: none; }
body.admin .search input { width: 100%; padding: 8px 12px 8px 36px; min-height: 40px; border: 1px solid var(--a-border-strong); border-radius: 10px; background: var(--a-surface); color: var(--a-text); font: inherit; }
.count-pill { color: var(--a-muted); font-size: .86rem; }
.empty { text-align: center; padding: 52px 20px; color: var(--a-muted); }
.empty .empty-ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--a-primary-soft); color: var(--a-primary); display: flex; align-items: center; justify-content: center; }
.empty h3 { margin: 0 0 6px; }
.empty p { margin: 0 auto 16px; max-width: 46ch; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; background: var(--a-surface-2); border: 1px solid var(--a-border); color: var(--a-muted); white-space: nowrap; line-height: 1.6; }
.badge--ok { background: var(--a-ok-bg); color: var(--a-ok); border-color: transparent; }
.badge--warn, .badge--new { background: var(--a-warn-bg); color: var(--a-warn); border-color: transparent; }
.badge--bad { background: var(--a-bad-bg); color: var(--a-bad); border-color: transparent; }
.badge--info, .badge--replied { background: var(--a-info-bg); color: var(--a-info); border-color: transparent; }
.badge--muted { background: var(--a-surface-2); color: var(--a-muted); }

/* ---------- Stats and dashboard ---------- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 22px; }
.stat-card { display: flex; gap: 14px; align-items: center; background: var(--a-surface); border: 1px solid var(--a-border); border-radius: var(--a-radius); box-shadow: var(--a-shadow); padding: 16px 18px; text-decoration: none; color: inherit; }
a.stat-card:hover { border-color: var(--a-primary); }
.stat-card .ico { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--a-primary-soft); color: var(--a-primary); }
.stat-card .ico--green { background: var(--a-ok-bg); color: var(--a-ok); } .stat-card .ico--amber { background: var(--a-warn-bg); color: var(--a-warn); } .stat-card .ico--blue { background: var(--a-info-bg); color: var(--a-info); } .stat-card .ico--red { background: var(--a-bad-bg); color: var(--a-bad); }
.stat-card b { display: block; font-size: 1.55rem; line-height: 1.1; font-weight: 800; color: var(--a-text); }
.stat-card span { color: var(--a-muted); font-size: .85rem; }
.stat { font-size: 1.9rem; font-weight: 800; color: var(--a-primary); line-height: 1; }
.quick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
body.admin .quick a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px dashed var(--a-border-strong); border-radius: 12px; text-decoration: none; font-weight: 600; color: var(--a-text); background: var(--a-surface); }
body.admin .quick a:hover { border-color: var(--a-primary); color: var(--a-primary); border-style: solid; }
.dash-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .dash-grid { grid-template-columns: 1.6fr 1fr; } }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 8px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.chart .bar i { display: block; width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #818cf8, var(--a-primary)); min-height: 3px; }
.chart .bar span { font-size: .72rem; color: var(--a-muted); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--a-border); }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .grow { min-width: 0; flex: 1; } .list-plain .grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Forms ---------- */
body.admin .field label, body.admin .field-check label { font-weight: 600; font-size: .9rem; color: var(--a-text); }
body.admin .field input:not([type=checkbox]):not([type=file]), body.admin .field select, body.admin .field textarea, body.admin .login-card input:not([type=checkbox]) {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--a-border-strong); border-radius: 10px; background: var(--a-surface); color: var(--a-text); font: inherit; transition: border-color .12s, box-shadow .12s;
}
body.admin .field input:focus, body.admin .field select:focus, body.admin .field textarea:focus, body.admin .search input:focus { outline: 0; border-color: var(--a-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--a-primary) 18%, transparent); }
body.admin .field textarea { min-height: 120px; line-height: 1.5; resize: vertical; }
body.admin .field textarea.tall { min-height: 280px; font-family: var(--font-mono); font-size: .9rem; }
body.admin .field input[type=file] { padding: 9px; border: 1px dashed var(--a-border-strong); border-radius: 10px; background: var(--a-surface-2); width: 100%; }
body.admin .field .hint { display: block; font-size: .82rem; margin-top: 5px; }
.field-check { display: flex; align-items: center; gap: 10px; }
body.admin .field-check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--a-primary); flex: none; }
body.admin .field-check label { margin: 0; font-weight: 500; }
.form { display: grid; gap: 16px; }
.form--wide { max-width: none; }
.form-layout { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1100px) { .form-layout { grid-template-columns: minmax(0, 1fr) 340px; } .form-layout .side { position: sticky; top: 84px; } }
.form-layout--single { grid-template-columns: minmax(0, 760px) !important; }
.form-layout .panel { margin-bottom: 20px; }
.form-layout .panel > h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--a-muted); margin-bottom: 16px; }
.form-layout .panel .field + .field, .form-layout .panel .field + .field-check, .form-layout .panel .field-check + .field, .form-layout .panel .field + .field.field--tight { margin-top: 16px; }
.savebar { position: sticky; bottom: 0; z-index: 40; margin: 8px -18px -90px; padding: 14px 18px; display: flex; gap: 10px; align-items: center; background: color-mix(in srgb, var(--a-surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--a-border); }
@media (min-width: 1024px) { .savebar { margin-inline: -28px; padding-inline: 28px; } }
.savebar .note { margin-left: auto; color: var(--a-muted); font-size: .85rem; }
.thumb { max-height: 110px; border-radius: 10px; border: 1px solid var(--a-border); margin-bottom: 8px; }
trix-toolbar .trix-button-group--file-tools { display: none; }
trix-editor { min-height: 320px; background: var(--a-surface); color: var(--a-text); border: 1px solid var(--a-border-strong); border-radius: 10px; padding: 14px; }
trix-toolbar .trix-button { background: #fff; }
#items-table input { width: 100%; min-height: 40px; padding: 8px 10px; font: inherit; color: var(--a-text); background: var(--a-surface); border: 1px solid var(--a-border-strong); border-radius: 8px; }
#items-table td { padding: 6px 8px; }

/* ---------- Media, board ---------- */
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.media-item { border: 1px solid var(--a-border); border-radius: var(--a-radius); padding: 12px; background: var(--a-surface); font-size: .85rem; word-break: break-all; box-shadow: var(--a-shadow); }
.media-item img { aspect-ratio: 4/3; object-fit: cover; width: 100%; border-radius: 10px; margin-bottom: 8px; }
.board { display: grid; gap: 14px; grid-template-columns: repeat(5, minmax(230px, 1fr)); overflow-x: auto; padding-bottom: 12px; }
.board__col { background: var(--a-surface-2); border: 1px solid var(--a-border); border-radius: var(--a-radius); padding: 12px; min-height: 140px; }
.board__col h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--a-muted); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; }
.board__card { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: 12px; padding: 12px; margin-bottom: 10px; font-size: .9rem; box-shadow: var(--a-shadow); }
.board__card a { text-decoration: none; }

/* ---------- Confirm dialog and toasts ---------- */
dialog.confirm { border: 0; border-radius: 16px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--a-surface); color: var(--a-text); box-shadow: 0 24px 70px rgba(2, 6, 23, .4); }
dialog.confirm::backdrop { background: rgba(5, 8, 20, .6); backdrop-filter: blur(2px); }
dialog.confirm .body { padding: 24px; } dialog.confirm h2 { margin: 0 0 8px; font-size: 1.15rem; } dialog.confirm p { margin: 0; color: var(--a-muted); }
dialog.confirm .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--a-border); background: var(--a-surface-2); border-radius: 0 0 16px 16px; }
.toasts { position: fixed; right: 18px; top: 70px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.toast { animation: toast-in .25s ease; box-shadow: 0 10px 30px rgba(2, 6, 23, .18); margin: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Login ---------- */
body.admin .login-wrap { max-width: none; margin: 0; padding: 0; min-height: 100vh; display: grid; }
@media (min-width: 900px) { body.admin .login-wrap { grid-template-columns: 1.1fr 1fr; } }
.login-art { display: none; background: radial-gradient(900px 500px at 20% 10%, #3730a3 0, transparent 60%), radial-gradient(700px 500px at 90% 100%, #0e7490 0, transparent 60%), #0b1020; color: #e8ecf8; padding: 56px; position: relative; overflow: hidden; }
@media (min-width: 900px) { .login-art { display: flex; flex-direction: column; justify-content: space-between; } }
.login-art .lat { position: absolute; inset: 0; opacity: .12; color: #a5b4fc; }
.login-art h2 { font-size: 2.2rem; line-height: 1.15; color: #fff; max-width: 14ch; position: relative; }
.login-art p { color: #aab6d3; max-width: 38ch; position: relative; }
body.admin .login-art .brand { color: #fff; position: relative; }
.login-card { align-self: center; justify-self: center; width: min(420px, calc(100vw - 32px)); padding: 28px 0; }
.login-card h1 { font-size: 1.6rem; margin: 0 0 6px; }
.login-card .sub { color: var(--a-muted); margin: 0 0 22px; }
.login-card form { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: 16px; padding: 24px; box-shadow: var(--a-shadow); display: grid; gap: 16px; }

/* ---------- Misc from earlier views ---------- */
body.admin .grid { gap: 16px; }
body.admin .tag { background: var(--a-surface-2); border-color: var(--a-border); color: var(--a-muted); }
body.admin .notice { background: var(--a-warn-bg); border-color: #f59e0b; color: var(--a-warn); }
body.admin hr { border-color: var(--a-border); }
body.admin .prose { max-width: none; }
body.admin code { background: var(--a-surface-2); padding: 1px 6px; border-radius: 6px; }
@media (max-width: 640px) {
  .table-wrap { margin-inline: -8px; }
  table.data th, table.data td { padding: 10px; }
  .actions { flex-wrap: wrap; }
}
@media print { .admin-side, .topbar, .savebar { display: none !important; } .admin-body { margin: 0; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Bare filter/search controls (outside .field wrappers) get the same look. */
body.admin .admin-main :where(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]):not([type=submit]), select, textarea) {
  min-height: 40px; padding: 8px 12px; border: 1px solid var(--a-border-strong); border-radius: 10px; background: var(--a-surface); color: var(--a-text); font: inherit;
}
body.admin .admin-main :where(select) { padding-right: 30px; }
body.admin .btn-row > form { margin: 0; }

/* ===== Forms v2: compact, consistent controls across the admin ===== */
body.admin .field label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 6px; color: var(--a-text); }
body.admin .field input:not([type=checkbox]):not([type=radio]):not([type=file]), body.admin .field select, body.admin .field textarea {
  min-height: 40px; padding: 8px 12px; font-size: .92rem; border-radius: 9px; background: var(--a-surface-2); border: 1px solid var(--a-border-strong);
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, .03);
}
body.admin .field input:not([type=checkbox]):not([type=radio]):not([type=file]):hover, body.admin .field select:hover, body.admin .field textarea:hover { border-color: color-mix(in srgb, var(--a-primary) 45%, var(--a-border-strong)); }
body.admin .field input:focus, body.admin .field select:focus, body.admin .field textarea:focus { background: var(--a-surface); }
body.admin .field input::placeholder, body.admin .field textarea::placeholder { color: color-mix(in srgb, var(--a-muted) 70%, transparent); }
body.admin .field [aria-invalid="true"], body.admin .field:has(.error-text) :is(input:not([type=checkbox]), select, textarea) { border-color: var(--a-bad); background: var(--a-bad-bg); }
body.admin .field textarea { min-height: 96px; }
body.admin .field select, body.admin .admin-main select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
body.admin .field .hint { font-size: .78rem; line-height: 1.45; margin-top: 5px; }
body.admin .error-text { font-size: .8rem; font-weight: 600; color: var(--a-bad); margin: 5px 0 0; }
body.admin .field input[type=file] { font-size: .86rem; padding: 10px; border-style: dashed; cursor: pointer; }
body.admin .field input[type=file]::file-selector-button { margin-right: 12px; padding: 6px 12px; border: 1px solid var(--a-border-strong); border-radius: 8px; background: var(--a-surface); color: var(--a-text); font: inherit; font-weight: 600; cursor: pointer; }
body.admin .field input[type=file]:hover { border-color: var(--a-primary); }
body.admin .field input[type=file]:hover::file-selector-button { border-color: var(--a-primary); color: var(--a-primary); }

/* Checkboxes as switches */
body.admin .field-check input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--a-border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
body.admin .field-check input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
body.admin .field-check input[type=checkbox]:checked { background: var(--a-primary); }
body.admin .field-check input[type=checkbox]:checked::after { transform: translateX(16px); }
body.admin .field-check label { font-size: .88rem; cursor: pointer; }
body.admin table input[type=checkbox], body.admin .bulk input[type=checkbox] { appearance: auto; width: 16px; height: 16px; }
body.admin table input[type=checkbox]::after { display: none; }

/* Two-column field grid inside panels */
.fgrid { display: grid; gap: 16px 18px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .fgrid { grid-template-columns: 1fr 1fr; } }
.fgrid > .field { margin: 0 !important; min-width: 0; }
.fgrid > .field--full { grid-column: 1 / -1; }
.fgrid > .field--check { align-self: end; padding-bottom: 8px; }
.form-layout .side .fgrid, .form-layout--single .fgrid .field:has(trix-editor) { grid-template-columns: 1fr; }
.form-layout .side .fgrid { grid-template-columns: 1fr; }
.form-layout .panel { padding: 20px 22px 22px; }
.thumb--preview { display: block; max-height: 150px; width: 100%; object-fit: cover; }

/* Panel headers */
.pane-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--a-border); }
.pane-head h2 { font-size: 1.05rem !important; margin: 0 0 2px !important; text-transform: none !important; letter-spacing: -.01em !important; color: var(--a-text) !important; }
.pane-head p { margin: 0; font-size: .85rem; color: var(--a-muted); }
.pane-head__ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--a-primary-soft); color: var(--a-primary); }
.pane-head--sm { padding-bottom: 12px; margin-bottom: 16px; }
.pane-head--sm .pane-head__ico { width: 32px; height: 32px; border-radius: 9px; }
.pane-head--sm h2 { font-size: .95rem !important; }
.pane-head--sm p { font-size: .8rem; }

/* Character counter */
.count { float: right; font-size: .74rem; font-weight: 600; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.count.is-over { color: var(--a-bad); }

/* ===== Settings page: tabs ===== */
.settings { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1000px) { .settings { grid-template-columns: 240px minmax(0, 1fr); } }
.settings__nav { display: flex; gap: 6px; overflow-x: auto; padding: 6px; background: var(--a-surface); border: 1px solid var(--a-border); border-radius: var(--a-radius); box-shadow: var(--a-shadow); scrollbar-width: thin; }
@media (min-width: 1000px) { .settings__nav { flex-direction: column; position: sticky; top: 84px; overflow: visible; } }
.settings__nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--a-muted); font: inherit; font-size: .9rem; font-weight: 600; text-align: left; cursor: pointer; white-space: nowrap; position: relative; }
.settings__nav button:hover { background: var(--a-surface-2); color: var(--a-text); }
.settings__nav button[aria-selected="true"] { background: var(--a-primary-soft); color: var(--a-primary); }
.settings__nav button[aria-selected="true"]::before { content: ""; position: absolute; left: -6px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--a-primary); }
@media (max-width: 999px) { .settings__nav button { width: auto; } .settings__nav button[aria-selected="true"]::before { display: none; } }
.tab-err { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--a-bad); color: #fff; font-style: normal; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; }
.settings__body { min-width: 0; }
.settings.js-tabs .settings__pane:not(.is-active) { display: none; }
.settings__pane { padding: 24px 26px 26px; }
.settings .savebar { margin: 0; border-radius: var(--a-radius); border: 1px solid var(--a-border); box-shadow: var(--a-shadow); }
.logo-field { display: grid; gap: 18px; align-items: center; margin-bottom: 20px; padding: 18px; border: 1px solid var(--a-border); border-radius: 12px; background: var(--a-surface-2); }
@media (min-width: 760px) { .logo-field { grid-template-columns: 240px 1fr; } }
.logo-field__preview { height: 110px; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 10px; font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; color: var(--a-text);
  background: var(--a-surface) repeating-conic-gradient(var(--a-surface-2) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border: 1px solid var(--a-border); }
.logo-field__preview img { max-height: 60px; max-width: 90%; }
.logo-field__preview svg { width: 34px; height: 34px; } .logo-field__preview b { color: var(--a-primary); }
.logo-field .field { margin: 0; }
.pane-note { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: var(--a-info-bg); color: var(--a-info); }
.pane-note > div { flex: 1 1 240px; display: grid; font-size: .86rem; } .pane-note strong { color: var(--a-text); } .pane-note span { color: var(--a-muted); }
.logo-field__preview .brand-logo img { max-height: 60px; width: auto; }

/* Project overview */
.stat-num { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card small { display: block; font-size: .78rem; }
.progress { height: 10px; border-radius: 99px; background: var(--a-surface-2); border: 1px solid var(--a-border); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--a-primary), #22d3ee); }

/* Login art panel: keep text light on the dark panel (beats the general admin heading colour) and let the lattice fill it. */
body.admin .login-art h2 { color: #fff; }
body.admin .login-art p { color: #c3cce6; }
.login-art .lat { width: 100%; height: 100%; }
.login-art > :not(.lat) { position: relative; z-index: 1; }

/* Forgot password link and notices on the sign-in pages */
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.label-row a { font-size: .84rem; font-weight: 600; text-decoration: none; }
.label-row a:hover { text-decoration: underline; }
.login-note { margin-bottom: 14px; padding: 12px 14px; border-radius: 10px; font-size: .9rem; background: var(--a-ok-bg); color: var(--a-ok); border: 1px solid color-mix(in srgb, var(--a-ok) 30%, transparent); }

