:root {
  --bg: #14100c; --bg-2: #1c1712; --panel: #221c16; --panel-2: #2a2219;
  --cream: #f4ece0; --cream-dim: #c9bca9; --muted: #8a7d6b;
  --gold: #c9a227; --gold-soft: #e0c97a; --line: rgba(201,162,39,.22);
  --danger: #c0563f; --ok: #6f9d57;
  --serif: "Cormorant Garamond", "Noto Serif Georgian", serif;
  --sans: "Manrope", "Noto Serif Georgian", system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--cream); font-family: var(--sans); font-weight: 300; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font-family: var(--sans); }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(201,162,39,.12), transparent 60%), var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 48px 44px; width: 100%; max-width: 400px; box-shadow: 0 30px 70px rgba(0,0,0,.5); }
.login-brand { font-family: var(--serif); font-size: 38px; font-weight: 600; letter-spacing: 2px; text-align: center; }
.login-brand span { color: var(--gold); font-size: .6em; }
.login-sub { text-align: center; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-size: 12px; margin: 8px 0 32px; }
.login-card form, .form-grid { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--cream-dim); letter-spacing: .5px; }
input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--cream); padding: 12px 14px;
  border-radius: 5px; font-size: 14px; transition: border-color .25s; resize: vertical;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
.btn-primary { background: var(--gold); color: var(--bg); border: none; padding: 13px 22px; border-radius: 5px;
  font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; cursor: pointer; transition: background .25s; font-weight: 500; }
.btn-primary:hover { background: var(--gold-soft); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--cream-dim); padding: 11px 18px;
  border-radius: 5px; cursor: pointer; font-size: 13px; transition: .25s; white-space: nowrap; }
.btn-ghost:hover { border-color: var(--gold); color: var(--cream); }
.login-error { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; }

/* ---------- App layout ---------- */
.admin-app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); padding: 30px 22px; display: flex; flex-direction: column; }
.side-brand { font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: 2px; margin-bottom: 36px; }
.side-brand span { color: var(--gold); font-size: .65em; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav button { background: none; border: none; color: var(--cream-dim); text-align: left; padding: 12px 16px;
  border-radius: 6px; cursor: pointer; font-size: 14px; letter-spacing: .5px; transition: all .2s; font-family: var(--sans); }
.side-nav button:hover { background: var(--panel); color: var(--cream); }
.side-nav button.active { background: var(--gold); color: var(--bg); font-weight: 500; }
.side-foot { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 20px; }
.side-foot a { color: var(--muted); font-size: 13px; transition: color .2s; }
.side-foot a:hover { color: var(--gold); }
.side-foot button { background: none; border: 1px solid var(--line); color: var(--cream-dim); padding: 10px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: .2s; }
.side-foot button:hover { border-color: var(--danger); color: var(--danger); }

.content { padding: 40px 44px; position: relative; max-width: 1100px; }
.view-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.view-head h1 { font-family: var(--serif); font-size: 38px; font-weight: 500; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th { text-align: left; padding: 14px 16px; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line); background: var(--bg-2); font-weight: 500; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid rgba(201,162,39,.08); font-size: 14px; color: var(--cream-dim); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(201,162,39,.04); }
.row-thumb { width: 52px; height: 40px; border-radius: 4px; background: var(--panel-2); background-size: cover; background-position: center; }
.row-thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 10px; }
.tag-mini { font-size: 10px; padding: 3px 8px; border-radius: 12px; letter-spacing: .5px; }
.tag-on { background: rgba(111,157,87,.2); color: var(--ok); }
.tag-off { background: rgba(192,86,63,.2); color: var(--danger); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--cream-dim); width: 32px; height: 32px;
  border-radius: 5px; cursor: pointer; transition: .2s; font-size: 14px; }
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; align-items: end; }
.form-grid.narrow { max-width: 460px; grid-template-columns: 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .btn-primary { grid-column: 1 / -1; justify-self: start; padding: 13px 40px; margin-top: 6px; }
.img-field { display: flex; gap: 10px; }
.img-field input { flex: 1; }
.img-preview { margin-top: 10px; }
.img-preview img { max-height: 130px; border-radius: 6px; border: 1px solid var(--line); }
.check-row { display: flex; flex-wrap: wrap; gap: 18px; padding: 6px 0; }
.chk { flex-direction: row; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; color: var(--cream); }
.chk input { width: auto; }

/* ---------- Editor modal ---------- */
.editor { position: fixed; inset: 0; z-index: 500; display: flex; align-items: flex-start; justify-content: center; padding: 40px 24px; overflow-y: auto; }
.editor[hidden] { display: none; }
.editor-backdrop { position: fixed; inset: 0; background: rgba(8,6,4,.78); backdrop-filter: blur(4px); }
.editor-card { position: relative; z-index: 2; background: var(--panel); border: 1px solid var(--gold); border-radius: 10px;
  width: 100%; max-width: 720px; padding: 30px 34px 36px; box-shadow: 0 30px 70px rgba(0,0,0,.5); }
.editor-card.small { max-width: 460px; }
.editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.editor-head h2 { font-family: var(--serif); font-size: 28px; font-weight: 500; }
.editor-head .x { background: none; border: none; color: var(--cream-dim); font-size: 30px; cursor: pointer; line-height: 1; }
.editor-head .x:hover { color: var(--danger); }

/* ---------- Toast ---------- */
.toast { position: fixed; top: 22px; right: 22px; z-index: 999; background: var(--panel); border: 1px solid var(--gold);
  color: var(--cream); padding: 14px 22px; border-radius: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.4); font-size: 14px; }
.toast.err { border-color: var(--danger); color: #f0b8aa; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .admin-app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 18px; }
  .side-brand { margin-bottom: 0; font-size: 22px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; flex: 1; justify-content: center; }
  .side-nav button { padding: 8px 12px; font-size: 13px; }
  .side-foot { flex-direction: row; border: none; padding-top: 0; }
  .content { padding: 26px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 28px; }
}
