:root {
  --ink: #1c1424;
  --muted: #5c5368;
  --line: #e4dcec;
  --paper: #f4f0f6;
  --card: #fff;
  --purple: #671a9a;
  --purple-dark: #2d0f45;
  --purple-soft: #f3e9f8;
  --green: #166534;
  --green-bg: #e8f6ee;
  --red: #9f1239;
  --red-bg: #fde8ee;
  --amber: #92400e;
  --amber-bg: #fff6e5;
  --shadow: 0 10px 28px rgba(45, 15, 69, 0.06);
  --sans: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.5 var(--sans);
}
a { color: var(--purple); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.7rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--purple-dark);
  color: #f6f0fa;
  padding: 1.15rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.nav a { color: inherit; text-decoration: none; }
.brand { display: flex; gap: 0.75rem; align-items: center; padding: 0 0.45rem; }
.brand strong, .brand small { display: block; }
.brand small, .nav__who { color: #d2c0e0; }
.brand__mark {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 0.75rem;
  background: #8d4bb8;
  font-weight: 700;
  flex: none;
}
.nav nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav nav a {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
}
.nav nav small { color: #cbb6dc; font-size: 0.72rem; font-weight: 500; }
.nav nav a:hover { background: rgba(255, 255, 255, 0.08); }
.nav nav a[aria-current="page"] { background: #fff; color: var(--purple-dark); }
.nav nav a[aria-current="page"] small { color: var(--purple); }
.nav__who { margin: 0 0.45rem; font-size: 0.85rem; }
.nav__foot { margin-top: auto; display: grid; gap: 0.6rem; }
.nav__logout { margin: 0; }
.nav__logout button {
  width: 100%;
  background: transparent;
  color: #f6f0fa;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0.7rem;
  padding: 0.5rem 0.7rem;
}
.nav__logout button:hover { background: rgba(255, 255, 255, 0.08); }

.main {
  padding: 1.6rem 1.75rem 2.5rem;
  max-width: 1120px;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.page-head { align-items: flex-end; }
.page-head, .card__head, .row-actions, .post-list li, .account-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.eyebrow {
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--purple);
}
.lede, .hint, .empty { color: var(--muted); }
.lede, .hint, .empty, p { margin-top: 0; }
.card h2, .card h3 { margin-bottom: 0.35rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow);
}
.status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: #fff;
}
.status strong { display: block; }
.status p { margin: 0.15rem 0 0; color: var(--muted); }
.status--on { background: var(--green-bg); border-color: #b7e4c7; }
.status--off { background: var(--amber-bg); border-color: #f3ddb0; }
.status--on strong { color: var(--green); }
.status--off strong { color: var(--amber); }

.stats, .cards, .split { display: grid; gap: 0.9rem; }
.stats { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.95rem 1rem 0.85rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--line);
}
.stat:hover { border-color: #c9a3e2; }
.stat strong { display: block; font-size: 1.7rem; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 0.92rem; }
.stat--draft { border-top-color: #64748b; }
.stat--scheduled { border-top-color: var(--purple); }
.stat--posted { border-top-color: var(--green); }
.stat--failed { border-top-color: var(--red); }
.split { grid-template-columns: 1.35fr 0.85fr; align-items: start; }
.cards { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stack { display: grid; gap: 0.85rem; }
.spaced { margin-top: 0; }
.empty-block { display: grid; justify-items: start; gap: 0.7rem; }
.empty { margin-bottom: 0; }

label { display: grid; gap: 0.35rem; font-weight: 600; }
.check { display: flex; align-items: flex-start; gap: 0.55rem; font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d9d0e2;
  border-radius: 0.7rem;
  background: #fff;
}
textarea { resize: vertical; min-height: 8rem; }
.check input { width: auto; margin-top: 0.2rem; }
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.75rem;
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}
.btn:hover { border-color: #c9a3e2; }
.btn--primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn--primary:hover { background: #571484; }
.btn--danger { color: var(--red); border-color: #f3c3d0; background: #fff; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}
.pill--on, .pill--posted { background: var(--green-bg); color: var(--green); }
.pill--off, .pill--failed { background: var(--red-bg); color: var(--red); }
.pill--scheduled { background: var(--purple-soft); color: var(--purple); }
.pill--draft { background: #eef2f6; color: #334155; }
.filters {
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  width: fit-content;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow-x: auto;
}
.filters a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  text-transform: capitalize;
  font-weight: 600;
}
.filters a[aria-current="page"] { background: var(--purple); color: #fff; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 1rem; }
.card .table-wrap { border: 0; background: transparent; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
tbody tr:hover { background: #faf8fb; }
.account-list, .post-list, .agenda { list-style: none; margin: 0; padding: 0; }
.account-list li, .post-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.account-list li:last-child, .post-list li:last-child, .agenda li:last-child { border-bottom: 0; padding-bottom: 0; }
.account-list p, .post-list time, .agenda time { margin: 0; color: var(--muted); }
.agenda { display: grid; gap: 0.35rem; }
.agenda li { padding: 0.65rem 0.15rem; border-bottom: 1px solid var(--line); }
.agenda h3 { font-size: 0.95rem; }
.agenda .is-today {
  background: var(--purple-soft);
  border: 0;
  border-radius: 0.8rem;
  padding: 0.75rem 0.85rem;
}
.agenda ul { margin: 0.35rem 0 0; padding-left: 1rem; }
.meta { display: grid; gap: 0.45rem; margin: 0.6rem 0 0.8rem; }
.meta div { display: grid; grid-template-columns: 7rem 1fr; gap: 0.5rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.copy { white-space: pre-wrap; margin-bottom: 0; }
.news-card {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 1rem;
  align-items: start;
}
.news-card:not(:has(img)) { grid-template-columns: 1fr; }
.news-card__body { display: grid; gap: 0.55rem; min-width: 0; }
.shot { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: 0.8rem; background: var(--purple-dark); }
.shot--side { max-height: 210px; height: 210px; }
.guide ol { margin: 0.35rem 0 0; padding-left: 1.15rem; display: grid; gap: 0.35rem; }
.guide h3 { margin-top: 0.2rem; }
.flashes { display: grid; gap: 0.5rem; }
.flash { margin: 0; padding: 0.7rem 0.85rem; border-radius: 0.75rem; }
.flash--success { background: var(--green-bg); color: var(--green); }
.flash--error { background: var(--red-bg); color: var(--red); }
fieldset { border: 1px solid var(--line); border-radius: 0.8rem; padding: 0.8rem 1rem; }
:focus-visible { outline: 3px solid #c9a3e2; outline-offset: 2px; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 420px at 15% -10%, rgba(141, 75, 184, 0.45), transparent 60%),
    var(--purple-dark);
}
.login-card { width: min(420px, 100%); display: grid; gap: 0.35rem; padding: 1.4rem 1.35rem 1.3rem; }
.login-card .brand__mark { margin-bottom: 0.35rem; }
.login-card h1 { margin-bottom: 0.15rem; }
.login-card .btn { width: 100%; margin-top: 0.3rem; }

@media (max-width: 860px) {
  .shell { display: block; }
  .nav {
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand out" "links links";
    gap: 0.7rem;
    padding: 0.75rem;
  }
  .brand { grid-area: brand; }
  .nav__foot { display: contents; }
  .nav__who { display: none; }
  .nav__logout { grid-area: out; }
  .nav__logout button { width: auto; padding-inline: 0.8rem; }
  .nav nav {
    grid-area: links;
    flex-direction: row;
    overflow-x: auto;
  }
  .nav nav a { min-width: max-content; }
  .nav nav small { display: none; }
  .stats, .split, .news-card { grid-template-columns: 1fr 1fr; }
  .news-card { grid-template-columns: 1fr; }
  .shot--side { height: auto; max-height: 220px; }
  .page-head, .post-list li, .status { align-items: stretch; flex-direction: column; }
  .main { padding: 1rem; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
}
