:root {
  color-scheme: light;
  scrollbar-gutter: stable;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display-font: Georgia, "Times New Roman", serif;
  --ink: #252c21;
  --muted: #615749;
  --quiet: #716653;
  --paper: #f4ecdd;
  --desk: #ece3d3;
  --surface: #fef9ee;
  --soft: #f6eedd;
  --hover: #eee3cf;
  --line: #e4d8c0;
  --strong-line: #bba989;
  --forest: #252e23;
  --rail-active: #394437;
  --rail-line: #4c5748;
  --rail-text: #f7e5c0;
  --rail-muted: #d0c8af;
  --accent: #9f321b;
  --accent-dark: #7d2a19;
  --accent-soft: #f4e2d5;
  --gold: #d8a651;
  --ochre: #875e24;
  --positive: #365f43;
  --comparison: #89765d;
  --reels: #9f321b;
  --youtube: #875e24;
  --telegram: #386047;
  --threads: #6c4739;
  --accent-line: #e5ccb7;
  --mark-line: #ead3bb;
  --gold-soft: #f2e5c6;
  --green-soft: #e1e9d9;
  --threads-soft: #eee1d8;
  --demo-ink: #6c4c20;
  --demo-soft: #f1e2be;
  --demo-line: #e6d5ad;
  --work-ink: #6c4a1b;
  --work-soft: #f2e4c2;
  --ready-ink: #3b512b;
  --ready-soft: #e7ebd9;
  --published-ink: #2f5338;
  --published-soft: #dce9d9;
  --row-hover: #f8f0df;
  --calendar-today: #f5ead1;
  --rail-edge: #192117;
  --rail-hover: #303c2e;
  --brand-edge: #a96542;
  --brand-surface: #773722;
  --scrim: #191d1463;
  --inspector-scrim: #241f1528;
  --folio-shadow: 0 2px 4px #36260805, 0 14px 40px #3626080c;
  --radius-panel: 10px;
  --desk-inset: clamp(14px, 2.1vw, 31px);
  --gutter: clamp(27px, 3.9vw, 57px);
  --rail-width: 224px;
  --bar-height: 58px;
  scroll-padding-top: calc(var(--bar-height) + 10px);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4e5c8;
  --muted: #c9bda4;
  --quiet: #adab95;
  --paper: #20251d;
  --desk: #1a2018;
  --surface: #22271e;
  --soft: #2b3127;
  --hover: #353d30;
  --line: #3c4638;
  --strong-line: #65715e;
  --forest: #161c14;
  --rail-active: #2d3628;
  --rail-line: #394432;
  --rail-text: #f4e0b4;
  --rail-muted: #c7bea4;
  --accent: #f28563;
  --accent-dark: #ffa082;
  --accent-soft: #402c25;
  --gold: #e7b86c;
  --ochre: #dfb76f;
  --positive: #a6ce9e;
  --comparison: #b0aa8d;
  --reels: #f28563;
  --youtube: #e7b86c;
  --telegram: #9dc796;
  --threads: #c7b5a0;
  --accent-line: #745042;
  --mark-line: #634438;
  --gold-soft: #403723;
  --green-soft: #2c3c2d;
  --threads-soft: #3e372e;
  --demo-ink: #e8c687;
  --demo-soft: #42351e;
  --demo-line: #645132;
  --work-ink: #e8c687;
  --work-soft: #42351e;
  --ready-ink: #bfd2a0;
  --ready-soft: #35402c;
  --published-ink: #afcfa4;
  --published-soft: #2d3c2e;
  --row-hover: #2a3025;
  --calendar-today: #3d3324;
  --rail-edge: #121710;
  --rail-hover: #242e21;
  --brand-edge: #aa6047;
  --brand-surface: #713a2a;
  --scrim: #0b100ab9;
  --inspector-scrim: #0b100a84;
  --folio-shadow: 0 2px 5px #0a0f0860, 0 14px 40px #0a0f083f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root:has(dialog:modal, .mobile-nav-open) { overflow: hidden; }
body { margin: 0; background: var(--desk); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: fixed; z-index: 9; top: 12px; left: 12px; transform: translateY(-160%); background: var(--surface); padding: 12px; border-radius: 5px; }
.skip:focus { transform: none; }

.shell { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100dvh; }
.shell.rail-collapsed { --rail-width: 62px; }
.rail {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; align-items: stretch; padding: 19px 14px 14px;
  min-width: 0; overflow: auto; background: var(--forest); color: var(--rail-text); border-right: 1px solid var(--rail-edge);
}
.rail :focus-visible { outline-color: var(--gold); outline-offset: -2px; }
.brand { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 47px; padding: 4px 6px; border-radius: 6px; }
.brand b { display: block; font: 400 25px/.97 var(--display-font); letter-spacing: -.04em; }
.brand small { display: block; margin-top: 4px; color: var(--rail-muted); font-size: 10px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; position: relative; width: 36px; height: 36px; border: 1px solid var(--brand-edge); color: var(--rail-text); background: var(--brand-surface); border-radius: 8px; flex: none; }
.brand-mark i { display: block; width: 16px; height: 18px; position: absolute; border: 1px solid currentColor; border-radius: 2px; }
.brand-mark i:first-child { transform: translate(-3px,-1px) rotate(-9deg); opacity: .55; }
.brand-mark i:last-child { transform: translate(3px,1px); }
.navigation { display: grid; gap: 3px; padding-top: 11px; margin-top: 5px; }
.nav-link, .rail-link, .shortcut-link {
  display: flex; align-items: center; gap: 9px; min-height: 39px; width: 100%; text-align: start; padding: 0 9px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--rail-muted); font-size: 13px; font-weight: 590; white-space: nowrap;
}
.nav-link:hover, .rail-link:hover, .shortcut-link:hover { background: var(--rail-hover); color: var(--rail-text); }
.nav-link[aria-current="page"] { color: var(--rail-text); background: var(--rail-active); }
.nav-link[aria-current="page"] .icon { color: var(--gold); }
.rail-search { margin-top: 19px; border-color: var(--rail-line); min-height: 38px; }
.rail-key { margin-inline-start: auto; color: var(--rail-muted); font-family: inherit; font-size: 10px; line-height: 1.1; white-space: nowrap; }
.workspace-shortcuts { margin-top: 13px; }
.workspace-shortcuts:empty { display: none; }
.shortcut-group { padding-top: 11px; margin-top: 9px; border-top: 1px solid var(--rail-line); }
.shortcut-heading { color: var(--rail-muted); padding: 0 9px 5px; font-size: 11px; line-height: 1.3; font-weight: 600; letter-spacing: .01em; }
.shortcut-link { min-height: 31px; font-size: 12px; }
.shortcut-link .icon { width: 14px; height: 14px; }
.shortcut-label, .shortcut-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rail-bottom { margin-top: auto; padding-top: 18px; }
.rail-bottom .rail-link { border-top-color: var(--rail-line); border-radius: 0 0 6px 6px; }
.rail-collapsed .rail { padding-inline: 9px; }
.rail-collapsed :is(.brand, .nav-link, .rail-link) { justify-content: center; padding-inline: 0; }
.rail-collapsed :is(.brand-copy, .nav-label, .rail-key, .workspace-shortcuts) { display: none; }
.nav-scrim { display: none; }
.main { min-width: 0; }
.topbar {
  position: sticky; z-index: 2; top: 0; min-height: var(--bar-height); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px clamp(12px, 2.1vw, 32px); border-bottom: 1px solid var(--line); background: var(--surface);
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.breadcrumbs { min-width: 0; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.breadcrumbs #current-section { overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 650; }
.breadcrumbs > :not(#current-section) { flex: none; }
.crumb-chevron { color: var(--quiet); opacity: .7; }
.rail-toggle { color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 6px; display: grid; place-items: center; width: 32px; height: 34px; padding: 0; flex: none; }
.rail-toggle:hover { background: var(--soft); color: var(--ink); }
.mobile-brand { display: none; }
.top-actions, .control-group, .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.top-actions { flex: none; }
.topbar-actions { display: flex; flex: none; align-items: center; gap: 7px; }
.theme-toggle {
  display: grid; place-items: center; flex: none; width: 35px; height: 35px; padding: 0;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted);
}
.theme-toggle:hover { background: var(--soft); color: var(--accent-dark); }
:is(.theme-moon, :root[data-theme="dark"] .theme-sun) { display: none; }
:root[data-theme="dark"] .theme-moon { display: block; }
.desk { padding: var(--desk-inset); }
#screen {
  max-width: 1120px; min-height: calc(100dvh - var(--bar-height) - 2 * var(--desk-inset)); margin-inline: auto;
  padding: clamp(31px,3.4vw,49px) var(--gutter) 58px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--folio-shadow);
}
.hero { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.page-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 8px; border: 1px solid var(--mark-line); background: var(--accent-soft); color: var(--accent); margin-bottom: 13px; }
.page-icon .icon { width: 20px; height: 20px; }
.hero h1 { font: 400 clamp(34px,4.15vw,56px)/.99 var(--display-font); letter-spacing: -.035em; overflow-wrap: anywhere; }
.hero p { color: var(--muted); margin-top: 10px; line-height: 1.46; }
.date-note { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--quiet); font-size: 11px; overflow-wrap: anywhere; }
.date-note .icon { width: 14px; height: 14px; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 7px; border-radius: 7px; min-height: 35px; padding: 0 11px; font-weight: 640; font-size: 12px; line-height: 1.2; }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { color: var(--surface); border: 1px solid var(--accent-dark); background: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.secondary, .btn.icon-only { color: var(--ink); border: 1px solid var(--strong-line); background: transparent; }
.btn.secondary:hover, .btn.icon-only:hover, .btn.ghost:hover { background: var(--soft); color: var(--accent-dark); }
.btn.ghost { color: var(--accent-dark); background: transparent; border: 1px solid transparent; }
.btn.icon-only { width: 35px; padding: 0; }
.controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.segmented { display: inline-flex; align-items: stretch; flex-wrap: wrap; column-gap: 2px; row-gap: 3px; max-width: 100%; }
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 9px; min-height: 34px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 630; white-space: nowrap;
}
.segmented button .icon { width: 14px; height: 14px; }
.segmented button:hover { background: var(--soft); color: var(--ink); }
.segmented button[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-dark); }
.controls > .segmented[aria-label="Площадка"] {
  display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,.76fr) repeat(3,minmax(0,1fr));
  inline-size: min(100%, 380px);
}
.controls > .segmented[aria-label="Площадка"] button { min-width: 0; white-space: normal; text-align: center; }
.demo-label { display: inline-flex; width: fit-content; color: var(--demo-ink); background: var(--demo-soft); border: 1px solid var(--demo-line); border-radius: 3px; padding: 2px 6px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.surface { border: 1px solid var(--line); border-radius: var(--radius-panel); min-width: 0; background: var(--surface); }
.panel { padding: 18px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-header h2 { font: 400 22px/1.12 var(--display-font); letter-spacing: -.015em; }
.panel-header p { margin-top: 5px; color: var(--quiet); font-size: 12px; line-height: 1.4; }

.kpis {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: 16px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--paper);
}
.kpi { min-height: 112px; text-align: start; padding: 13px 14px; display: flex; flex-direction: column; align-items: flex-start; border: 0; border-inline-end: 1px solid var(--line); border-radius: 0; background: transparent; }
.kpi:last-child { border-inline-end: 0; }
.kpi:hover:not(:disabled), .kpi[aria-pressed="true"] { background: var(--soft); }
.kpi:focus-visible { outline-offset: -3px; }
.kpi[aria-pressed="true"] { box-shadow: inset 0 -2px var(--accent); }
.kpi-label { min-height: 22px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.kpi-symbol { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-dark); }
.kpi-symbol .icon { width: 14px; height: 14px; }
.kpi-symbol.reels { color: var(--reels); }
.kpi-symbol.youtube, .kpi-symbol.layers, .kpi-symbol.bookmark { background: var(--gold-soft); color: var(--ochre); }
.kpi-symbol.threads { background: var(--threads-soft); color: var(--threads); }
.kpi-symbol.telegram, .kpi-symbol.people { background: var(--green-soft); color: var(--positive); }
.kpi strong { display: block; max-width: 100%; margin-top: 8px; font-variant-numeric: tabular-nums; font-size: clamp(23px,2.5vw,32px); letter-spacing: -.045em; line-height: 1; overflow-wrap: anywhere; }
.kpi:disabled strong { font-size: clamp(16px,2vw,22px); }
.kpi-small { margin-top: 7px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; color: var(--quiet); font-size: 10px; line-height: 1.3; }
.delta { color: var(--positive); font-weight: 720; white-space: nowrap; }
.delta.down { color: var(--accent); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.86fr) minmax(238px,1fr); gap: 16px; margin-bottom: 16px; }
.legend { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 4px; font-size: 10px; color: var(--quiet); }
.legend span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 100%; background: var(--accent); }
.legend .previous i { background: var(--comparison); }
.plot-area { display: grid; grid-template-columns: max-content minmax(0,1fr); column-gap: 9px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; text-align: right; color: var(--quiet); font-size: 10px; font-variant-numeric: tabular-nums; transform: translateY(-5px); }
.plot { height: 175px; position: relative; background: repeating-linear-gradient(to bottom,var(--line) 0,var(--line) 1px,transparent 1px,transparent 25%); border-bottom: 1px solid var(--line); }
.plot svg { width: 100%; height: 100%; overflow: visible; }
.plot-marker { position: absolute; top: 0; width: 1px; height: 100%; border-left: 1px dashed var(--comparison); pointer-events: none; }
.plot-marker::after { content: ""; position: absolute; top: var(--point-y); left: -1px; transform: translate(-50%,-50%); width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--surface); background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plot-tooltip { position: absolute; top: 0; z-index: 1; min-width: 105px; padding: 7px 9px; border-radius: 6px; color: var(--rail-text); background: var(--forest); font-size: 10px; pointer-events: none; }
.plot-tooltip strong { display: block; margin-top: 3px; font-size: 12px; }
.x-axis { display: flex; justify-content: space-between; grid-column: 2; margin-top: 8px; color: var(--quiet); font-size: 10px; white-space: nowrap; }
.chart-foot, .channel-footer { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 12px; color: var(--quiet); font-size: 11px; line-height: 1.4; }
.channel-list { display: grid; gap: 5px; }
.channel-row { min-height: 41px; width: 100%; display: grid; grid-template-columns: 30px minmax(0,1fr) max-content; align-items: center; gap: 8px; padding: 4px; border: 1px solid transparent; border-radius: 4px; background: transparent; text-align: left; }
.channel-row:hover, .channel-row[aria-pressed="true"] { border-color: var(--line); background: var(--soft); }
.platform-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 4px; flex: none; vertical-align: middle; }
.platform-icon .icon { width: 16px; height: 16px; }
.platform-icon.reels { background: var(--accent-soft); color: var(--reels); }
.platform-icon.youtube { background: var(--gold-soft); color: var(--youtube); }
.platform-icon.telegram { background: var(--green-soft); color: var(--telegram); }
.platform-icon.threads { background: var(--threads-soft); color: var(--threads); }
.channel-name { display: block; margin-bottom: 5px; font-weight: 650; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-progress { display: block; height: 3px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.channel-progress i { display: block; height: 100%; background: var(--platform-color); border-radius: inherit; }
.channel-values { text-align: right; color: var(--quiet); font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.channel-values b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.metric-option { display: grid; gap: 3px; min-height: 39px; padding: 5px 7px; border: 1px solid transparent; border-radius: 4px; color: var(--muted); background: var(--soft); font-size: 10px; text-align: left; }
.metric-option b { color: var(--ink); font-size: 13px; }
.metric-option[aria-pressed="true"], .metric-option:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-dark); }
.metric-option:disabled b { font-size: 10px; color: var(--quiet); }

.table-wrap { position: relative; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th { padding: 9px 11px; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--paper); }
td { padding: 5px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--row-hover); }
td.numeric, th.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.numeric { font-weight: 620; }
.table-item { display: flex; align-items: center; gap: 8px; min-height: 35px; width: 100%; padding: 0; border: none; border-radius: 3px; background: transparent; text-align: left; }
.table-item:focus-visible, .cal-date:focus-visible { outline-offset: -2px; }
.table-item:hover .item-title { color: var(--accent-dark); }
.item-title { display: block; font-weight: 640; line-height: 1.28; overflow-wrap: anywhere; }
.item-sub { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.publications .panel-header { align-items: center; margin-bottom: 9px; }
.publications td:last-child { width: 25px; color: var(--quiet); }
.publications td:last-child .icon { width: 13px; height: 13px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 3px 2px; min-height: 34px; color: var(--accent-dark); background: transparent; border: none; font-size: 12px; font-weight: 650; }
.text-button .icon { width: 14px; height: 14px; }
.text-button:hover { text-decoration: underline; }
.empty { padding: 19px 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.studio-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); gap: 24px; align-items: start; }
.studio-grid .panel { padding: 0; border: 0; border-radius: 0; background: transparent; }
.studio-grid .editor-panel { padding-inline-start: 24px; border-inline-start: 1px solid var(--line); }
.studio-grid .panel-header { margin-bottom: 14px; }
.library-toolbar { display: grid; gap: 8px; margin-bottom: 9px; }
.library-search { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; }
.library-search:has(.filter-select) { grid-template-columns: minmax(0,1fr) minmax(8.25rem,42%); }
.library-search .filter-select { width: 100%; }
.library-meta, .library-pages { color: var(--quiet); font-size: 11px; line-height: 1.4; }
.library-results { display: grid; border-top: 1px solid var(--line); }
.library-card { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; padding: 10px 6px; border: none; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.library-card:hover { background: var(--soft); }
.library-title { display: block; font-size: 13px; line-height: 1.4; font-weight: 650; overflow-wrap: anywhere; }
.library-card small { display: block; margin-top: 4px; color: var(--ochre); font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.library-card .library-detail { color: var(--muted); font-size: 11px; }
.library-card > .icon { color: var(--accent); width: 15px; height: 15px; }
.library-pages { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; }
.library-pages .actions { display: grid; grid-template-columns: repeat(2,35px); }
.library-pages [data-value="-1"] { grid-column: 1; }
.library-pages [data-value="1"] { grid-column: 2; }
.field { display: grid; gap: 6px; min-width: 0; margin-bottom: 13px; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 640; }
.field input, .field textarea, .field select, .filter-select, .search-field {
  width: 100%; min-width: 0; min-height: 36px; border: 1px solid var(--strong-line); border-radius: 6px;
  padding: 7px 9px; background: var(--surface); color: var(--ink);
}
.field textarea { min-height: 64px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder, .search-field::placeholder { color: var(--quiet); }
.field select, .filter-select {
  -webkit-appearance: none;
  appearance: none;
  padding-inline-end: 32px;
  background-image:
    linear-gradient(45deg, transparent 36%, var(--quiet) 43% 57%, transparent 64%),
    linear-gradient(-45deg, transparent 36%, var(--quiet) 43% 57%, transparent 64%);
  background-position: right 17px center, right 12px center;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  cursor: pointer;
  text-overflow: ellipsis;
}
@media (hover: hover) {
  .field select:hover:enabled, .filter-select:hover:enabled { background-color: var(--soft); }
}
.filter-select { width: auto; max-width: 100%; font-size: 12px; font-weight: 620; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 5px; }
.editor-footer p, .editor-sources { color: var(--quiet); font-size: 11px; }
.editor-sources { margin-bottom: 10px; line-height: 1.45; overflow-wrap: anywhere; }

.plan-panel { padding: 0; }
.database-toolbar { gap: 10px; margin: 0; padding: 8px 9px; border-bottom: 1px solid var(--line); }
.database-filters { gap: 6px; }
.database-filters .filter-select { inline-size: 8.5rem; }
.plan-summary { padding: 11px 12px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 11px; }
.plan-summary:empty { display: none; }
.plan-table-item { gap: 9px; }
.plan-item-copy { min-width: 0; }
.plan-file { display: grid; place-items: center; color: var(--accent); }
.plan-title-cell { width: 47%; }
.plan-title-cell > .icon, .plan-open-icon { color: var(--quiet); }
.plan-open-icon { margin-inline-start: auto; display: inline-flex; opacity: .65; }
.plan-table-item:hover .plan-open-icon { color: var(--accent); opacity: 1; }
.plan-platform-tag { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.plan-platform-tag .platform-icon { width: 22px; height: 22px; }
.plan-platform-tag .platform-icon .icon { width: 13px; height: 13px; }
.plan-mobile-platform { display: none; }
.plan-demo { font-size: 10px; color: var(--quiet); }
.plan-date-cell { color: var(--muted); white-space: nowrap; font-size: 12px; }
.status { display: inline-flex; align-items: center; width: fit-content; border-radius: 3px; background: var(--hover); padding: 3px 6px; color: var(--muted); font-size: 11px; font-weight: 640; white-space: nowrap; }
.status.work { background: var(--work-soft); color: var(--work-ink); }
.status.ready { background: var(--ready-soft); color: var(--ready-ink); }
.status.planned { background: var(--accent-soft); color: var(--accent-dark); }
.status.published { background: var(--published-soft); color: var(--published-ink); }
.cards-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 11px; }
.plan-card { display: flex; flex-direction: column; justify-content: space-between; gap: 9px; min-height: 106px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); text-align: left; }
.plan-card:hover { border-color: var(--strong-line); background: var(--soft); }
.plan-card-top, .plan-card-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 5px; width: 100%; color: var(--muted); font-size: 11px; }
.plan-card-bottom .item-sub { margin: 0; }
.plan-calendar-header { align-items: center; padding: 10px 11px; margin: 0; }
.calendar-tools { display: flex; gap: 4px; align-items: center; flex: none; }
.calendar-tools .btn { min-height: 32px; }
.calendar-tools .icon-only { width: 30px; }
.calendar { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); border-top: 1px solid var(--line); }
.weekday { text-align: right; padding: 7px; color: var(--muted); font-size: 11px; background: var(--soft); border: solid var(--line); border-width: 0 1px 1px 0; }
.cal-day { min-height: 88px; padding: 3px 4px 5px; border: solid var(--line); border-width: 0 1px 1px 0; }
.calendar > :nth-child(7n) { border-right: 0; }
.cal-day.today { background: var(--calendar-today); }
.cal-day.outside { background: var(--paper); }
.cal-top { text-align: right; margin-bottom: 3px; }
.cal-date { min-width: 27px; min-height: 26px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 11px; }
.cal-date:hover { background: var(--hover); color: var(--accent-dark); }
.today .cal-date { color: var(--accent); font-weight: 740; }
.cal-event { display: flex; align-items: center; gap: 4px; width: 100%; padding: 4px; margin-bottom: 3px; min-height: 24px; border: 0; border-radius: 3px; background: var(--soft); color: var(--ink); text-align: left; }
.cal-event:hover { background: var(--hover); }
.cal-event i, .calendar-dots i { width: 5px; height: 5px; flex: none; border-radius: 100%; background: var(--platform-color); }
.cal-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.cal-date-mobile, .calendar-hint-mobile { display: none; }
.unscheduled { display: grid; gap: 5px; padding: 11px; }
.unscheduled h3 { font-size: 13px; }

dialog { width: min(540px,calc(100% - 24px)); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border: 1px solid var(--strong-line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 16px 54px #20190933; }
dialog::backdrop { background: var(--scrim); }
.dialog-body { padding: 19px; }
.dialog-head { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 8px 13px; margin-bottom: 15px; }
.dialog-head h2 { margin-top: 2px; font: 400 clamp(22px,3vw,29px)/1.06 var(--display-font); letter-spacing: -.02em; overflow-wrap: anywhere; }
.dialog-head p { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.dialog-page-header { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 7px; }
.dialog-body .actions { margin-top: 12px; }
.connection-list { display: grid; gap: 5px; }
.connection { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.connection h3 { font-size: 13px; margin-bottom: 2px; }
.connection p { color: var(--muted); font-size: 11px; line-height: 1.35; }
.connection .status { font-size: 10px; }
.detail-heading { padding-top: 16px; border-top: 1px solid var(--line); margin-top: 16px; margin-bottom: 8px; }
.detail-heading h2 { font-size: 15px; }
.detail-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.detail-metric { padding: 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.detail-metric b { display: block; margin-top: 4px; color: var(--ink); font-size: 15px; }
.selection-note { padding: 9px; border-left: 2px solid var(--gold); background: var(--soft); color: var(--muted); font-size: 12px; line-height: 1.4; }
#toast { position: fixed; z-index: 5; bottom: 15px; right: 15px; max-width: calc(100% - 30px); padding: 10px 13px; border: 1px solid var(--rail-line); border-radius: 4px; background: var(--forest); color: var(--rail-text); opacity: 0; transform: translateY(5px); pointer-events: none; transition: opacity .16s ease, transform .16s ease; font-size: 12px; }
#toast.visible { opacity: 1; transform: none; }

@media (max-width: 1040px) {
  :root { --rail-width: 179px; --gutter: 25px; }
  .dashboard-grid { grid-template-columns: minmax(0,1.55fr) minmax(212px,1fr); }
  .panel { padding: 13px; }
}
@media (max-width: 850px) {
  :root { --rail-width: 148px; --gutter: 19px; }
  .rail { padding-inline: 8px; }
  .brand small { font-size: 9px; }
  .dashboard-grid { grid-template-columns: minmax(0,1fr); }
  .studio-grid { gap: 14px; }
  .studio-grid .editor-panel { padding-inline-start: 14px; }
  .library-search:has(.filter-select) { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 720px) {
  :root { --gutter: 15px; --desk-inset: 0px; --bar-height: 53px; }
  .shell, .shell.rail-collapsed { display: block; }
  .rail { display: none; position: fixed; top: 0; bottom: 0; left: 0; z-index: 5; width: min(245px,85vw); height: 100dvh; padding: 14px 11px calc(11px + env(safe-area-inset-bottom)); }
  .mobile-nav-open .rail { display: flex; }
  .mobile-nav-open .rail :is(.brand, .nav-link, .rail-link) { justify-content: flex-start; padding-inline: 9px; }
  .mobile-nav-open .rail :is(.brand-copy,.nav-label) { display: block; }
  .mobile-nav-open .rail .workspace-shortcuts:not(:empty) { display: block; }
  .rail-key { display: none; }
  .nav-scrim { display: block; position: fixed; z-index: 4; inset: 0; width: 100%; height: 100%; border: 0; background: var(--scrim); }
  .mobile-brand { display: inline-flex; }
  .desktop-crumb { display: none; }
  .mobile-brand { font: 400 16px/1 var(--display-font); color: var(--ink); }
  .breadcrumbs { gap: 6px; font-size: 11px; }
  .topbar { padding-inline: 8px; }
  .top-actions { gap: 4px; }
  .topbar-actions { gap: 5px; }
  .theme-toggle { width: 44px; height: 44px; }
  .rail-toggle, .btn.icon-only { width: 44px; }
  .btn, .rail-toggle, .filter-select, .text-button { min-height: 44px; }
  .field input, .field textarea, .field select, .filter-select, .search-field { min-height: 44px; font-size: 16px; }
  .nav-link, .rail-link, .shortcut-link, .channel-row, .metric-option, .table-item { min-height: 44px; }
  #screen { padding-top: 24px; padding-bottom: calc(38px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; box-shadow: none; }
  .hero { display: block; padding-bottom: 15px; margin-bottom: 12px; }
  .hero h1 { font-size: clamp(34px,7.4vw,42px); }
  .hero p { font-size: 13px; margin-top: 6px; }
  .page-icon { width: 29px; height: 29px; margin-bottom: 8px; }
  .page-icon .icon { width: 17px; height: 17px; }
  .date-note { margin-top: 9px; }
  .controls { gap: 7px; margin-bottom: 10px; }
  .segmented button { padding-inline: 7px; min-height: 44px; font-size: 11px; }
  .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 10px; }
  .kpi { min-height: 98px; padding: 10px; }
  .kpi:nth-child(even) { border-inline-end: 0; }
  .kpi:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .kpi strong { font-size: clamp(20px, 6vw, 25px); }
  .dashboard-grid { gap: 8px; margin-bottom: 9px; }
  .plot { height: 145px; }
  .table-secondary { display: none; }
  .plan-mobile-platform { display: block; }
  .plan-title-cell { width: auto; }
  td, th { padding-inline: 5px; }
  .studio-grid { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .studio-grid .editor-panel { padding: 17px 0 0; border: solid var(--line); border-width: 1px 0 0; }
  .library-search:has(.filter-select) { grid-template-columns: minmax(0,1fr) minmax(9.75rem,42%); }
  .library-pages .actions { grid-template-columns: repeat(2,44px); }
  .database-toolbar { margin: 0; padding: 5px; }
  .database-filters .filter-select { inline-size: 10rem; }
  .cards-grid { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 7px; }
  .plan-calendar-header { flex-wrap: wrap; }
  .calendar-tools .icon-only { width: 44px; }
  .calendar-tools .btn { min-height: 44px; }
  .calendar-hint-desktop, .calendar .cal-event, .calendar .cal-date:not(.cal-date-mobile) { display: none; }
  .calendar-hint-mobile { display: inline; }
  .cal-day { min-height: 51px; padding: 0 2px; }
  .cal-top { margin: 0; text-align: center; }
  .calendar .cal-date-mobile { display: flex; flex-direction: column; width: 100%; align-items: center; justify-content: center; gap: 5px; min-height: 48px; padding: 0; }
  .calendar-dots { display: flex; justify-content: center; align-items: center; gap: 2px; height: 5px; }
  .calendar-dots b { font-size: 8px; }
}
@media (max-width: 390px) {
  :root { --gutter: 13px; }
  .breadcrumbs { gap: 4px; }
  .top-actions > .btn { padding-inline: 6px; }
  .top-actions .btn .icon { width: 14px; height: 14px; }
  .top-actions .btn.secondary .icon { display: none; }
  .hero h1 { font-size: 34px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .segmented button { padding-inline: 5px; }
  .controls > .segmented[aria-label="Площадка"] { display: grid; grid-template-columns: 1.22fr .8fr 1fr 1fr .9fr; width: 100%; }
  .controls > .segmented[aria-label="Площадка"] button { min-width: 0; white-space: normal; font-size: 10px; padding-inline: 3px; text-align: center; }
  .controls .control-group:has(.segmented[aria-label="Период"]) { inline-size: 100%; }
  .controls .segmented[aria-label="Период"] { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); flex: 1; }
  .controls .segmented[aria-label="Период"] button { min-width: 0; white-space: normal; padding-inline: 3px; }
  .plan-date-cell { white-space: normal; }
}
@media (max-width: 640px) {
  .database-toolbar { display: grid; grid-template-columns: minmax(0,1fr); }
  .database-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .database-filters .filter-select { inline-size: 100%; }
}
@media (max-width: 380px) {
  .database-filters { grid-template-columns: minmax(0,1fr); }
  .library-search:has(.filter-select) { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 365px) {
  .breadcrumbs .mobile-brand, .breadcrumbs .crumb-chevron { display: none; }
  .plan-calendar-header { display: grid; grid-template-columns: minmax(0,1fr); }
  .plan-calendar-header .calendar-tools { justify-self: start; }
}
@media (forced-colors: active) {
  .field select, .filter-select { -webkit-appearance: auto; appearance: auto; padding-inline-end: 9px; background-image: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.rail-head { display: flex; align-items: center; }
.rail-close { display: none; }
.plan-inline-platform { color: var(--muted); font-size: 10px; }
.plan-item-meta:empty { display: none; }
.plan-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.plan-item-meta:has(> .plan-mobile-platform:only-child) { margin-top: 0; }
@media (max-width: 720px) {
  .rail-close { display: grid; color: var(--rail-muted); }
  .rail-close:hover { color: var(--rail-text); background: var(--rail-active); }
  .plan-title-cell .plan-open-icon { display: none; }
}
