:root {
  --ink: #18211f;
  --muted: #66736f;
  --line: #dce4df;
  --paper: #f5f7f3;
  --white: #ffffff;
  --red: #b43a31;
  --green: #2e7256;
  --steel: #3d5660;
  --amber: #b9852c;
  --dark: #0b0b0b;
  --shadow: 0 18px 50px rgba(24, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter", Arial, sans-serif;
}

body.theme-dark {
  --ink: #f4f4f2;
  --muted: #b8bbb8;
  --line: #343434;
  --paper: #0b0b0b;
  --white: #151515;
  --red: #c73b32;
  --green: #d7d7d7;
  --steel: #9da7ad;
  --amber: #d29a3b;
  --dark: #050505;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.hidden {
  display: none !important;
}

.public-screen {
  min-height: 100vh;
  background: var(--paper);
}

.public-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(18px, 5vw, 70px);
  color: var(--white);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  color: #f4f7f3;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(105, 119, 112, 0.12) 45%, rgba(255, 255, 255, 0.14)),
    rgba(255, 255, 255, 0.09);
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -35% auto -35% -65%;
  width: 42%;
  transform: rotate(22deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.56), transparent);
  animation: logoSheen 4.8s ease-in-out infinite;
}

@keyframes logoSheen {
  0%,
  58% {
    left: -65%;
  }

  76%,
  100% {
    left: 125%;
  }
}

.brand strong,
.brand small {
  display: block;
}

.brand > span:not(.brand-mark) {
  min-width: 0;
}

.brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.public-nav {
  display: flex;
  gap: clamp(14px, 3vw, 34px);
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  font-weight: 800;
}

.public-hero {
  min-height: 92vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 34px;
  align-items: center;
  padding: 120px clamp(20px, 6vw, 80px) 54px;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(10, 10, 10, 0.92) 0%, rgba(10, 10, 10, 0.68) 42%, rgba(10, 10, 10, 0.28) 100%),
    url("assets/hero-europe-parts.png") center / cover;
}

.hero-copy {
  max-width: 820px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.public-hero .eyebrow {
  color: #d9eee3;
}

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

.public-hero h1 {
  max-width: 800px;
  margin-bottom: 20px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.public-hero p {
  max-width: 720px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.62;
}

.hero-tags,
.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-tags span,
.tag-grid span,
.tag-grid a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
}

.public-screen {
  min-height: 100vh;
  background: #090b0b;
}

.public-final-hero {
  min-height: 100vh;
  display: grid;
  align-items: center;
  overflow: hidden;
  padding: 34px clamp(18px, 5vw, 78px);
  color: #f6f6f1;
  background:
    linear-gradient(90deg, rgba(8, 11, 10, 0.95) 0%, rgba(8, 11, 10, 0.76) 48%, rgba(8, 11, 10, 0.34) 100%),
    linear-gradient(180deg, rgba(8, 11, 10, 0.24), rgba(8, 11, 10, 0.74)),
    url("assets/hero-europe-parts.png") center / cover;
}

.public-final-shell {
  width: min(1440px, 100%);
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(540px, 760px) minmax(420px, 540px);
  gap: clamp(48px, 7vw, 118px);
  align-items: center;
  animation: publicAppear 0.72s ease both;
}

.final-copy {
  max-width: 760px;
  display: grid;
  gap: 16px;
  justify-self: end;
}

.final-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.final-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.final-brand-logo {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

.final-brand small {
  display: block;
  color: rgba(246, 246, 241, 0.72);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.35;
}

.final-tag {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #f6f6f1;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.final-kicker {
  margin: 0;
  color: #8ad0af;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.final-copy h1 {
  max-width: 720px;
  margin: 0;
  color: #f6f6f1;
  font-size: clamp(30px, 4.1vw, 50px);
  line-height: 1.08;
  letter-spacing: 0;
}

.final-copy p:not(.final-kicker) {
  max-width: 700px;
  margin: 0;
  color: rgba(246, 246, 241, 0.72);
  font-size: clamp(15px, 1.55vw, 18px);
  font-weight: 760;
  line-height: 1.58;
}

.final-actions,
.final-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.final-actions {
  gap: 10px;
  padding-top: 4px;
}

.final-cta {
  display: grid;
  gap: 14px;
}

.final-actions .button {
  min-height: 44px;
  border-radius: 9px;
  padding: 0 18px;
  font-weight: 950;
}

.final-actions .button.secondary,
.public-final-hero .auth-card .button.secondary {
  color: #f6f6f1;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.final-chips span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.07);
  color: #f6f6f1;
  font-size: 13px;
  font-weight: 900;
}

.final-side {
  display: grid;
  gap: 12px;
  align-self: center;
  width: 100%;
}

.final-work-card,
.public-final-hero .auth-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(10, 14, 13, 0.72);
  color: #f6f6f1;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.final-work-card {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.final-work-card h2,
.public-final-hero .auth-card h2 {
  margin: 0;
  color: #f6f6f1;
}

.final-work-card h2 {
  font-size: 22px;
}

.final-steps {
  display: grid;
  gap: 8px;
}

.final-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #f6f6f1;
  font-weight: 850;
}

.final-step b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(116, 182, 149, 0.22);
  color: #b5f1d2;
}

.public-final-hero .auth-card {
  max-width: 560px;
  padding: 16px;
}

.public-final-hero .auth-card p,
.public-final-hero .form-note {
  color: rgba(246, 246, 241, 0.68);
}

.public-final-hero .auth-card .eyebrow {
  color: #8ad0af;
}

.public-final-hero .auth-card label {
  color: rgba(246, 246, 241, 0.82);
}

.public-final-hero .auth-card input,
.public-final-hero .auth-card textarea {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
}

.public-final-hero .text-button {
  color: #b5f1d2;
}

.access-flow {
  display: grid;
  gap: 10px;
}

.access-flow p {
  margin: 0;
  color: rgba(246, 246, 241, 0.76);
  font-weight: 760;
  line-height: 1.48;
}

.access-flow ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.access-flow li {
  position: relative;
  padding-left: 18px;
  color: rgba(246, 246, 241, 0.72);
  font-weight: 760;
  line-height: 1.4;
}

.access-flow li::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #8ad0af;
  box-shadow: 0 0 0 4px rgba(138, 208, 175, 0.12);
}

.final-copy > *,
.final-work-card,
.final-auth-card {
  animation: publicItem 0.7s ease both;
}

.final-copy > :nth-child(2) {
  animation-delay: 0.05s;
}

.final-copy > :nth-child(3) {
  animation-delay: 0.1s;
}

.final-copy > :nth-child(4) {
  animation-delay: 0.15s;
}

.final-copy > :nth-child(5) {
  animation-delay: 0.2s;
}

.final-copy > :nth-child(6) {
  animation-delay: 0.16s;
}

.final-work-card {
  animation-delay: 0.18s;
}

.final-auth-card {
  animation-delay: 0.26s;
}

@keyframes publicAppear {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes publicItem {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .public-final-hero {
    min-height: 100vh;
    align-items: start;
    padding: 20px 16px 28px;
  }

  .public-final-shell,
  .final-top {
    grid-template-columns: 1fr;
  }

  .public-final-shell {
    display: grid;
    gap: 22px;
  }

  .final-copy {
    justify-self: stretch;
  }

  .final-top {
    display: grid;
  }

  .final-tag {
    justify-self: start;
    white-space: normal;
  }

  .final-brand-logo {
    width: 62px;
    height: 62px;
  }

  .final-work-card {
    padding: 14px;
  }

  .final-copy h1 {
    font-size: clamp(30px, 11vw, 42px);
  }
}

.auth-card,
.panel,
.metric-card,
.service-card,
.split-info article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 1px 0 rgba(24, 33, 31, 0.04);
}

.auth-card {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 4vw, 34px);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.auth-card p {
  color: var(--muted);
}

.auth-form,
.auth-intro {
  display: grid;
  gap: 16px;
}

.auth-actions,
.login-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 13px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.primary {
  color: #ffffff;
  background: var(--red);
}

.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--white);
}

.danger-button {
  color: var(--red);
  border-color: #edc7c2;
  background: #fff6f5;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fbfcfa;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(46, 114, 86, 0.2);
  border-color: var(--green);
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.public-section {
  padding: 76px clamp(20px, 6vw, 80px);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.section-heading h2,
.split-info h2 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.06;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.service-card {
  min-height: 230px;
  padding: 24px;
}

.service-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 38px;
  margin-bottom: 28px;
  border-radius: 8px;
  color: var(--white);
  background: var(--steel);
  font-weight: 800;
}

.service-card:nth-child(2) .service-icon {
  background: var(--green);
}

.service-card:nth-child(3) .service-icon {
  background: var(--red);
}

.service-card p,
.legal-note {
  color: var(--muted);
  line-height: 1.55;
}

.split-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  background: #eef2ed;
}

.split-info article {
  padding: 24px;
}

.tag-grid span,
.tag-grid a {
  color: var(--ink);
  border-color: var(--line);
  background: #fbfcfa;
}

.tag-grid a:hover {
  color: var(--green);
  border-color: var(--green);
}

.legal-note {
  margin: 18px 0 0;
  font-size: 14px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 20px;
  color: var(--white);
  background: #0b0b0b;
}

.sidebar-head {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.app-brand-mark {
  width: 88px;
  height: 42px;
  font-size: 12px;
  letter-spacing: 0;
}

.sidebar .brand {
  align-items: center;
  gap: 10px;
}

.brand-lines {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sidebar .brand-lines small {
  max-width: 150px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.66);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .brand-lines small:first-child {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.sidebar .brand-lines small:last-child {
  color: rgba(255, 255, 255, 0.64);
  font-size: 13px;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  position: relative;
  overflow: hidden;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 15px;
  font-size: 16px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.nav-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 42%, rgba(255, 255, 255, 0.1)),
    radial-gradient(110px 28px at 50% 92%, rgba(255, 255, 255, 0.16), transparent 72%);
  transition: opacity 0.2s ease;
}

.nav-item::after {
  content: "";
  position: absolute;
  inset: auto 18% 7px;
  height: 14px;
  border-radius: 999px;
  opacity: 0;
  background: rgba(255, 255, 255, 0.16);
  filter: blur(10px);
  transition: opacity 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -18px 28px rgba(255, 255, 255, 0.1),
    0 12px 28px rgba(0, 0, 0, 0.18);
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item.active::after {
  opacity: 1;
}

.admin-only {
  display: none;
}

.is-admin .admin-only {
  display: block;
}

.is-admin th.admin-only,
.is-admin td.admin-only {
  display: table-cell;
}

.is-admin .client-only {
  display: none;
}

.sidebar-note {
  margin-top: 0;
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-search {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.sidebar-search label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.sidebar-search input {
  min-height: 36px;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.search-results {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.search-result {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px;
  color: #f4f4f2;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
  cursor: pointer;
}

.search-result strong {
  color: #f4f4f2;
}

.search-result span,
.search-result small {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.theme-dark .search-result,
.theme-dark .search-result strong {
  color: #f4f4f2;
}

.is-search-highlight {
  position: relative;
  animation: searchHighlight 2.8s ease-out;
  outline: 2px solid rgba(49, 126, 92, 0.75);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px rgba(49, 126, 92, 0.14);
}

@keyframes searchHighlight {
  0% {
    background: rgba(49, 126, 92, 0.24);
  }
  100% {
    background: transparent;
  }
}

.sidebar-note span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  line-height: 1.45;
}

.sidebar-note .rate-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.sidebar-note .rate-line strong {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.topbar h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.user-chip span {
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  border: 0;
  padding: 0;
  color: var(--green);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}

.metric-card {
  min-height: 60px;
  display: grid;
  align-content: space-between;
  gap: 4px;
  padding: 8px 9px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 16px;
  line-height: 1.12;
}

.metric-card small,
.metric-card span {
  font-size: 11px;
}

.account-strip {
  position: sticky;
  top: 0;
  z-index: 4;
  padding-bottom: 3px;
  background: var(--paper);
}

.content-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 12px;
}

.finance-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.finance-order-panel .admin-form,
.admin-order-module .admin-form,
.finance-ledger-panel .admin-form {
  gap: 9px;
}

.finance-grid > .panel {
  height: 100%;
}

.finance-ledger-panel .admin-form {
  height: calc(100% - 44px);
  align-content: start;
}

.finance-order-panel textarea,
.admin-order-module textarea {
  min-height: 82px;
}

.finance-ledger-panel .inline-form {
  grid-template-columns: 1fr;
}

.admin-order-module {
  width: 100%;
}

.client-balances-list {
  display: grid;
  gap: 8px;
}

.balance-client-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 110px 100px 90px auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.balance-client-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-client-row span,
.balance-client-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.balance-client-row.is-empty {
  grid-template-columns: 1fr;
}

.theme-dark .balance-client-row {
  background: #111;
}

.dashboard-flow {
  display: grid;
  gap: 12px;
}

.request-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full-row {
  grid-column: 1 / -1;
}

.panel {
  padding: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.catalog-grid {
  grid-template-columns: 1fr;
  align-items: start;
}

.catalog-summary,
.catalog-card {
  display: grid;
  gap: 10px;
}

.catalog-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.catalog-summary-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
}

.catalog-summary-grid strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.catalog-summary-grid p,
.catalog-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.42;
}

.dealer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.dealer-grid span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.catalog-dealer-panel .dealer-grid span {
  flex: 1 1 150px;
  justify-content: space-between;
}

.dealer-grid b {
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--green);
  background: #e6f0ea;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.shop-list {
  display: grid;
  gap: 8px;
}

.shop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
}

.shop-row h3 {
  margin: 0 0 3px;
  font-size: 14px;
  line-height: 1.15;
}

.shop-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.shop-row a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--green);
  background: var(--white);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.shop-row a:hover {
  color: #ffffff;
  border-color: var(--green);
  background: var(--green);
}

body.theme-dark .catalog-summary-grid > div,
body.theme-dark .dealer-grid span,
body.theme-dark .shop-row,
body.theme-dark .shop-row a {
  background: #111;
}

body.theme-dark .dealer-grid b {
  background: rgba(138, 208, 175, 0.14);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--green);
  background: #e6f0ea;
  font-size: 12px;
  font-weight: 800;
}

.pill.danger {
  color: var(--red);
  background: #f7e7e5;
}

.timeline,
.quote-list,
.admin-list,
.quote-form,
.admin-form {
  display: grid;
  gap: 9px;
}

#ordersView {
  display: none;
}

#ordersView.active {
  display: grid;
  gap: 18px;
}

.compact-form {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.form-row,
.inline-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.source-form-row {
  grid-template-columns: minmax(110px, 0.45fr) minmax(260px, 1fr) auto;
  align-items: start;
}

.quote-source-form-row {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.source-list {
  display: grid;
  gap: 7px;
}

.source-row {
  display: grid;
  grid-template-columns: 96px minmax(220px, 1fr) auto;
  gap: 7px;
  align-items: end;
}

.source-row-priced {
  grid-template-columns: 96px minmax(220px, 1fr) minmax(180px, 0.8fr) minmax(120px, 0.35fr) minmax(120px, 0.35fr) auto;
}

.source-row label {
  margin: 0;
}

.source-row input {
  min-height: 38px;
}

.quote-position-toolbar,
.entity-position-head,
.entity-position-money {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quote-position-editor,
.entity-position-list {
  display: grid;
  gap: 10px;
}

.quote-position-row {
  grid-template-columns: minmax(220px, 1.7fr) minmax(180px, 1.2fr) 82px minmax(115px, 0.7fr) minmax(115px, 0.7fr) minmax(190px, 1.2fr) auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.quote-position-row textarea {
  min-height: 38px;
}

.entity-position-list {
  width: 100%;
}

.entity-position {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.entity-position-money {
  justify-content: flex-start;
}

.order-service-row {
  grid-template-columns: minmax(130px, 0.6fr) minmax(180px, 1fr) minmax(220px, 1.15fr) minmax(140px, 0.7fr);
  align-items: end;
}

.order-service-row .date-toggle,
.order-service-row .check-card {
  min-height: 42px;
  padding: 0 12px;
  align-items: center;
}

.add-source-button {
  justify-self: start;
  align-self: end;
  width: auto;
  min-width: 88px;
  min-height: 34px;
}

.source-form-row .add-source-button {
  align-self: start;
  margin-top: 24px;
}

.remove-source-button {
  min-width: 34px;
  color: var(--red);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.admin-client-filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 340px);
  gap: 8px;
  align-items: end;
  margin: 8px 0 12px;
}

.admin-client-filter-row label,
.admin-client-filter-row select {
  width: 100%;
}

.inline-form {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.7fr) minmax(140px, 0.7fr) minmax(220px, 1fr) auto;
  align-items: end;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.check-grid label,
.check-card {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fbfcfa;
  font-size: 13px;
}

.check-grid input,
.check-card input {
  width: auto;
}

.check-cell {
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.warehouse-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 160px;
  justify-content: start;
  align-items: end;
  gap: 8px;
  margin: -2px 0 8px;
}

.warehouse-toolbar label {
  width: 100%;
  min-width: 0;
  max-width: none;
  font-size: 11px;
  color: var(--muted);
}

.warehouse-toolbar select {
  min-height: 34px;
  padding: 0 28px 0 10px;
  font-size: 12px;
}

.warehouse-toolbar label:first-child {
  min-width: 0;
}

.warehouse-toolbar label:last-child {
  width: 100%;
}

.compact-table {
  font-size: 13px;
}

.compact-table th,
.compact-table td {
  padding: 7px 8px;
  vertical-align: middle;
}

.warehouse-table th,
.warehouse-table td {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.warehouse-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  min-width: 0;
}

.warehouse-table th:first-child,
.warehouse-table td:first-child {
  max-width: 0;
  white-space: normal;
  width: 32%;
}

.warehouse-table th:nth-child(2),
.warehouse-table td:nth-child(2) {
  width: 5%;
}

.warehouse-table th:nth-child(3),
.warehouse-table td:nth-child(3) {
  width: 8%;
}

.warehouse-table th:nth-child(4),
.warehouse-table td:nth-child(4) {
  width: 7%;
  max-width: 0;
}

.warehouse-table th:nth-child(5),
.warehouse-table td:nth-child(5) {
  width: 9%;
}

.warehouse-table th:nth-child(6),
.warehouse-table td:nth-child(6),
.warehouse-table th:nth-child(7),
.warehouse-table td:nth-child(7) {
  width: 8.5%;
}

.warehouse-table th:nth-child(8),
.warehouse-table td:nth-child(8) {
  width: 22%;
}

.warehouse-position-cell {
  min-width: 0;
  overflow: hidden;
}

.warehouse-position-name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.18;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.warehouse-position-meta {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-place-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.warehouse-place-text {
  display: inline-block;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.compact-source-link {
  display: inline-block;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-actions {
  min-width: 0;
  overflow: visible !important;
  white-space: normal !important;
  text-align: right;
}

.warehouse-actions .compact-action {
  display: inline-flex;
  min-height: 28px;
  margin: 2px 0 2px 4px;
  padding: 5px 7px;
  font-size: 12px;
  white-space: nowrap;
}

.warehouse-edit-row td {
  background: var(--soft);
  padding: 8px;
  white-space: normal;
}

.warehouse-edit-form {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) 72px minmax(150px, 1fr) 124px 108px 108px 150px;
  gap: 8px;
  align-items: end;
  max-width: 100%;
}

.warehouse-edit-form input {
  min-width: 0;
}

.warehouse-edit-form label {
  margin: 0;
}

.warehouse-edit-actions {
  display: flex;
  gap: 6px;
  align-items: end;
  justify-content: flex-end;
}

.table-section-row td {
  background: #f0f6f1;
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.compact-action {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.warehouse-distribution {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fbf8;
}

.compact-panel-head {
  margin-bottom: 0;
}

.compact-panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.warehouse-distribution-list {
  display: grid;
  gap: 8px;
}

.warehouse-distribution-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.25fr) 72px minmax(100px, 0.7fr) minmax(130px, 0.9fr) minmax(100px, 0.7fr) minmax(110px, 0.7fr) minmax(120px, 0.75fr) auto;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--white);
}

.warehouse-distribution-row.is-paid {
  opacity: 0.72;
}

.warehouse-paid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.warehouse-paid input {
  width: auto;
}

.date-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-toggle input {
  width: auto;
}

.profit-metrics {
  position: static;
}

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

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.group-header strong {
  font-size: 14px;
}

.group-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-item,
.quote-item,
.admin-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fbfcfa;
}

.theme-dark .timeline-item,
.theme-dark .quote-item,
.theme-dark .admin-item,
.theme-dark .tab-button,
.theme-dark .check-grid label,
.theme-dark .warehouse-distribution,
.theme-dark .warehouse-distribution-row {
  background: #171717;
}

.theme-dark .table-section-row td {
  background: #171717;
  color: #e2e2e2;
}

.timeline-item strong,
.quote-item strong,
.admin-item strong {
  display: block;
  margin-bottom: 3px;
}

.timeline-item span,
.quote-item span,
.admin-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.note-line {
  color: var(--steel) !important;
}

.note-line strong {
  display: inline;
  margin: 0;
  color: var(--ink);
}

.admin-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.request-panel {
  margin-top: 18px;
}

.work-item summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.work-item summary::-webkit-details-marker {
  display: none;
}

.work-item summary::after {
  content: "Открыть";
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--green);
  background: var(--white);
  font-size: 12px;
  font-weight: 800;
}

.work-item[open] summary::after {
  content: "Скрыть";
}

.work-item-body {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--green);
  background: var(--white);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.detail-row td {
  padding-top: 0;
}

.detail-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(46, 114, 86, 0.05);
}

.detail-panel div {
  display: grid;
  gap: 3px;
}

.detail-panel strong {
  font-size: 12px;
}

.detail-panel span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-panel {
  max-width: none;
}

.management-panel {
  max-width: none;
}

.management-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(320px, 1fr);
  gap: 12px;
  align-items: start;
}

.announcement-form,
.announcement-log {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.inner-head {
  margin-bottom: 0;
}

.inner-head h3 {
  margin: 0;
  font-size: 18px;
}

.compact-list {
  gap: 8px;
}

.compact-announcement span {
  overflow-wrap: anywhere;
}

.calc-panel {
  max-width: none;
}

.calc-mode {
  display: none;
  gap: 12px;
  margin-top: 12px;
}

.calc-mode.active {
  display: grid;
}

.calc-two-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.calc-form,
.calc-history-block {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--white);
}

.theme-dark .calc-form,
.theme-dark .calc-history-block {
  background: #111;
}

.compact-calc-row {
  grid-template-columns: minmax(130px, 0.45fr) minmax(130px, 0.45fr) minmax(180px, 1fr);
}

.calc-lines {
  display: grid;
  gap: 8px;
}

.calc-line {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) repeat(3, minmax(105px, 0.6fr)) auto;
  gap: 8px;
  align-items: end;
}

.markup-line {
  grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(120px, 0.6fr)) auto;
}

.calc-line .mini-button {
  min-height: 42px;
  padding: 8px 12px;
}

.calc-add-button {
  width: max-content;
}

.calc-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #f4f8f5;
}

.theme-dark .calc-summary {
  background: #171717;
}

.calc-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calc-summary strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
}

.calc-breakdown {
  min-width: 0;
}

.calc-breakdown-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background: #fbfcfa;
}

.theme-dark .calc-breakdown-empty {
  background: #151515;
}

.calc-live-table-wrap {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.calc-live-table {
  min-width: 980px;
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.calc-live-table th,
.calc-live-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.calc-live-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.calc-live-table tbody tr:last-child td {
  border-bottom: 0;
}

.calc-active-cell {
  background: #e8f4ef;
  color: var(--green);
  font-weight: 900;
}

.theme-dark .calc-active-cell {
  background: #222;
  color: #f4f4f2;
}

.calc-history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}

.theme-dark .calc-history-item {
  background: #101010;
}

.calc-history-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f4f8f5;
}

.theme-dark .calc-history-totals {
  background: #171717;
}

.calc-history-totals span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.calc-history-totals strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 15px;
}

.calc-history-item summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.calc-history-item summary::-webkit-details-marker {
  display: none;
}

.calc-history-item summary span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.calc-history-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.source-link {
  color: #1d6fd1;
  font-weight: 900;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.item-status-stack {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.paid-badge {
  background: #dff4e8;
  color: #1f7d52;
}

.theme-dark .source-link {
  color: #7cb7ff;
}

.theme-dark .paid-badge {
  background: rgba(80, 190, 130, 0.18);
  color: #8fe0b1;
}

.calc-history-body {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
}

.calc-table-wrap {
  margin: 0;
}

.calc-mini-table {
  min-width: 760px;
  font-size: 13px;
}

.calc-mini-table th,
.calc-mini-table td {
  padding: 8px;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.switch-row,
.setting-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.theme-dark .switch-row,
.theme-dark .setting-block {
  background: #171717;
}

.switch-row span,
.setting-block {
  min-width: 0;
}

.switch-row strong,
.setting-block strong {
  display: block;
  margin-bottom: 3px;
}

.switch-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.switch-row input[type="checkbox"] {
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--green);
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--white);
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 7px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented-control input:checked + span {
  color: #ffffff;
  background: var(--green);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.tab-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--muted);
  background: #fbfcfa;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.tab-button.active {
  color: var(--white);
  border-color: var(--green);
  background: var(--green);
}

.tab-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 20px;
  margin-left: 5px;
  border-radius: 999px;
  background: rgba(18, 36, 30, 0.08);
  font-size: 11px;
}

.tab-button.active span {
  color: var(--green);
  background: var(--white);
}

.user-tab {
  display: none;
}

.user-tab.active {
  display: grid;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.theme-dark input,
.theme-dark select,
.theme-dark textarea {
  color: var(--ink);
  border-color: var(--line);
  background: #111;
}

.theme-dark .primary {
  color: #ffffff;
  background: #c73b32;
}

.theme-dark .secondary,
.theme-dark .button.secondary {
  color: #f4f4f2;
  border-color: #3c4140;
  background: #171717;
}

.theme-dark .danger-button {
  color: #ffb2ac;
  border-color: rgba(199, 59, 50, 0.45);
  background: rgba(199, 59, 50, 0.14);
}

.theme-dark .panel,
.theme-dark .metric-card,
.theme-dark .user-chip,
.theme-dark .auth-card {
  background: var(--white);
}

.theme-dark .panel h2,
.theme-dark .metric-card strong,
.theme-dark .switch-row strong,
.theme-dark .setting-block strong,
.theme-dark .topbar h1,
.theme-dark .user-chip strong {
  color: #f4f4f2;
}

.theme-dark .metric-card span,
.theme-dark .metric-card small,
.theme-dark .switch-row small,
.theme-dark .form-note,
.theme-dark .user-chip span {
  color: #b8bbb8;
}

.theme-dark .account-strip {
  background: var(--paper);
}

.theme-dark .sidebar {
  color: #f4f4f2;
  background: #080808;
}

.theme-dark .nav-item:hover,
.theme-dark .nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -18px 28px rgba(255, 255, 255, 0.08),
    0 12px 28px rgba(0, 0, 0, 0.22);
}

.theme-dark .sidebar-note > strong,
.theme-dark .sidebar-note .rate-line strong {
  color: #ffffff;
}

.theme-dark .sidebar-note span,
.theme-dark .sidebar-note .rate-line {
  color: #c8cbc8;
}

.theme-dark .pill {
  color: #e2e2e2;
  background: rgba(255, 255, 255, 0.08);
}

.theme-dark .pill.danger {
  color: #ffb2ac;
  background: rgba(199, 59, 50, 0.18);
}

.theme-dark .segmented-control {
  border-color: #3c4140;
  background: #111;
}

.theme-dark .segmented-control span {
  color: #b8bbb8;
}

.theme-dark .segmented-control input:checked + span {
  color: #0b0b0b;
  background: #d7d7d7;
}

.theme-dark .status.quote,
.theme-dark .status.requested,
.theme-dark .status.quote-new {
  background: rgba(210, 154, 59, 0.18);
}

.theme-dark .status.buy,
.theme-dark .status.ordered,
.theme-dark .status.quote-priced,
.theme-dark .status.quote-approved {
  background: rgba(157, 167, 173, 0.18);
}

.theme-dark .status.transit,
.theme-dark .status.in-poland,
.theme-dark .status.in-minsk,
.theme-dark .status.quote-order_requested,
.theme-dark .status.done,
.theme-dark .status.delivered {
  background: rgba(255, 255, 255, 0.12);
}

.theme-dark .status.cancelled,
.theme-dark .status.quote-rejected {
  background: rgba(199, 59, 50, 0.2);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
}

.status.quote {
  color: var(--amber);
  background: #f8efd9;
}

.status.requested,
.status.quote-new {
  color: var(--amber);
  background: #f8efd9;
}

.status.buy,
.status.ordered,
.status.quote-priced,
.status.quote-approved {
  color: var(--steel);
  background: #e6eef1;
}

.status.transit,
.status.in-poland,
.status.in-minsk,
.status.quote-order_requested {
  color: var(--green);
  background: #e6f0ea;
}

.status.done,
.status.delivered {
  color: var(--green);
  background: #d9f0e1;
}

.status.cancelled,
.status.quote-rejected {
  color: var(--red);
  background: #f7e7e5;
}

.quote-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.item-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.item-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.quote-price {
  text-align: right;
  font-weight: 800;
  font-size: 13px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow);
  animation: toastIn 0.22s ease-out;
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.toast span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.action-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right));
  background: rgb(7 13 12 / 0.58);
  backdrop-filter: blur(10px);
}

.action-modal.hidden {
  display: none;
}

.action-modal-card {
  width: min(440px, calc(100vw - 28px));
  max-height: min(72vh, 520px);
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: auto;
  overscroll-behavior: contain;
}

.action-modal-card h2 {
  margin: 0;
  font-size: 24px;
}

.action-modal-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .public-hero,
  .app-shell,
  .content-grid,
  .admin-grid,
  .finance-grid,
  .management-grid,
  .split-info {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 12px;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 13px;
    white-space: nowrap;
  }

  .metric-grid,
  .service-grid,
  .request-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  body {
    position: relative;
  }

  .public-header {
    position: static;
    color: var(--ink);
    background: var(--white);
    padding: 14px 16px;
  }

  .public-brand .brand-mark {
    color: var(--white);
    background: var(--dark);
  }

  .public-nav {
    display: none;
  }

  .public-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 34px 16px 24px;
  }

  .public-hero h1 {
    font-size: 34px;
    line-height: 1.04;
  }

  .public-hero p {
    font-size: 15px;
    line-height: 1.5;
  }

  .auth-card {
    padding: 18px;
  }

  .catalog-summary-grid {
    grid-template-columns: 1fr;
  }

  .dealer-grid span {
    min-height: 30px;
    font-size: 12px;
  }

  .shop-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .shop-row a {
    width: 100%;
  }

  .hero-tags span,
  .tag-grid span,
  .tag-grid a {
    min-height: 32px;
    font-size: 12px;
  }

  .public-section,
  .sidebar,
  .workspace {
    padding: 14px;
  }

  .app-shell {
    display: block;
    width: 100%;
    max-width: 100vw;
    min-height: 100svh;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    max-width: 100%;
    gap: 8px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
  }

  .sidebar-head {
    display: grid;
    grid-template-columns: minmax(0, max-content) minmax(128px, 146px);
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
  }

  .sidebar .brand {
    gap: 6px;
    min-width: 0;
  }

  .app-brand-mark {
    width: 60px;
    height: 29px;
    border-radius: 7px;
    font-size: 8.5px;
  }

  .sidebar .brand-lines small {
    max-width: none;
  }

  .sidebar .brand-lines small:first-child {
    font-size: 9.5px;
  }

  .sidebar .brand-lines small:last-child {
    font-size: 9.5px;
  }

  .side-nav {
    width: 100%;
    max-width: calc(100vw - 28px);
    margin: 0;
    padding: 0 0 3px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
  }

  .nav-item {
    min-height: 30px;
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0 9px;
    font-size: 11px;
  }

  .sidebar-search {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-top: 0;
  }

  .sidebar-search label {
    display: contents;
    font-size: 11px;
    font-weight: 800;
  }

  .sidebar-search input {
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }

  .sidebar-search .search-results {
    grid-column: 1 / -1;
  }

  .sidebar-note {
    min-width: 0;
    width: 100%;
    align-self: stretch;
    gap: 3px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
  }

  .sidebar-note strong {
    font-size: 9px;
    line-height: 1;
  }

  .sidebar-note span {
    font-size: 10px;
    line-height: 1.2;
  }

  .sidebar-note .rate-line {
    min-height: 16px;
    justify-content: flex-start;
    gap: 6px;
    font-size: 10px;
  }

  .sidebar-note .rate-line strong {
    min-width: 44px;
    font-size: 10px;
  }

  @media (max-width: 380px) {
    .sidebar-head {
      grid-template-columns: minmax(0, max-content) minmax(118px, 132px);
      gap: 8px;
    }

    .app-brand-mark {
      width: 56px;
      font-size: 8px;
    }

    .sidebar .brand-lines small:first-child,
    .sidebar .brand-lines small:last-child {
      font-size: 9px;
    }

    .sidebar-note {
      padding-inline: 7px;
    }

    .topbar {
      grid-template-columns: minmax(0, 1fr);
      align-items: stretch;
    }

    .user-chip {
      justify-self: stretch;
      justify-content: space-between;
      max-width: none;
      padding: 5px 0 0;
      border-top: 1px solid var(--line);
    }
  }

  .side-nav,
  .metric-grid,
  .service-grid,
  .form-row,
  .source-form-row,
  .inline-form,
  .warehouse-toolbar,
  .check-grid,
  .warehouse-distribution-row,
  .request-grid {
    grid-template-columns: 1fr;
  }

  .warehouse-distribution {
    padding: 8px;
  }

  .warehouse-toolbar {
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 6px;
  }

  .warehouse-toolbar label:first-child {
    min-width: 0;
    max-width: none;
  }

  .warehouse-toolbar label:last-child {
    width: 100%;
  }

  .warehouse-distribution-row {
    align-items: stretch;
  }

  .workspace {
    width: 100%;
    max-width: 100%;
    padding-top: 12px;
    overflow-x: hidden;
  }

  .view,
  .view.active,
  .panel,
  .table-wrap,
  .filter-row,
  .settings-form,
  .settings-panel,
  .management-panel,
  .management-grid,
  .announcement-form,
  .announcement-log {
    min-width: 0;
    max-width: 100%;
  }

  #ordersView.active {
    display: block;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px 10px;
    margin-bottom: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: var(--white);
    box-shadow: 0 1px 0 rgba(24, 33, 31, 0.04);
  }

  .topbar > div {
    display: grid;
    min-width: 0;
    gap: 3px;
  }

  .topbar .eyebrow {
    margin-bottom: 0;
    font-size: 10px;
    line-height: 1.1;
  }

  .topbar h1 {
    min-width: 0;
    overflow: hidden;
    font-size: 24px;
    line-height: 1.02;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-chip {
    align-items: center;
    justify-content: end;
    display: inline-grid;
    grid-template-columns: auto auto auto;
    gap: 6px;
    max-width: min(46vw, 210px);
    border-color: transparent;
    padding: 4px 0 4px 6px;
    background: transparent;
    font-size: 11px;
  }

  .user-chip span {
    font-size: 11px;
  }

  .user-chip strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-chip .text-button {
    font-size: 12px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 7px;
  }

  .metric-card {
    min-height: 58px;
    gap: 2px;
    padding: 7px 8px;
  }

  .metric-card span,
  .metric-card small {
    font-size: 10px;
    line-height: 1.25;
  }

  .metric-card strong {
    font-size: 15px;
    line-height: 1.05;
  }

  .panel {
    padding: 10px;
  }

  .panel-head {
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
  }

  .panel-head h2 {
    min-width: 0;
    font-size: 17px;
  }

  .pill {
    flex: 0 1 auto;
    min-height: 24px;
    max-width: 100%;
    font-size: 11px;
    white-space: normal;
    text-align: center;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    margin: 0 0 8px;
    padding: 0 0 4px;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
  }

  .tab-button {
    flex: 0 0 auto;
    min-height: 32px;
    font-size: 12px;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    position: relative;
    margin-bottom: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 8px;
    border-bottom: 1px solid var(--line);
    padding: 8px 9px;
    font-size: 13px;
  }

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

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  td[colspan] {
    grid-template-columns: 1fr;
  }

  td[colspan]::before,
  .detail-row td::before {
    content: "";
    display: none;
  }

  .detail-row {
    margin-top: -9px;
    border-top: 0;
  }

  .detail-panel {
    grid-template-columns: 1fr;
    border: 0;
    padding: 0;
    background: transparent;
  }

  .mini-button {
    justify-self: start;
  }

  .expandable-row .detail-toggle-cell {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: block;
    width: auto;
    border: 0;
    padding: 0;
  }

  .expandable-row .detail-toggle-cell::before {
    display: none;
  }

  .expandable-row .detail-toggle-cell .mini-button {
    min-height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
  }

  .expandable-row td:nth-child(2) {
    padding-right: 116px;
  }

  #ordersView .table-wrap {
    overflow: hidden;
  }

  #ordersView tr:not(.expandable-row):not(.detail-row) {
    border: 0;
    background: transparent;
  }

  #ordersView tr:not(.expandable-row):not(.detail-row) td {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: var(--white);
  }

  #ordersView tr:not(.expandable-row):not(.detail-row) td strong {
    display: block;
    font-size: 18px;
    line-height: 1.15;
  }

  #ordersView tr:not(.expandable-row):not(.detail-row) td .muted {
    display: block;
    margin-top: 6px;
    font-size: 14px;
  }

  #ordersView .expandable-row td {
    grid-template-columns: 82px minmax(0, 1fr);
    padding: 7px 8px;
  }

  #ordersView .expandable-row td:nth-child(2) {
    padding-right: 108px;
  }

  #ordersView .expandable-row .status {
    justify-self: start;
    max-width: 100%;
    white-space: normal;
  }

  .admin-item-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .source-form-row .add-source-button {
    width: 100%;
    margin-top: 0;
  }

  .source-row {
    grid-template-columns: 82px minmax(0, 1fr) 42px;
  }

  .source-row-priced {
    grid-template-columns: 78px minmax(0, 1fr) 42px;
  }

  .source-row-priced label:nth-of-type(3),
  .source-row-priced label:nth-of-type(4),
  .source-row-priced label:nth-of-type(5) {
    grid-column: 1 / -1;
  }

  .warehouse-edit-form {
    grid-template-columns: 1fr;
  }

  .warehouse-edit-actions {
    flex-direction: column;
  }

  .order-service-row {
    grid-template-columns: 1fr 1fr;
  }

  .balance-client-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .balance-client-row span,
  .balance-client-row small {
    grid-column: auto;
  }

  .balance-client-row b {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

  .filter-row {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .filter-row label,
  .filter-row input,
  .filter-row button {
    min-width: 0;
    width: 100%;
  }

  .settings-panel {
    width: 100%;
    max-width: none;
    overflow: hidden;
  }

  .settings-panel *,
  .topbar *,
  .metric-grid *,
  .sidebar * {
    max-width: 100%;
  }

  .settings-form,
  .announcement-form,
  .announcement-log,
  .switch-row,
  .setting-block,
  .segmented-control,
  .settings-panel .button,
  .management-panel .button {
    width: 100%;
    max-width: 100%;
  }

  .management-grid {
    grid-template-columns: 1fr;
  }

  .calc-two-columns,
  .compact-calc-row,
  .calc-line,
  .markup-line,
  .calc-summary {
    grid-template-columns: 1fr;
  }

  .calc-panel {
    padding: 10px;
  }

  .calc-panel .panel-head h2,
  .calc-form .inner-head h3,
  .calc-history-block .inner-head h3 {
    font-size: 20px;
    line-height: 1.05;
  }

  .calc-form,
  .calc-history-block {
    gap: 7px;
    padding: 9px;
  }

  .calc-line {
    gap: 6px;
  }

  .calc-line label,
  .compact-calc-row label {
    font-size: 13px;
  }

  .calc-line .mini-button {
    min-height: 34px;
    padding: 5px 9px;
  }

  .calc-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 8px;
  }

  .calc-summary span {
    font-size: 10px;
  }

  .calc-summary strong {
    font-size: 13px;
  }

  .calc-live-table {
    min-width: 690px;
    font-size: 10px;
  }

  .calc-live-table th,
  .calc-live-table td {
    padding: 4px 5px;
  }

  .calc-live-table th {
    font-size: 9px;
  }

  .calc-mini-table {
    min-width: 620px;
    font-size: 10px;
  }

  .calc-history-body {
    padding: 7px;
  }

  .calc-history-item summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .calc-history-item summary span {
    white-space: normal;
  }

  .calc-add-button {
    width: 100%;
  }

  .app-shell,
  .panel,
  .metric-card,
  .switch-row,
  .setting-block,
  .nav-item,
  .tab-button,
  .user-chip,
  .button,
  .mini-button {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  input,
  textarea,
  select {
    max-width: 100%;
    font-size: 16px !important;
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
  }

  .action-modal {
    align-items: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .action-modal-card {
    width: min(380px, calc(100vw - 24px));
    max-height: min(70svh, 480px);
    gap: 10px;
    padding: 14px;
    border-radius: 9px;
  }

  .action-modal-card h2 {
    font-size: 20px;
    line-height: 1.1;
  }

  .action-modal-card p {
    font-size: 14px;
  }

  .toast-stack {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
  }

  .switch-row,
  .setting-block {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
  }

  .segmented-control {
    width: 100%;
    display: flex;
    min-width: 0;
  }

  .segmented-control label,
  .segmented-control span {
    min-width: 0;
    flex: 1;
  }

  .segmented-control span {
    justify-content: center;
  }

  /* Compact standalone-PWA layout for phones. */
  .sidebar {
    padding: max(10px, env(safe-area-inset-top)) 10px 8px;
  }

  .workspace {
    padding: 8px 8px max(12px, env(safe-area-inset-bottom));
  }

  .topbar {
    padding: 7px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .metric-grid {
    gap: 4px;
  }

  .metric-card {
    min-height: 52px;
    padding: 6px 7px;
  }

  .metric-card span,
  .metric-card small {
    font-size: 9px;
  }

  .metric-card strong {
    font-size: 14px;
  }

  .panel {
    padding: 8px;
  }

  .panel-head {
    gap: 7px;
    margin-bottom: 7px;
  }

  .panel-head h2,
  .calc-panel .panel-head h2,
  .calc-form .inner-head h3,
  .calc-history-block .inner-head h3 {
    font-size: 16px;
  }

  .pill {
    min-height: 22px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .admin-form,
  .quote-form,
  .calc-form,
  .calc-history-block {
    gap: 6px;
  }

  label {
    gap: 3px;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    line-height: 1.2;
  }

  textarea {
    min-height: 72px;
  }

  input[type="file"] {
    min-height: 40px;
    padding: 5px 7px;
    font-size: 13px !important;
  }

  input[type="checkbox"],
  input[type="radio"] {
    min-height: 0;
    padding: 0;
  }

  input[type="date"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 38px;
  }

  .button,
  .mini-button {
    min-height: 34px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .form-note {
    padding: 6px 7px;
    font-size: 11px;
  }

  .order-service-row,
  .compact-calc-row,
  .calc-line,
  .markup-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .order-service-row > label,
  .compact-calc-row > label,
  .calc-line > label {
    min-width: 0;
  }

  .compact-calc-row > label:last-child,
  .calc-line > label:first-child {
    grid-column: 1 / -1;
  }

  .calc-line .mini-button {
    width: 38px;
    min-height: 38px;
    justify-self: start;
    padding: 5px;
  }

  .calc-add-button {
    min-height: 34px;
  }

  .filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .filter-row > label:first-child,
  .filter-row > button:last-child {
    grid-column: 1 / -1;
  }

  .warehouse-toolbar {
    grid-template-columns: minmax(0, 1fr) 118px;
  }

  .warehouse-table,
  .warehouse-table tbody,
  .warehouse-table tr {
    width: 100%;
    max-width: 100%;
  }

  .warehouse-table th,
  .warehouse-table td,
  .warehouse-table th:first-child,
  .warehouse-table td:first-child,
  .warehouse-table th:nth-child(2),
  .warehouse-table td:nth-child(2),
  .warehouse-table th:nth-child(3),
  .warehouse-table td:nth-child(3),
  .warehouse-table th:nth-child(4),
  .warehouse-table td:nth-child(4),
  .warehouse-table th:nth-child(5),
  .warehouse-table td:nth-child(5),
  .warehouse-table th:nth-child(6),
  .warehouse-table td:nth-child(6),
  .warehouse-table th:nth-child(7),
  .warehouse-table td:nth-child(7),
  .warehouse-table th:nth-child(8),
  .warehouse-table td:nth-child(8) {
    width: 100%;
    max-width: none;
    overflow: visible;
    white-space: normal;
  }

  .warehouse-table td {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 6px;
    padding: 6px 7px;
    font-size: 12px;
  }

  .warehouse-table td::before {
    font-size: 10px;
  }

  .warehouse-position-name {
    -webkit-line-clamp: 3;
  }

  .warehouse-actions {
    display: grid;
    grid-template-columns: 82px repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 5px;
    text-align: left;
  }

  .warehouse-actions .compact-action {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 5px 4px;
    font-size: 11px;
  }

  .table-section-row td {
    display: block;
    padding: 6px 7px;
  }

  .calc-live-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
  }

  .calc-live-table {
    display: table;
    min-width: 620px;
    table-layout: auto;
    font-size: 10px;
  }

  .calc-live-table thead {
    display: table-header-group;
  }

  .calc-live-table tbody {
    display: table-row-group;
  }

  .calc-live-table tr {
    display: table-row;
    width: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .calc-live-table th,
  .calc-live-table td {
    display: table-cell;
    width: auto;
    padding: 5px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 10px;
    white-space: nowrap;
  }

  .calc-live-table th {
    font-size: 9px;
  }

  .calc-live-table td::before {
    content: none;
    display: none;
  }

  /* Second mobile density pass: prioritize content over controls. */
  input[type="date"] {
    height: 30px;
    min-height: 30px;
    padding: 3px 7px;
    font-size: 12px !important;
  }

  .filter-row {
    margin-bottom: 7px;
  }

  .filter-row > label {
    font-size: 10px;
  }

  .filter-row > button:last-child {
    width: auto;
    min-width: 96px;
    min-height: 30px;
    justify-self: end;
    padding-inline: 12px;
  }

  #ledgerForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  #ledgerForm > label:nth-of-type(1),
  #ledgerForm > label:nth-of-type(4),
  #ledgerForm > button,
  #ledgerForm > .form-note {
    grid-column: 1 / -1;
  }

  #ledgerForm .date-toggle,
  #ledgerForm .check-card,
  .order-service-row .date-toggle,
  .order-service-row .check-card {
    min-height: 30px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .warehouse-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 112px !important;
    gap: 5px;
    margin-bottom: 6px;
  }

  .warehouse-toolbar label {
    min-width: 0;
    font-size: 9px;
  }

  .warehouse-toolbar select {
    min-height: 30px;
    height: 30px;
    padding: 3px 23px 3px 7px;
    font-size: 12px !important;
  }

  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td {
    width: 100%;
    min-width: 0;
    padding: 5px 7px;
    font-size: 11px;
  }

  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td::before {
    font-size: 9px;
    line-height: 1.1;
  }

  .warehouse-table .warehouse-position-cell {
    grid-column: 1 / -1;
    display: block;
    padding: 7px;
  }

  .warehouse-table .warehouse-position-cell::before {
    display: block;
    margin-bottom: 3px;
  }

  .warehouse-position-name {
    display: block;
    width: 100%;
    font-size: 13px;
    line-height: 1.2;
    -webkit-line-clamp: unset;
  }

  .warehouse-position-meta {
    margin-top: 3px;
    font-size: 10px;
  }

  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(2),
  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(3),
  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(4),
  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(5) {
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
  }

  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(2),
  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(4) {
    border-right: 1px solid var(--line);
  }

  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(6),
  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(7) {
    grid-column: 1 / -1;
    grid-template-columns: 105px minmax(0, 1fr);
    padding-block: 4px;
  }

  .warehouse-table tbody tr:not(.table-section-row):not(.warehouse-edit-row) > td:nth-child(7) {
    font-size: 12px;
  }

  .warehouse-paid {
    gap: 3px;
    font-size: 9px;
  }

  .warehouse-paid input {
    width: 14px;
    height: 14px;
  }

  .warehouse-table td.warehouse-actions {
    grid-column: 1 / -1;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    padding: 5px 7px;
  }

  .warehouse-actions::before {
    content: none;
    display: none;
  }

  .warehouse-actions .compact-action {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0;
    min-height: 27px;
    padding: 4px 8px;
    font-size: 10px;
  }

  #adminLedgerTable td,
  #profitabilityTable td {
    padding: 5px 7px;
    font-size: 12px;
  }

  #adminLedgerTable td::before,
  #profitabilityTable td::before {
    font-size: 9px;
  }

  .markup-form .compact-calc-row {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .markup-form .compact-calc-row > label:last-child {
    grid-column: auto;
  }

  .calc-summary {
    gap: 3px 5px;
    padding: 6px;
  }

  .calc-summary span {
    font-size: 9px;
  }

  .calc-summary strong {
    font-size: 12px;
  }

  .calc-breakdown-empty {
    padding: 7px;
    font-size: 11px;
  }

  /* Third mobile density pass: compact secondary controls and keep content dominant. */
  #profitabilityView .filter-row,
  #adminView .full-row .filter-row,
  #balanceView .filter-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 5px;
  }

  #profitabilityView .filter-row > label:first-child,
  #adminView .full-row .filter-row > label:first-child {
    grid-column: 1 / -1;
    width: min(100%, 270px);
  }

  #balanceView .filter-row > label:first-child {
    grid-column: auto;
  }

  #profitabilityView .filter-row > button:last-child,
  #adminView .full-row .filter-row > button:last-child,
  #balanceView .filter-row > button:last-child {
    grid-column: 3;
    width: auto;
    min-width: 70px;
    min-height: 28px;
    padding-inline: 8px;
    font-size: 10px;
  }

  #profitabilityView .filter-row select,
  #adminView .full-row .filter-row select {
    min-height: 30px;
    height: 30px;
    font-size: 12px !important;
  }

  #profitabilityView .filter-row input[type="date"],
  #adminView .full-row .filter-row input[type="date"],
  #balanceView .filter-row input[type="date"],
  #ledgerForm input[type="date"],
  #adminOrderForm input[type="date"] {
    height: 28px;
    min-height: 28px;
    font-size: 11px !important;
  }

  #ledgerForm > label:nth-of-type(6) {
    width: min(100%, 160px);
    justify-self: end;
  }

  .balance-client-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 2px 7px;
    padding: 6px 8px;
  }

  .balance-client-row strong {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: 12px;
  }

  .balance-client-row > b {
    grid-column: 2 / -1;
    grid-row: 1;
    justify-self: end;
    font-size: 12px;
    white-space: nowrap;
  }

  .balance-client-row > span {
    grid-column: 1;
    grid-row: 2;
    font-size: 9px;
  }

  .balance-client-row > small:first-of-type {
    grid-column: 2;
    grid-row: 2;
  }

  .balance-client-row > small:last-of-type {
    grid-column: 3;
    grid-row: 2;
  }

  .balance-client-row > small {
    font-size: 9px;
    white-space: nowrap;
  }

  .warehouse-toolbar {
    grid-template-columns: minmax(0, 1fr) 142px !important;
  }

  .warehouse-toolbar select {
    font-size: 11px !important;
  }

  .work-item summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 7px;
    align-items: center;
  }

  .work-item summary > .item-main {
    grid-column: 1 / -1;
    width: 100%;
    gap: 2px;
  }

  .work-item summary > .item-main > strong {
    margin-bottom: 1px;
    font-size: 14px;
    line-height: 1.18;
  }

  .work-item summary > .item-main > span {
    font-size: 10px;
    line-height: 1.3;
  }

  .work-item summary > .status,
  .work-item summary > .item-status-stack {
    grid-column: 1;
    justify-self: start;
  }

  .work-item summary > .status,
  .work-item summary > .item-status-stack .status,
  .work-item summary > .item-status-stack .paid-badge {
    min-height: 24px;
    padding: 3px 7px;
    font-size: 10px;
    line-height: 1.1;
  }

  .work-item summary::after {
    grid-column: 2;
    min-height: 24px;
    padding: 4px 8px;
    font-size: 10px;
  }

  #adminOrderForm > .form-row:not(.order-service-row),
  [data-admin-order-update-form] > .form-row:first-of-type {
    grid-template-columns: 62px repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  #adminOrderForm > .form-row:not(.order-service-row) > label,
  [data-admin-order-update-form] > .form-row:first-of-type > label,
  .source-row-priced > label {
    font-size: 9px;
  }

  #adminOrderForm > .form-row:not(.order-service-row) input,
  [data-admin-order-update-form] > .form-row:first-of-type input,
  .source-row-priced input {
    min-height: 32px;
    height: 32px;
    padding: 4px 6px;
    font-size: 13px !important;
  }

  .source-row-priced {
    grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr) 36px;
    gap: 5px;
  }

  .source-row-priced > label:nth-of-type(1) {
    grid-column: 1;
  }

  .source-row-priced > label:nth-of-type(2) {
    grid-column: 2 / 4;
  }

  .source-row-priced > label:nth-of-type(3) {
    grid-column: 1 / 5;
  }

  .source-row-priced > label:nth-of-type(4) {
    grid-column: 1 / 3;
  }

  .source-row-priced > label:nth-of-type(5) {
    grid-column: 3 / 5;
  }

  .source-row-priced > .remove-source-button {
    grid-column: 4;
    grid-row: 1;
    width: 36px;
    min-width: 36px;
    min-height: 32px;
  }

  #adminOrderForm > .order-service-row {
    grid-template-columns: minmax(105px, 1fr) minmax(135px, 160px);
  }

  #adminOrderForm > .order-service-row > label:nth-child(2) {
    width: 100%;
    justify-self: end;
  }

  /* Safari phone fix: date controls must obey their compact grid cells. */
  input[type="date"] {
    inline-size: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    -webkit-min-logical-width: 0;
    overflow: hidden;
  }

  label:has(> input[type="date"]) {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  #profitabilityView .filter-row,
  #adminView .full-row .filter-row,
  #balanceView .filter-row {
    grid-template-columns: 126px 126px 70px;
    justify-content: start;
  }

  #profitabilityView .filter-row > label:first-child,
  #adminView .full-row .filter-row > label:first-child {
    width: min(100%, 252px);
  }

  #profitabilityView .filter-row > button:last-child,
  #adminView .full-row .filter-row > button:last-child,
  #balanceView .filter-row > button:last-child {
    width: 70px;
    min-width: 70px;
  }

  .calc-form .compact-calc-row {
    grid-template-columns: 148px 110px;
    justify-content: start;
    gap: 5px;
  }

  .calc-form .compact-calc-row > label {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
  }

  .calc-form .compact-calc-row > label:last-child {
    grid-column: 1 / -1;
    width: 100%;
  }

  .markup-form .compact-calc-row {
    grid-template-columns: 148px minmax(0, 1fr);
  }

  .markup-form .compact-calc-row > label:last-child {
    grid-column: auto;
  }

  .calc-form input[type="date"],
  .calc-form input[type="number"] {
    min-height: 32px;
    height: 32px;
    padding: 4px 6px;
    font-size: 13px !important;
  }

  .delivery-line {
    grid-template-columns: minmax(90px, 1fr) 62px 92px 34px;
    gap: 5px;
  }

  .delivery-line > label:first-child {
    grid-column: 1 / -1;
  }

  .delivery-line > label:nth-child(2) {
    grid-column: 1;
  }

  .delivery-line > label:nth-child(3) {
    grid-column: 2;
  }

  .delivery-line > label:nth-child(4) {
    grid-column: 3;
  }

  .delivery-line > .mini-button {
    grid-column: 4;
    width: 34px;
    min-width: 34px;
    min-height: 32px;
    padding: 4px;
  }

  .markup-line {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px;
    gap: 5px;
  }

  .markup-line > label:first-child {
    grid-column: 1 / -1;
  }

  .markup-line > label:nth-child(2) {
    grid-column: 1;
  }

  .markup-line > label:nth-child(3) {
    grid-column: 2;
  }

  .markup-line > .mini-button {
    grid-column: 3;
    width: 34px;
    min-width: 34px;
    min-height: 32px;
    padding: 4px;
  }

  .delivery-line > label,
  .markup-line > label {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
  }

  #adminOrderForm > .order-service-row {
    grid-template-columns: 125px 140px;
    justify-content: space-between;
  }

  #adminOrderForm > .order-service-row > label:nth-child(2) {
    width: 140px;
    max-width: 140px;
    overflow: hidden;
  }

  /* iOS Safari renders native date controls wider than their CSS grid track. */
  input[type="date"] {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
    text-align: left;
  }

  input[type="date"]::-webkit-date-and-time-value {
    min-width: 0;
    margin: 0;
    padding: 0;
    text-align: left;
  }

  input[type="date"]::-webkit-calendar-picker-indicator {
    flex: 0 0 auto;
    margin: 0 0 0 4px;
    padding: 0;
  }

  label:has(> input[type="date"]),
  #adminOrderForm > .order-service-row > label:nth-child(2) {
    overflow: visible;
  }

  #profitabilityView .filter-row,
  #adminView .full-row .filter-row,
  #balanceView .filter-row {
    grid-template-columns: 128px 128px 70px;
  }

  .calc-form .compact-calc-row,
  .markup-form .compact-calc-row {
    grid-template-columns: 140px minmax(0, 1fr);
    width: 100%;
  }

  .calc-form .compact-calc-row > label {
    overflow: visible;
  }

  .calc-form .compact-calc-row > label:last-child {
    grid-column: 1 / -1;
    width: 100%;
  }

  .markup-form .compact-calc-row > label:last-child {
    grid-column: auto;
  }

  #ledgerForm > label:nth-of-type(5) {
    width: 125px;
  }

  #ledgerForm > label:nth-of-type(6) {
    width: 140px;
    max-width: 140px;
    justify-self: start;
    overflow: visible;
  }

  /* Compact, readable calculation history on phones. */
  .calc-history-item summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 8px;
  }

  .calc-history-item summary > strong {
    margin: 0;
    font-size: 14px;
    line-height: 1.2;
  }

  .calc-history-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    width: 100%;
  }

  .calc-history-actions > span:first-child {
    flex: 1 0 100%;
    min-width: 0;
    font-size: 11px;
    line-height: 1.2;
  }

  .calc-history-actions .mini-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    min-height: 27px;
    padding: 4px 6px;
    font-size: 9px;
    line-height: 1.1;
  }

  .calc-history-body {
    padding: 6px;
  }

  .calc-history-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 6px;
    margin-bottom: 6px;
    padding: 7px;
  }

  .calc-history-totals span {
    font-size: 8px;
  }

  .calc-history-totals strong {
    margin-top: 1px;
    font-size: 11px;
  }

  .calc-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .calc-mini-table {
    display: table;
    width: max-content;
    min-width: 680px;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 9px;
  }

  .calc-mini-table thead {
    display: table-header-group;
  }

  .calc-mini-table tbody {
    display: table-row-group;
  }

  .calc-mini-table tr {
    display: table-row;
    width: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .calc-mini-table th,
  .calc-mini-table td {
    display: table-cell;
    width: auto;
    padding: 5px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 9px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .calc-mini-table th {
    color: var(--muted);
    font-size: 8px;
    text-transform: uppercase;
  }

  .calc-mini-table td::before {
    content: none;
    display: none;
  }

  .profit-order-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 6px;
    min-width: 0;
  }

  .profit-order-main strong {
    white-space: nowrap;
  }

  .profit-order-main > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #profitabilityTable td:first-child {
    grid-template-columns: 78px minmax(0, 1fr);
  }
}

/* Desktop-only density and alignment pass. Mobile layouts stay unchanged. */
@media (min-width: 681px) {
  #adminOrderForm > .form-row:not(.order-service-row) {
    grid-template-columns: 100px 190px 190px;
    justify-content: start;
  }

  #adminOrderForm > .order-service-row {
    grid-template-columns: 145px 180px minmax(240px, 330px) 150px;
    justify-content: start;
  }

  #adminOrderForm > .form-row input,
  #adminOrderForm > .form-row select,
  #adminOrderForm > .form-row .check-card,
  #adminOrderForm > .form-row .date-toggle {
    min-height: 36px;
  }

  #profitabilityView .filter-row {
    grid-template-columns: 240px 180px 180px 110px;
    justify-content: start;
  }

  #adminView .full-row .filter-row {
    grid-template-columns: 250px 180px 180px 110px;
    justify-content: start;
  }

  #profitabilityView .filter-row .button,
  #adminView .full-row .filter-row .button {
    width: 110px;
  }

  .finance-ledger-panel .admin-form {
    height: auto;
  }

  #ledgerForm {
    grid-template-columns: 165px 190px minmax(0, 1fr);
    align-items: end;
  }

  #ledgerForm > label:nth-of-type(1),
  #ledgerForm > label:nth-of-type(4),
  #ledgerForm > button,
  #ledgerForm > .form-note {
    grid-column: 1 / -1;
  }

  #ledgerForm > label:nth-of-type(2) {
    grid-column: 1;
  }

  #ledgerForm > label:nth-of-type(3) {
    grid-column: 2;
  }

  #ledgerForm > label:nth-of-type(5) {
    grid-column: 1;
    width: 145px;
  }

  #ledgerForm > label:nth-of-type(6) {
    grid-column: 2;
    width: 190px;
  }

  #ledgerForm input,
  #ledgerForm select,
  #ledgerForm .date-toggle {
    min-height: 36px;
  }

  .recent-deposits {
    display: grid;
    gap: 5px;
    margin-top: 10px;
    border-top: 1px solid var(--line);
    padding-top: 9px;
  }

  .recent-deposits-head,
  .recent-deposit-row {
    display: grid;
    align-items: center;
    gap: 4px 10px;
  }

  .recent-deposits-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .recent-deposits-head strong {
    font-size: 13px;
  }

  .recent-deposits-head span,
  .recent-deposit-row small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .recent-deposit-row {
    grid-template-columns: minmax(120px, 1fr) 135px auto;
    min-height: 31px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 4px 7px;
    background: #fbfcfa;
  }

  .recent-deposit-row > span {
    overflow: hidden;
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .recent-deposit-row > strong {
    font-size: 12px;
    white-space: nowrap;
  }

  .recent-deposits-empty {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
  }

  .theme-dark .recent-deposit-row {
    background: #111;
  }

  .warehouse-table th:first-child,
  .warehouse-table td:first-child {
    width: 33%;
  }

  .warehouse-table th:nth-child(2),
  .warehouse-table td:nth-child(2) {
    width: 5%;
  }

  .warehouse-table th:nth-child(3),
  .warehouse-table td:nth-child(3),
  .warehouse-table th:nth-child(4),
  .warehouse-table td:nth-child(4) {
    width: 8%;
  }

  .warehouse-table th:nth-child(5),
  .warehouse-table td:nth-child(5) {
    width: 10%;
  }

  .warehouse-table th:nth-child(6),
  .warehouse-table td:nth-child(6),
  .warehouse-table th:nth-child(7),
  .warehouse-table td:nth-child(7) {
    width: 9%;
  }

  .warehouse-table th:nth-child(8),
  .warehouse-table td:nth-child(8) {
    width: 18%;
  }

  .warehouse-table th {
    padding-inline: 6px;
    font-size: 10px;
    letter-spacing: -0.01em;
  }

  .warehouse-table th:nth-child(3),
  .warehouse-table th:nth-child(8),
  .warehouse-table td.warehouse-actions {
    text-align: center;
  }

  .calc-form .compact-calc-row {
    grid-template-columns: 180px 160px minmax(320px, 1fr);
    justify-content: start;
  }

  .calc-form .delivery-line {
    grid-template-columns: minmax(360px, 1fr) 160px 90px 140px 42px;
  }

  .calc-form .markup-line {
    grid-template-columns: minmax(360px, 1fr) 160px 160px 42px;
  }

  .calc-form input,
  .calc-form .calc-line .mini-button {
    min-height: 36px;
    height: 36px;
  }

  .calc-form {
    gap: 7px;
    padding: 10px;
  }
}

@media (max-width: 680px) {
  .recent-deposits {
    display: none;
  }

  .quote-position-row {
    grid-template-columns: 64px minmax(0, 1fr) 36px;
    gap: 6px;
    padding: 8px;
  }

  .quote-position-row > label {
    grid-column: 1 / -1;
    font-size: 10px;
  }

  .quote-position-row > label:nth-of-type(3) {
    grid-column: 1;
  }

  .quote-position-row > label:nth-of-type(4) {
    grid-column: 2;
  }

  .quote-position-row > label:nth-of-type(5) {
    grid-column: 1 / 3;
  }

  .quote-position-row > .remove-source-button {
    grid-column: 3;
    grid-row: 3;
    min-width: 36px;
    width: 36px;
  }

  .quote-position-row input,
  .quote-position-row textarea {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 13px !important;
  }

  .entity-position {
    padding: 8px;
    font-size: 12px;
  }
}
