:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  --ink: #152522;
  --muted: #506660;
  --dark: #13221f;
  --paper: #f4f7f4;
  --surface: #fff;
  --line: #dce5df;
  --green: #0b684c;
  --green-light: #e2f2e8;
  --amber: #805000;
  --red: #ac312a;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 2px solid #238766; outline-offset: 3px; }
[hidden] { display: none !important; }
.layout { display: grid; grid-template-columns: 228px minmax(0,1fr); min-height: 100vh; }
.sidebar { background: var(--dark); color: #f1fbf4; display: flex; flex-direction: column; gap: 38px; padding: 29px 16px 19px; position: sticky; top: 0; height: 100vh; }
.brand { color: #f5fdf8; text-decoration: none; display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 730; padding: 0 10px; line-height: 1.14; }
.brand small, .workspace small { display: block; color: #a2b9af; font-weight: 400; font-size: 12px; margin-top: 5px; }
.brand-icon { width: 38px; height: 38px; border-radius: 11px; background: #9be1bc; display: grid; grid-template-columns: repeat(2, 6px); gap: 3px; place-content: center; flex: none; }
.brand-icon i { width: 6px; height: 6px; border-radius: 1px; background: var(--dark); }
.brand-icon i:last-child { opacity: .42; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 8px; color: #c6d7ce; text-decoration: none; font-size: 14px; white-space: nowrap; }
.sidebar nav a:hover { background: #243833; color: #fff; }
.sidebar nav a[aria-current="page"] { background: #29483d; color: #d0f2dd; font-weight: 650; }
.nav-icon { color: #99d1b1; width: 20px; text-align: center; font-size: 18px; line-height: 1; }
.workspace { margin-top: auto; display: flex; align-items: flex-start; gap: 10px; padding: 14px 10px 2px; border-top: 1px solid #355048; font-size: 13px; }
.indicator { width: 8px; height: 8px; flex: none; background: #9be1bc; border-radius: 50%; margin-top: 6px; }
main { min-width: 0; }
.topbar { height: 62px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px,4vw,48px); color: var(--muted); font-size: 13px; }
.main-content { max-width: 1480px; margin: 0 auto; padding: 34px clamp(18px,4vw,48px) 64px; }
.page-head, .panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; }
.page-head { margin-bottom: 24px; align-items: end; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(32px,4vw,43px); letter-spacing: -.045em; line-height: 1.08; font-weight: 730; }
h2 { font-size: 17px; letter-spacing: -.012em; }
h3 { font-size: 14px; }
.page-head p { margin-top: 8px; color: var(--muted); font-size: 14px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); text-decoration: none; font-weight: 620; font-size: 13px; white-space: nowrap; }
.button:hover { background: #eef4f0; border-color: #b2c9ba; }
.button.primary { background: var(--green); color: #fff; border-color: var(--green); }
.button.primary:hover { background: #06533d; }
.button.small { min-height: 29px; padding: 4px 8px; font-size: 12px; }
.button.danger { color: var(--red); }
.button.icon { min-height: 32px; padding: 4px 9px; font-size: 17px; line-height: 1; }
.button.link { border-color: transparent; color: var(--green); background: transparent; padding-left: 0; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 22px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 15px 17px; min-width: 0; }
.metric:first-child { background: #e9f5ed; border-color: #cee7d7; }
.metric-label { font-size: 13px; color: var(--muted); }
.metric strong { display: block; margin-top: 4px; font-size: clamp(23px,3vw,31px); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); font-size: 12px; display: block; margin-top: 1px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 15px; overflow: hidden; }
.panel-head { padding: 15px 16px; align-items: center; }
.panel-head .muted { display: block; margin-top: 4px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th { font-size: 12px; font-weight: 650; color: var(--muted); background: #edf3ef; border-bottom: 1px solid var(--line); white-space: nowrap; }
td, th { padding: 10px 13px; vertical-align: middle; }
td { border-bottom: 1px solid #ebf0ec; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td strong { font-weight: 650; }
.product-name { min-width: 190px; max-width: 370px; }
.product-name strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.35; }
.muted, .hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.sku { font-size: 11px; font-family: Consolas, monospace; color: var(--muted); display: block; margin-top: 3px; }
.pill { display: inline-flex; align-items: center; min-height: 22px; border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 650; background: #edf1ee; color: #445a50; white-space: nowrap; }
.pill.good { background: var(--green-light); color: #0a6145; }
.pill.warn { background: #fff1d9; color: var(--amber); }
.pill.bad { background: #fbe9e7; color: var(--red); }
.positive { color: var(--green); }
.negative { color: var(--red); }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.empty .button { margin-top: 10px; }
.grid-two { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.event-row { padding: 10px 15px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13px; border-top: 1px solid #edf1ee; }
.event-row strong { display: block; font-size: 13px; }
.form-panel { padding: 0 16px 15px; }
label { display: grid; gap: 5px; font-weight: 620; font-size: 13px; min-width: 0; }
input, select, textarea { width: 100%; min-height: 38px; border: 1px solid #ccd9d0; padding: 8px 9px; border-radius: 7px; background: #fff; color: var(--ink); font-size: 13px; }
input[type="checkbox"] { width: 15px; height: 15px; min-height: 0; accent-color: var(--green); }
textarea { resize: vertical; min-height: 62px; }
.search { width: min(270px,65vw); }
.filters { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.filters select { max-width: 220px; }
.filters input[type="date"] { width: 137px; }
.filters input[type="search"] { width: 220px; }
.check-row { display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 3px 0; }
.login-state .layout { display: block; }
.login-state .sidebar, .login-state .topbar { display: none; }
.public-card { width: min(440px, calc(100% - 30px)); margin: min(13vh, 115px) auto 25px; padding: 27px; }
.public-card p, .public-card h2 { margin: 10px 0 16px; }
.public-card form { display: grid; gap: 13px; }
.public-card .button { justify-self: start; }
#workspace-user { display: block; margin-top: 10px; }
.order-actions { margin: 12px 0; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.catalog-connections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 10px; padding: 0 16px 16px; }
.catalog-connection { display: grid; align-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.catalog-connection h3 { margin-bottom: 7px; }
.catalog-connection p { margin-top: 6px; }
.catalog-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 9px 15px; padding: 0 16px 14px; }
.catalog-filters input[type="search"] { width: min(250px, 100%); }
.catalog-filters .check-row { min-height: 38px; }
.catalog-ids { min-width: 190px; max-width: 465px; overflow-wrap: anywhere; }
.catalog-count { padding: 8px 16px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; margin: 10px 0 15px; }
.fields.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.fields.four { grid-template-columns: repeat(4,minmax(0,1fr)); }
.wide { grid-column: 1 / -1; }
.line-editor { border-top: 1px solid var(--line); padding-top: 9px; margin: 12px 0; }
.line-row { display: grid; grid-template-columns: minmax(0,2fr) minmax(75px,1fr) auto; align-items: end; gap: 8px; margin: 0 0 8px; }
.line-row.four { grid-template-columns: minmax(0,2fr) minmax(55px,.65fr) minmax(70px,.9fr) minmax(80px,1fr) auto; }
.line-row .button { min-height: 38px; }
.line-solid { padding: 10px 0; border-top: 1px solid var(--line); }
.line-solid .fields { margin-bottom: 0; }
details { border-top: 1px solid var(--line); }
summary { cursor: pointer; padding: 12px 16px; font-weight: 640; font-size: 13px; }
.notice { background: #edf5ef; border: 1px solid #d6e6da; border-radius: 8px; padding: 9px 11px; font-size: 13px; color: #304c3e; margin-bottom: 11px; }
.notice.error { background: #fbe9e7; border-color: #efd2cf; color: var(--red); }
dialog { width: min(760px, calc(100% - 24px)); max-height: min(88vh, 950px); border: 1px solid #ccdad1; border-radius: 14px; padding: 0; color: var(--ink); box-shadow: 0 20px 65px #0c251e3b; }
dialog::backdrop { background: #15252270; }
.dialog-head { display: flex; justify-content: space-between; gap: 9px; align-items: start; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-head h2 { font-size: 21px; }
.dialog-body { padding: 13px 18px 20px; }
.dialog-foot { display: flex; justify-content: end; gap: 8px; margin-top: 16px; }
#toast { background: #173e31; color: #fff; position: fixed; bottom: 18px; right: 18px; max-width: min(480px,calc(100vw - 36px)); padding: 11px 15px; border-radius: 8px; box-shadow: 0 4px 20px #15252242; z-index: 5; }
#toast.error { background: #8c2824; }
@media (max-width: 1050px) {
  .layout { grid-template-columns: 178px minmax(0,1fr); }
  .sidebar { padding-inline: 11px; }
  .main-content { padding-inline: 22px; }
}
@media (max-width: 740px) {
  .layout { display: block; }
  .sidebar { height: auto; padding: 12px 12px 7px; gap: 10px; z-index: 3; }
  .brand { font-size: 15px; padding: 0 3px; }
  .brand small, .workspace, .topbar { display: none; }
  .brand-icon { width: 29px; height: 29px; border-radius: 7px; }
  .sidebar nav { display: flex; overflow-x: auto; padding: 0 0 3px; }
  .sidebar nav a { padding: 7px 8px; font-size: 12px; gap: 5px; }
  .nav-icon { font-size: 14px; width: 13px; }
  .main-content { padding: 24px 12px 45px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metric { padding: 11px; }
  .grid-two { grid-template-columns: 1fr; gap: 0; }
  .fields.three, .fields.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .line-row.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
