:root {
  --bg: #0b0d12;
  --bg-elevated: #11141b;
  --surface: #171a21;
  --surface-2: #1c2029;
  --surface-hover: #1e222c;
  --border: #2a2e38;
  --border-subtle: #22262f;

  --text: #e8eaed;
  --text-dim: #9aa0ac;
  --text-muted: #6b7280;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-2: #22d3ee;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);

  --radius-sm: 0.375rem;
  --radius: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.125rem;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 160ms;

  --header-h: 4.25rem;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 0.9375rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.85em;
}

code {
  padding: 0.1em 0.35em;
  background: var(--surface-2);
  border-radius: 4px;
}

img {
  max-width: 100%;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--text-muted);
}

.tiny {
  font-size: 0.78rem;
}

.nowrap {
  white-space: nowrap;
}

.stack {
  display: grid;
  gap: 0.6rem;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(11, 13, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hdr-in {
  padding: 0.75rem 1.5rem;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand:hover .brand-title {
  color: var(--accent-hover);
}

.logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  transition: color var(--dur) var(--ease);
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease);
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.is-active {
  color: var(--accent-2);
}

.nav-badge {
  min-width: 1.4rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--amber);
  color: #1a1300;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35rem;
}

.nav-foot {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-subtle);
}

.nav-foot form {
  margin: 0;
}

.me {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.25rem;
}

.me-name {
  font-weight: 600;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-width: 0;
  padding: 2rem 1.5rem 3rem;
}






.bare {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  padding: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 600 0.875rem/1.3 var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), filter var(--dur) var(--ease);
}

.btn:hover {
  background: var(--surface-hover);
  border-color: #3a3f4b;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-color: transparent;
  filter: brightness(1.12);
}

.btn-accent {
  background: var(--green-soft);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--green);
}

.btn-accent:hover {
  background: rgba(52, 211, 153, 0.2);
  border-color: var(--green);
}

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: var(--red);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: transparent;
  color: var(--text);
}

.btn-danger-text {
  color: var(--red);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 1.25rem;
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.icon-btn-danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-2);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input[readonly] {
  color: var(--text-dim);
  background: var(--bg-elevated);
}

textarea.input {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.5;
}

.label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

.field + .field,
.hint + .field,
.field-row + .field,
.field + .field-row {
  margin-top: 0.85rem;
}

.field-row > .field {
  margin-top: 0;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5rem;
  gap: 0.6rem;
}

.flag-input {
  position: relative;
}

.flag-input img {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 2px;
}

.flag-input img:not([hidden]) + .input {
  padding-left: 2.4rem;
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hint-error {
  color: var(--red);
}

.search-input {
  max-width: 22rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.lede {
  margin: 0.4rem 0 0;
  max-width: 46rem;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.65;
}

.head-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card + .card,
.list-tools + .card,
.hint + .card,
.banner + .card {
  margin-top: 1rem;
}

.card-title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.empty-state h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.empty-state .btn {
  margin-top: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-dim);
}

.pill-published,
.pill-synced {
  background: var(--green-soft);
  color: var(--green);
}

.pill-pending_publish,
.pill-pending,
.pill-approved {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill-rejected {
  background: var(--red-soft);
  color: var(--red);
}

.pill-draft,
.pill-superseded {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-dim);
  vertical-align: middle;
}

.section-title {
  margin: 2rem 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.page-head + .section-title {
  margin-top: 0;
}

.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chips + .card {
  margin-top: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: 500 0.8rem/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.chip span {
  color: var(--text-muted);
}

.chip:hover {
  color: var(--text);
}

.chip.is-active {
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.08);
  color: var(--accent-2);
}

.chip.is-active span {
  color: inherit;
  opacity: 0.75;
}

.table-card {
  padding: 0;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.table tbody tr {
  transition: background var(--dur) var(--ease);
}

.table tbody tr:hover {
  background: var(--surface-hover);
}

.table-empty {
  padding: 1rem;
  margin: 0;
}

.col-actions {
  text-align: right;
  width: 1%;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
}

.row-actions form {
  margin: 0;
}

.guide-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.guide-title {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  transition: color var(--dur) var(--ease);
}

a.guide-title:hover {
  color: var(--accent-hover);
}

.flag {
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  object-fit: cover;
}

.flag-none {
  display: inline-block;
  width: 24px;
  height: 18px;
  background: var(--surface-hover);
}

.ua {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.flashes {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.flashes .alert {
  margin: 0;
}

.alert-ok {
  background: var(--green-soft);
  border-color: rgba(52, 211, 153, 0.3);
  color: #a7f3d0;
}

.alert-error {
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

.alert-close {
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.banner-warn {
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

.banner-error {
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.banner-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}

.page-edit .main {
  padding-bottom: 1.5rem;
}

.edit-head {
  display: block;
  margin-bottom: 1rem;
}

.edit-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.save-status {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.save-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.save-status[data-state="unsaved"]::before {
  background: var(--amber);
}

.save-status[data-state="saving"]::before {
  background: var(--accent-hover);
}

.save-status[data-state="error"] {
  color: var(--red);
}

.save-status[data-state="error"]::before {
  background: var(--red);
}

.edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.workspace {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h) - 10rem);
  overflow: hidden;
}

.ws-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font: 500 0.82rem/1.3 var(--font);
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  background: var(--surface-hover);
  color: var(--accent-2);
}

.tab-count {
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1px;
}

.tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.tool:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.tool svg {
  width: 17px;
  height: 17px;
}

.tool-sep {
  width: 1px;
  height: 18px;
  margin: 0 0.3rem;
  background: var(--border);
}

.panes {
  flex: 1;
  display: grid;
  min-height: 0;
}

.pane {
  min-width: 0;
  min-height: 0;
  display: none;
}

.panes[data-view="write"] .pane-write,
.panes[data-view="preview"] .pane-preview,
.panes[data-view="changes"] .pane-changes {
  display: block;
}

.panes[data-view="split"] {
  grid-template-columns: 1fr 1fr;
}

.panes[data-view="split"] .pane-write,
.panes[data-view="split"] .pane-preview {
  display: block;
}

.panes[data-view="split"] .pane-preview {
  border-left: 1px solid var(--border-subtle);
}

.md-input {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 28rem;
  padding: 1.1rem 1.25rem;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font: 400 0.9rem/1.7 var(--mono);
  tab-size: 2;
}

.md-input.is-drag {
  background: var(--accent-soft);
}

.pane-preview,
.pane-changes {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h) - 11rem);
}

.edit-side {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.edit-side .card + .card {
  margin-top: 0;
}

.edit-side form {
  margin: 0;
}

.edit-side .card > * + .btn-block,
.edit-side .card > * + form {
  margin-top: 0.6rem;
}

.dropzone {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
}

.dropzone svg {
  width: 22px;
  height: 22px;
  color: var(--accent-hover);
}

.dropzone:hover,
.dropzone.is-drag,
.dropzone:focus-within {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.thumbs:empty {
  display: none;
}

.thumbs-lg {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  max-height: 60vh;
  overflow-y: auto;
}

.thumb {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.thumb:hover {
  border-color: var(--accent);
}

.thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.thumb-name {
  padding: 0 0.35rem 0.3rem;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumbs:not(.thumbs-lg) .thumb-name {
  display: none;
}

.dialog {
  width: min(760px, calc(100vw - 2rem));
  padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.dialog-sm {
  width: min(420px, calc(100vw - 2rem));
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dialog h2 {
  margin: 0;
  font-size: 1rem;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.dialog-head form {
  margin: 0;
}

.dialog .input + .thumbs {
  margin-top: 0.75rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.pv {
  max-width: 56rem;
  font-size: 1rem;
  line-height: 1.6;
}

.pv-head {
  margin-bottom: 2rem;
}

.pv-head h1 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 3.5vw, 2.15rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.pv-flag {
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}


.pv-sec {
  margin-top: 2rem;
}

.pv-sec h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.pv-box {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.pv-pic {
  flex: 0 0 240px;
}

.pv-pic img {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
}

.pv-text {
  flex: 1;
  min-width: 0;
  font-size: 0.98rem;
  color: var(--text);
}

.pv-text > :first-child {
  margin-top: 0;
}

.pv-text > :last-child {
  margin-bottom: 0;
}

.pv-text p {
  margin: 0 0 0.85em;
  color: var(--text-dim);
}

.pv-text strong,
.pv-text b,
.pv-text em {
  color: var(--text);
}

.pv-text strong,
.pv-text b {
  font-weight: 600;
}

.pv-text a {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pv-text a:hover {
  color: var(--accent-hover);
}

.pv-text ul,
.pv-text ol {
  margin: 0 0 0.85em;
  padding-left: 1.25rem;
  color: var(--text-dim);
}

.pv-text li + li {
  margin-top: 0.35em;
}

.pv-text code {
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 0.3rem;
  padding: 0.1em 0.35em;
  color: var(--accent-2);
}

.pv-text pre {
  overflow-x: auto;
  margin: 0 0 0.85em;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pv-text pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.pv-text blockquote {
  margin: 0 0 0.85em;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
  background: rgba(99, 102, 241, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.pv-text table {
  border-collapse: collapse;
}

.pv-text th,
.pv-text td {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
}

.panes[data-view="split"] .pv-box {
  flex-direction: column;
}

.panes[data-view="split"] .pv-pic {
  flex: none;
  width: 100%;
}

.changes-head {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.add {
  color: var(--green);
  font-weight: 600;
}

.del {
  color: var(--red);
  font-weight: 600;
}

.diff-stats {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.diff-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg);
}

.diff {
  width: 100%;
  border-collapse: collapse;
  font: 0.8rem/1.6 var(--mono);
}

.diff td {
  padding: 0 0.6rem;
  vertical-align: top;
}

.diff-no {
  width: 1%;
  min-width: 2.75rem;
  text-align: right;
  color: var(--text-muted);
  user-select: none;
  border-right: 1px solid var(--border-subtle);
}

.diff-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-sign {
  display: inline-block;
  width: 1.1rem;
  color: var(--text-muted);
  user-select: none;
}

.diff-add {
  background: rgba(52, 211, 153, 0.08);
}

.diff-add .diff-sign {
  color: var(--green);
}

.diff-add mark {
  background: rgba(52, 211, 153, 0.3);
  color: inherit;
  border-radius: 2px;
}

.diff-del {
  background: rgba(248, 113, 113, 0.08);
}

.diff-del .diff-sign {
  color: var(--red);
}

.diff-del mark {
  background: rgba(248, 113, 113, 0.3);
  color: inherit;
  border-radius: 2px;
}

.diff-gap td {
  padding: 0.25rem 0.75rem;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.diff-empty {
  margin: 0;
}

.review-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.review-forms form {
  margin: 0;
}

.perm-table .perm-cell {
  text-align: center;
  width: 1%;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.perm-head {
  display: inline-block;
  max-width: 6.5rem;
  white-space: normal;
  line-height: 1.25;
  cursor: help;
}

.perm-all {
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
}

.perm-table input[type="checkbox"],
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.perm-table input:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.perm-list {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.5rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.check input {
  margin-top: 0.2rem;
}

.check > span {
  display: grid;
}

.form-card {
  max-width: 34rem;
}

.secret-card {
  margin-bottom: 1rem;
  border-color: rgba(251, 191, 36, 0.4);
}

.secret-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.secret {
  padding: 0.45rem 0.7rem;
  font-size: 1rem;
  user-select: all;
}

.login-card {
  width: min(400px, 100%);
  padding: 2rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-brand img {
  border-radius: var(--radius);
}

.login-brand h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin: 0;
  font-size: 0.85rem;
}

.login-card .btn-block {
  margin-top: 0.4rem;
  padding: 0.65rem;
}

.error-card {
  max-width: 34rem;
  margin: 2rem auto;
}

.error-code {
  margin: 0 0 0.25rem;
  font: 700 0.85rem/1 var(--mono);
  letter-spacing: 0.1em;
  color: var(--accent-2);
}

@media (max-width: 1100px) {
  .edit-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .edit-side {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    align-items: start;
  }

  .workspace {
    min-height: 0;
  }

  .panes[data-view="split"] {
    grid-template-columns: 1fr;
  }

  .panes[data-view="split"] .pane-preview {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 960px) {
  .hdr-in {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .nav-toggle {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-bottom: 0.25rem;
  }

  .hdr.is-open .nav {
    display: flex;
  }

  .nav-foot {
    margin: 0.5rem 0 0;
    padding: 0.5rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }

  .me {
    flex: 1;
  }
}

@media (max-width: 820px) {
  .main {
    padding: 1.25rem 1rem 2.5rem;
  }

  .page-head {
    flex-direction: column;
  }

  .hide-sm {
    display: none;
  }

  .review-forms {
    grid-template-columns: 1fr;
  }

  .toolbar {
    width: 100%;
  }

  .pv-box {
    flex-direction: column;
  }

  .pv-pic {
    flex: none;
    width: 100%;
  }
}

.is-current td {
  background: rgba(34, 211, 238, 0.05);
}

.is-selected td {
  background: var(--surface-hover);
}
