:root {
  color-scheme: light;
  --ink: #162a36;
  --muted: #536673;
  --line: #d6e0e5;
  --input: #a7b8c3;
  --accent: #0d4b50;
  --wash: #e6f1f1;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 14px; background: #fff; border: 1px solid var(--input); border-radius: 5px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--wash); border-color: var(--accent); }
button:disabled { opacity: .44; cursor: default; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { background: #143b40; color: #fff; }
.quiet { color: var(--muted); border-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top { min-height: 78px; padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 17px; white-space: nowrap; }
.brand strong { font-size: 30px; letter-spacing: -.065em; }
.brand span { font-size: 19px; font-weight: 600; border-left: 1px solid var(--input); padding-left: 17px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 13px; }
.error { color: #9a2d2d; }
.shell { display: grid; grid-template-columns: 184px minmax(0,1fr); min-height: calc(100vh - 78px); }
nav { border-right: 1px solid var(--line); padding: 24px 0; }
nav button { width: 100%; min-height: 48px; justify-content: flex-start; gap: 12px; border: 0; border-left: 4px solid transparent; border-radius: 0; padding: 9px 17px; }
nav button[aria-current] { background: var(--wash); border-left-color: var(--accent); color: var(--accent); font-weight: 650; }
nav .marker { display: inline-grid; place-items: center; width: 21px; height: 21px; }
nav svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
main { min-width: 0; }
.layout { display: grid; grid-template-columns: minmax(225px, .88fr) minmax(310px, 1.32fr) minmax(240px, .95fr); min-height: calc(100vh - 78px); }
.outline, .editor, .preview { min-width: 0; padding: 24px; }
.outline, .editor { border-right: 1px solid var(--line); }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-size: 27px; letter-spacing: -.035em; line-height: 1.15; margin-bottom: 16px; }
h3 { font-size: 18px; }
.outline-list { display: grid; gap: 6px; }
.outline-item { width: 100%; min-height: 66px; text-align: left; display: flex; justify-content: start; white-space: normal; gap: 10px; padding: 7px; border-color: transparent; font-weight: 560; }
.outline-item[aria-pressed=true] { background: var(--wash); border-color: var(--accent); }
.outline-item img, .outline-item .blank { width: 66px; height: 50px; object-fit: cover; background: #edf2f4; flex: 0 0 66px; border-radius: 2px; }
.outline-item span { min-width: 0; overflow-wrap: anywhere; }
.outline .add { margin-top: 12px; width: 100%; justify-content: start; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.field { display: grid; gap: 7px; margin: 0 0 16px; font-size: 15px; }
.field > span { font-weight: 560; }
input, textarea, select { width: 100%; border: 1px solid var(--input); border-radius: 5px; min-height: 40px; padding: 8px 10px; background: #fff; }
textarea { min-height: 105px; resize: vertical; line-height: 1.45; }
input[type=checkbox] { width: 17px; min-height: 17px; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; }
.media-picker { margin-bottom: 16px; }
.media-picker .field { margin-bottom: 8px; }
.media-picker img { display: block; width: 100%; max-height: 190px; object-fit: contain; border: 1px solid var(--line); border-radius: 5px; margin: 8px 0; background: #f7f9fa; }
.media-picker .upload { font-size: 13px; }
.inline { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.inline button { min-height: 32px; }
.phone { max-width: 312px; margin: 18px auto; border: 9px solid #162328; border-radius: 31px; box-shadow: 0 5px 14px #14252a23; min-height: 460px; display: flex; flex-direction: column; overflow: hidden; }
.phone-brand { padding: 15px 14px 10px; border-bottom: 1px solid var(--line); font-weight: 750; }
.phone-content { padding: 15px; overflow-wrap: anywhere; flex: 1; }
.phone-content img { width: 100%; max-height: 250px; object-fit: contain; margin-bottom: 15px; display: block; }
.phone-content p { margin-top: 8px; line-height: 1.5; white-space: pre-line; }
.phone-content .preview-link { color: var(--accent); font-weight: 650; }
.phone-controls { justify-content: space-between; border-top: 1px solid var(--line); padding: 9px 11px; }
.single { padding: 24px; max-width: 850px; }
.single .field { max-width: 560px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 14px; margin-top: 18px; }
.media-card { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.media-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.media-card p { padding: 8px 10px; overflow-wrap: anywhere; font-size: 13px; }
.loading { padding: 24px; }
.login { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: #f4f8f8; }
.login-panel { width: min(100%, 410px); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 26px; }
.login-panel h1 { margin-top: 28px; }
.login-panel label { display: grid; gap: 6px; margin-bottom: 14px; }
.login-panel .error { margin-bottom: 14px; }
@media (max-width: 1180px) {
  .shell { grid-template-columns: 150px minmax(0,1fr); }
  .outline, .editor, .preview { padding: 17px; }
  .layout { grid-template-columns: minmax(173px, .82fr) minmax(250px, 1.32fr) minmax(185px, .9fr); }
  nav button { padding-left: 11px; }
  .outline-item img, .outline-item .blank { width: 44px; height: 42px; flex-basis: 44px; }
}
@media (max-width: 850px) {
  .shell { display: block; }
  nav { display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  nav button { width: auto; padding: 8px 12px; border: 0; border-bottom: 3px solid transparent; }
  nav button[aria-current] { border-bottom-color: var(--accent); }
  .top { padding: 13px 16px; flex-wrap: wrap; }
}
@media (max-width: 650px) {
  .layout { display: block; }
  .outline, .editor, .preview { border: 0; border-bottom: 1px solid var(--line); }
  .outline-list { display: flex; overflow-x: auto; padding: 3px; }
  .outline-item { flex: 0 0 155px; min-height: 52px; font-size: 13px; }
  .brand strong { font-size: 25px; }
  .brand span { font-size: 16px; }
  .actions { gap: 5px; }
  .actions button { padding: 7px 9px; }
  .status { order: 5; width: 100%; }
}
