:root {
  --navy: #0b1f3a;
  --navy-ink: #071628;
  --crimson: #c9182b;
  --paper: #f7f5f1;
  --mist: #e8edf3;
  --steel: #5b6b7c;
  --white: #ffffff;
  --ok: #0f7a45;
  --danger: #b42318;
  --radius: 12px;
  --tap: 48px;
  --shadow: 0 10px 30px rgba(7, 22, 40, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--navy-ink); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.admin-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: 248px; display: flex; flex-direction: column;
  background: var(--navy-ink); color: white; padding: 20px 14px;
  transform: translateX(-100%); transition: transform 0.2s ease;
}
.sidebar.open { transform: none; }
.sidebar__brand { font-weight: 700; letter-spacing: 0.08em; padding: 8px 12px 18px; }
.sidebar__brand span { display: block; margin-top: 4px; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: rgba(255,255,255,0.55); }
.sidebar nav { display: grid; gap: 6px; }
.sidebar a, .sidebar button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--tap); width: 100%; padding: 0 14px;
  border: 0; border-radius: 12px; background: transparent; color: white;
  font-weight: 600; text-align: left; cursor: pointer;
}
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,0.12); }
.sidebar .count {
  min-width: 22px; height: 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--crimson); color: white; font-size: 11px;
}
.sidebar__logout { margin-top: auto; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 30; background: rgba(7, 22, 40, 0.45);
}
.sidebar-backdrop.open { display: block; }
.workspace { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 18px;
  background: rgba(247, 245, 241, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--mist);
}
.topbar__menu {
  min-height: var(--tap); min-width: var(--tap);
  border: 1px solid #d5dde6; border-radius: 12px; background: white; color: var(--navy);
}
.topbar h1 { margin: 0; font-size: 1.05rem; }
@media (min-width: 960px) {
  .sidebar { transform: none; }
  .sidebar-backdrop { display: none !important; }
  .workspace { margin-left: 248px; }
  .topbar__menu { display: none; }
}
.page { padding: 20px 18px 40px; max-width: 1080px; }
.page h1 { margin: 0 0 8px; font-size: 1.7rem; }
.lede { margin: 0 0 18px; color: var(--steel); line-height: 1.5; }

.card {
  background: var(--white); border: 1px solid var(--mist); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card-row { display: flex; gap: 12px; align-items: center; }
.card-row img, .thumb {
  width: 72px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--mist); flex-shrink: 0;
}
.meta { font-size: 12px; color: var(--steel); margin-top: 4px; }
.badge {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px;
  border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge--new, .badge--published { background: #e8f8ef; color: var(--ok); }
.badge--draft, .badge--read { background: var(--mist); color: var(--steel); }
.badge--archived, .badge--deleted { background: #fdecea; color: var(--danger); }
.badge--featured { background: #fff1e8; color: #9a3412; }

.stack { display: grid; gap: 12px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  border: 1px solid #d5dde6; border-radius: 10px; background: white;
}
.field textarea { min-height: 120px; resize: vertical; }
.field .hint { margin-top: 6px; font-size: 12px; color: var(--steel); }
.check {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap);
  padding: 8px 12px; border: 1px solid var(--mist); border-radius: 10px; background: white;
}
.check input { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 18px; border: 0; border-radius: 10px;
  font-weight: 700; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--crimson); color: white; }
.btn-secondary { background: var(--navy); color: white; }
.btn-ghost { background: white; color: var(--navy); border: 1px solid #d5dde6; }
.btn-danger { background: var(--danger); color: white; }
.btn-row { display: grid; gap: 10px; }
@media (min-width: 640px) {
  .btn-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btn { width: auto; }
}

.flash {
  margin-bottom: 14px; padding: 12px 14px; border-radius: 10px;
  background: #e8f8ef; color: var(--ok); font-weight: 600;
}
.flash--error { background: #fdecea; color: var(--danger); }
.errors { margin: 0 0 12px; padding: 12px; border-radius: 10px; background: #fdecea; color: var(--danger); }
.errors ul { margin: 0; padding-left: 18px; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: white; border-radius: var(--radius); padding: 16px; border: 1px solid var(--mist); }
.stat strong { display: block; font-size: 1.6rem; }
.stat span { color: var(--steel); font-size: 13px; }

.filters { display: grid; gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) {
  .filters { grid-template-columns: 1fr 180px auto; align-items: end; }
}
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.photo-tile { position: relative; border: 1px solid var(--mist); border-radius: 10px; overflow: hidden; background: white; }
.photo-tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.photo-tile form { padding: 8px; }
.spec-row { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .spec-row { grid-template-columns: 1fr 1.4fr auto; align-items: end; }
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #071628, #123058 55%, #c9182b); }
.login-card { width: min(100%, 420px); background: white; border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 6px; }
.pagination { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span {
  min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px; border-radius: 8px; background: white; border: 1px solid var(--mist);
}
