@font-face {
  font-family: Manrope;
  src: url('/assets/manrope.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #202825;
  --muted: #55635e;
  --line: #dce3df;
  --field: #a5b4ad;
  --paper: #fff;
  --canvas: #f6f7f6;
  --teal: #24584c;
  --soft: #e8f0ed;
  --radius: 12px;
  font: 15px/1.55 Manrope, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
a { color: var(--teal); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #347f70; outline-offset: 3px; }
.skip-link {
  position: fixed;
  z-index: 2;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--paper);
}
.skip-link:focus { transform: none; }

.workspace { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 0 16px 18px;
  background: var(--paper);
  border-inline-end: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 8px;
  color: var(--ink);
  text-decoration: none;
}
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; }
.brand-mark { width: 35px; height: 35px; border-radius: 8px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}
.sidebar nav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; }
.sidebar nav a[aria-current], .sidebar nav a:hover { background: var(--soft); color: var(--teal); }
.workspace-state {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.workspace-state span { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 10px clamp(20px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 14px;
}
.toolbar a { color: inherit; text-decoration: none; }
.toolbar a:hover { text-decoration: underline; }
.toolbar strong { color: var(--ink); }
main { padding: 30px clamp(20px, 3vw, 44px) 56px; }
h1 { font-size: clamp(26px, 3vw, 30px); letter-spacing: -.025em; line-height: 1.2; }
h2 { font-size: 17px; }
.page-heading { margin-bottom: 22px; }
.page-heading p { margin-top: 8px; overflow-wrap: anywhere; }
.page-heading p .badge { margin-inline-start: 6px; }
.page-heading p, .hint, small { color: var(--muted); }
.hint, small { font-size: 13px; }
.editor-heading, .actions, .actions form, .section-heading, .result-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.editor-heading, .section-heading, .result-bar { justify-content: space-between; }
.editor-heading { gap: 16px; }
.notice + .languages { margin-top: 12px; }
.editor-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--paper);
}
.editor-footer .actions { margin-inline-start: auto; }
.editor-content :focus, .editor-settings :focus { scroll-margin-block-end: 120px; }
.back { display: inline-block; margin-bottom: 12px; }

.panel {
  min-width: 0;
  padding: clamp(16px, 2vw, 24px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel > h2 { margin-bottom: 16px; }
.create-panel { max-width: 680px; }
.create-panel .hint { margin-top: 8px; }
.create-panel .actions { justify-content: flex-end; margin-top: 20px; }
label { display: block; font-size: 14px; font-weight: 700; }
input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin-top: 5px;
  border: 1px solid var(--field);
  border-radius: 7px;
  padding: 8px 11px;
  background: var(--paper);
  font-weight: 500;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
}
.primary { background: var(--teal); border-color: var(--teal); color: var(--paper); }
.primary:hover { background: #194438; }
.secondary { background: var(--paper); color: var(--ink); }
.secondary:hover { background: var(--soft); }

.catalog { padding: 0; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; padding: 16px 20px; }
.filters select { min-width: 132px; }
.article-labels, .articles a { display: grid; grid-template-columns: minmax(0, 1fr) 114px; align-items: center; gap: 12px; padding: 10px 20px; }
.article-labels { background: var(--canvas); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }
.articles { margin: 0; padding: 0; list-style: none; }
.articles a { min-height: 64px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.articles a:hover { background: var(--soft); }
.articles a:focus-visible { outline-offset: -3px; }
.articles li:last-child a { border-radius: 0 0 var(--radius) var(--radius); }
.articles small { display: block; }
.badge {
  display: inline-block;
  justify-self: start;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
}
.empty { padding: 20px; color: var(--muted); }

.languages { display: flex; gap: 5px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.languages a { padding: 10px 13px 8px; border-bottom: 3px solid transparent; text-decoration: none; font-weight: 750; }
.languages a[aria-current] { border-color: var(--teal); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(250px, 1fr); gap: 16px; align-items: start; }
.editor-content { display: grid; gap: 16px; min-width: 0; }
.fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.panel label + label, .fields + label { margin-top: 13px; }
.fields label + label { margin: 0; }
.paragraph { min-width: 0; margin: 12px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); }
.remove-section { margin-top: 12px; }
.previous-builds { margin-top: 22px; }
.previous-builds ul { margin: 6px 0; padding-inline-start: 20px; }
.notice { padding: 9px 12px; border-inline-start: 3px solid var(--teal); background: var(--soft); border-radius: 0 6px 6px 0; }
.error { border-color: #9d3825; background: #f9e8e3; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.previews { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 15px; }
.previews iframe { display: block; width: 100%; height: 600px; margin-top: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.previews.phone iframe { max-width: 390px; }

@media (max-width: 1030px) {
  .workspace { grid-template-columns: 192px minmax(0, 1fr); }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .workspace, .previews { display: block; }
  .sidebar { position: static; height: auto; padding: 0 12px 10px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 12px 8px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .workspace-state { display: none; }
  .toolbar { min-height: 46px; padding-inline: 16px; }
  main { padding: 22px 16px 40px; }
  .editor-footer { position: static; border-radius: var(--radius); }
  .previews section + section { margin-top: 16px; }
}

@media (max-width: 420px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .article-labels, .articles a { grid-template-columns: minmax(0, 1fr) auto; padding-inline: 12px; }
  .filters { padding-inline: 12px; }
  .filters select { min-width: 114px; }
}

.theme-panel { max-width: 820px; }
.theme-notice { margin-bottom: 16px; }
.theme-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.theme-list legend { margin-bottom: 14px; padding: 0; font-weight: 750; }
.theme-list .theme-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--field);
  border-radius: 8px;
  cursor: pointer;
}
.theme-option:has(:checked) { border-color: var(--teal); background: var(--soft); }
.theme-option input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--teal); }
.theme-option small { display: block; font-weight: 500; }
.theme-preview {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.theme-actions { margin-top: 20px; }

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 400px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 6vw, 34px); }
.login-card h1 { margin-block-start: 16px; font-size: 25px; }
.login-card p { margin-block-start: 8px; color: var(--muted); }
.login-card .login-action { width: 100%; min-height: 44px; justify-content: center; margin-block-start: 24px; }
.toolbar .logout { margin-inline-start: auto; }
