/* Admin panel */
:root { --ink: #12233a; --text: #26323f; --muted: #5d6b7a; --bg: #f2f4f7; --surface: #fff; --line: #dde3ea; --primary: #1c4f86; --primary-dark: #123a64; --tint: #e7eff8; --danger: #a8261b; --danger-tint: #fcebe9; --ok: #0d6d55; --ok-tint: #e2f4ee; --warn-tint: #fff3d1; --warn: #5f4500; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0; color: var(--ink); }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--ink); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 1px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--primary); border-color: #c4d0de; }
.btn-ghost:hover { background: var(--tint); color: var(--primary-dark); }
.btn-small { padding: 5px 10px; font-size: 14px; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #ecc2bd; }
.btn-danger:hover, .btn-danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
form.inline { display: inline; }

.a-top { background: var(--ink); color: #fff; display: flex; align-items: center; gap: 16px; padding: 10px max(16px, env(safe-area-inset-left, 0px)); position: sticky; top: 0; z-index: 10; }
.a-brand { color: #fff; text-decoration: none; font-weight: 700; }
.a-brand span { font-weight: 400; opacity: .7; margin-left: 4px; }
.a-user { margin-left: auto; display: flex; gap: 16px; align-items: center; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.a-user a { color: #cfe0f3; }
.a-menu { display: none; background: none; color: #fff; border: 1px solid #50627a; border-radius: 6px; padding: 5px 10px; font: inherit; }
.a-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 48px); }
.a-side { background: var(--surface); border-right: 1px solid var(--line); padding: 12px 8px; }
.a-side ul { list-style: none; margin: 0; padding: 0; position: sticky; top: 60px; }
.a-side a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); text-decoration: none; }
.a-side a:hover { background: var(--bg); }
.a-side a.on { background: var(--tint); color: var(--primary-dark); font-weight: 600; }
.a-main { padding: 24px max(16px, env(safe-area-inset-right, 0px)) 60px 28px; min-width: 0; max-width: 1100px; }
@media (max-width: 860px) {
  .a-menu { display: inline-block; }
  .a-shell { grid-template-columns: 1fr; }
  .a-side { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .a-side.open { display: block; }
  .a-main { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .a-user span { display: none; }
}
.a-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.back { font-size: 14px; text-decoration: none; display: inline-block; margin-bottom: 4px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash-ok { background: var(--ok-tint); color: var(--ok); border-color: #b5e0d1; }
.flash-error { background: var(--danger-tint); color: var(--danger); border-color: #f0c4be; }
.flash-warn { background: var(--warn-tint); color: var(--warn); border-color: #f0dc9a; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; min-width: 0; }
fieldset.card { margin: 0 0 18px; }
legend { font-weight: 700; color: var(--ink); padding: 0 6px; font-size: 1.05rem; }
.form .field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form label, .form .label { font-weight: 600; color: var(--ink); font-size: 14px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form input[type=date], .form input[type=search], .form input:not([type]), .form select, .form textarea { font: inherit; padding: 9px 11px; border: 1px solid #c6d0dc; border-radius: 8px; background: #fff; color: var(--text); width: 100%; max-width: 760px; }
.form textarea { resize: vertical; line-height: 1.5; }
.form input[type=number] { max-width: 160px; }
.form input[type=date] { max-width: 220px; }
.form .check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--text); font-size: 15px; }
.form .check input { width: 18px; height: 18px; }
.help { font-size: 13px; color: var(--muted); }
.req { color: var(--danger); }
.checks { display: grid; gap: 6px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-width: 760px; }
.current-file { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.current-file img { max-height: 90px; border-radius: 6px; border: 1px solid var(--line); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }
.danger-zone { margin-top: 18px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.photo-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.photo-item input:not([type=checkbox]) { padding: 6px 8px !important; font-size: 14px !important; }
.photo-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.photo-row label { font-weight: 400 !important; font-size: 13px !important; display: flex; align-items: center; gap: 4px; }
.photo-row input[type=number] { width: 60px; }

.a-search { display: flex; gap: 8px; margin-bottom: 14px; max-width: 520px; }
.a-search input { flex: 1; font: inherit; padding: 8px 10px; border: 1px solid #c6d0dc; border-radius: 8px; min-width: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.a-table { width: 100%; border-collapse: collapse; }
.a-table th, .a-table td { padding: 10px 12px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.a-table thead th { border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f8f9fb; }
.a-table td.main a { font-weight: 600; color: var(--ink); text-decoration: none; }
.a-table td.main a:hover { color: var(--primary); text-decoration: underline; }
.a-table .actions { text-align: right; white-space: nowrap; }
.thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #eef1f5; color: var(--muted); }
.pill-on { background: var(--ok-tint); color: var(--ok); }
.empty { background: var(--surface); border: 1px dashed #c6d0dc; border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: var(--surface); }
.pager span { background: var(--primary); color: #fff; }

.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; text-decoration: none; color: var(--muted); }
.stat:hover { border-color: var(--primary); }
.stat b { display: block; font-size: 1.6rem; color: var(--ink); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows span { color: var(--muted); font-size: 13px; white-space: nowrap; }

body.auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; background: var(--ink); }
.auth-card { background: var(--surface); border-radius: 12px; padding: 32px; width: 100%; max-width: 420px; }
.auth-card h1 { margin: 4px 0 10px; }
.auth-card .form label { display: block; margin: 12px 0 5px; }
.auth-card .form input:not([type=checkbox]) { max-width: none; }
.auth-card .form .check { margin: 16px 0; }
.auth-card .btn { margin-top: 16px; }
