:root {
  color-scheme: dark;
  --background: #100f10;
  --sidebar: #141314;
  --surface: #1d1c1e;
  --surface-hover: #252427;
  --border: #323034;
  --text: #f3f1f4;
  --muted: #b0aeb5;
  --accent: #92b8ff;
  --primary: #a6c5ff;
  --primary-text: #0f1d33;
  --positive: #8fd8b3;
  --warning: #efc78c;
  --danger: #ff9fa5;
  --radius: 14px;
  font: 15px/1.48 system-ui, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; background: var(--background); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
a, button, summary, select { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: clamp(1.85rem, 5vw, 2.55rem); line-height: 1.13; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; line-height: 1.25; margin-bottom: 14px; }
img { max-width: 100%; }
.muted { color: var(--muted); font-size: .94rem; }
.loading { padding: 10vh 20px; color: var(--muted); text-align: center; }
.shell, .body { min-width: 0; min-height: 100dvh; }
.sidebar { padding: 16px; background: var(--sidebar); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; letter-spacing: -.035em; }
.mark { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid #41434b; background: #282a32; border-radius: 10px; color: var(--accent); font-size: 21px; }
.navigation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 16px; }
.navigation a {
  display: flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px;
  padding: 6px; border: 1px solid transparent; border-radius: 9px; color: var(--muted); font-size: .82rem;
}
.navigation a span { flex: none; font-size: 1.08rem; }
.navigation a:hover, .navigation a[aria-current="page"] { color: var(--text); background: var(--surface-hover); border-color: var(--border); }
.navigation a[aria-current="page"] span { color: var(--accent); }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; min-height: 54px; padding: 5px 16px; border-bottom: 1px solid var(--border); }
.user { display: grid; min-width: 0; text-align: right; font-size: .83rem; overflow-wrap: anywhere; }
.user span { color: var(--muted); font-size: .76rem; }
.content { width: min(100%, 1250px); margin: 0 auto; padding: 22px 16px 48px; display: grid; gap: 18px; }
.heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 5px; }
.heading .muted { margin-top: 8px; }
.section-title { margin: 4px 0 -5px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; max-width: 100%;
  padding: 8px 14px; color: var(--text); border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-hover); font-weight: 640; text-align: center;
}
.button:hover:not(:disabled) { border-color: #6a6670; }
.button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.button.primary:hover:not(:disabled) { background: #c0d6ff; }
.button.quiet { background: transparent; color: var(--muted); border-color: transparent; }
.button:disabled { opacity: .5; cursor: default; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { display: grid; align-content: start; gap: 3px; padding: 14px; min-height: 122px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.tile:hover { background: var(--surface-hover); }
.tile strong { color: var(--text); font-size: 1.9rem; letter-spacing: -.045em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-icon { color: var(--accent); font-size: 1.17rem; margin-bottom: 7px; }
.columns, .stack, .form, .section-body { display: grid; gap: 12px; }
.columns { align-items: start; }
.panel, .listing, .editor-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel { min-width: 0; padding: 16px; overflow-wrap: anywhere; }
.panel > :last-child { margin-bottom: 0; }
.panel > .field + .field, .panel > .field + .columns, .panel > .columns + .columns, .panel > .columns + .field, .panel > .muted + .actions, .panel > .muted + .button, .panel > .actions + .field, .panel > .field + .button, .panel > .columns + .button { margin-top: 12px; }
.form > .button, .section-body > .button, .form .button[type="submit"] { justify-self: start; }
.field { display: grid; align-content: start; min-width: 0; gap: 6px; font-weight: 550; }
.field span { font-size: .9rem; }
input, select, textarea {
  min-width: 0; min-height: 44px; width: 100%; padding: 9px 11px; border: 1px solid #444047; border-radius: 9px;
  background: var(--background); color: var(--text); font-size: max(.95rem, 16px);
}
input[type="file"] { padding: 8px; }
input::file-selector-button { border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface-hover); margin-right: 8px; padding: 7px; }
textarea { resize: vertical; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input { flex: 1 1 190px; }
.filters select { flex: 0 1 200px; }
.listing, .members { margin: 0; padding: 0; list-style: none; overflow: hidden; }
.listing a, .members li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 16px; overflow-wrap: anywhere; }
.listing li + li, .members li + li { border-top: 1px solid var(--border); }
.listing a:hover { background: var(--surface-hover); }
.listing a:focus-visible { outline-offset: -4px; }
.listing .muted, .members .muted { margin-top: 3px; }
.members li { padding-inline: 0; }
.members + form, .panel > p + form { margin-top: 14px; }
.badge { font-size: .78rem; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); white-space: nowrap; }
.badge.review { color: var(--warning); border-color: #534233; }
.badge.published { color: var(--positive); border-color: #354d43; }
.revision-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.revision-bar select { width: auto; max-width: 100%; }
.editor-section summary { padding: 13px 15px; min-height: 44px; font-weight: 640; overflow-wrap: anywhere; }
.editor-section[open] > summary { border-bottom: 1px solid var(--border); }
.section-body { padding: 13px; }
.section-body .panel { background: #242326; }
.checkbox { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.checkbox input { width: 19px; min-height: 19px; accent-color: var(--accent); }
.assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 10px; }
.assets img { display: block; width: 100%; max-height: 220px; object-fit: contain; background: var(--background); }
.assets figcaption { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; padding: 5px 0; }
.details-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; }
.import-result:empty { display: none; }
.import-result { border-top: 1px solid var(--border); padding-top: 16px; }
.import-result .button { margin-top: 14px; }
.warnings { padding-inline-start: 22px; color: var(--warning); }
.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 16px; }
.login-page .panel { width: min(100%, 390px); padding: 23px; }
.login-page .mark { margin-bottom: 18px; }
.login-page h1 { font-size: 2rem; }
.login-page p { margin: 7px 0 20px; }
.login-page button { margin-top: 5px; width: 100%; }
#notice { position: fixed; bottom: max(10px, env(safe-area-inset-bottom)); right: 12px; max-width: min(420px, calc(100% - 24px)); z-index: 2; }
.message { padding: 10px 13px; border: 1px solid #466251; background: #202d25; color: #d4f6e2; border-radius: 10px; overflow-wrap: anywhere; }
.message.failure { border-color: #743f44; background: #351d22; color: #ffcfce; }

@media (min-width: 515px) {
  .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding-inline: 24px; }
}
@media (min-width: 820px) {
  .shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100dvh; padding: 25px 14px; border-bottom: 0; border-right: 1px solid var(--border); }
  .brand { margin-left: 8px; }
  .navigation { grid-template-columns: 1fr; margin-top: 30px; gap: 5px; }
  .navigation a { justify-content: flex-start; padding: 8px 12px; gap: 10px; font-size: .93rem; }
  .topbar { min-height: 64px; padding-inline: 30px; }
  .content { padding: 34px 30px 54px; gap: 20px; }
  .panel { padding: 20px; }
  .tile { padding: 18px; }
}
@media (min-width: 1080px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
}
