:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e2330;
  --line: #2a3142;
  --text: #e8ecf4;
  --muted: #9aa3b5;
  --accent: #c9a227;
  --accent-2: #e8c547;
  --danger: #d45d5d;
  --ok: #3f9f6e;
  --radius: 10px;
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --display: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
html, body { margin: 0; padding: 0; }
body.admin {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #242a3a 0%, var(--bg) 55%);
  color: var(--text);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #141820, #10141c);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100vh;
  max-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  position: sticky;
  top: 0;
  align-self: start;
}
.brand { display: flex; gap: .75rem; align-items: center; flex-shrink: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #8a6d12);
  color: #111; font-family: var(--display); font-weight: 700;
}
.brand strong { display: block; font-family: var(--display); letter-spacing: .02em; }
.brand small { color: var(--muted); }
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.sidebar a {
  color: var(--muted); text-decoration: none; padding: .65rem .75rem;
  border-radius: 8px; font-weight: 500;
}
.sidebar a:hover { background: var(--panel-2); color: var(--text); }
.sidebar a.active { background: var(--panel-2); color: var(--accent-2); }
.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .9rem;
  flex-shrink: 0;
  padding-top: .5rem;
  border-top: 1px solid var(--line);
}

.main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.main-head {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15,17,21,.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
}
.main-head h1 {
  margin: 0; font-family: var(--display); font-size: 1.45rem; font-weight: 700;
}
.main-body { padding: 1.5rem 1.75rem 3rem; flex: 1 0 auto; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.panel h2 {
  margin: 0 0 1rem; font-family: var(--display); font-size: 1.1rem;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 960px) {
  body.admin {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: auto;
  }
  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .sidebar nav { overflow: visible; }
  .main {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
input[type="text"], input[type="number"], input[type="url"], input[type="color"],
input[type="email"], input[type="password"], input[type="date"],
textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: .65rem .75rem;
  font: inherit;
  margin-bottom: .9rem;
}
textarea { min-height: 90px; resize: vertical; }
.field-row { display: flex; gap: .75rem; align-items: end; }
.field-row > * { flex: 1; }

.btn {
  appearance: none; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #a8861a);
  color: #111; font-weight: 600; border-radius: 8px;
  padding: .65rem 1rem; font: inherit;
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: .4rem .7rem; font-size: .85rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; padding: .7rem .5rem; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.thumb {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #000;
}
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem;
}
.media-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.media-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.media-card .meta { padding: .5rem .6rem; font-size: .8rem; color: var(--muted); }
.tag {
  display: inline-block; padding: .15rem .45rem; border-radius: 999px;
  background: #2a3142; color: var(--accent-2); font-size: .75rem;
}
.flash {
  padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem;
  background: rgba(63,159,110,.15); border: 1px solid rgba(63,159,110,.4); color: #b6e6cb;
}
.flash.error { background: rgba(212,93,93,.15); border-color: rgba(212,93,93,.4); color: #f0b6b6; }
.muted { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem;
}
.stat strong { display: block; font-family: var(--display); font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }
@media (max-width: 960px) { .stats { grid-template-columns: 1fr 1fr; } }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(900px 500px at 50% 0%, #2a3142, #0f1115 60%);
  font-family: var(--font); color: var(--text);
}
.login-card {
  width: min(400px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.75rem;
}
.login-card h1 { font-family: var(--display); margin: 0 0 .25rem; }
.drag-handle { cursor: grab; color: var(--muted); user-select: none; }
.crop-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 1rem;
}
.crop-modal.open { display: flex; }
.crop-box {
  width: min(720px, 96vw); background: var(--panel); border-radius: 12px; padding: 1rem;
  border: 1px solid var(--line);
}
.crop-stage { max-height: 60vh; background: #000; }
.crop-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .75rem; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem .75rem; margin-bottom: 1rem; }
.checkbox-grid label { display: flex; gap: .45rem; align-items: center; color: var(--text); margin: 0; }
.stock-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.stock-results button {
  border: 1px solid var(--line); background: #000; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer;
}
.stock-results img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }

.dropzone {
  display: block;
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  background: rgba(30,35,48,.55);
  transition: border-color .15s, background .15s;
  cursor: pointer;
  color: inherit;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(201,162,39,.12);
}
.dropzone strong { display: block; font-family: var(--display); margin-bottom: .35rem; }
.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: .5rem;
  max-height: 280px;
  overflow: auto;
  padding: .25rem;
  margin-bottom: .75rem;
}
.picker-item {
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  padding: 0;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
}
.picker-item img, .picker-item video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.picker-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.picker-item .check {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent); color: #111;
  display: none; place-items: center; font-size: 11px; font-weight: 700;
  pointer-events: none;
}
.picker-item.selected .check { display: grid; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .4rem;
  margin-top: 1rem;
}
.cal-dow {
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .35rem 0;
}
.cal-day {
  min-height: 78px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .45rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.muted-day { opacity: .4; }
.cal-day.today { outline: 1px solid var(--accent); }
.cal-day.selected { background: rgba(201,162,39,.15); border-color: var(--accent); }
.cal-num { font-family: var(--display); font-weight: 700; }
.cal-count { font-size: .72rem; color: var(--accent-2); }
.cal-dots { display: flex; gap: 3px; margin-top: auto; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.cal-dot.status-pending { background: #e0b04a; }
.cal-dot.status-confirmed { background: var(--ok); }
.cal-dot.status-completed { background: #5b8def; }
.cal-dot.status-cancelled { background: var(--danger); }
@media (max-width: 720px) {
  .cal-day { min-height: 56px; }
  .cal-count { display: none; }
}

.howto-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: .85rem;
  line-height: 1.45;
}
.howto-list a { color: var(--accent-2); }
.howto-bullets {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: .55rem;
  color: var(--text);
  line-height: 1.45;
}
.howto-bullets a { color: var(--accent-2); }
.howto-bullets code, .howto-list code, .panel code {
  font-size: .85em;
  background: var(--panel-2);
  padding: .1rem .35rem;
  border-radius: 4px;
}

.admin-sn-footer {
  margin-top: auto;
  padding: 1.25rem 1.75rem 1.75rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.admin-sn-footer .sn-credit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.admin-sn-footer .sn-credit-copy {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
}
.admin-sn-footer .sn-credit-logo img {
  height: 32px;
  width: auto;
  max-width: 180px;
  display: block;
}
.login-sn {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .4rem;
  margin: .35rem 0 .5rem;
}
.slot-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: .5rem .35rem;
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
  text-align: center;
}
.slot-btn:hover { border-color: var(--accent); }
.slot-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
  font-weight: 700;
}
.reschedule-row td {
  background: var(--panel-2);
  border-top: 0;
}
