:root {
  --ink: #261f27;
  --muted: #756c76;
  --line: #e8e0e6;
  --canvas: #f8f5f7;
  --panel: #ffffff;
  --plum: #582244;
  --plum-dark: #36152b;
  --plum-soft: #f2e8ef;
  --gold: #b68a53;
  --green: #267957;
  --green-soft: #e7f5ee;
  --red: #a63d4d;
  --red-soft: #fbeaec;
  --amber: #9b651e;
  --amber-soft: #fff3dc;
  --shadow: 0 14px 45px rgba(54, 21, 43, 0.08);
  --radius: 18px;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

h2 {
  margin-bottom: 0.4rem;
  font-size: 1.22rem;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1rem;
}

code {
  direction: ltr;
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 6px;
  background: #f1edf0;
  color: var(--plum-dark);
  font-family: Consolas, monospace;
}

.admin-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 0 0 auto;
  width: 270px;
  padding: 24px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 25% 10%, rgba(182, 138, 83, 0.18), transparent 28%),
    linear-gradient(170deg, var(--plum), var(--plum-dark));
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 35px rgba(54, 21, 43, 0.12);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-block strong,
.brand-block small {
  display: block;
}

.brand-block small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  color: #fff;
  font-family: Georgia, serif;
  letter-spacing: 0.04em;
}

.brand-mark.large {
  width: 66px;
  height: 66px;
  margin-bottom: 1rem;
  border-color: rgba(88, 34, 68, 0.3);
  color: var(--plum);
  font-size: 1.2rem;
}

.main-nav {
  display: grid;
  gap: 7px;
  margin-top: 28px;
}

.main-nav a {
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.76);
  transition: 160ms ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.12);
}

.main-nav a.active {
  box-shadow: inset -3px 0 0 var(--gold);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.09);
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.78rem;
}

.main-column {
  margin-right: 270px;
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 88px;
  padding: 16px clamp(18px, 4vw, 46px);
  border-bottom: 1px solid rgba(232, 224, 230, 0.8);
  background: rgba(248, 245, 247, 0.94);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-title {
  flex: 1;
}

.eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.admin-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.admin-menu strong,
.admin-menu small {
  display: block;
}

.admin-menu small {
  color: var(--muted);
  font-size: 0.76rem;
}

.content {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 46px) 60px;
}

.panel {
  margin-bottom: 20px;
  padding: clamp(18px, 2.5vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.flat {
  box-shadow: none;
}

.section-heading {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading.compact {
  margin-bottom: 18px;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.button {
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: #d5c8d1;
}

.button.primary {
  border-color: var(--plum);
  background: var(--plum);
  color: #fff;
}

.button.secondary {
  border-color: #d6c1d0;
  background: var(--plum-soft);
  color: var(--plum);
}

.button.danger {
  border-color: #e9b9c0;
  background: var(--red-soft);
  color: var(--red);
}

.button.ghost {
  background: transparent;
}

.button.small {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 0.78rem;
}

.button.full {
  width: 100%;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}

.menu-button {
  display: none;
}

.alert {
  margin-bottom: 18px;
  padding: 12px 15px;
  border: 1px solid;
  border-radius: 12px;
}

.alert.success {
  border-color: #b8dfcf;
  background: var(--green-soft);
  color: var(--green);
}

.alert.error {
  border-color: #edbdc5;
  background: var(--red-soft);
  color: var(--red);
}

.alert.info {
  border-color: #dec9b0;
  background: var(--amber-soft);
  color: var(--amber);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 8px 25px rgba(54, 21, 43, 0.045);
}

.stat-card span,
.stat-card strong {
  display: block;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-card strong {
  margin-top: 8px;
  color: var(--plum);
  font-size: 1.45rem;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 20px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fdfbfc;
}

.table-title {
  font-weight: 700;
}

.table-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.thumb {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--plum-soft);
  object-fit: cover;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 9px;
  border-radius: 99px;
  background: #efebee;
  color: #5e555e;
  font-size: 0.74rem;
}

.badge.success {
  background: var(--green-soft);
  color: var(--green);
}

.badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

.badge.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.plum {
  background: var(--plum-soft);
  color: var(--plum);
}

.filters {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) repeat(2, minmax(150px, 0.7fr)) auto;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: #4e454e;
  font-weight: 600;
}

label > span {
  font-size: 0.82rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid #dcd2d9;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
  transition: 150ms ease;
}

textarea {
  min-height: 115px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(88, 34, 68, 0.09);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--plum);
}

.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.stack {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.span-2 {
  grid-column: 1 / -1;
}

fieldset {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

legend {
  padding: 0 8px;
  color: var(--plum);
  font-weight: 700;
}

.field-error {
  color: var(--red);
  font-weight: 400;
}

.form-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.checkbox-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfafb;
}

.pagination {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pagination .pages {
  display: flex;
  gap: 7px;
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fdfbfc;
}

.detail-item span,
.detail-item strong {
  display: block;
}

.detail-item span {
  color: var(--muted);
  font-size: 0.76rem;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  padding: 11px 15px;
  border-right: 3px solid var(--plum);
  background: #fbf8fa;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgba(182, 138, 83, 0.17), transparent 32%),
    linear-gradient(135deg, #f8f5f7, #f0e9ee);
}

.auth-shell {
  width: min(920px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(54, 21, 43, 0.15);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-brand,
.auth-card {
  padding: clamp(28px, 5vw, 54px);
}

.auth-brand {
  background: linear-gradient(160deg, var(--plum-soft), #fff);
}

.auth-brand p {
  color: var(--muted);
}

.auth-card {
  align-self: center;
}

.setup-page {
  padding: 30px 18px 70px;
  background: var(--canvas);
}

.setup-shell {
  width: min(980px, 100%);
  margin: 0 auto;
}

.setup-brand {
  padding: 20px 4px;
}

.setup-brand p {
  color: var(--muted);
}

.requirements-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.requirement {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.requirement.ok strong {
  color: var(--green);
}

.requirement.bad strong {
  color: var(--red);
}

.success-panel {
  border-color: #b8dfcf;
}

.plain-page,
.error-page {
  display: grid;
  place-items: center;
}

.error-page {
  min-height: 100vh;
  padding: 30px;
  text-align: center;
}

.error-code {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 4rem;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1150px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .sidebar {
    transform: translateX(105%);
    transition: transform 190ms ease;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 30;
    inset: 0;
    background: rgba(20, 14, 19, 0.5);
  }

  .sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main-column {
    margin-right: 0;
  }

  .menu-button {
    display: inline-grid;
    place-items: center;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    display: none;
  }
}

@media (max-width: 580px) {
  .admin-menu > div {
    display: none;
  }

  .content {
    padding-top: 20px;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .stats-grid,
  .form-grid,
  .checkbox-grid,
  .detail-grid,
  .requirements-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }
}
