:root {
  color-scheme: light;
  font: 16px/1.45 system-ui, sans-serif;
  color: #192c28;
  background: #f2f4ef;
  --ink: #173e34;
  --line: #cbd7cf;
  --muted: #4d655d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { width: min(960px, 100%); margin: auto; padding: 16px; }
header { color: white; background: var(--ink); }
header small { letter-spacing: .15em; color: #d4e9d7; font-weight: 700; }
h1 { margin: 2px 0; font-size: 2rem; }
h2, p { margin: 0 0 8px; }
nav, #filters, .actions, footer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
button, input, select, .download {
  font: inherit; border: 1px solid var(--line); padding: 8px 12px;
  min-height: 44px; border-radius: 8px; background: white; color: inherit;
}
button, .download { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
nav button { flex: 1; }
nav button[aria-current="page"], .primary { background: var(--ink); color: white; border-color: var(--ink); }
#search { flex: 2 1 290px; min-width: 0; }
#filters select { flex: 1; min-width: 105px; }
.card { display: flex; justify-content: space-between; gap: 12px; align-items: center;
  background: white; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 8px 0; }
.card > div { min-width: 0; }
.card h2 { font-size: 1rem; overflow-wrap: anywhere; margin: 0; }
.card .actions { margin: 0; }
.meta { color: var(--muted); font-size: .88rem; margin: 2px 0 0; }
.manual-position {
  display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 5px;
  background: #f6ecd8; color: #61441e; font-size: .82rem; font-weight: 600;
}
.amount { font-variant-numeric: tabular-nums; font-weight: 750; }
footer { justify-content: space-between; margin-top: 16px; }
.download { display: inline-flex; align-items: center; text-decoration: none; }
#status, #form-error { background: #f9e7da; color: #742e1d; padding: 10px; border-radius: 8px; }
dialog { width: min(440px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 14px; color: inherit; }
dialog::backdrop { background: #13261ec0; }
#fields label { display: grid; gap: 3px; margin: 10px 0; }
#fields .check { display: flex; align-items: center; }
input[type=checkbox] { width: 20px; min-height: 24px; }
dialog .actions { margin: 14px 0 0; justify-content: end; }
@media (max-width: 570px) {
  .card { align-items: stretch; flex-direction: column; }
  .card button { flex: 1; }
}


#filters:has(#count-warehouse:not([hidden])) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6rem max-content;
}
#filters #count-warehouse {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
}
@media (max-width: 570px) {
  #filters:has(#count-warehouse:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 6rem;
  }
  #filters:has(#count-warehouse:not([hidden])) #filter {
    grid-column: 1 / -1;
    justify-self: end;
  }
}


.catalog-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.catalog-toolbar p { margin: 0; }
.catalog-toolbar .primary { margin-inline-start: auto; white-space: nowrap; }
.card .remove-position {
  flex: 0 0 44px; width: 44px; padding: 0;
  font-size: 1.45rem; line-height: 1; color: #742e1d;
}

.login {
  width: min(400px, calc(100% - 32px));
  margin: clamp(20px, 8vh, 90px) auto;
  padding: clamp(24px, 6vw, 40px);
  text-align: center;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 14px 44px #173e3412;
}
.login img { border-radius: 22px; }
.login h1 { color: var(--ink); letter-spacing: -.04em; }
.login-caption { color: var(--muted); margin: 2px 0 24px; }
.login #roles, .login form { display: grid; gap: 10px; }
.login label { text-align: left; font-weight: 600; }
.login input { min-width: 0; }
.login [readonly] { color: var(--muted); background: #f2f4ef; }
#login-error { margin: 12px 0 0; color: #742e1d; }
.account { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.account span { color: var(--muted); margin-inline-end: auto; }
.account button { font-size: .875rem; }
#account-status { color: var(--ink); }
