:root {
  --cream: #E4E2DA;
  --sand: #D8D3CD;
  --stone: #838587;
  --charcoal: #373334;
  --navy: #29406A;
  --bg: var(--sand);
  --panel: var(--cream);
  --ink: var(--charcoal);
  --muted: var(--stone);
  --line: rgba(55, 51, 52, 0.18);
  --green: var(--navy);
  --green-2: rgba(41, 64, 106, 0.12);
  --blue: var(--navy);
  --amber: var(--navy);
  --red: var(--charcoal);
  --red-soft: rgba(55, 51, 52, 0.12);
  --shadow: 0 18px 45px rgba(55, 51, 52, 0.12);
  --field: var(--cream);
  --soft: rgba(228, 226, 218, 0.52);
  --table-head: rgba(216, 211, 205, 0.7);
  --sidebar-bg: var(--charcoal);
  --sidebar-active: var(--sand);
  --font-body: "Open Sans", sans-serif;
  --font-ui: "Montserrat Classic", "Open Sans", sans-serif;
  --font-display: "The Seasons", "Montserrat Classic", serif;
  --font-impact: "IMPACT", "Montserrat Classic", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}
body.dark-mode {
  --bg: var(--charcoal);
  --panel: rgba(41, 64, 106, 0.28);
  --ink: var(--cream);
  --muted: var(--sand);
  --line: rgba(228, 226, 218, 0.18);
  --green: var(--sand);
  --green-2: rgba(228, 226, 218, 0.1);
  --blue: var(--cream);
  --amber: var(--sand);
  --red: var(--sand);
  --red-soft: rgba(216, 211, 205, 0.12);
  --shadow: 0 18px 45px rgba(55, 51, 52, 0.4);
  --field: rgba(55, 51, 52, 0.9);
  --soft: rgba(41, 64, 106, 0.26);
  --table-head: rgba(41, 64, 106, 0.36);
  --sidebar-bg: var(--charcoal);
  --sidebar-active: var(--navy);
}
body.auth-locked {
  display: block;
}
body.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}
body.auth-locked .sidebar,
body.auth-locked .shell {
  display: none;
}
body.public-catalog-page {
  display: block;
  background: var(--bg);
}

.login-screen {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: 24px;
  background: #111;
  overflow: hidden;
}
.login-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 32%, rgba(228, 226, 218, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(55, 51, 52, 0.28), rgba(17, 17, 17, 0.92));
  pointer-events: none;
}

.public-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0 36px;
}
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.public-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  text-decoration: none;
}
.public-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.public-hero h1 {
  margin-bottom: 8px;
  font-size: 34px;
}
.public-hero p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}
.public-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}
.public-order-panel {
  position: sticky;
  top: 16px;
}
.public-order-form {
  display: grid;
  gap: 11px;
}
.public-catalog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.public-product-card {
  grid-template-columns: 130px minmax(0, 1fr);
  min-height: 210px;
}
.public-product-card .catalog-cover {
  width: 130px;
  min-height: 184px;
}
.public-qty {
  max-width: 150px;
}
.public-order-summary {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}
.public-order-summary div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.public-order-message {
  min-height: 22px;
  margin: 0;
  font-weight: 700;
}
.public-order-message.success { color: var(--green); }
.public-order-message.error { color: var(--red); }
body.auth-locked .login-screen {
  display: grid;
}
.login-card {
  position: relative;
  width: min(500px, 100%);
  display: grid;
  gap: 22px;
  border: 1px solid rgba(228, 226, 218, 0.18);
  border-radius: 8px;
  background: var(--cream);
  color: var(--charcoal);
  padding: 38px;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(228, 226, 218, 0.04);
  font-family: var(--font-ui);
  overflow: visible;
}
.login-card:hover {
  border-color: rgba(228, 226, 218, 0.28);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(228, 226, 218, 0.08);
}
.login-card > * {
  position: relative;
  z-index: 1;
}
.login-brand {
  color: var(--charcoal);
}
.login-brand strong,
.login-brand small,
.login-card h1,
.login-card .eyebrow,
.login-card label,
.login-card .primary-button,
.login-card .input {
  font-family: var(--font-ui);
}
.login-brand strong {
  color: var(--charcoal);
  font-weight: 800;
  letter-spacing: 0;
}
.login-brand small {
  color: var(--stone);
}
.login-card h1 {
  max-width: 420px;
  font-size: 36px;
  line-height: 1.08;
  color: var(--charcoal);
}
.login-card .eyebrow {
  color: var(--navy);
}
.login-card label {
  color: var(--charcoal);
}
.login-card .input {
  min-height: 54px;
  border-color: rgba(55, 51, 52, 0.22);
  background: rgba(216, 211, 205, 0.42);
  color: var(--charcoal);
}
.login-card .input:focus {
  outline: 0;
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(41, 64, 106, 0.14);
}
.login-card .primary-button {
  min-height: 54px;
  background: var(--navy);
  color: var(--cream);
  border-color: rgba(41, 64, 106, 0.38);
  box-shadow: none;
}
.login-card .primary-button:hover {
  background: #213556;
}
.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button,
.nav-item,
.ghost-button,
.primary-button,
.mini-button,
.period-button,
label,
th,
.badge,
.eyebrow {
  font-family: var(--font-ui);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: var(--sidebar-bg);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sidebar-toggle {
  width: 32px;
  height: 32px;
  margin: -4px 0 -2px auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(228, 226, 218, 0.24);
  border-radius: 6px;
  background: transparent;
  color: var(--sand);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1;
}
.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: var(--sand);
  background: rgba(228, 226, 218, 0.1);
  outline: none;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-copy { min-width: 0; }
.brand-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: var(--charcoal);
  color: var(--cream);
  font-weight: 800;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--font-impact); letter-spacing: 0.01em; }
.brand small { color: var(--sand); margin-top: 2px; }
.login-card .login-brand strong {
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: 0;
}
.login-card .login-brand small {
  font-family: var(--font-ui);
}

.plane-switch {
  --dot: var(--cream);
  --street: var(--charcoal);
  --street-line: var(--stone);
  --street-line-mid: var(--sand);
  --sky-1: var(--sand);
  --sky-2: var(--navy);
  --light-1: rgba(228, 226, 218, 1);
  --light-2: rgba(228, 226, 218, 0.32);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  transform: translateY(2px);
}
.plane-switch input { display: none; }
.plane-switch input + div {
  -webkit-mask-image: -webkit-radial-gradient(var(--cream), var(--charcoal));
  position: relative;
  overflow: hidden;
  width: 50px;
  height: 25px;
  padding: 1px;
  border-radius: 13px;
  background: linear-gradient(90deg, var(--street) 0%, var(--street) 25%, var(--sky-1) 75%, var(--sky-2) 100%) left var(--p, 0%) top 0;
  background-position-x: var(--p, 0%);
  background-size: 400% auto;
  transition: background-position 0.6s;
}
.plane-switch input + div::before,
.plane-switch input + div::after {
  content: "";
  display: block;
  position: absolute;
  transform: translateX(var(--s, 0));
  transition: transform 0.3s;
}
.plane-switch input + div::before {
  width: 42px;
  right: 2px;
  top: 4px;
  height: 1px;
  background: var(--street-line);
  box-shadow: 0 16px 0 0 var(--street-line);
}
.plane-switch input + div::after {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  left: 23px;
  top: 1px;
  animation: lights2 2s linear infinite;
  box-shadow: inset 0 0 0 2px var(--light-1), 0 21px 0 var(--light-1), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2);
}
.plane-switch input + div span {
  display: block;
  position: absolute;
}
.plane-switch input + div span.street-middle {
  top: 12px;
  left: 21px;
  width: 3px;
  height: 1px;
  transform: translateX(var(--s, 0));
  background: var(--street-line-mid);
  box-shadow: 5px 0 0 var(--street-line-mid), 10px 0 0 var(--street-line-mid), 15px 0 0 var(--street-line-mid), 20px 0 0 var(--street-line-mid), 25px 0 0 var(--street-line-mid);
  transition: transform 0.3s;
}
.plane-switch input + div span.cloud {
  width: 12px;
  height: 4px;
  border-radius: 2px;
  background: var(--cream);
  top: var(--ct, 8px);
  left: 100%;
  opacity: var(--co, 0);
  transition: opacity 0.3s;
  animation: clouds2 2s linear infinite var(--cd, 0s);
}
.plane-switch input + div span.cloud::before,
.plane-switch input + div span.cloud::after {
  content: "";
  position: absolute;
  transform: translateX(var(--cx, 0));
  border-radius: 50%;
  width: var(--cs, 5px);
  height: var(--cs, 5px);
  background: var(--cream);
  bottom: 1px;
  left: 1px;
}
.plane-switch input + div span.cloud::after {
  --cs: 6px;
  --cx: 4px;
}
.plane-switch input + div span.cloud.two {
  --ct: 20px;
  --cd: 1s;
  opacity: var(--co-2, 0);
}
.plane-switch input + div div {
  display: table;
  position: relative;
  z-index: 1;
  padding: 5px;
  border-radius: 50%;
  background: var(--dot);
  transform: translateX(var(--x, 0));
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.35, 1.2);
}
.plane-switch input + div div svg {
  width: 13px;
  height: 13px;
  display: block;
  color: var(--c, var(--street));
  transition: color 0.6s;
}
.plane-switch input:checked + div {
  --p: 100%;
  --x: 25px;
  --s: -50px;
  --c: var(--sky-2);
  --co: 0.8;
  --co-2: 0.6;
}

@keyframes lights2 {
  20%, 30% { box-shadow: inset 0 0 0 2px var(--light-2), 0 21px 0 var(--light-2), 8px 0 0 var(--light-1), 8px 21px 0 var(--light-1), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2); }
  55%, 65% { box-shadow: inset 0 0 0 2px var(--light-2), 0 21px 0 var(--light-2), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-1), 16px 21px 0 var(--light-1); }
  90%, 100% { box-shadow: inset 0 0 0 2px var(--light-1), 0 21px 0 var(--light-1), 8px 0 0 var(--light-2), 8px 21px 0 var(--light-2), 16px 0 0 var(--light-2), 16px 21px 0 var(--light-2); }
}
@keyframes clouds2 {
  97% { transform: translateX(-72px); visibility: visible; }
  98%, 100% { visibility: hidden; }
  99% { transform: translateX(-72px); }
  100% { transform: translateX(0); }
}

.nav { display: grid; gap: 6px; }
.nav-item, .ghost-button, .primary-button, .mini-button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
}
.nav-item {
  text-align: left;
  color: var(--sand);
  background: transparent;
}
.nav-item.active, .nav-item:hover { background: var(--sidebar-active); color: var(--charcoal); }
.ghost-button { background: transparent; border: 1px solid var(--line); color: inherit; }
.sidebar .ghost-button { margin-top: auto; border-color: rgba(228, 226, 218, 0.22); color: var(--sand); }

body.sidebar-collapsed .sidebar {
  align-items: center;
  padding-right: 12px;
  padding-left: 12px;
}
body.sidebar-collapsed .sidebar-toggle { margin-right: 0; }
body.sidebar-collapsed .brand { justify-content: center; }
body.sidebar-collapsed .brand-copy { display: none; }
body.sidebar-collapsed .nav { width: 100%; }
body.sidebar-collapsed .nav-item {
  min-height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0;
}
body.sidebar-collapsed .nav-item::after {
  color: currentColor;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
}
body.sidebar-collapsed .nav-item:nth-child(1)::after { content: "D"; }
body.sidebar-collapsed .nav-item:nth-child(2)::after { content: "I"; }
body.sidebar-collapsed .nav-item:nth-child(3)::after { content: "P"; }
body.sidebar-collapsed .nav-item:nth-child(4)::after { content: "C"; }
body.sidebar-collapsed .nav-item:nth-child(5)::after { content: "Pe"; }
body.sidebar-collapsed .nav-item:nth-child(6)::after { content: "De"; }
body.sidebar-collapsed .nav-item:nth-child(7)::after { content: "R"; }
body.sidebar-collapsed .sidebar .ghost-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 0;
}
body.sidebar-collapsed .sidebar .ghost-button::after {
  content: "M";
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
}

.shell { min-width: 0; padding: 28px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: var(--font-display); font-size: 30px; letter-spacing: 0; }
h2 { margin-bottom: 0; font-family: var(--font-ui); font-size: 22px; line-height: 1.2; }
.panel-header h2 { font-size: 24px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.system-status {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--panel);
}
.system-status span,
.system-status small { display: block; }
.system-status span { color: var(--green); font-size: 13px; font-weight: 800; }
.system-status small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.maintenance-status {
  margin-bottom: 14px;
  background: var(--soft);
}

.primary-button {
  background: var(--navy);
  color: var(--cream);
  border: 1px solid rgba(41, 64, 106, 0.35);
  font-weight: 700;
}
.primary-button.dark {
  background: var(--charcoal);
  color: var(--cream);
  border-color: rgba(55, 51, 52, 0.36);
}
.mini-button {
  background: var(--sand);
  color: var(--charcoal);
  border: 1px solid rgba(55, 51, 52, 0.18);
  font-weight: 700;
  min-height: 32px;
}
.mini-button.warn {
  background: var(--charcoal);
  color: var(--cream);
  border-color: rgba(55, 51, 52, 0.36);
}
.table-actions {
  width: 116px;
}
.table-actions .mini-button {
  display: block;
  width: 84px;
  min-height: 28px;
  margin-bottom: 6px;
  padding: 0 10px;
  font-size: 13px;
}
.table-actions .mini-button:last-child {
  margin-bottom: 0;
}

.view { display: none; }
.view.active { display: block; }
.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.dashboard-toolbar > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.period-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.period-button {
  min-width: 82px;
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}
.period-button:last-child { border-right: 0; }
.period-button.active {
  background: var(--navy);
  color: var(--cream);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.kpi, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.kpi { padding: 18px; }
.kpi span { display: block; color: var(--muted); font-size: 13px; }
.kpi strong { display: block; margin-top: 8px; font-size: 30px; }
.kpi.danger strong { color: var(--red); }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 14px;
}
.wide { grid-column: 1 / -1; }
.panel { padding: 18px; margin-bottom: 14px; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-search { max-width: 360px; }
.is-hidden { display: none !important; }
.product-editor-panel {
  scroll-margin-top: 16px;
}
.input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
}
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: var(--table-head); font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--green-2);
  color: var(--green);
}
.badge.warn { background: var(--red-soft); color: var(--red); }
.badge.pending { background: rgba(216, 211, 205, 0.72); color: var(--navy); }
.badge.info { background: rgba(41, 64, 106, 0.12); color: var(--blue); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.form-grid.compact { grid-template-columns: 1fr 220px 160px; align-items: end; }
.import-card .form-grid.compact { grid-template-columns: minmax(225px, 1.05fr) minmax(190px, 0.95fr) 220px 150px; }
label { color: var(--muted); font-size: 13px; font-weight: 700; }
label .input, label select, label textarea { margin-top: 6px; color: var(--ink); font-weight: 400; }
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--ink);
}
.checkbox-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}
.catalog-image-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 86px;
  gap: 10px;
  align-items: end;
}
.catalog-image-tools {
  display: flex;
  gap: 8px;
  align-items: end;
}
.catalog-image-picker {
  min-width: 118px;
}
.catalog-image-tools .ghost-button {
  min-height: 40px;
  color: var(--ink);
}
.catalog-image-preview {
  width: 86px;
  height: 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.catalog-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.muted-field { opacity: 0.55; }
.full { grid-column: 1 / -1; }
.alert-list, .report-list, .destination-groups, .import-list { display: grid; gap: 10px; }
.dashboard-alerts-panel .alert-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.alert-item, .report-item, .destination-group, .import-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}
.dashboard-alerts-panel .alert-item {
  min-height: 92px;
}
.alert-item strong, .report-item strong { display: block; margin-bottom: 4px; }
.muted { color: var(--muted); }
.report-filters {
  display: grid;
  grid-template-columns: 150px 150px minmax(220px, 1fr) 180px minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}
.report-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.report-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--soft);
}
.report-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.report-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.import-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.freight-import-button {
  color: var(--cream);
}
.freight-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.freight-summary-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}
.freight-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.freight-summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}
.freight-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.freight-columns-box {
  margin-bottom: 14px;
}
.freight-column-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 10px;
}
.freight-column-option {
  min-height: 30px;
}
.freight-table-wrap {
  max-height: 560px;
}
.freight-table-wrap table {
  min-width: 1280px;
}
.freight-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-input {
  min-width: 150px;
  min-height: 34px;
  padding: 6px 8px;
}
.freight-actions {
  width: 180px;
}
.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}
.file-picker input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.drop-zone {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 112px;
  border: 2px dashed rgba(131, 133, 135, 0.55);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  margin-bottom: 12px;
  padding: 18px;
  text-align: center;
}
.drop-zone strong { color: var(--ink); }
.drop-zone.dragging {
  border-color: var(--green);
  background: var(--green-2);
}
.manual-import {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
  padding: 12px;
  background: var(--panel);
}
.manual-import summary {
  cursor: pointer;
  font-weight: 800;
}
.manual-import-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.5fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: end;
}
.import-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.import-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.import-card .badge.import-marker-neutral {
  background: #E9E8EA;
  color: #29406A;
  border: 1px solid rgba(41, 64, 106, 0.18);
}
.import-card .badge.import-marker-blocked,
.import-card .import-status.import-status-blocked {
  background: #AB4C25;
  color: #FFFFFF;
  border-color: #AB4C25;
}
.import-card .badge.import-marker-valid,
.import-card .import-status.import-status-valid {
  background: #DDF1E5;
  color: #175C38;
  border-color: #78B994;
}
.import-card .import-status {
  display: flex;
  align-items: center;
  font-weight: 800;
}

.import-items { display: grid; gap: 8px; }

.import-annotations {
  display: block;
  margin-top: 14px;
}
.import-annotations textarea {
  min-height: 96px;
}

.import-item {
  display: grid;
  grid-template-columns: minmax(110px, .45fr) minmax(180px, 1fr) 90px minmax(200px, 1fr);
  gap: 8px;
  align-items: center;
}
.import-item-header {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.destination-group header { display: flex; align-items: center; justify-content: space-between; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.catalog-hint { margin: 6px 0 0; }
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 14px;
}
.catalog-card {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 16px;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}
.catalog-cover {
  width: 142px;
  min-height: 202px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--green);
  font-size: 34px;
  font-weight: 900;
}
.catalog-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.catalog-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.catalog-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.catalog-title-row strong,
.catalog-title-row span {
  display: block;
}
.catalog-title-row strong {
  font-size: 20px;
  line-height: 1.25;
}
.catalog-title-row div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.catalog-info p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.catalog-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
}
.catalog-meta strong {
  color: var(--ink);
}
.catalog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}
.catalog-actions .mini-button {
  min-height: 36px;
  padding: 0 14px;
}
.catalog-actions .catalog-link-button {
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--ink);
}
.catalog-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  border: 1px dashed rgba(131, 133, 135, 0.55);
  border-radius: 8px;
  padding: 20px;
  background: var(--soft);
}
.catalog-service {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.catalog-share-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.public-link-preview {
  display: inline-block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 9px 11px;
  color: var(--ink);
  font-family: var(--font-ui);
  word-break: break-all;
}
.catalog-share-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.orders-filters {
  grid-template-columns: minmax(260px, 1fr) 220px;
}
.order-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.order-card:hover {
  border-color: rgba(41, 64, 106, 0.35);
  box-shadow: 0 18px 36px rgba(55, 51, 52, 0.16);
  transform: translateY(-1px);
}
.order-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.order-header h2 {
  margin-top: 2px;
  font-size: 22px;
}
.order-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}
.order-actions select {
  min-width: 160px;
}
.order-card-compact .order-header {
  margin-bottom: 0;
  gap: 12px;
}
.order-card-compact .order-actions {
  min-width: 150px;
  display: grid;
  gap: 8px;
}
.order-card-compact .ghost-button {
  min-height: 40px;
}
.order-card-compact h2 {
  font-size: 20px;
  line-height: 1.15;
}
.order-card-compact select {
  min-width: 0;
}
.order-modal {
  width: min(1120px, 100%);
}
.order-detail-body {
  display: grid;
  gap: 14px;
}
.order-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.order-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}
.order-grid h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.order-grid p {
  margin-bottom: 0;
  color: var(--ink);
  line-height: 1.45;
}
.order-table table {
  min-width: 600px;
}
.order-total {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
}
.order-total span {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}
.order-total strong {
  font-size: 24px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--charcoal);
  color: var(--cream);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(55, 51, 52, 0.55);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(860px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(55, 51, 52, 0.28);
  padding: 18px;
}
.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}
.maintenance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.maintenance-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}
.maintenance-grid article strong { display: block; margin-bottom: 6px; }
.maintenance-grid article p { color: var(--muted); font-size: 13px; }
.danger-zone {
  border-color: rgba(55, 51, 52, 0.28) !important;
  background: rgba(55, 51, 52, 0.08) !important;
}
.danger-zone .input { margin-bottom: 10px; }

body.dark-mode .system-status,
body.dark-mode .alert-item,
body.dark-mode .report-item,
body.dark-mode .destination-group,
body.dark-mode .import-card,
body.dark-mode .catalog-card,
body.dark-mode .order-card,
body.dark-mode .modal,
body.dark-mode .icon-button,
body.dark-mode .file-picker,
body.dark-mode .manual-import {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
body.dark-mode .maintenance-status,
body.dark-mode .drop-zone,
body.dark-mode .report-summary article,
body.dark-mode .catalog-image-preview,
body.dark-mode .catalog-cover,
body.dark-mode .catalog-empty,
body.dark-mode .public-link-preview,
body.dark-mode .order-grid section,
body.dark-mode .public-order-summary,
body.dark-mode .catalog-actions .catalog-link-button {
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink);
}body.dark-mode .period-button.active {
  background: var(--navy);
  color: var(--cream);
}
body.dark-mode .nav-item.active,
body.dark-mode .nav-item:hover {
  background: var(--navy);
  color: var(--cream);
}
body.dark-mode .period-toggle,
body.dark-mode .period-button {
  background: var(--field);
  border-color: var(--line);
  color: var(--muted);
}
body.dark-mode .table-wrap {
  border-color: var(--line);
}
body.dark-mode td,
body.dark-mode th {
  border-color: var(--line);
}
body.dark-mode .badge {
  background: rgba(228, 226, 218, 0.14);
  color: var(--cream);
}
body.dark-mode .badge.pending {
  background: rgba(216, 211, 205, 0.14);
  color: var(--sand);
}
body.dark-mode .badge.warn,
body.dark-mode .mini-button.warn {
  background: var(--sand);
  color: var(--charcoal);
  border-color: rgba(216, 211, 205, 0.4);
}
body.dark-mode .mini-button {
  background: var(--sand);
  color: var(--charcoal);
  border-color: rgba(216, 211, 205, 0.35);
}
body.dark-mode .ghost-button {
  color: var(--ink);
  border-color: var(--line);
}
body.dark-mode .sidebar .ghost-button {
  color: var(--sand);
}
body.dark-mode .danger-zone {
  background: rgba(216, 211, 205, 0.08) !important;
  border-color: rgba(216, 211, 205, 0.3) !important;
}

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  body.sidebar-collapsed { grid-template-columns: 1fr; }
  .public-header, .public-layout { grid-template-columns: 1fr; }
  .public-header { align-items: stretch; flex-direction: column; }
  .public-order-panel { position: static; }
  .public-product-card { grid-template-columns: 1fr; }
  .public-product-card .catalog-cover { width: 100%; aspect-ratio: 3 / 4; min-height: 0; }
  .sidebar { position: static; height: auto; }
  body.sidebar-collapsed .sidebar { align-items: stretch; padding: 16px 18px; }
  body.sidebar-collapsed .sidebar-toggle { align-self: flex-end; }
  body.sidebar-collapsed .brand { justify-content: flex-start; }
  body.sidebar-collapsed .brand-copy { display: block; }
  body.sidebar-collapsed .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.sidebar-collapsed .nav-item {
    min-height: 40px;
    padding: 0 14px;
    display: block;
    font-size: inherit;
  }
  body.sidebar-collapsed .nav-item::after { content: none; }
  body.sidebar-collapsed .sidebar .ghost-button {
    width: auto;
    min-height: 40px;
    padding: 0 14px;
    font-size: inherit;
  }
body.sidebar-collapsed .sidebar .ghost-button::after { content: none; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-grid, .kpi-grid { grid-template-columns: 1fr; }
  .freight-summary-grid,
  .freight-tools,
  .freight-column-list { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { align-items: stretch; flex-wrap: wrap; width: 100%; }
  .panel-header { align-items: stretch; flex-direction: column; }
  .panel-actions { justify-content: stretch; }
  .panel-actions .input,
  .panel-actions .primary-button { max-width: none; width: 100%; }
  .system-status { width: 100%; }
  .dashboard-toolbar { align-items: stretch; flex-direction: column; }
  .period-toggle { width: 100%; }
  .period-button { flex: 1; min-width: 0; }
  .form-grid, .form-grid.compact, .import-item, .report-filters, .report-summary, .manual-import-grid, .catalog-image-field { grid-template-columns: 1fr; }
  .catalog-image-tools { align-items: stretch; flex-direction: column; }
  .catalog-image-preview { width: 100%; height: 180px; }
  .catalog-grid { grid-template-columns: 1fr; }
  .catalog-card { grid-template-columns: 1fr; }
  .catalog-cover { width: 100%; aspect-ratio: 3 / 4; min-height: 0; }
  .catalog-service, .catalog-share-panel { align-items: stretch; flex-direction: column; }
  .catalog-share-actions { justify-content: stretch; }
  .catalog-share-actions button { flex: 1; }
  .dashboard-alerts-panel .alert-list { grid-template-columns: 1fr; }
  .orders-filters, .order-grid, .order-list { grid-template-columns: 1fr; }
  .order-header, .order-actions { align-items: stretch; flex-direction: column; }
  .maintenance-grid { grid-template-columns: 1fr; }
  .shell { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card {
    transform: none !important;
    transition: none;
  }
}


/* Public catalog: balanced two-column book cards without changing purchase behavior. */
.public-catalog-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.public-product-card {
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  min-height: 248px;
  padding: 16px;
}
.public-product-card .catalog-cover {
  width: 118px;
  min-height: 0;
  height: 100%;
  max-height: 216px;
  align-self: center;
  background: var(--soft);
}
.public-product-card .catalog-cover img {
  object-fit: contain;
}
.public-product-card .catalog-info {
  min-height: 0;
  padding: 2px 0;
  gap: 9px;
}
.public-product-card .catalog-title-row strong {
  font-size: 19px;
  line-height: 1.24;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.public-product-card .catalog-title-row div > span {
  margin-top: 5px;
  line-height: 1.35;
}
.public-product-card .catalog-info > p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.public-product-card .catalog-meta {
  margin-top: auto;
  padding-top: 4px;
}
.public-product-card .public-qty {
  max-width: 156px;
}

@media (max-width: 720px) {
  .public-catalog-grid { grid-template-columns: 1fr; }
  .public-product-card {
    grid-template-columns: 104px minmax(0, 1fr);
    min-height: 218px;
    padding: 14px;
  }
  .public-product-card .catalog-cover {
    width: 104px;
    max-height: 190px;
  }
  .public-product-card .catalog-title-row strong { font-size: 18px; }
}

.product-stock-controls { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--soft); }
.product-stock-controls h3 { margin: 0 0 4px; font-size: 16px; }
.product-stock-grid { margin: 10px 0 0; }
.product-last-movement { font-size: 11px; white-space: nowrap; }
.table-actions { width: 120px; }
.table-actions .mini-button.entry { background: var(--blue); color: var(--cream); border-color: var(--blue); }
.product-entry-modal { width: min(720px, 100%); }


/* Public catalog: compact card with cover and purchasing details side by side. */
.public-catalog-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.public-product-card {
  grid-template-columns: 122px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 206px;
  padding: 16px;
}

.public-product-card .catalog-cover {
  width: 122px;
  min-height: 168px;
  height: 168px;
  align-self: center;
  background: var(--soft);
}

.public-product-card .catalog-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.public-product-info {
  min-width: 0;
  height: 100%;
  align-content: center;
  gap: 10px;
}

.public-product-title {
  color: var(--ink);
  font-size: 1.14rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.public-product-price {
  color: var(--muted);
  font-size: 0.98rem;
}

.public-product-price strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.public-product-card .public-qty {
  max-width: 146px;
  gap: 5px;
}

.public-product-card .public-qty .input {
  min-height: 38px;
}

.public-product-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.public-product-actions .mini-button,
.public-product-actions .ghost-button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.88rem;
  text-decoration: none;
}

@media (max-width: 980px) {
  .public-catalog-grid {
    grid-template-columns: 1fr;
  }

  .public-product-card {
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 188px;
  }

  .public-product-card .catalog-cover {
    width: 112px;
    min-height: 154px;
    height: 154px;
    aspect-ratio: auto;
  }
}

@media (max-width: 480px) {
  .public-product-card {
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 13px;
    padding: 13px;
  }

  .public-product-card .catalog-cover {
    width: 94px;
    min-height: 132px;
    height: 132px;
  }

  .public-product-title {
    font-size: 1.02rem;
  }

  .public-product-actions {
    gap: 6px;
  }
}


/* Internal catalog: same compact visual hierarchy as the public catalog. */
.internal-catalog-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.internal-catalog-card {
  grid-template-columns: 122px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 206px;
  padding: 16px;
}

.internal-catalog-card .catalog-cover {
  width: 122px;
  min-height: 168px;
  height: 168px;
  align-self: center;
  background: var(--soft);
}

.internal-catalog-card .catalog-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.internal-catalog-info {
  min-width: 0;
  height: 100%;
  justify-content: center;
  gap: 10px;
}

.internal-product-title {
  color: var(--ink);
  font-size: 1.14rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.internal-product-price {
  color: var(--muted);
  font-size: 0.98rem;
}

.internal-product-price strong,
.internal-product-meta strong {
  color: var(--ink);
}

.internal-product-price strong {
  font-size: 1.05rem;
}

.internal-product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.internal-catalog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.internal-catalog-actions .mini-button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .internal-catalog-grid {
    grid-template-columns: 1fr;
  }

  .internal-catalog-card {
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 188px;
  }

  .internal-catalog-card .catalog-cover {
    width: 112px;
    min-height: 154px;
    height: 154px;
  }
}

@media (max-width: 480px) {
  .internal-catalog-card {
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 13px;
    padding: 13px;
  }

  .internal-catalog-card .catalog-cover {
    width: 94px;
    min-height: 132px;
    height: 132px;
  }

  .internal-product-title {
    font-size: 1.02rem;
  }
}


.catalog-author {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}


/* Public catalog layout: wider desktop canvas and balanced product cards. */
.public-catalog-page .public-shell {
  width: min(1440px, calc(100% - 48px));
  padding-bottom: 44px;
}

.public-catalog-page .public-layout {
  grid-template-columns: minmax(0, 1fr) 338px;
  gap: 20px;
}

.public-catalog-page .public-catalog-grid {
  gap: 20px;
}

.public-catalog-page .public-product-card {
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  min-height: 224px;
  padding: 18px;
}

.public-catalog-page .public-product-card .catalog-cover {
  width: 148px;
  min-height: 188px;
  height: 188px;
  align-self: start;
}

.public-catalog-page .public-product-info {
  align-content: start;
  padding-top: 2px;
}

.public-catalog-page .public-product-actions {
  flex-wrap: nowrap;
  gap: 10px;
}

@media (max-width: 980px) {
  .public-catalog-page .public-shell {
    width: min(100% - 32px, 920px);
  }

  .public-catalog-page .public-layout {
    grid-template-columns: 1fr;
  }

  .public-catalog-page .public-product-card {
    grid-template-columns: 122px minmax(0, 1fr);
    gap: 18px;
    min-height: 194px;
  }

  .public-catalog-page .public-product-card .catalog-cover {
    width: 122px;
    min-height: 166px;
    height: 166px;
  }
}

@media (max-width: 560px) {
  .public-catalog-page .public-shell {
    width: calc(100% - 28px);
  }

  .public-catalog-page .public-product-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .public-catalog-page .public-product-card .catalog-cover {
    width: 96px;
    min-height: 136px;
    height: 136px;
  }

  .public-catalog-page .public-product-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
}


/* Public catalog: availability and quantity share one compact line. */
.public-catalog-page .public-product-availability {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.public-catalog-page .public-product-availability .badge {
  margin-bottom: 2px;
  white-space: nowrap;
}

.public-catalog-page .public-product-card .public-qty {
  width: 88px;
  max-width: 88px;
  flex: 0 0 88px;
  gap: 4px;
}

.public-catalog-page .public-product-card .public-qty .input {
  width: 88px;
  min-width: 88px;
  min-height: 36px;
  padding-inline: 10px;
}

@media (max-width: 560px) {
  .public-catalog-page .public-product-availability {
    align-items: start;
    gap: 8px;
  }
}


/* Stock status emphasis: presentation only. */
.badge.out-of-stock {
  background: #111111;
  border-color: #111111;
  color: #FFFFFF;
}

.catalog-card .badge.stock-low {
  background: #F2BF5E;
  border-color: #F2BF5E;
  color: #29406A;
}


/* Pedido selecionado e ação destrutiva controlada. */
.orders-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-delete-button {
  border-color: #AB4C25;
  color: #AB4C25;
}

.order-delete-button:hover {
  background: #AB4C25;
  border-color: #AB4C25;
  color: #FFFFFF;
}

.order-card-compact.is-selected {
  border-color: #29406A;
  box-shadow: 0 0 0 2px rgba(41, 64, 106, 0.16);
}

.order-select-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  color: var(--muted);
  cursor: pointer;
}

.order-select-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #29406A;
}

@media (max-width: 640px) {
  .orders-header-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }
}


/* Lista de pedidos em linhas, com acoes preservadas. */
.order-list {
  display: grid;
  gap: 8px;
}

.order-list-head,
.order-row {
  display: grid;
  grid-template-columns: 42px 110px 165px minmax(220px, 1fr) 170px 112px;
  align-items: center;
  column-gap: 14px;
}

.order-list-head {
  padding: 0 16px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.order-card.order-row {
  min-height: 72px;
  padding: 12px 16px;
  border-radius: 8px;
}

.order-card.order-row:hover {
  transform: none;
  box-shadow: 0 10px 24px rgba(55, 51, 52, 0.1);
}

.order-row-select,
.order-row-cell {
  min-width: 0;
}

.order-row-select {
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-row-select .order-select-checkbox {
  margin: 0;
}

.order-row-number strong,
.order-row-customer strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-row-date {
  color: var(--muted);
  font-size: 14px;
}

.order-row-status select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.order-row-print .ghost-button {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
}

@media (max-width: 820px) {
  .order-list-head {
    display: none;
  }

  .order-card.order-row {
    grid-template-columns: 30px minmax(0, 1fr);
    row-gap: 8px;
    padding: 14px;
  }

  .order-row-select {
    grid-row: 1 / span 5;
    align-self: start;
    padding-top: 3px;
  }

  .order-row-cell {
    grid-column: 2;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .order-row-cell::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .order-row-status select,
  .order-row-print .ghost-button {
    width: min(100%, 220px);
  }
}


/* Estabiliza a grade horizontal de Pedidos. */
@media (min-width: 821px) {
  .order-list-head,
  .order-card.order-row {
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: 38px minmax(84px, 0.8fr) minmax(126px, 1fr) minmax(170px, 2fr) minmax(132px, 1.15fr) 104px;
    column-gap: 12px;
  }

  .order-row-cell {
    overflow: hidden;
  }

  .order-row-status,
  .order-row-print {
    overflow: visible;
  }
}

.order-row-customer,
.order-row-date,
.order-row-number {
  min-width: 0;
}

.order-row-customer strong,
.order-row-date,
.order-row-number strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Tabela estavel de Pedidos. */
.order-list {
  display: block;
  width: 100%;
  min-width: 0;
}

.orders-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.orders-table {
  width: 100%;
  min-width: 840px;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
}

.orders-col-select { width: 56px; }
.orders-col-number { width: 132px; }
.orders-col-date { width: 168px; }
.orders-col-status { width: 190px; }
.orders-col-print { width: 124px; }

.orders-table th {
  height: 44px;
  padding: 10px 14px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.orders-table th:first-child,
.orders-table td:first-child {
  text-align: center;
}

.orders-table td {
  height: 68px;
  padding: 12px 14px;
  vertical-align: middle;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

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

.order-table-row {
  cursor: pointer;
  transition: background 160ms ease;
}

.order-table-row:hover td {
  background: rgba(41, 64, 106, 0.04);
}

.order-table-row.is-selected td {
  background: rgba(41, 64, 106, 0.08);
}

.order-table-select .order-select-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #29406A;
}

.order-table-number strong,
.order-table-customer strong,
.order-table-date {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-table-number strong {
  font-size: 15px;
}

.order-table-number .order-origin-badge {
  display: inline-flex;
  margin: 4px 0 0;
  vertical-align: top;
}

.order-table-date {
  color: var(--muted);
  font-size: 14px;
}

.order-table-status select,
.order-table-print .ghost-button {
  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  margin: 0;
}

.order-table-print .ghost-button {
  padding: 8px 12px;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .orders-table {
    min-width: 760px;
  }

  .orders-table th,
  .orders-table td {
    padding-left: 10px;
    padding-right: 10px;
  }
}


/* Relatorio Estoque interno. */
.stock-report-panel .panel-header {
  align-items: flex-start;
}

.stock-report-panel .panel-header .hint {
  margin: 5px 0 0;
}

.stock-report-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.stock-report-fields .checkbox-line {
  min-height: 30px;
  margin: 0;
}

@media (max-width: 900px) {
  .stock-report-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .stock-report-panel .panel-header {
    align-items: stretch;
  }

  .stock-report-fields {
    grid-template-columns: 1fr;
  }
}


/* Acordeoes da aba Relatorios. */
#reports .content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.report-accordion {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.report-accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 20px;
  color: var(--primary);
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  list-style: none;
}

.report-accordion > summary::-webkit-details-marker {
  display: none;
}

.report-accordion > summary:hover {
  background: var(--soft);
}

.report-accordion[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.report-accordion-arrow {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-3px);
  transition: transform 160ms ease;
}

.report-accordion[open] .report-accordion-arrow {
  transform: rotate(225deg) translateY(-2px);
}

.report-accordion > .panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.report-accordion > .panel > .panel-header > h2,
.report-accordion > .panel > .panel-header > div > h2 {
  display: none;
}

.report-accordion[data-report-section="group"] > .panel > .panel-header,
.report-accordion[data-report-section="destination"] > .panel > .panel-header {
  display: none;
}

@media (max-width: 620px) {
  .report-accordion > summary {
    min-height: 54px;
    padding: 0 15px;
    font-size: 1rem;
  }
}


/* Exclusao segura de produto. */
.table-actions .mini-button.danger {
  background: #AB4C25;
  color: #fff;
  border-color: #AB4C25;
}

.table-actions .mini-button.danger:hover {
  background: #8f3d1d;
  border-color: #8f3d1d;
}

body.dark-mode .table-actions .mini-button.danger {
  background: #AB4C25;
  color: #fff;
  border-color: #AB4C25;
}


/* Pedido interno: bloco isolado para preservar o restante da tela. */
.order-origin-badge { display:inline-flex; margin-left:8px; padding:3px 7px; border-radius:999px; background:#E9E8EA; color:#29406A; font-size:.72rem; font-weight:700; vertical-align:middle; }
.internal-order-modal { width:min(1040px, calc(100vw - 32px)); max-height:calc(100vh - 32px); overflow:auto; }
.internal-order-form { display:grid; gap:18px; }
.internal-order-section { padding:16px; border:1px solid rgba(41,64,106,.18); border-radius:8px; background:rgba(233,232,234,.38); }
.internal-order-section h3 { margin:0; color:#29406A; font-size:1rem; }
.internal-order-section-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.internal-order-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
.internal-order-fields label { display:grid; gap:6px; font-weight:700; }
.internal-order-full { grid-column:1 / -1; }
.internal-order-items { display:grid; gap:10px; }
.internal-order-item { display:grid; grid-template-columns:30px minmax(220px,1.8fr) minmax(100px,.55fr) minmax(135px,.7fr) minmax(125px,.65fr) 34px; gap:10px; align-items:end; padding:12px; border:1px solid rgba(41,64,106,.16); border-radius:8px; background:#fff; }
.internal-order-item label { display:grid; gap:6px; font-size:.82rem; font-weight:700; }
.internal-order-item-index { align-self:center; color:#29406A; font-weight:700; }
.internal-order-subtotal { display:grid; gap:6px; font-size:.82rem; color:#5d6470; }
.internal-order-subtotal strong { color:#29406A; font-size:.95rem; }
.internal-order-remove { align-self:end; color:#AB4C25; }
.internal-order-totals { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:18px; padding:4px 0; color:#29406A; }
.internal-order-totals span { display:grid; gap:3px; font-size:.88rem; }
.internal-order-totals strong { font-size:1rem; }
.internal-order-grand-total strong { font-size:1.18rem; }
body.dark-mode .internal-order-section { background:rgba(255,255,255,.04); border-color:rgba(233,232,234,.18); }
body.dark-mode .internal-order-section h3, body.dark-mode .internal-order-subtotal strong, body.dark-mode .internal-order-totals, body.dark-mode .internal-order-item-index { color:#F2BF5E; }
body.dark-mode .internal-order-item { background:#20242b; border-color:rgba(233,232,234,.16); }
body.dark-mode .order-origin-badge { background:#F2BF5E; color:#29406A; }
@media (max-width:780px) {
  .internal-order-fields { grid-template-columns:1fr; }
  .internal-order-full { grid-column:auto; }
  .internal-order-item { grid-template-columns:28px 1fr 40px; }
  .internal-order-item label:first-of-type { grid-column:2 / -1; }
  .internal-order-subtotal { grid-column:2; }
  .internal-order-remove { grid-column:3; }
  .internal-order-totals { justify-content:flex-start; }
}


/* Campos estruturados do pedido interno. */
.internal-order-address-fields { display:grid; grid-template-columns:130px minmax(190px,1.8fr) 100px minmax(150px,1fr) minmax(150px,1fr) 88px; gap:14px; align-items:end; }
.internal-order-address-fields label { display:grid; gap:6px; font-weight:700; }
.internal-order-complement { grid-column:span 2; }
.internal-cep-hint { min-height:1.1rem; margin:0; color:#5d6470; font-size:.84rem; }
body.dark-mode .internal-cep-hint { color:#E9E8EA; }
@media (max-width:780px) {
  .internal-order-address-fields { grid-template-columns:repeat(2, minmax(0,1fr)); }
  .internal-order-complement { grid-column:auto; }
}

/* Forma de pagamento finaliza o fluxo após os itens do pedido interno. */
.internal-order-payment-section { display:flex; justify-content:flex-end; }
.internal-order-payment-section label { display:grid; gap:6px; width:min(320px, 100%); font-weight:700; }
@media (max-width:780px) { .internal-order-payment-section { justify-content:stretch; } .internal-order-payment-section label { width:100%; } }


/* Organização de endereços e envio no Pedido Interno. */
.internal-order-address-block { margin-top:18px; padding-top:16px; border-top:1px solid rgba(41,64,106,.15); }
.internal-order-address-block h4 { margin:0 0 12px; color:#29406A; font-size:.9rem; }
.internal-delivery-toggle { display:flex; align-items:center; gap:9px; margin-top:16px; font-weight:700; cursor:pointer; }
.internal-delivery-toggle input { width:18px; height:18px; accent-color:#29406A; }
.internal-order-shipping-fields { grid-template-columns:repeat(4,minmax(0,1fr)); }
body.dark-mode .internal-order-address-block { border-color:rgba(233,232,234,.18); }
body.dark-mode .internal-order-address-block h4 { color:#F2BF5E; }
@media (max-width:980px) { .internal-order-shipping-fields { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:780px) { .internal-order-shipping-fields { grid-template-columns:1fr; } }


/* Dados condicionais de transportadora no Pedido Interno. */
.internal-carrier-fields {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  padding:2px 0;
}
.internal-carrier-fields label { display:grid; gap:6px; font-weight:700; }
@media (max-width:780px) { .internal-carrier-fields { grid-template-columns:1fr; } }


/* Detalhes do Pedido Interno: leitura sequencial, sem cartões pesados. */
.order-heading-meta { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.order-heading-meta .order-origin-badge { margin-left:0; }
.internal-order-details-view, .order-detail-sections { display:grid; gap:0; margin:0; }
.internal-order-details-view section, .order-detail-sections section, .internal-order-products-view { border:0; border-bottom:1px solid var(--line); border-radius:0; background:transparent; padding:20px 0; }
.internal-order-details-view section:first-child, .order-detail-sections section:first-child { padding-top:0; }
.internal-order-details-view h3, .order-detail-sections h3, .internal-order-products-view h3 { margin:0 0 12px; color:var(--muted); font-size:12px; font-weight:800; text-transform:uppercase; }
.internal-order-detail-list { display:grid; gap:8px; max-width:760px; }
.internal-order-detail-line { display:grid; grid-template-columns:minmax(150px,.75fr) minmax(0,2fr); gap:16px; align-items:baseline; }
.internal-order-detail-line span { color:var(--muted); font-size:.9rem; }
.internal-order-detail-line strong { overflow-wrap:anywhere; color:var(--ink); }
.internal-order-address-fallback, .internal-order-notes { margin:0; line-height:1.5; white-space:normal; overflow-wrap:anywhere; }
.internal-order-products-view { margin:0; }
.internal-order-summary-view { grid-template-columns:1fr; }
.internal-order-summary-view section:last-child { border-bottom:0; }
.internal-order-summary-view .internal-order-detail-line:last-child { margin-top:6px; padding-top:12px; border-top:1px solid var(--line); font-size:1.08rem; }
body.dark-mode .internal-order-details-view section, body.dark-mode .order-detail-sections section, body.dark-mode .internal-order-products-view { background:transparent; }
@media (max-width:780px) { .internal-order-detail-line { grid-template-columns:1fr; gap:2px; } }

/* Pedido interno: modal de detalhes opaco. */
.modal-backdrop:has(.order-modal) {
  z-index: 100;
  background: rgba(15, 18, 21, 0.78);
}

.order-modal {
  isolation: isolate;
  background: var(--panel);
}

.order-modal > header {
  position: relative;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.order-modal > header #orderModalTitle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.order-modal .order-header {
  align-items: flex-end;
  gap: 28px;
  margin: 0;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}

.order-modal .order-header h2 {
  margin: 8px 0 0;
  font-size: 28px;
  line-height: 1.16;
}

.order-modal .order-actions {
  display: grid;
  grid-template-columns: minmax(170px, 210px) auto;
  align-items: end;
  gap: 10px;
}

.order-modal .order-actions label {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

.order-modal .order-actions .ghost-button {
  min-height: 42px;
  white-space: nowrap;
}

body.dark-mode .order-modal {
  background: #20252b;
  border-color: rgba(228, 226, 218, 0.25);
}

body.dark-mode .order-modal .internal-order-details-view section,
body.dark-mode .order-modal .order-detail-sections section,
body.dark-mode .order-modal .internal-order-products-view {
  background: transparent;
  border-color: rgba(228, 226, 218, 0.18);
}

body.dark-mode .order-modal .table-wrap,
body.dark-mode .order-modal table,
body.dark-mode .order-modal tbody tr,
body.dark-mode .order-modal tbody td {
  background-color: #2a3037;
}

body.dark-mode .order-modal .order-header,
body.dark-mode .order-modal .order-actions,
body.dark-mode .order-modal .order-actions label {
  background: transparent;
}

/* Pedido interno: responsividade dos detalhes. */
.order-modal {
  width: min(1120px, calc(100vw - 32px));
  overflow-x: hidden;
}

.order-modal .order-header > div:first-child {
  min-width: 0;
}

.order-modal .order-header h2 {
  overflow-wrap: anywhere;
}

.order-modal .order-actions {
  flex: 0 0 auto;
}

@media (max-width: 780px) {
  .modal-backdrop:has(.order-modal) {
    padding: 12px;
  }

  .order-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 16px;
  }

  .order-modal .order-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .order-modal .order-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .order-modal .order-actions label,
  .order-modal .order-actions select,
  .order-modal .order-actions button {
    width: 100%;
  }
}



/* Chave NF-e exibida apenas como referência na classificação da importação. */
.import-access-key {
  font-size: 0.72rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}


/* Orçamento: fluxo temporário e sem persistência. */
.budget-modal { width:min(980px, calc(100vw - 32px)); max-height:calc(100vh - 32px); overflow:auto; }
.budget-form { display:grid; gap:18px; }
.budget-section { padding:16px; border:1px solid rgba(41,64,106,.18); border-radius:8px; background:rgba(233,232,234,.38); }
.budget-section h3 { margin:0; color:#29406A; font-size:1rem; }
.budget-section-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.budget-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
.budget-fields label, .budget-section > label { display:grid; gap:6px; font-weight:700; }
.budget-full { grid-column:1 / -1; }
.budget-items, .budget-shipping-options { display:grid; gap:10px; }
.budget-item { display:grid; grid-template-columns:30px minmax(230px,1.8fr) minmax(105px,.56fr) minmax(135px,.72fr) minmax(118px,.62fr) 34px; gap:10px; align-items:end; padding:12px; border:1px solid rgba(41,64,106,.16); border-radius:8px; background:#fff; }
.budget-item label, .budget-shipping-option label { display:grid; gap:6px; font-size:.82rem; font-weight:700; }
.budget-item-index { align-self:center; color:#29406A; font-weight:700; }
.budget-subtotal { display:grid; gap:6px; font-size:.82rem; color:#5d6470; }
.budget-subtotal strong { color:#29406A; font-size:.95rem; }
.budget-remove { align-self:end; color:#AB4C25; }
.budget-total { display:flex; justify-content:flex-end; gap:12px; margin:14px 0 0; color:#29406A; }
.budget-shipping-option { display:grid; grid-template-columns:minmax(150px,1fr) minmax(135px,.7fr) minmax(180px,1fr) 34px; gap:10px; align-items:end; padding:12px; border:1px solid rgba(41,64,106,.16); border-radius:8px; background:#fff; }
.budget-preview { padding:4px 2px; }
.budget-preview-text { max-width:720px; color:#373334; }
.budget-preview-text h3 { margin:24px 0 7px; color:#29406A; font-size:1rem; }
.budget-preview-text p { margin:3px 0; line-height:1.5; }
.budget-preview-text .budget-preview-emphasis { font-weight:700; color:#29406A; }
.budget-preview-space { height:9px; }
body.dark-mode .budget-section { background:rgba(255,255,255,.04); border-color:rgba(233,232,234,.18); }
body.dark-mode .budget-section h3, body.dark-mode .budget-item-index, body.dark-mode .budget-subtotal strong, body.dark-mode .budget-total, body.dark-mode .budget-preview-text h3, body.dark-mode .budget-preview-text .budget-preview-emphasis { color:#F2BF5E; }
body.dark-mode .budget-item, body.dark-mode .budget-shipping-option { background:#20242b; border-color:rgba(233,232,234,.16); }
body.dark-mode .budget-preview-text { color:#E9E8EA; }
@media (max-width:780px) {
  .budget-fields { grid-template-columns:1fr; }
  .budget-full { grid-column:auto; }
  .budget-item { grid-template-columns:28px 1fr 34px; }
  .budget-item label:first-of-type { grid-column:2 / -1; }
  .budget-subtotal { grid-column:2; }
  .budget-remove { grid-column:3; }
  .budget-shipping-option { grid-template-columns:1fr 1fr 34px; }
  .budget-shipping-option label:nth-of-type(3) { grid-column:1 / 3; }
  .budget-shipping-option .budget-remove { grid-column:3; grid-row:1 / 3; }
}

/* Internal interface refinement: visual only. */
.shell {
  padding: 30px;
}

.shell .panel,
.shell .kpi {
  border-color: rgba(41, 64, 106, 0.14);
  box-shadow: 0 8px 24px rgba(55, 51, 52, 0.06);
}

.shell .panel {
  padding: 20px;
  margin-bottom: 16px;
}

.shell .panel-header {
  gap: 16px;
  margin-bottom: 18px;
}

.shell .panel-actions {
  gap: 8px;
}

.shell .input,
.shell select,
.shell textarea {
  border-color: rgba(41, 64, 106, 0.18);
  border-radius: 8px;
  min-height: 42px;
  background: var(--field);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.shell .input::placeholder,
.shell textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
}

.shell .input:focus,
.shell select:focus,
.shell textarea:focus {
  outline: 0;
  border-color: #29406A;
  box-shadow: 0 0 0 3px rgba(41, 64, 106, 0.12);
}

.shell input[type="checkbox"] {
  accent-color: #29406A;
}

.shell .primary-button,
.shell .ghost-button,
.shell .mini-button {
  min-height: 42px;
  border-radius: 8px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.shell .primary-button {
  border-color: #29406A;
  box-shadow: 0 2px 5px rgba(41, 64, 106, 0.14);
}

.shell .primary-button:hover {
  background: #22365a;
  box-shadow: 0 5px 12px rgba(41, 64, 106, 0.18);
}

.shell .ghost-button {
  border-color: rgba(41, 64, 106, 0.22);
  background: transparent;
}

.shell .ghost-button:hover {
  border-color: rgba(41, 64, 106, 0.42);
  background: rgba(41, 64, 106, 0.05);
}

.shell .mini-button {
  border-color: rgba(41, 64, 106, 0.16);
}

.shell .mini-button.warn {
  background: #AB4C25;
  border-color: #AB4C25;
  color: #FFFFFF;
}

.shell .mini-button.warn:hover {
  background: #913f20;
  border-color: #913f20;
}

.shell .badge {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid transparent;
  font-size: 11px;
  letter-spacing: 0;
}

.shell .table-wrap {
  border-color: rgba(41, 64, 106, 0.15);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

.shell .table-wrap th {
  height: 42px;
  padding: 10px 14px;
  background: rgba(233, 232, 234, 0.72);
  border-bottom-color: rgba(41, 64, 106, 0.14);
  color: #29406A;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.shell .table-wrap td {
  padding: 12px 14px;
  border-bottom-color: rgba(41, 64, 106, 0.1);
}

.shell .table-wrap tbody tr:hover td {
  background: rgba(41, 64, 106, 0.035);
}

.shell .import-card,
.shell .report-item,
.shell .alert-item,
.shell .destination-group {
  border-color: rgba(41, 64, 106, 0.14);
  box-shadow: none;
}

.shell .orders-filters {
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.shell .orders-table-wrap {
  border-color: rgba(41, 64, 106, 0.16);
  box-shadow: 0 5px 18px rgba(55, 51, 52, 0.045);
}

.shell .orders-table th {
  height: 46px;
  background: rgba(233, 232, 234, 0.76);
  border-bottom-color: rgba(41, 64, 106, 0.14);
  color: #29406A;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.shell .orders-table td {
  height: 66px;
  border-bottom-color: rgba(41, 64, 106, 0.1);
}

.shell .order-table-row:hover td {
  background: rgba(41, 64, 106, 0.04);
}

.shell .order-table-row.is-selected td {
  background: rgba(242, 191, 94, 0.18);
}

.shell .order-origin-badge {
  border: 1px solid rgba(41, 64, 106, 0.16);
  background: rgba(233, 232, 234, 0.92);
  color: #29406A;
}

.shell .order-table-status select,
.shell .order-table-print .ghost-button {
  height: 38px;
  min-height: 38px;
}

body.dark-mode .shell .panel,
body.dark-mode .shell .kpi,
body.dark-mode .shell .table-wrap,
body.dark-mode .shell .orders-table-wrap {
  border-color: rgba(233, 232, 234, 0.16);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

body.dark-mode .shell .input:focus,
body.dark-mode .shell select:focus,
body.dark-mode .shell textarea:focus {
  border-color: #F2BF5E;
  box-shadow: 0 0 0 3px rgba(242, 191, 94, 0.16);
}

body.dark-mode .shell .ghost-button:hover {
  background: rgba(233, 232, 234, 0.08);
}

body.dark-mode .shell .table-wrap th,
body.dark-mode .shell .orders-table th {
  background: rgba(233, 232, 234, 0.08);
  border-bottom-color: rgba(233, 232, 234, 0.14);
  color: #E9E8EA;
}

body.dark-mode .shell .table-wrap td,
body.dark-mode .shell .orders-table td {
  border-bottom-color: rgba(233, 232, 234, 0.12);
}

body.dark-mode .shell .table-wrap tbody tr:hover td,
body.dark-mode .shell .order-table-row:hover td {
  background: rgba(233, 232, 234, 0.045);
}

body.dark-mode .shell .order-table-row.is-selected td {
  background: rgba(242, 191, 94, 0.14);
}

body.dark-mode .shell .order-origin-badge {
  border-color: rgba(242, 191, 94, 0.28);
  background: rgba(242, 191, 94, 0.12);
  color: #F2BF5E;
}

@media (max-width: 980px) {
  .shell { padding: 20px; }
  .shell .panel { padding: 16px; }
}

/* Orders list: stable eight-column table. */
.orders-table {
  min-width: 1060px;
}

.orders-col-select { width: 64px; }
.orders-col-number { width: 112px; }
.orders-col-type { width: 112px; }
.orders-col-date { width: 172px; }
.orders-col-status { width: 168px; }
.orders-col-print { width: 116px; }
.orders-col-delete { width: 72px; }

.orders-table th,
.orders-table td {
  text-align: center;
}

.orders-table th {
  padding-left: 10px;
  padding-right: 10px;
}

.orders-table td {
  padding-left: 10px;
  padding-right: 10px;
}

.order-table-number strong,
.order-table-date,
.order-table-customer strong {
  text-align: center;
}

.order-table-type,
.order-table-status,
.order-table-print,
.order-table-delete {
  text-align: center;
}

.order-table-type .order-origin-badge {
  display: inline-flex;
  margin: 0;
  vertical-align: middle;
}

.order-table-customer strong {
  max-width: 100%;
}

.order-table-status select {
  display: block;
  width: min(150px, 100%);
  margin: 0 auto;
}

.order-table-print .ghost-button {
  display: inline-flex;
  width: 100px;
  margin: 0 auto;
  justify-content: center;
}

.order-table-delete-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(171, 76, 37, 0.32);
  border-radius: 8px;
  background: transparent;
  color: #AB4C25;
  font-size: 17px;
  line-height: 1;
}

.order-table-delete-button:hover,
.order-table-delete-button:focus-visible {
  border-color: #AB4C25;
  background: rgba(171, 76, 37, 0.1);
  outline: 0;
}

body.dark-mode .order-table-delete-button {
  border-color: rgba(242, 191, 94, 0.4);
  color: #F2BF5E;
}

body.dark-mode .order-table-delete-button:hover,
body.dark-mode .order-table-delete-button:focus-visible {
  border-color: #F2BF5E;
  background: rgba(242, 191, 94, 0.14);
}

@media (max-width: 820px) {
  .orders-table { min-width: 980px; }
}

/* Edi\u00e7\u00e3o de pedidos: a a\u00e7\u00e3o permanece compacta na listagem. */
.orders-table { min-width: 1140px; }
.orders-col-edit { width: 70px; }
.order-table-edit { text-align: center; }
.order-table-edit-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(41, 64, 106, 0.36);
  border-radius: 8px;
  background: transparent;
  color: #29406A;
  font-size: 17px;
  line-height: 1;
}

.order-table-edit-button:hover,
.order-table-edit-button:focus-visible {
  border-color: #29406A;
  background: rgba(41, 64, 106, 0.1);
  outline: 0;
}

.order-table-edit-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.order-edit-modal {
  width: min(1060px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

body.dark-mode .order-table-edit-button {
  border-color: rgba(242, 191, 94, 0.42);
  color: #F2BF5E;
}

body.dark-mode .order-table-edit-button:hover,
body.dark-mode .order-table-edit-button:focus-visible {
  border-color: #F2BF5E;
  background: rgba(242, 191, 94, 0.14);
}

@media (max-width: 820px) {
  .orders-table { min-width: 1080px; }
  .order-edit-modal { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
}

/* Ajustes compactos para a listagem de pedidos. */
.orders-table { min-width: 1080px; }
.orders-col-select { width: 50px; }
.orders-col-type { width: 84px; }
.orders-col-date { width: 126px; }
.orders-col-print { width: 70px; }

.order-table-select,
.order-table-type,
.order-table-date,
.order-table-print {
  white-space: nowrap;
}

.order-table-date-lines {
  display: inline-grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.2;
  white-space: nowrap;
}

.order-table-print-button {
  display: inline-flex;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(41, 64, 106, 0.36);
  border-radius: 8px;
  background: transparent;
  color: #29406A;
  font-size: 18px;
  line-height: 1;
}

.order-table-print-button:hover,
.order-table-print-button:focus-visible {
  border-color: #29406A;
  background: rgba(41, 64, 106, 0.1);
  outline: 0;
}

body.dark-mode .order-table-print-button {
  border-color: rgba(242, 191, 94, 0.42);
  color: #F2BF5E;
}

body.dark-mode .order-table-print-button:hover,
body.dark-mode .order-table-print-button:focus-visible {
  border-color: #F2BF5E;
  background: rgba(242, 191, 94, 0.14);
}

/* Compact action controls without changing their behavior. */
#productRows .table-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 142px;
  gap: 5px;
  vertical-align: middle;
}

#productRows .table-actions .mini-button {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 7px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.order-table-edit-button,
.order-table-print-button,
.order-table-delete-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 7px;
  font-size: 15px;
}

@media (max-width: 820px) {
  .orders-table { min-width: 1040px; }
}

/* Order duplication uses the same compact action treatment as the other row controls. */
.orders-table { min-width: 1140px; }
.orders-col-duplicate { width: 64px; }
.order-table-duplicate { text-align: center; white-space: nowrap; }
.order-table-duplicate-button {
  display: inline-flex;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(41, 64, 106, 0.36);
  border-radius: 7px;
  background: transparent;
  color: #29406A;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.order-table-duplicate-button:hover,
.order-table-duplicate-button:focus-visible {
  border-color: #29406A;
  background: rgba(41, 64, 106, 0.1);
  outline: 0;
}

body.dark-mode .order-table-duplicate-button {
  border-color: rgba(242, 191, 94, 0.42);
  color: #F2BF5E;
}

body.dark-mode .order-table-duplicate-button:hover,
body.dark-mode .order-table-duplicate-button:focus-visible {
  border-color: #F2BF5E;
  background: rgba(242, 191, 94, 0.14);
}

@media (max-width: 820px) {
  .orders-table { min-width: 1100px; }
}

