:root {
  --admin-bg: oklch(97.5% 0.012 170);
  --admin-sidebar: oklch(20% 0.045 170);
  --admin-ink: oklch(22% 0.035 172);
  --admin-muted: oklch(45% 0.028 172);
  --admin-line: oklch(89% 0.018 173);
  --admin-good: oklch(43% 0.13 158);
  --admin-warn: oklch(58% 0.16 65);
  --admin-danger: oklch(52% 0.19 28);
}

.admin-shell {
  min-height: 100vh;
  background: var(--admin-bg);
  color: var(--admin-ink);
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: var(--admin-sidebar);
  color: white;
  overflow-y: auto;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  color: white;
}

.admin-brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  font-weight: 900;
}

.admin-brand strong,
.admin-brand small {
  display: block;
  line-height: 1.2;
}

.admin-brand small {
  color: color-mix(in oklch, white 70%, var(--mint));
  font-weight: 700;
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 8px;
  color: color-mix(in oklch, white 76%, var(--mint));
  font-weight: 800;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: color-mix(in oklch, var(--primary) 38%, transparent);
  color: white;
}

.admin-nav svg,
.admin-topbar svg,
.admin-action svg,
.btn svg {
  width: 18px;
  height: 18px;
}

.admin-main {
  min-height: 100vh;
  margin-left: 280px;
}

.admin-topbar {
  min-height: 86px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 28px;
  background: color-mix(in oklch, white 92%, transparent);
  border-bottom: 1px solid var(--admin-line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-topbar h1 {
  max-width: none;
  font-size: 28px;
  line-height: 1.2;
  color: var(--primary-strong);
}

.admin-kicker {
  color: var(--admin-muted);
  font-weight: 800;
}

.admin-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: white;
  color: var(--primary-strong);
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.admin-user a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: white;
  color: var(--primary-strong);
}

.admin-content {
  width: min(100% - 36px, 1280px);
  margin: 0 auto;
  padding: 26px 0 56px;
}

.admin-flash {
  width: min(100% - 36px, 1280px);
  margin: 18px auto 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: color-mix(in oklch, var(--primary) 10%, white);
  color: var(--primary-strong);
  font-weight: 800;
}

.admin-flash.error {
  background: color-mix(in oklch, var(--admin-danger) 10%, white);
  color: var(--admin-danger);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.stat-card,
.panel,
.admin-form,
.table-shell,
.media-card {
  background: white;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  color: var(--admin-muted);
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  color: var(--primary-strong);
  font-size: 34px;
  line-height: 1;
}

.panel {
  margin-top: 18px;
  padding: 18px;
}

.panel-header,
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header h2,
.list-header h2,
.admin-form h2 {
  color: var(--primary-strong);
  font-size: 22px;
}

.btn,
.admin-action {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: white;
  color: var(--primary-strong);
  font-weight: 900;
  cursor: pointer;
}

.btn.primary,
.admin-action.primary {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  color: white;
}

.btn.danger {
  border-color: color-mix(in oklch, var(--admin-danger) 32%, white);
  color: var(--admin-danger);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select,
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 8px 11px;
  background: white;
  color: var(--admin-ink);
}

.toolbar label {
  display: grid;
  gap: 4px;
  min-width: 180px;
  color: var(--admin-muted);
  font-weight: 800;
}

.toolbar label:first-child {
  min-width: min(360px, 100%);
  flex: 1;
}

.table-shell {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--admin-line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--admin-muted);
  font-size: 14px;
  white-space: nowrap;
}

.admin-table td {
  font-weight: 700;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.status-badge.good {
  background: color-mix(in oklch, var(--admin-good) 14%, white);
  color: var(--admin-good);
}

.status-badge.warn {
  background: color-mix(in oklch, var(--admin-warn) 16%, white);
  color: oklch(43% 0.13 65);
}

.status-badge.muted {
  background: oklch(94% 0.008 172);
  color: var(--admin-muted);
}

.admin-form {
  display: grid;
  gap: 18px;
  padding: 20px;
}

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

.field {
  display: grid;
  gap: 7px;
  color: var(--admin-ink);
  font-weight: 900;
}

.field.full {
  grid-column: 1 / -1;
}

.field small {
  color: var(--admin-muted);
  font-weight: 700;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

.field .richtext {
  min-height: 210px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--admin-line);
  padding-top: 16px;
}

.preview-img {
  width: 128px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--admin-line);
  background: var(--surface-soft);
}

.attachments {
  display: grid;
  gap: 8px;
}

.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.media-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.media-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-soft);
}

.media-card strong {
  overflow-wrap: anywhere;
}

.login-admin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 34px);
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--primary) 7%, white), oklch(98.5% 0.006 172));
}

.login-admin-shell {
  width: min(100%, 1040px);
  min-height: min(620px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 0.72fr);
  overflow: hidden;
  border-radius: 14px;
  background: white;
  box-shadow: 0 8px 12px rgb(8 45 38 / 10%);
}

.login-admin-panel {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(26px, 4vw, 42px);
  color: white;
  background:
    linear-gradient(145deg, color-mix(in oklch, var(--primary-strong) 96%, black), var(--primary-strong) 58%, var(--primary));
}

.login-admin-brand {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 14px;
  color: white;
}

.login-admin-seal {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: white;
}

.login-admin-seal img {
  width: 86px;
  height: 64px;
  object-fit: cover;
  object-position: left center;
}

.login-admin-brand strong,
.login-admin-brand small {
  display: block;
  line-height: 1.2;
}

.login-admin-brand strong {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 900;
}

.login-admin-brand small {
  color: color-mix(in oklch, white 78%, var(--mint));
  font-weight: 800;
}

.login-admin-copy .admin-kicker {
  color: color-mix(in oklch, white 74%, var(--mint));
}

.login-admin-copy h1 {
  max-width: 16ch;
  margin-top: 12px;
  color: white;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.18;
  overflow-wrap: break-word;
}

.login-admin-copy p {
  max-width: 48ch;
  margin-top: 14px;
  color: color-mix(in oklch, white 84%, var(--mint));
  font-size: 17px;
  font-weight: 650;
}

.login-admin-meta {
  display: grid;
  gap: 9px;
}

.login-admin-meta span {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in oklch, white 13%, transparent);
  color: color-mix(in oklch, white 86%, var(--mint));
  font-weight: 800;
  line-height: 1.45;
}

.login-admin-meta svg,
.login-card-icon svg,
.login-input-shell svg,
.login-return svg {
  width: 20px;
  height: 20px;
}

.login-admin-form-panel {
  display: grid;
  align-items: center;
  padding: clamp(28px, 4vw, 50px);
  background:
    linear-gradient(180deg, white, color-mix(in oklch, var(--surface-soft) 35%, white));
}

.login-admin-card {
  width: min(100%, 440px);
  display: grid;
  gap: 18px;
  margin: auto;
}

.login-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.login-card-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in oklch, var(--primary) 12%, white);
  color: var(--primary-strong);
}

.login-admin-card h2 {
  max-width: none;
  font-size: clamp(26px, 2.8vw, 34px);
  line-height: 1.18;
  color: var(--primary-strong);
}

.login-admin-card .admin-flash {
  width: 100%;
  margin: 0;
}

.login-input-shell {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  background: white;
  color: var(--admin-muted);
}

.login-input-shell:focus-within {
  border-color: var(--primary);
  outline: 3px solid color-mix(in oklch, var(--primary) 16%, transparent);
}

.login-input-shell input {
  width: 100%;
  min-height: 48px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--admin-ink);
}

.login-submit {
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
}

.login-return {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--primary-strong);
  font-weight: 900;
}

@media (max-width: 980px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .admin-main {
    margin-left: 0;
  }

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

  .admin-user {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .admin-topbar {
    grid-template-columns: auto 1fr;
  }

  .admin-user {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

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

  .panel-header,
  .list-header {
    align-items: stretch;
    flex-direction: column;
  }

  .login-admin {
    padding: 0;
  }

  .login-admin-shell {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border-radius: 0;
  }

  .login-admin-panel {
    min-height: auto;
    gap: 24px;
  }

  .login-admin-copy h1 {
    max-width: 14ch;
    font-size: clamp(32px, 9.5vw, 38px);
  }

  .login-admin-meta {
    grid-template-columns: 1fr;
  }
}
