:root {
  color-scheme:light;
  --ink:#172e35;
  --muted:#50666d;
  --line:#d4dfe2;
  --accent:#005F73;
  --sea:#e6f2f4;
  --paper:#fff;
  --base:#f5f8f9;
  --amber:#895620;
  font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  color:var(--ink);
  background:var(--base);
  font-size:14px;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
}

.login-page {
  min-height:100vh;
  min-height:100svh;
  display:grid;
  grid-template-rows:auto 1fr;
}

.login-page .login-mast a {
  margin-inline-start:auto;
  color:white;
  text-underline-offset:.2em;
}

.login-main {
  display:grid;
  place-items:center;
  padding:24px 16px;
}

.login-form {
  width:min(100%, 380px);
  padding:clamp(23px, 5vw, 32px);
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:8px;
}

.login-form h1 { margin:0 0 24px; }
.login-form label { display:block; margin-bottom:6px; font-weight:550; }
.login-form input {
  width:100%;
  height:44px;
  padding:0 12px;
  border:1px solid #9eb6bb;
  border-radius:5px;
  font-size:16px;
}
.login-form input[aria-invalid] { border-color:#a03a2e; }
.login-form #login-error { color:#923629; margin:8px 0 0; }
.login-form .primary { width:100%; min-height:44px; margin-top:18px; }

button,input,select {
  font:inherit;
  color:inherit;
}

button,a,input,select {
  outline-offset:3px;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {
  outline:2px solid #087387;
}

button,.button {
  cursor:pointer;
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--paper);
  padding:8px 13px;
  font-weight:550;
  text-decoration:none;
  white-space:nowrap;
}

button:hover,.button:hover {
  background:#ebf3f5;
  border-color:#acc6cd;
}

button:disabled {
  opacity:.48;
  cursor:default;
}

button.primary,.button.primary {
  background:var(--accent);
  border-color:var(--accent);
  color:white;
}

button.primary:hover,.button.primary:hover {
  background:#004a59;
}

button.text-btn {
  padding:4px 0;
  background:transparent;
  border:0;
  color:var(--accent);
}

button.text-btn:hover {
  text-decoration:underline;
}

h1,h2,h3,p {
  margin:0;
}

p {
  line-height:1.65;
}

h1 {
  font-size:27px;
  letter-spacing:-.035em;
  font-weight:670;
}

h2 {
  font-size:17px;
}

h3 {
  font-size:14px;
}

.mast {
  height:59px;
  background:var(--accent);
  color:#f5fafb;
  display:flex;
  align-items:center;
  gap:23px;
  padding:0 27px;
}

.brand {
  display:flex;
  align-items:center;
  gap:10px;
  font-family:"Baskervville",Georgia,serif;
  letter-spacing:.09em;
  font-size:18px;
}

.monogram {
  width:28px;
  height:30px;
  line-height:29px;
  text-align:center;
  font-family:Georgia,serif;
  font-size:21px;
  border:1px solid #99c2c9;
  border-radius:3px;
  letter-spacing:0;
}

.product {
  border-left:1px solid #558594;
  padding-left:21px;
  font-size:14px;
  letter-spacing:.05em;
}

.connection {
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:#f0f8fa;
}

.connection i,.dot {
  width:7px;
  height:7px;
  background:#a5d8b5;
  border-radius:50%;
  display:inline-block;
}

.connection.off i {
  background:#e7a55f;
}

#db-info {
  margin-left: auto;
  padding: 6px 0;
  border: 0;
  background: transparent;
}

#rule-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 0;
  background: var(--base);
}

.shell {
  display:grid;
  grid-template-columns:245px minmax(0,1fr);
  min-height:calc(100vh - 59px);
}

.sidebar {
  padding:23px 16px 16px;
  background:#eef4f5;
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.import {
  width:100%;
  height:40px;
}

.import span {
  font-size:17px;
  line-height:1;
}

.sub,.small {
  color:var(--muted);
  font-size:12px;
}

.search,.control,select,input[type=text],input[type=number] {
  border:1px solid #c8d6db;
  background:white;
  border-radius:5px;
  padding:8px 10px;
  min-width:0;
}

.search {
  width:100%;
  height:34px;
  font-size:13px;
}

.side-foot {
  margin-top:auto;
  border-top:1px solid var(--line);
  padding:12px 2px 0;
}

.side-foot button {
  font-size:12px;
}

main {
  min-width:0;
}

.nav {
  display:flex;
  gap:26px;
  align-items:stretch;
  height:51px;
  padding:0 28px;
  background:#fff;
  border-bottom:1px solid var(--line);
}

.nav button {
  border:0;
  border-radius:0;
  padding:0;
  background:transparent;
  color:var(--muted);
}

.nav button[aria-current=page] {
  color:var(--accent);
  font-weight:700;
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:.45em;
}

#page {
  padding:24px 27px 26px;
}

.page-head,.section-title,.toolbar,.dialog-head,.dialog-foot,.actions,.summary,.filter,.inline {
  display:flex;
  align-items:center;
}

.page-head {
  justify-content:space-between;
  gap:15px;
  margin-bottom:18px;
}

.page-head .sub {
  margin-top:6px;
  overflow-wrap:anywhere;
}

.actions {
  gap:8px;
  flex-wrap:wrap;
}

.summary {
  flex-wrap:wrap;
  row-gap:8px;
  border:1px solid var(--line);
  border-radius:7px;
  background:var(--paper);
  margin:0 0 17px;
  padding:12px 0;
}

.metric {
  padding:0 20px;
  border-left:1px solid var(--line);
  display:flex;
  align-items:baseline;
  gap:9px;
}

.metric:first-child {
  border:0;
}

.metric span {
  color:var(--muted);
  font-size:12px;
}

.metric b {
  font-size:21px;
  line-height:1.15;
  font-weight:620;
  font-variant-numeric:tabular-nums;
}

.metric.warn b {
  color:var(--amber);
}

.panel,.rule-card,.formula-card {
  background:white;
  border:1px solid var(--line);
  border-radius:7px;
  overflow:hidden;
}

.toolbar {
  padding:11px 13px;
  justify-content:space-between;
  gap:10px;
}

.toolbar .search {
  max-width:285px;
}

.filter {
  gap:6px;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}

.filter input {
  accent-color:var(--accent);
}

.inline {
  gap:9px;
  flex-wrap:wrap;
}

.table-wrap {
  overflow:auto;
  max-height:calc(100vh - 345px);
  min-height:125px;
  scrollbar-color:#b2c5ca #f0f5f6;
}

table {
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:13px;
}

th,td {
  padding:8px 11px;
  text-align:left;
  border-bottom:1px solid #e2e9eb;
  vertical-align:middle;
}

th {
  font-weight:600;
  color:#365863;
  background:#eaf2f4;
  white-space:nowrap;
  font-size:12px;
}

thead th {
  position:sticky;
  top:0;
  z-index:1;
  border-top:1px solid var(--line);
  border-bottom:1px solid #c9dadd;
}

tbody tr:last-child td {
  border-bottom:0;
}

tbody tr:hover {
  background:#f3f9fa;
}

td.money,th.money,.tnum {
  font-variant-numeric:tabular-nums;
  text-align:right;
  white-space:nowrap;
}

.cost-col {
  background:#edf6f7;
  color:#135366;
  font-weight:650;
}

th.cost-col {
  background:#dbecef;
}

.row-num {
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}

.row-num .dot {
  width:6px;
  height:6px;
  background:#c18a46;
  margin-right:6px;
}

.thumb {
  display:block;
  width:55px;
  height:41px;
  object-fit:contain;
  background:white;
  border-radius:3px;
}

.thumb-none {
  display:grid;
  place-items:center;
  background:#edf3f4;
  color:#617780;
}

.sku {
  font-weight:650;
  white-space:nowrap;
}

.sku small,td small {
  display:block;
  color:var(--muted);
  font-size:11px;
  font-weight:400;
  line-height:1.45;
}

.open-row {
  border:0;
  background:transparent;
  padding:0;
  color:var(--accent);
  text-align:left;
}

.open-row:hover {
  text-decoration:underline;
  background:transparent;
}

.nowrap {
  white-space:nowrap;
}

.dim {
  color:#75878e;
}

.footnote {
  margin-top:11px;
  color:var(--muted);
  font-size:12px;
}

.sheet-table {
  width:max-content;
  min-width:100%;
}

.sheet-table td {
  max-width:310px;
  white-space:pre-line;
}

.sheet-table td:nth-child(12) {
  color:var(--accent);
  font-weight:600;
}

.sheet-table .col-letter {
  display:block;
  font-size:12px;
  color:#577582;
  margin-bottom:3px;
}

.empty {
  padding:55px 20px;
  text-align:center;
  color:var(--muted);
}

.empty h2 {
  color:var(--ink);
  margin:0 0 6px;
}

.empty .actions {
  justify-content:center;
  margin-top:15px;
}

.rule-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(230px,30%);
  gap:14px;
  align-items:start;
}

.rule-groups {
  display:grid;
  gap:12px;
}

.rule-card,.formula-card {
  padding:15px 16px;
}

.rule-card h3,.formula-card h3,.field-group h3 {
  margin:0 0 12px;
}

.rule-grid,.field-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
  gap:12px 16px;
}

.rule-field,.field {
  display:grid;
  gap:5px;
  font-size:12px;
  color:var(--muted);
  align-content:start;
}

.box-rule-row,.insole-rules,.price-rule-row,.price-rule-fields {
  display:grid;
  gap:8px 16px;
  align-items:end;
}

.box-rule-row {
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.box-rule-row + .box-rule-row,.price-rule-row + .price-rule-row {
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid var(--line);
}

.rule-note,.price-rule-row p {
  color:var(--muted);
  font-size:12px;
  line-height:1.4;
}

.rule-note {
  grid-column:1/-1;
}

.rule-range {
  min-height:31px;
  display:flex;
  align-items:center;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
}

.insole-rules {
  grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr));
}

.price-rules {
  container-type:inline-size;
}

.price-rule-row {
  grid-template-columns:minmax(150px,1fr) minmax(0,2.7fr);
  align-items:center;
}

.price-rule-row h4 {
  margin:0 0 3px;
  font-size:14px;
}

.price-rule-fields {
  grid-template-columns:repeat(3,minmax(0,1fr));
}

@container (max-width:640px) {
  .price-rule-row { grid-template-columns:1fr; }
}

@container (max-width:420px) {
  .price-rule-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .price-rule-fields > :nth-child(3) { grid-column:1/-1; }
}

.unit-field {
  display:flex;
  align-items:center;
  border:1px solid #c8d6db;
  border-radius:5px;
  background:white;
}

.unit-field:focus-within {
  outline:2px solid #087387;
  outline-offset:2px;
}

.unit-field input:focus-visible {
  outline:none;
}

.unit-field input {
  width:100%;
  border:0;
  background:transparent;
  padding:7px 8px;
  font-weight:600;
  font-variant-numeric:tabular-nums;
}

.unit-field span {
  margin-right:9px;
  white-space:nowrap;
}

.formula-card {
  font-size:12px;
}

.formula-card dl {
  margin:0;
}

.formula-card dt {
  font-weight:650;
  color:var(--ink);
  margin-top:11px;
}

.formula-card dd {
  margin:3px 0 0;
  color:var(--muted);
  line-height:1.6;
}

.rule-bar {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.rule-bar select {
  padding:6px 9px;
}

.pending {
  display:block;
  border-top:1px solid var(--line);
  padding-top:12px;
  margin-top:15px;
  color:var(--muted);
}

dialog {
  width:min(745px,calc(100vw - 30px));
  max-height:90vh;
  max-height:90dvh;
  border:1px solid var(--line);
  border-radius:10px;
  padding:0;
  color:var(--ink);
  box-shadow:0 6px 18px rgba(0,0,0,.14);
  overflow:auto;
}

dialog::backdrop {
  background:#112c3370;
}

.dialog-head {
  justify-content:space-between;
  border-bottom:1px solid var(--line);
  padding:13px 18px;
  background:white;
  position:sticky;
  top:0;
  z-index:2;
}

.dialog-head h2 {
  font-size:18px;
}

.close {
  font-size:21px;
  line-height:1;
  width:29px;
  height:29px;
  padding:0;
  border:0;
  color:var(--muted);
}

#dialog-body {
  padding:17px 18px;
}

.dialog-foot {
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:8px;
  border-top:1px solid var(--line);
  padding:12px 18px;
  background:#f8fafb;
  position:sticky;
  bottom:0;
  z-index:1;
}

.dialog-foot:empty {
  display:none;
}

.drop {
  padding:28px 15px;
  border:1px dashed #99b6bf;
  border-radius:7px;
  display:grid;
  justify-items:center;
  gap:9px;
  background:#f1f8f9;
}

.drop.over {
  background:#d7eef1;
}

.file-label {
  display:inline-block;
  background:white;
  border:1px solid #9fbfc7;
  border-radius:5px;
  padding:7px 13px;
  cursor:pointer;
}

.file-label:focus-within {
  outline:2px solid var(--accent);
}

.file-input {
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
}

.import-info {
  margin-top:17px;
}

.import-info h3 {
  overflow-wrap:anywhere;
}

.import-info p {
  margin:6px 0;
}

.mini-table {
  overflow:auto;
  margin:10px 0;
}

.mini-table table {
  font-size:12px;
}

.mini-table th,.mini-table td {
  padding:6px 9px;
}

.feedback {
  padding:9px 12px;
  border-radius:5px;
  font-size:13px;
  background:var(--sea);
  color:var(--accent);
}

.feedback.error {
  background:#f9eee7;
  color:#8c361e;
  margin:0 18px 14px;
}

.callout {
  background:#faf3e6;
  color:#76501c;
  padding:9px 12px;
  border-radius:5px;
  font-size:12px;
  line-height:1.65;
}

.editor-top {
  display:flex;
  gap:18px;
  align-items:center;
  margin-bottom:13px;
}

.editor-img {
  width:108px;
  height:85px;
  object-fit:contain;
  border:1px solid var(--line);
  border-radius:6px;
}

.editor-top h3 {
  font-size:18px;
}

.editor-prices {
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
  font-size:12px;
  margin-top:7px;
}

.editor-prices span {
  color:var(--muted);
}

.editor-prices b {
  color:var(--ink);
  margin-left:3px;
}

.field-group {
  margin-top:15px;
  padding-top:13px;
  border-top:1px solid var(--line);
}

.field input,.field select {
  width:100%;
  height:34px;
  font-size:13px;
}

.field small {
  font-size:12px;
}

.guide {
  font-size:13px;
  line-height:1.65;
}

.guide p,.guide dl {
  margin:.65em 0;
}

.guide dt {
  margin-top:8px;
  font-weight:650;
}

.guide dd {
  margin-left:0;
  color:var(--muted);
}

.path {
  overflow-wrap:anywhere;
  font-size:12px;
}

.toast {
  position:fixed;
  bottom:18px;
  left:50%;
  transform:translateX(-50%);
  background:#074f60;
  color:white;
  border-radius:6px;
  padding:9px 15px;
  z-index:10;
  font-size:13px;
}

button[hidden],[hidden] {
  display:none!important;
}

@media(min-width:1500px) {
  .shell {
    grid-template-columns:270px minmax(0,1fr);
  }
  #page {
    padding:29px 35px;
  }
  .nav {
    padding:0 35px;
  }
  .rule-grid {
    grid-template-columns:repeat(4,minmax(0,1fr));
  }
}

@media(max-width:1060px) {
  .shell {
    grid-template-columns:205px minmax(0,1fr);
  }
  #page {
    padding:18px;
  }
  .nav {
    padding:0 18px;
  }
  .metric {
    padding:0 13px;
    gap:6px;
  }
  .rule-layout {
    grid-template-columns:1fr;
  }
  .page-head {
    align-items:flex-start;
  }
}

#language {
  width:auto;
  max-width:110px;
  padding:5px 7px;
  border-color:#82aab2;
  color:var(--ink);
  font-size:13px;
}

.section-nav {
  display:grid;
  gap:3px;
  margin:21px 0 16px;
}

.section-nav button {
  text-align:left;
  background:transparent;
  border:0;
  padding:10px 12px;
  font-weight:550;
}

.section-nav button:hover {
  background:#e3eef0;
}

.section-nav button[aria-current=page] {
  background:#d7e9ec;
  color:var(--accent);
  font-weight:700;
}

.side-season {
  padding:15px 1px;
  border-top:1px solid var(--line);
  display:grid;
  gap:7px;
}

.side-season label {
  font-size:13px;
  font-weight:600;
}

.side-season select {
  width:100%;
}

.side-season button {
  justify-self:start;
  font-size:13px;
}

.periods {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:0 0 16px;
}

.period {
  display:grid;
  grid-template-columns:auto auto;
  align-items:center;
  column-gap:14px;
  border:1px solid var(--line);
  border-radius:7px;
  background:var(--paper);
  padding:9px 14px;
}

.period > button:first-child {
  display:grid;
  grid-template-columns:auto 1fr;
  align-items:baseline;
  gap:1px 8px;
  background:transparent;
  border:0;
  padding:3px 0;
  color:var(--muted);
  text-align:left;
  font-size:13px;
}

.period > button:first-child span:first-child {
  grid-column:1/-1;
  font-weight:650;
  color:var(--ink);
}

.period > button:first-child strong {
  color:var(--accent);
  font-size:24px;
  font-variant-numeric:tabular-nums;
}

.period:has([aria-pressed=true]) {
  background:var(--sea);
  border-color:#88b3bc;
}

.period .bin-link {
  font-size:12px;
  white-space:normal;
}

.registry-tools {
  display:flex;
  align-items:end;
  gap:10px;
  padding:13px 15px;
  flex-wrap:wrap;
}

.registry-tools .query {
  flex:1 1 210px;
  max-width:420px;
}

.price-method {
  min-width:110px;
}

.page-head .price-method {
  width:auto;
  min-width:118px;
}

.batch-filters .query {
  max-width:240px;
  flex-basis:170px;
}

.batch-filters .facet select {
  min-width:88px;
  max-width:155px;
}

.batch-filters .inline {
  min-height:34px;
}

.comparison-table th,.comparison-table td {
  padding-left:7px;
  padding-right:7px;
}

.comparison-table .price-group {
  text-align:center;
  height:28px;
  padding-block:3px;
  border-left:1px solid #c9dadd;
}

.comparison-table thead tr:nth-child(2) th {
  top:28px;
  padding-block:3px;
  border-top:0;
}

.comparison-table td.money {
  min-width:44px;
}

.comparison-table .cost-col {
  border-left:1px solid var(--line);
}

.inline-material {
  border:1px solid var(--line);
  background:white;
  border-radius:5px;
  max-width:125px;
  padding:4px;
  color:var(--ink);
  font:inherit;
  min-height:30px;
}

.inline-material.pending {
  color:#825116;
  border-color:#cbad82;
}

.material-actions {
  flex-wrap:wrap;
}

.price-strip {
  margin-top:8px;
}

.price-strip > strong {
  color:var(--accent);
  font-size:13px;
}

.duty-detail,.duty-notice {
  margin:6px 0;
  font-size:13px;
}

.duty-notice {
  padding:0 15px;
}

.registry-tools select {
  max-width:260px;
}

.registry-tools input[type=date] {
  border:1px solid #c8d6db;
  border-radius:5px;
  background:white;
  padding:4px 8px;
}

.registry-tools #reset-filters {
  min-height:34px;
  font-size:13px;
}

.results-head,.selection,.pager {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:9px 15px;
  border-top:1px solid var(--line);
}

.results-head h2 {
  font-size:14px;
}

.results-head h2 span {
  margin-left:5px;
  color:var(--accent);
  font-variant-numeric:tabular-nums;
}

.registry-table {
  overflow:auto;
  max-height:calc(100vh - 320px);
  min-height:110px;
}

.imports-table,.trash-table {
  min-width:670px;
}

.archive-table {
  min-width:970px;
}

.day-group th {
  background:#f6f9fa;
  font-size:12px;
  font-weight:600;
  color:var(--muted);
  padding:6px 11px;
}

.file-cell {
  min-width:200px;
  max-width:390px;
  overflow-wrap:anywhere;
}

.file-cell button {
  max-width:100%;
  white-space:normal;
  text-align:left;
  overflow-wrap:anywhere;
}

.table-action {
  padding:5px 9px;
  font-size:12px;
}

.danger-quiet {
  color:#863d30;
}

.trash-actions {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

button.danger {
  background:#853d30;
  border-color:#853d30;
  color:white;
}

.selection {
  justify-content:flex-start;
  background:var(--sea);
  font-size:13px;
}

.pager {
  justify-content:flex-end;
  font-size:13px;
}

.pager button {
  padding:5px 10px;
}

.import-season,.history-entry {
  margin:0 0 14px;
}

.import-season details {
  margin-top:7px;
}

summary {
  cursor:pointer;
}

.import-season details > .field,.import-season .field-grid,#create-single {
  margin-top:8px;
}

.history-entry {
  border-top:1px solid var(--line);
  padding-top:13px;
}

.history-main {
  display:flex;
  gap:13px;
  align-items:center;
}

.variant-heading {
  padding-bottom:12px;
}

.material-list {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(98px,1fr));
  margin:12px 0 7px;
  gap:8px;
}

.material-list dt {
  color:var(--muted);
  font-size:12px;
}

.material-list dd {
  margin:3px 0 0;
  overflow-wrap:anywhere;
}

.impact-table {
  max-height:35vh;
  margin-top:8px;
}

input[type=checkbox] {
  accent-color:var(--accent);
}

#dialog-body p,#dialog-body .history-main > div {
  overflow-wrap:anywhere;
  min-width:0;
}

.import-h {
  margin-top:10px;
}

.backup-entry {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  margin-top:8px;
  color:var(--muted);
  font-size:13px;
}

.quote-count {
  font-size:12px;
}

@media(max-width:1024px) {
  .imports-table,.trash-table,.imports-table tbody,.trash-table tbody {
    display:block;
    min-width:0;
  }

  .imports-table thead,.trash-table thead {
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip-path:inset(50%);
  }

  .imports-table tbody tr,.trash-table tbody tr {
    display:grid;
    align-items:center;
    grid-template-columns:auto 1fr auto;
    gap:3px 8px;
    padding:8px 10px;
    border-top:1px solid var(--line);
  }

  .imports-table tbody tr {
    grid-template-areas:"file file hour" "season supplier supplier" "count action action";
  }

  .trash-table tbody tr {
    grid-template-areas:"file file file" "season date date" "content content content" "action action action";
  }

  .imports-table td,.trash-table td {
    padding:0;
    border:0;
    font-size:12px;
  }

  .imports-table .file-cell,.trash-table .file-cell {
    grid-area:file;
    min-width:0;
    padding-bottom:3px;
    font-size:13px;
  }

  .imports-table tbody .day-group {
    display:block;
    padding:5px 10px;
    background:#edf3f4;
  }

  .day-group th {
    display:block;
    padding:0;
    background:transparent;
    border:0;
  }

  .imports-table td:first-child {
    grid-area:hour;
  }

  .imports-table td:nth-child(3),.trash-table td:nth-child(3) {
    grid-area:season;
    color:var(--accent);
    font-weight:650;
  }

  .imports-table td:nth-child(4) {
    grid-area:supplier;
  }

  .imports-table td:nth-child(5) {
    grid-area:count;
    text-align:left;
  }

  .imports-table td:nth-child(5)::after {
    content:" " attr(data-label);
  }

  .imports-table td:last-child,.trash-table td:last-child {
    grid-area:action;
    justify-self:end;
  }

  .trash-table td:last-child {
    justify-self:start;
    margin-top:4px;
  }

  .trash-table td:first-child {
    grid-area:date;
    justify-self:end;
  }

  .trash-table td:nth-child(4) {
    grid-area:content;
  }
}
.template-link {
  color:var(--accent);
  font-size:13px;
  text-underline-offset:.18em;
}

#calculator-form { max-width:660px; padding:20px; }
.calc-fields,.calc-accessories,.calc-material { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.calc-fields .field { align-content:end; font-size:14px; font-weight:550; }
.calc-fields select,.calc-amount { min-height:46px; width:100%; }
.calc-fields select { font-weight:500; font-size:16px; }
.calc-amount { display:flex; align-items:center; gap:8px; padding-right:12px; border:1px solid #c8d6db; border-radius:5px; background:white; }
.calc-amount:focus-within { outline:2px solid #087387; outline-offset:2px; }
.calc-amount input[type=text] { height:44px; min-width:0; border:none; outline:0; font-size:18px; font-variant-numeric:tabular-nums; }
.calc-amount span { color:var(--muted); font-size:13px; font-weight:600; }
.calc-options { border:0; margin:20px 0; padding:0; min-width:0; }
.calc-options legend { padding:0; margin-bottom:7px; color:var(--muted); font-size:14px; font-weight:550; }
#calc-rate { margin-inline-start:4px; color:var(--accent); font-variant-numeric:tabular-nums; }
.calc-material { gap:0; }
.calc-material label {
  display:flex; align-items:center; gap:9px; min-height:44px; padding:8px 12px;
  border:1px solid var(--line); cursor:pointer;
}
.calc-material label:first-child { border-radius:5px 0 0 5px; }
.calc-material label:last-child { border-radius:0 5px 5px 0; margin-inline-start:-1px; }
.calc-material input { margin:0; width:16px; height:16px; accent-color:var(--accent); }
.calc-material label:has(:checked) { position:relative; z-index:1; background:var(--sea); color:var(--accent); border-color:var(--accent); font-weight:600; }
.calc-material label:has(:focus-visible) { outline:2px solid var(--accent); outline-offset:2px; }
.calc-toggle { min-height:46px; display:flex; align-items:center; justify-content:space-between; gap:8px; text-align:left; white-space:normal; -webkit-tap-highlight-color:transparent; }
.calc-toggle strong { font-size:13px; font-weight:650; color:var(--muted); }
.calc-toggle[aria-pressed=true] { background:var(--accent); border-color:var(--accent); color:white; }
.calc-toggle[aria-pressed=true] strong { color:white; }
.calc-results { table-layout:fixed; font-variant-numeric:tabular-nums; }
.calc-results th,.calc-results td { padding:10px 8px; white-space:normal; overflow-wrap:anywhere; }
.calc-results thead th { position:static; font-size:13px; }
.calc-results th:first-child { width:40%; }
.calc-results th:not(:first-child),.calc-results td { text-align:right; }
.calc-results tbody th { background:transparent; color:var(--ink); font-size:14px; font-weight:500; }
.calc-results td { font-size:clamp(16px,2vw,20px); font-weight:550; }
.calc-results tbody tr:first-child > * { color:var(--accent); font-weight:700; }
.calc-results tbody tr:last-child th { border-bottom:0; }
#calc-error { margin-bottom:8px; color:#8c361e; }
#calc-retry { min-height:44px; }

@media (hover:none) {
  .calc-toggle[aria-pressed=false]:hover { color:var(--ink); background:var(--paper); border-color:var(--line); }
}

.compact-only { display:none; }
#workspace-tools,#filter-fields,#selection-options { display:contents; }
.sidebar .section-nav { order:1; }
.sidebar .side-season { order:2; }
.sidebar .side-foot { order:3; display:flex; align-items:center; justify-content:space-between; gap:12px; }

@media (max-width:1024px) {
  .wide-only,.mast .product,.mast #db-info { display:none; }
  .compact-only { display:inline; }
  .mast {
    height:auto;
    min-height:54px;
    padding:env(safe-area-inset-top) max(12px,env(safe-area-inset-right)) 0 max(14px,env(safe-area-inset-left));
    gap:8px;
  }
  .brand { font-size:16px; gap:7px; white-space:nowrap; }
  .monogram { width:24px; height:26px; line-height:24px; font-size:18px; }
  #language,#menu-toggle {
    min-height:44px; color:white; background:transparent; border:0; padding:0 5px;
  }
  #language { margin-inline-start:auto; width:auto; max-width:108px; font-size:16px; }
  #language option { background:white; color:var(--ink); }
  #menu-toggle { font-size:14px; }
  #menu-toggle[aria-expanded=true] { text-decoration:underline; text-underline-offset:4px; }
  .mast :focus-visible { outline-color:white; outline-offset:0; }
  .shell { display:block; min-height:0; }
  .sidebar {
    display:flex; flex-direction:column; row-gap:0; padding:0 max(10px,env(safe-area-inset-right)) 0 max(10px,env(safe-area-inset-left));
    border:0; border-bottom:1px solid var(--line); background:white;
  }
  .sidebar .section-nav {
    order:0; display:grid; grid-template-columns:minmax(max-content,1.3fr) repeat(4,minmax(0,1fr));
    gap:3px; margin:0; padding:4px 0;
  }
  .section-nav button {
    min-height:44px; width:100%; padding:3px 0; text-align:center; font-size:14px;
    white-space:normal; overflow-wrap:anywhere;
  }
  #workspace-tools { display:none; }
  #workspace-tools.expanded {
    display:grid; grid-template-columns:1fr; gap:10px; padding:12px 4px; border-top:1px solid var(--line);
  }
  .sidebar .import { height:44px; }
  .sidebar .side-season { padding:0; border:0; grid-template-columns:minmax(0,1fr) auto; align-items:center; }
  .side-season label { grid-column:1/-1; }
  .side-season button { padding:0 5px; }
  .sidebar .side-foot { padding:0; border:0; }
  .side-foot button,.side-season button { min-height:44px; font-size:14px; white-space:normal; }
  #page { padding:16px max(12px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); }
  .nav { min-height:44px; height:auto; gap:8px; justify-content:space-between; padding:0 max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left)); }
  .nav button { min-height:44px; min-width:0; padding:5px 0; white-space:normal; font-size:13px; }
  .page-head { flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:12px; }
  .page-head > * { min-width:0; max-width:100%; }
  h1 { font-size:24px; }
  .page-head .sub { line-height:1.45; margin-top:4px; }
  .page-head .primary,.page-head .actions button { min-height:44px; white-space:normal; }
  .page-head .actions { align-items:end; gap:6px; }
  .page-head .price-method { min-width:0; }
  .summary { padding:9px 0; margin-bottom:12px; gap:8px 0; }
  .metric { padding:0 10px; gap:5px; }
  .metric b { font-size:18px; }
  .metric span { font-size:12px; }
  .periods { gap:8px; margin-bottom:12px; }
  .period { flex:1; min-width:0; padding:8px 12px; display:block; }
  .period > button:first-child { width:100%; min-height:44px; }
  .period .bin-link { min-height:44px; }
  .registry-tools { display:grid; grid-template-columns:minmax(0,1fr) auto; padding:10px 12px; gap:8px; }
  .registry-tools .query,.registry-tools .field { min-width:0; max-width:none; }
  #filter-toggle { min-height:44px; align-self:end; }
  #filter-fields { display:none; }
  #filter-toggle[aria-expanded=true] + #filter-fields {
    grid-column:1/-1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:end; gap:10px;
  }
  #filter-fields .inline { grid-column:1/-1; justify-content:space-between; }
  #result-count { grid-column:1/-1; }
  .registry-tools #reset-filters,.filter { min-height:44px; }
  .registry-tools #reset-filters { justify-self:start; }
  .field input:not([type=checkbox]),.field select,.rule-field input,.rule-bar select,.side-season select,.inline-material {
    min-width:0; max-width:100%; min-height:44px; font-size:16px;
  }
  .batch-filters .facet select { max-width:100%; }
  .results-head,.pager { padding:9px 12px; }
  .results-head h2 { font-size:15px; }
  .registry-table,.table-wrap { overflow:visible; max-height:none; min-height:0; }
  .table-action,.pager button,.file-cell .open-row,.trash-actions button { min-height:44px; }
  .imports-table tbody tr,.trash-table tbody tr { grid-template-columns:minmax(0,auto) minmax(0,1fr) auto; }
  .imports-table td,.trash-table td { overflow-wrap:anywhere; }
  .pager { justify-content:space-between; }
  .panel:has(.record-list) { overflow:visible; }
  #page:has(.record-list) { padding-bottom:calc(84px + env(safe-area-inset-bottom)); }
  .list-controls { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0 8px; padding:0 12px; border-top:1px solid var(--line); }
  .page-picker { margin-inline-start:auto; display:flex; gap:6px; align-items:center; color:var(--muted); font-size:13px; }
  .page-picker select { border:0; min-height:44px; padding:3px; font-size:16px; }
  .select-page-line {
    display:flex; align-items:center; gap:9px; min-height:44px;
    font-size:13px; color:var(--muted); cursor:pointer;
  }
  .select-page-line input,.record-check input { width:18px; height:18px; margin:0; }
  .record-list { list-style:none; padding:0; margin:0; }
  .record { min-width:0; padding:12px; border-top:1px solid var(--line); overflow-wrap:anywhere; }
  .record-top { display:flex; align-items:flex-start; gap:6px; }
  .record-link {
    flex:1; min-width:0; display:flex; align-items:center; gap:10px; padding:0; min-height:48px;
    text-align:left; border:0; background:transparent; white-space:normal; overflow-wrap:anywhere;
  }
  .record-link .thumb { flex:none; width:60px; height:54px; }
  .record-id { display:grid; gap:2px; min-width:0; }
  .record-id strong { font-size:17px; line-height:1.3; color:var(--accent); }
  .record-id span { color:var(--muted); font-size:13px; font-weight:450; }
  .record-check { display:grid; place-items:center; cursor:pointer; width:44px; height:44px; flex:none; }
  .record:has(.record-check input:checked) { background:#f0f7f8; }
  .record-meta { margin:5px 0 8px; color:var(--muted); font-size:12px; line-height:1.45; }
  .mobile-prices { width:100%; table-layout:fixed; font-variant-numeric:tabular-nums; }
  .mobile-prices th,.mobile-prices td {
    position:static; white-space:normal; padding:3px 5px; border:0; text-align:right; background:transparent; color:var(--ink);
  }
  .mobile-prices th:first-child { width:41%; text-align:left; }
  .mobile-prices thead th { color:var(--muted); font-size:12px; border-bottom:1px solid var(--line); font-weight:550; }
  .mobile-prices tbody th { font-weight:450; font-size:13px; }
  .mobile-prices tbody tr:first-child > * { font-weight:650; }
  .record-material { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:7px; font-size:13px; }
  .record-material .inline-material { flex:none; width:55%; padding-inline:8px; }
  .record-details { font-size:13px; }
  .record-details summary { padding:12px 0; min-height:44px; color:var(--accent); font-weight:550; }
  .record-details dl { margin:0; }
  .record-details dl > div { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,3fr); gap:10px; padding:5px 0; border-top:1px solid var(--line); }
  .record-details dt,.sheet-prices dt,.size-label small { color:var(--muted); font-size:12px; }
  .record-details dd { margin:0; white-space:pre-line; }
  .sheet-record .record-top { align-items:center; }
  .size-label { text-align:right; }
  .size-label small,.size-label b { display:block; }
  .size-label b { margin-top:3px; font-size:15px; color:var(--accent); }
  .sheet-prices { display:grid; grid-template-columns:1.4fr repeat(4,minmax(0,1fr)); margin:10px 0 0; border-block:1px solid var(--line); }
  .sheet-prices div { padding:6px 2px; text-align:right; }
  .sheet-prices div:first-child { text-align:left; }
  .sheet-prices dd { margin:3px 0 0; font-weight:600; font-variant-numeric:tabular-nums; }
  .material-actions {
    position:fixed; inset:auto 0 0; z-index:5; display:flex; justify-content:space-between;
    padding:6px max(14px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));
    background:var(--sea); border-top:1px solid #a6c3ca; gap:6px 10px;
  }
  .material-actions button { min-height:44px; white-space:normal; }
  #selection-options { display:none; }
  #selection-toggle[aria-expanded=true] + #selection-options {
    flex:0 0 100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px;
    max-height:40dvh; overflow-y:auto;
  }
  #rule-heading { position:static; }
  .rule-grid,.field-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .rule-card,.formula-card { padding:12px; }
  .box-rule-row,.price-rule-fields { align-items:end; }
  .rule-bar { overflow-wrap:anywhere; }
  .unit-field input { min-width:0; }
  dialog { width:min(650px,calc(100% - 16px)); max-height:94dvh; overscroll-behavior:contain; }
  html:has(dialog[open]) { overflow-y:hidden; }
  .dialog-head,.dialog-foot,#dialog-body { padding:10px 12px; }
  .dialog-head .close,.dialog-foot button { min-width:44px; min-height:44px; }
  .dialog-foot { padding-bottom:max(10px,env(safe-area-inset-bottom)); gap:6px; }
  .dialog-foot button { flex:1 1 auto; padding:6px; white-space:normal; }
  .editor-top,.history-main { display:block; }
  .editor-top .editor-img,.history-main .editor-img { float:right; width:58px; height:48px; margin:0 0 5px 8px; }
  .price-strip { clear:both; }
  .editor-prices { display:grid; grid-template-columns:1.6fr repeat(4,minmax(0,1fr)); gap:4px; }
  .editor-prices b { display:block; margin:2px 0 0; }
  .toast { width:max-content; max-width:calc(100% - 24px); bottom:calc(14px + env(safe-area-inset-bottom)); pointer-events:none; }
  body:has(.material-actions) .toast { bottom:calc(68px + env(safe-area-inset-bottom)); }
}

@media (min-width:700px) and (max-width:1024px) {
  .record-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .record:nth-child(even) { border-inline-start:1px solid var(--line); }
  #workspace-tools.expanded { grid-template-columns:auto minmax(0,1fr) auto; align-items:center; }
}

@media (max-width:520px) {
  #calculator-form { padding:14px; }
  .calc-fields { grid-template-columns:minmax(0,1fr); gap:10px; }
  .calc-accessories { gap:6px; }
  .calc-toggle { padding:8px; }
  .calc-options { margin:16px 0; }
  .calc-results th,.calc-results td { padding:9px 5px; }
}
