:root {
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #ebebeb;
  --bg: #f3f3f3;
  --side: #ffffff;
  --panel: #ffffff;
  --gold: #c4a35a;
  --gold-bg: #f7f1e6;
  --ok: #2f7a52;
  --ok-bg: #e9f6ef;
  --danger: #c45c5c;
  --slot: #faf7f2;
  --font: "Montserrat", system-ui, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .05);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.dash {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100svh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2 { margin: 0 0 .55rem; }
h1 {
  font-family: var(--serif);
  font-size: clamp(1.85rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -.01em;
  color: #111;
  line-height: 1.15;
}
h2 {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #222;
}

/* Login */
.login {
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  padding: 1.5rem;
  font-family: var(--font);
}
.box {
  width: min(400px, 100%);
  border: 1px solid rgba(255,255,255,.2);
  padding: 1.7rem;
  display: grid;
  gap: .8rem;
}
.login .logo-box {
  width: 64px; height: 64px;
  border: 1px solid var(--gold);
  color: var(--gold);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: .85rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.login label {
  color: rgba(255,255,255,.7);
  display: grid; gap: .3rem;
  font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.login input {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  padding: .75rem .8rem;
  font: inherit;
  border-radius: 10px;
}
.login button {
  border: 0;
  background: #fff;
  color: #111;
  padding: .75rem 1.15rem;
  font: inherit;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .72rem;
  cursor: pointer;
  width: fit-content;
  border-radius: 999px;
}
.login a { color: rgba(255,255,255,.65); font-size: .88rem; }
.err { background: #fdecec; color: var(--danger); padding: .65rem; border-radius: 10px; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: .9rem clamp(1rem, 3vw, 2rem);
  background: #111;
  color: #fff;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  white-space: nowrap;
}
.brand span {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
}
.brand em {
  font-style: normal;
  width: 1px;
  height: .9rem;
  background: rgba(255,255,255,.35);
  display: inline-block;
  align-self: center;
}
.brand strong {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #fff;
}
.topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem 1.2rem;
  margin-inline: auto;
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(255,255,255,.82);
}
.topbar-nav a:hover { color: #fff; }
.top-site {
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: calc(100svh - 54px);
}
.sidebar {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 1.4rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 54px;
  height: calc(100svh - 54px);
}
.side-user {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .15rem .35rem;
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #111;
  color: var(--gold);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
}
.side-user strong {
  display: block;
  font-size: .66rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.side-user span {
  font-size: .92rem;
  font-weight: 600;
  color: #222;
}
.side-nav { display: grid; gap: .28rem; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .72rem .85rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  color: #333;
}
.side-nav a:hover { background: #f4f4f4; }
.side-nav a.on {
  background: #111;
  color: #fff;
}
.side-nav .ico {
  width: 1.1rem;
  text-align: center;
  font-size: .88rem;
  opacity: .9;
}
.side-foot {
  margin-top: auto;
  display: grid;
  gap: 1rem;
}
.logout {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem .85rem;
  font-size: .86rem;
  font-weight: 600;
  color: var(--danger);
  border-radius: 10px;
}
.logout:hover { background: rgba(196, 92, 92, .08); }
.side-art {
  height: 100px;
  opacity: .35;
  background:
    radial-gradient(circle at 50% 75%, transparent 18%, var(--gold) 19% 20.5%, transparent 22%),
    radial-gradient(circle at 50% 48%, transparent 7%, var(--gold) 8% 9%, transparent 12%),
    radial-gradient(ellipse at 50% 30%, transparent 42%, rgba(196,163,90,.45) 58%, transparent 72%);
}

.main {
  position: relative;
  padding: 1.55rem clamp(1rem, 3vw, 2.1rem) 3rem;
  display: grid;
  gap: 1.05rem;
  align-content: start;
  max-width: 1100px;
  overflow: hidden;
}
.main::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 240px;
  height: 240px;
  pointer-events: none;
  opacity: .12;
  background:
    radial-gradient(circle at 62% 42%, transparent 26%, var(--gold) 27% 28.5%, transparent 30%),
    radial-gradient(ellipse at 48% 58%, transparent 36%, rgba(196,163,90,.7) 52%, transparent 70%);
}
.page-head {
  position: relative;
  z-index: 1;
  max-width: 34rem;
}
.page-head p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .94rem;
}

.panel {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid rgba(0,0,0,.04);
  border-radius: var(--radius);
  padding: 1.3rem 1.35rem 1.4rem;
  box-shadow: var(--shadow);
}
.panel > h2 {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .75rem;
}
.panel-ico {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-bg);
  color: #8a6d2f;
  display: grid;
  place-items: center;
  font-size: .85rem;
  flex: 0 0 auto;
}
.help { color: var(--muted); font-size: .88rem; margin: 0 0 .9rem; }
.help.muted { margin: 0; }
.help strong { color: var(--ink); }
.help.full { grid-column: 1 / -1; }

.flash {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .95rem 1.15rem;
  border-radius: 12px;
  font-size: .92rem;
  border: 1px solid transparent;
}
.flash-ico {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 700;
  flex: 0 0 auto;
  margin-top: .05rem;
}
.flash.ok {
  background: var(--ok-bg);
  color: #245c3e;
  border-color: #d2ebdc;
}
.flash.ok .flash-ico {
  background: #d7f0e1;
  color: var(--ok);
}
.flash.error {
  background: #fdecec;
  color: var(--danger);
  border-color: #f0c8c8;
}
.flash.error .flash-ico {
  background: #f8d4d4;
  color: var(--danger);
}
.flash strong { display: block; margin-bottom: .1rem; }

.quadrants {
  display: grid;
  grid-template-columns: 1fr;
  gap: .35rem;
  margin-bottom: .9rem;
}
.quad {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding: .55rem .15rem;
  border: 0;
  background: transparent;
  border-bottom: 1px solid #f0f0f0;
}
.quad:last-child { border-bottom: 0; }
.quad:hover { background: #fafafa; }
.quad.has strong { color: #111; }
.quad em {
  font-style: normal;
  min-width: 1.2rem;
  color: var(--muted);
  font-weight: 700;
  font-size: .85rem;
}
.quad strong {
  font-size: .86rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  margin: 0 .35rem 0 0;
}
.quad span {
  color: var(--muted);
  font-size: .84rem;
  margin-left: auto;
}

.video-slots { display: grid; gap: .9rem; }
.slot {
  border: 1px solid #efe8dc;
  border-radius: 12px;
  padding: 1rem 1.05rem;
  margin: 0;
  display: grid;
  gap: .7rem;
  background: var(--slot);
}
.slot legend {
  padding: 0 .35rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #555;
}
.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  padding: .55rem .9rem;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}
.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-hint { color: var(--muted); font-size: .82rem; }
.slot-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.check.trash { color: var(--danger); font-size: .82rem; }

label {
  display: grid;
  gap: .32rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #555;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  padding: .72rem .8rem;
  font: inherit;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  font-size: .95rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
  border-color: #111;
}
button, .btn {
  border: 0;
  background: #111;
  color: #fff;
  border-radius: 999px;
  padding: .72rem 1.15rem;
  font: inherit;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .7rem;
  cursor: pointer;
  width: fit-content;
}
button:hover { background: #000; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.grid .full { grid-column: 1 / -1; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.filters a {
  border: 1px solid #ddd;
  border-radius: 999px;
  padding: .4rem .75rem;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: #fff;
}
.filters a.on { background: #111; color: #fff; border-color: #111; }
.media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .85rem;
}
.media article {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.media img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eee; }
.media form { padding: .75rem; display: grid; gap: .45rem; }
.media small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .66rem;
  font-weight: 700;
}
.row { display: flex; gap: .4rem; flex-wrap: wrap; }
.row button:last-child { background: var(--danger); }
.check {
  display: flex;
  align-items: center;
  gap: .4rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: .9rem;
  color: var(--ink);
}
.check input { width: auto; }
.block-edit,
.cat-create {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.custom-cats { margin-top: .85rem; display: grid; gap: .4rem; }
.custom-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
  font-size: .9rem;
}
.custom-cat-row button {
  background: var(--danger);
  padding: .42rem .7rem;
  font-size: .64rem;
}

/* Rich editor */
.rich-source { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.rich-box {
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.rich-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
  padding: .45rem .55rem;
  border-bottom: 1px solid var(--line);
  background: #f7f7f7;
}
.rich-bar button,
.rich-bar select {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  padding: .32rem .48rem;
  font: inherit;
  font-size: .74rem;
  font-weight: 700;
  cursor: pointer;
  width: auto;
  text-transform: none;
  letter-spacing: normal;
  color: #111;
}
.rich-bar select { font-weight: 500; max-width: 9rem; }
.rich-bar .sep {
  width: 1px;
  height: 1.15rem;
  background: #ddd;
  margin: 0 .12rem;
}
.rich-edit {
  min-height: 140px;
  padding: .85rem .9rem;
  font-size: .95rem;
  line-height: 1.6;
  outline: none;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.rich-edit p { margin: 0 0 .65rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .9rem;
  }
  .side-nav { display: flex; flex-wrap: wrap; gap: .3rem; }
  .side-nav a { padding: .55rem .75rem; }
  .side-foot { margin-top: 0; width: 100%; display: flex; justify-content: space-between; }
  .side-art { display: none; }
  .topbar-nav { display: none; }
  .main::after { display: none; }
  .quad span { margin-left: 0; display: block; }
  .quad { align-items: flex-start; flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; }
}
