:root {
  --bg: #f5f7f8;
  --surface: #fff;
  --ink: #142629;
  --muted: #627377;
  --edge: #e1e9e9;
  --frame: #132529;
  --accent: #136c5c;
  --accent-hover: #0e594c;
  --pale: #dff3ed;
  --amber: #835813;
  --warn: #fff0cf;
  color: var(--ink);
  background: var(--bg);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, summary, select { cursor: pointer; }
:focus-visible { outline: 3px solid #2bb99b; outline-offset: 3px; }
.skip { position: fixed; z-index: 20; left: 10px; top: -60px; padding: 10px; background: white; }
.skip:focus { top: 10px; }
.loading { display: grid; min-height: 100vh; place-items: center; color: var(--muted); }
.layout { display: grid; min-height: 100vh; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--frame); color: #d2e0e0; display: flex; flex-direction: column; padding: 26px 15px 15px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 0 8px; flex-shrink: 0; }
.brand img { width: 43px; height: 43px; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.5px; line-height: 1.25; color: #f2f8f6; }
.brand small { font-size: 12px; color: #a4b8b8; }
nav { flex: 1; overflow: auto; margin: 30px 0 18px; }
.nav-group { margin: 0 0 16px; }
.nav-group > p { margin: 0 10px 6px; color: #a4b8b8; font-size: 10px; text-transform: uppercase; letter-spacing: .13em; font-weight: 700; }
.nav-group a { display: flex; text-decoration: none; font-size: 13px; align-items: center; gap: 11px; height: 38px; padding: 0 10px; margin: 2px 0; border-radius: 7px; color: #d0dddd; }
.nav-group a:hover { background: #20383d; }
.nav-group a[aria-current="page"] { background: #284743; color: #a5f2dc; font-weight: 650; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
.account { border-top: 1px solid #34494d; padding: 14px 0 0 4px; display: flex; align-items: center; gap: 9px; }
.account > div:nth-child(2) { flex: 1; min-width: 0; }
.account strong, .account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: 13px; color: white; }
.account small { font-size: 11px; margin-top: 3px; color: #a4b8b8; }
.account button, .icon-button { border: 0; border-radius: 8px; display: grid; place-items: center; width: 36px; aspect-ratio: 1; background: transparent; color: inherit; padding: 0; }
.account button:hover { background: #263a3f; }
.icon-button:hover { background: #e9f1ef; }
.avatar { display: grid; width: 34px; height: 34px; border-radius: 50%; place-items: center; color: #092d27; background: #93dfcb; font-size: 12px; font-weight: 750; flex-shrink: 0; }
.main { min-width: 0; }
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--edge); background: var(--surface); }
.breadcrumb, .top-tools { display: flex; gap: 11px; align-items: center; }
.breadcrumb { font-size: 13px; color: var(--muted); }
.breadcrumb strong { color: var(--ink); }
.separator { color: #9babaf; }
.environment { color: var(--accent); background: #e8f5ef; font-size: 12px; padding: 6px 9px; border-radius: 6px; font-weight: 650; }
.environment.test { color: var(--amber); background: var(--warn); }
.mobile { display: none; }
main { max-width: 1500px; margin: auto; padding: 31px 32px 48px; }
.page-head { display: flex; gap: 20px; justify-content: space-between; align-items: end; margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(29px, 3.2vw, 42px); letter-spacing: -.045em; line-height: 1.1; }
h2 { margin-bottom: 6px; font-size: 19px; letter-spacing: -.025em; }
h3 { margin-bottom: 7px; font-size: 14px; }
p { line-height: 1.5; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 37px; border-radius: 7px; padding: 8px 13px; background: white; color: var(--ink); border: 1px solid #d5e0e0; font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.button:hover { background: #f0f7f5; }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-hover); }
.button[disabled] { opacity: .6; cursor: wait; }
.button.small { min-height: 31px; font-size: 12px; padding: 5px 10px; }
.button .icon { width: 15px; height: 15px; }
.wide { width: 100%; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 19px; }
.stat { display: grid; text-decoration: none; padding: 16px; border: 1px solid var(--edge); border-radius: 12px; background: white; gap: 7px; min-height: 117px; }
.stat:hover { border-color: #9bc0b9; }
.stat div { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat div .icon { width: 17px; color: var(--accent); }
.stat strong { font-size: 31px; letter-spacing: -.06em; line-height: 1; }
.stat small { color: var(--muted); font-size: 12px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: 12px; min-width: 0; overflow: hidden; margin-bottom: 16px; }
.panel-head { padding: 17px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2, .panel-head p { margin-bottom: 0; }
.task-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.task-list > article { display: grid; gap: 3px; justify-items: start; padding: 12px 18px; border-top: 1px solid var(--edge); }
.guide { padding: 0 18px 16px; }
.guide ol { padding-left: 20px; margin: 0 0 8px; line-height: 1.65; }
.list-toolbar { margin-bottom: 13px; display: flex; gap: 8px; }
.list-toolbar input { max-width: 330px; }
.catalog-tools { flex-wrap: wrap; gap: 12px; }
.catalog-tools label:first-child { flex: 0 1 175px; }
.catalog-tools label:last-child { flex: 1 1 230px; }
.catalog-tools input { max-width: 520px; }
.catalog-pages { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 15px; border-top: 1px solid var(--edge); color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 15px; border-bottom: 1px solid #e8eeee; vertical-align: middle; }
th { background: #f9fbfb; border-top: 1px solid #eef2f2; color: #4a6061; font-size: 11px; letter-spacing: .025em; font-weight: 700; white-space: nowrap; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfa; }
.row-link { text-align: left; color: var(--accent); border: 0; padding: 0; background: transparent; font-weight: 720; }
.row-link:hover { text-decoration: underline; }
.secondary { display: block; font-size: 12px; margin-top: 4px; color: var(--muted); }
.code { color: #415758; font-size: 11px; letter-spacing: .035em; font-family: "IBM Plex Mono", Consolas, monospace; }
.badge { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; background: #e9eeee; color: #455b5d; padding: 4px 8px; font-size: 11px; font-weight: 690; }
.badge::before { content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.badge.green { background: var(--pale); color: #146451; }
.badge.amber { background: var(--warn); color: var(--amber); }
.badge.red { background: #fce8e7; color: #963b35; }
.badge.blue { background: #e6effc; color: #305c89; }
.activity, .queue { list-style: none; padding: 0 17px 4px; margin: 0; }
.activity li, .queue li { display: flex; align-items: start; gap: 10px; padding: 12px 0; border-top: 1px solid var(--edge); font-size: 13px; }
.activity li .icon { color: #518174; width: 16px; }
.activity p, .queue p { margin: 0; line-height: 1.3; }
.queue li { justify-content: space-between; align-items: center; }
.queue > li > div { min-width: 0; }
.empty { padding: 26px 16px; color: var(--muted); text-align: center; }
.errors { color: #942e2a; }
.section-note { font-size: 13px; line-height: 1.5; background: #f0f7f6; border-radius: 7px; padding: 11px 13px; margin-bottom: 15px; color: #305452; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 25px; background: radial-gradient(ellipse at 18% 0%, #deefea 0, transparent 53%), var(--bg); }
.login-card { background: white; border: 1px solid var(--edge); padding: 30px; border-radius: 15px; width: min(440px, 100%); box-shadow: 0 12px 32px #14262913; }
.login-brand { padding: 0; margin-bottom: 28px; }
.login-brand strong { color: var(--ink); }
.login-brand small { color: var(--muted); }
.login-card > p { color: var(--muted); font-size: 14px; }
form { display: grid; gap: 12px; }
label { font-size: 13px; font-weight: 630; color: #2f4547; }
label input, label textarea, label select { margin-top: 5px; }
input, textarea, select { width: 100%; min-height: 37px; background: #fff; border: 1px solid #ccdcdc; border-radius: 7px; padding: 8px 10px; color: var(--ink); font-size: 14px; }
input[type=checkbox] { width: 17px; min-height: 17px; margin-right: 7px; vertical-align: middle; }
input[type=file] { min-width: 0; }
textarea { min-height: 72px; resize: vertical; }
select { min-width: 0; }
dialog { width: min(760px, calc(100vw - 28px)); max-height: 92vh; padding: 0; border: 1px solid var(--edge); border-radius: 13px; box-shadow: 0 20px 82px #0615184d; }
dialog::backdrop { background: #14272b72; }
.dialog-shell { padding: 18px 22px 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; gap: 12px; }
.dialog-head h2 { font-size: 23px; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.span { grid-column: 1 / -1; }
.lines { border: 1px solid var(--edge); border-radius: 9px; padding: 10px; }
.lines h3 { margin: 3px 4px 7px; }
.field-row { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; padding: 7px 4px; }
.field-row > label { flex: 1 1 105px; }
.field-row > label:first-child { flex-basis: 185px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 8px; padding-top: 8px; }
.error { background: #fce9e7; color: #8d2924; border-radius: 6px; font-size: 13px; padding: 10px; }
#notice { position: fixed; z-index: 10; bottom: 20px; right: 20px; max-width: min(460px, calc(100vw - 40px)); white-space: pre-line; background: #203f38; color: white; padding: 13px 15px; font-size: 14px; border-radius: 9px; box-shadow: 0 4px 15px #1426292e; }
#notice.fail { background: #84322e; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 12px; margin: 12px 0; }
.meta div { padding: 8px 10px; border: 1px solid var(--edge); border-radius: 7px; overflow-wrap: anywhere; }
.meta dt { font-size: 11px; font-weight: 650; color: var(--muted); }
.meta dd { margin: 3px 0 0; font-size: 14px; white-space: pre-line; }
.detail-actions { margin: 13px 0; }
.detail-subsection { margin: 15px 0; }
.multiline { white-space: pre-wrap; overflow-wrap: anywhere; }
.source-status { color: #305452; font-size: 13px; margin: 9px 4px; }
.detail-subsection table { border: 1px solid var(--edge); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 1050px) {
  .layout { grid-template-columns: 209px minmax(0, 1fr); }
  main, .topbar { padding-right: 22px; padding-left: 22px; }
  .overview-grid { grid-template-columns: 1fr; gap: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .layout { display: block; }
  .sidebar { display: none; position: fixed; z-index: 8; top: 56px; left: 0; width: 242px; height: calc(100dvh - 56px); }
  .sidebar.open { display: flex; }
  .topbar { position: sticky; top: 0; z-index: 7; height: 56px; padding: 0 12px; }
  .breadcrumb { margin-right: auto; }
  .top-tools { gap: 3px; }
  .mobile { display: grid; }
  main { padding: 21px 13px 32px; }
  .page-head { align-items: start; flex-direction: column; gap: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  th, td { padding: 9px 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .dialog-shell { padding: 12px; }
}
.calculation { --calc-line: #dce8e7; --calc-input: #fff; padding-bottom: 4px; }
.main:has(.calculation) > main { max-width: none; padding: 22px 22px 24px; }
.calc-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 13px; }
.calc-heading h1 { font-size: clamp(24px, 2.8vw, 33px); margin: 0 0 3px; }
.calc-heading p, .calc-section p { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.calc-heading p { margin: 0; }
.calc-body, .calc-section { padding: 14px; }
.calc-project, #calc-panel { background: white; border: 1px solid var(--calc-line); border-radius: 9px; }
.calc-project { padding: 11px 13px; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 9px 11px; }
.calc-field { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 4px;
  align-content: start; color: var(--ink); }
.calc-field > span, .calc-choose label, .calc-related label { font-size: 11px; color: var(--muted); font-weight: 650; }
.calc-field input, .calc-field select, .calc-value { min-height: 34px; }
.calc-value { padding: 6px 8px; background: #f3f7f6; border: 1px solid #e8efee; border-radius: 5px;
  font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.calc-value .button { margin-top: 4px; max-width: 100%; white-space: normal; }
.calc-related, .calc-choose { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.calc-related { margin-top: 9px; }
.calc-choose label, .calc-related label { display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 4px; flex: 0 1 280px; min-width: min(250px, 100%); max-width: 100%; }
.calc-tabs { display: flex; gap: 4px; overflow-x: auto; margin: 11px 0 0; }
.calc-tabs button { white-space: nowrap; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0;
  min-height: 37px; background: transparent; padding: 7px 10px; color: var(--muted); font-size: 12px; font-weight: 650; }
.calc-tabs button:hover { color: var(--accent); background: #eef5f3; }
.calc-tabs button[aria-selected="true"] { background: white; border-color: var(--calc-line); color: var(--accent);
  box-shadow: inset 0 3px var(--accent); }
#calc-panel { border-top-left-radius: 0; min-height: 240px; }
.calc-section h2 { font-size: 18px; margin: 0 0 3px; }
.calc-section-head { display: flex; align-items: start; justify-content: space-between; gap: 8px;
  flex-wrap: wrap; margin-bottom: 7px; }
.calc-section-head:not(:first-child) { margin-top: 17px; }
.calc-section-head p { margin: 0; }
.calc-table-wrap { overflow: auto; min-width: 0; width: 100%; max-height: 60vh;
  border: 1px solid var(--calc-line); border-radius: 6px; }
.calc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.calc-table :is(th,td) { min-width: 70px; padding: 5px 7px; border-bottom: 1px solid #e9f0ef; border-right: 1px solid #ecf1f0; }
.calc-table thead th { position: sticky; top: 0; z-index: 1; background: #e8f1ef; text-transform: none;
  font-size: 11px; letter-spacing: 0; line-height: 1.25; color: #35514e; font-weight: 700; }
.calc-table th:first-child { position: sticky; left: 0; min-width: 230px; z-index: 1; }
.calc-table thead th:first-child { z-index: 3; }
.calc-table thead .calc-band th { height: 28px; background: #dceae7; }
.calc-raw thead tr:nth-child(2) th { top: 28px; }
.calc-table tbody th { background: white; text-transform: none; letter-spacing: 0; }
.calc-table tbody tr:nth-child(even) :is(td,th) { background: #f8fbfa; }
.calc-table tbody tr:hover :is(td,th) { background: #edf7f4; }
.calc-table td { min-width: 84px; text-align: right; white-space: nowrap; }
.calc-table td:last-child, .calc-table thead th:last-child { min-width: 35px; }
.calc-table :is(input, select) { margin: 0; min-height: 29px; min-width: 68px; max-width: 100%;
  padding: 4px 5px; font-size: 12px; text-align: right; border-radius: 4px; background: var(--calc-input); }
.calc-table input.calc-article { text-align: left; min-width: 218px; }
.calc-table input[data-line-field="vendor"], .calc-table select { text-align: left; min-width: 112px; }
.calc-table :is(input, select):focus { border-color: var(--accent); }
.calc-table small { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.calc-table tfoot :is(th, td) { background: #e9f4f1; font-weight: 700; border-bottom: 0; }
.calc-table tfoot td:last-child { text-align: left; }
.calc-table-wrap:has(.calc-raw) { min-height: 110px; }
.calc-remove { border: 0; background: transparent; color: #873636; font-size: 19px; line-height: 1;
  width: 26px; height: 29px; border-radius: 4px; }
.calc-remove:hover { background: #fbe8e6; }
.calc-add { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin: 8px 0 13px; }
.calc-add > span { font-size: 11px; color: var(--muted); margin-right: 2px; }
.calc-section > .calc-field, .calc-totals, .calc-note { margin-top: 12px; }
.calc-footer { display: flex; justify-content: space-between; align-items: center; gap: 9px; flex-wrap: wrap;
  position: sticky; z-index: 5; bottom: 0; background: #f9fcfb; border: 1px solid var(--calc-line);
  border-radius: 8px; padding: 9px 11px; margin-top: 10px; }
.calc-footer-values { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.calc-footer .calc-value { padding: 0; border: 0; background: transparent; min-height: 16px; font-size: 14px; }
.calc-footer .calc-field { padding-right: 6px; }
.calc-status { font-size: 12px; }
.calc-status small { display: block; color: var(--muted); }
.calculation[data-dirty="true"] .calc-output { visibility: hidden; }
.calc-totals { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.calc-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.calc-flow section { background: #f6f9f8; padding: 12px; border: 1px solid var(--calc-line); border-radius: 7px; }
.calc-flow .badge { margin-left: 6px; }
.calc-flow .actions { margin-top: 8px; }
.calc-issues { list-style: none; padding: 0; margin: 8px 0; }
.calc-issues li { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--calc-line); }
.layout:has(.calc-expanded) { grid-template-columns: minmax(0, 1fr); }
.layout:has(.calc-expanded) .sidebar { display: none; }
.calc-expanded .calc-table-wrap { max-height: 72vh; }
@media (max-width: 700px) {
  .main:has(.calculation) > main { padding: 13px; }
  .main:has(.calculation) .breadcrumb { flex: 1; min-width: 0; }
  .main:has(.calculation) .breadcrumb > span { display: none; }
  .main:has(.calculation) .breadcrumb strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .calc-heading, .calc-footer { align-items: start; }
  .calc-heading { flex-direction: column; }
  .calculation .actions { max-width: 100%; }
  .calculation .actions .button { max-width: 100%; white-space: normal; }
  .calc-footer-values { margin-left: 0; max-width: 100%; flex-wrap: wrap; }
  .calc-table-wrap { max-height: 55vh; }
  .calc-table th:first-child { min-width: 160px; }
  .calc-table input.calc-article { min-width: 148px; }
}
