:root {
  --bg: #0b0706;
  --panel: #171110;
  --panel2: #211815;
  --line: #33251e;
  --line2: #4a382f;
  --text: #f6f1ee;
  --sub: #b5aaa3;
  --muted: #7d726b;
  --orange: #ff6b00;
  --orange2: #e8531a;
  --orange-dim: #3b1a09;
  --green: #3ecf6e;
  --red: #ff5c5c;
  --gold: #ffc22e;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--sub); }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.error { color: var(--red); min-height: 20px; font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line2); font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--orange); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(90deg, #ff7a0a, #e8501a); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(600px 400px at 20% 0%, #3a1808 0%, transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; padding: 30px 26px; display: grid; gap: 14px; text-align: center; }
.login-card .field { text-align: left; }
.logo { width: 60px; height: 60px; border-radius: 16px; margin: 0 auto; display: grid; place-items: center;
  font-size: 30px; color: #fff; background: linear-gradient(135deg, #ff7a0a, #e8501a); }
.logo.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 15px; margin: 0; display: inline-grid; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; padding: 0 6px; }
.brand small { color: var(--orange); font-weight: 700; }
#nav { display: grid; gap: 4px; flex: 1; align-content: start; }
#nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
  border-radius: 10px; color: var(--sub); font-weight: 600; }
#nav a:hover { background: var(--panel2); color: var(--text); }
#nav a.on { background: var(--orange-dim); color: var(--orange); }
.badge { background: var(--orange2); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 800; }
.main { padding: 26px 28px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h2 { font-size: 22px; font-weight: 800; flex: 1; min-width: 160px; }
.head .sub { flex-basis: 100%; color: var(--sub); margin-top: -8px; }

/* ---------- cards / tables ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card .num { font-size: 26px; font-weight: 800; }
.card .lab { color: var(--sub); font-size: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }
.code { background: #0e0908; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; user-select: all; }

.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 6px; }
.thumb { width: 48px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--panel2); display: block; }
.thumb.wide { width: 96px; height: 54px; }
.thumb.none { display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.title { font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line2); color: var(--sub); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px;
  font-size: 12px; font-weight: 700; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.on { color: var(--green); border-color: #1f5a35; background: #0f2417; }
.pill.on::before { background: var(--green); }
.pill.gold.on { color: var(--gold); border-color: #6b5210; background: #2a2208; }
.pill.gold.on::before { background: var(--gold); }
.empty { padding: 40px 20px; text-align: center; color: var(--sub); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .lab2 { font-size: 12px; font-weight: 700; color: var(--sub); }
input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; background: #0e0908; border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; min-height: 38px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="search"] { max-width: 280px; }
.toolbar select { max-width: 200px; }
.switch { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 11px; background: var(--line2);
  position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--orange); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:disabled { opacity: .4; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 5px 12px; border-radius: 16px; border: 1px solid var(--line2);
  background: var(--panel2); font-size: 13px; }
.chip input:checked + span { background: var(--orange2); border-color: var(--orange2); color: #fff; font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 14px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.days label { font-size: 11px; color: var(--sub); display: grid; gap: 4px; }

/* ---------- uploads ---------- */
.drop { width: 100%; min-height: 110px; border: 1.5px dashed var(--line2); border-radius: 12px; background: #0e0908;
  display: grid; place-content: center; gap: 4px; text-align: center; cursor: pointer; padding: 14px; }
.drop:hover { border-color: var(--orange); }
.drop span { color: var(--muted); font-size: 12px; }
.drop.busy { cursor: default; }
.progress { width: 200px; height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; margin: 0 auto 6px; }
.progress i { display: block; height: 100%; background: var(--orange); transition: width .1s; }
.preview { display: grid; gap: 8px; }
.preview img, .preview video { width: 100%; max-height: 240px; object-fit: contain; border-radius: 12px; background: #000; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.shot { position: relative; }
.shot img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; display: block; background: #000; }
.shot button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 12px; border: 0;
  background: rgba(0,0,0,.7); color: #fff; cursor: pointer; }
.shots .drop { min-height: 0; aspect-ratio: 16/9; padding: 6px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: grid; place-items: start center;
  padding: 4vh 16px; overflow-y: auto; z-index: 20; }
#dialog { z-index: 30; place-items: center; }
.sheet { width: 100%; max-width: 900px; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; }
.sheet.narrow { max-width: 560px; }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet header h3 { font-size: 17px; }
.sheet .body { padding: 20px; }
.sheet footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--sub); line-height: 1; }
.dlg { width: 100%; max-width: 400px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 16px; padding: 22px; }
.dlg h3 { margin-bottom: 8px; }
.dlg p { color: var(--sub); margin-bottom: 14px; }
.dlg .row { justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--panel2); border: 1px solid var(--orange); border-radius: 12px; padding: 10px 18px; font-weight: 600;
  transition: all .2s; pointer-events: none; z-index: 40; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { border-color: var(--red); color: #ffd0d0; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 10px; }
  #nav { display: flex; overflow-x: auto; gap: 6px; }
  #nav a { white-space: nowrap; gap: 6px; }
  .side > .btn { display: none; }
  .main { padding: 18px 14px 50px; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .days { grid-template-columns: repeat(4, 1fr); }
}
