:root {
  --navy: #061d49;
  --navy-2: #0a2d68;
  --red: #d90816;
  --red-dark: #b90611;
  --ink: #13213b;
  --muted: #66758e;
  --line: #dce4ef;
  --canvas: #f3f6fb;
  --paper: #ffffff;
  --shadow: 0 8px 24px rgba(7, 31, 76, .08);
}

[hidden] {
  display: none !important;
}

body {
  background: radial-gradient(circle at 85% 0, #e9eef8 0, transparent 24rem), var(--canvas);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.sidebar {
  background: linear-gradient(180deg, var(--navy) 0%, #041535 100%);
  box-shadow: 8px 0 30px rgba(4, 21, 53, .12);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  padding: 6px 10px 22px;
}

.brand img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

.brand strong {
  letter-spacing: .5px;
}

.sidebar p {
  font-weight: 700;
  letter-spacing: 1.25px;
}

.nav-link {
  border-left: 3px solid transparent;
  margin: 2px 0;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.nav-link:hover {
  transform: translateX(2px);
}

.nav-link:hover,
.nav-link.active {
  border-left-color: var(--red);
  background: rgba(255, 255, 255, .93);
}

.content {
  padding: 34px clamp(20px, 3vw, 46px);
}

.topbar {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(185, 197, 215, .7);
}

.topbar h1 {
  color: var(--navy);
  letter-spacing: -.6px;
}

.section-head h2 {
  color: var(--navy);
  letter-spacing: -.35px;
}

.section-head {
  padding: 2px 0 4px;
}

.section-head p {
  max-width: 760px;
  line-height: 1.45;
}

.stat-grid article,
.panel,
.form-panel,
.print-document {
  border-color: rgba(209, 219, 233, .9);
  box-shadow: var(--shadow);
}

.stat-grid article {
  position: relative;
  overflow: hidden;
  min-height: 112px;
}

.stat-grid article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(var(--red), #ee3340);
}

.stat-grid strong {
  color: var(--navy);
  letter-spacing: -1px;
}

.stat-grid small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.panel,
.form-panel {
  margin-bottom: 20px;
}

.settlement-trips {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settlement-trips h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 16px;
}

.form-panel {
  border-top: 3px solid var(--navy-2);
}

.form-panel .form-actions {
  padding-top: 4px;
  border-top: 1px solid #edf1f7;
}

.panel-head {
  margin-bottom: 8px;
}

.primary,
.secondary,
.text-button {
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.primary:hover,
.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(7, 31, 76, .14);
}

.primary:hover {
  background: var(--red-dark);
}

.primary:focus-visible,
.secondary:focus-visible,
.text-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .22);
  outline-offset: 2px;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.delivery-row input,
.delivery-row select {
  border-color: #c5d0df;
  min-height: 43px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.delivery-row input:focus,
.delivery-row select:focus {
  border-color: var(--navy-2);
  box-shadow: 0 0 0 3px rgba(10, 45, 104, .08);
}

th {
  background: #f7f9fc;
  color: #52617a;
  white-space: nowrap;
}

tbody tr {
  transition: background .12s ease;
}

tbody tr:hover {
  background: #f8faff;
}

td:last-child {
  white-space: nowrap;
}

.table-wrap table {
  min-width: 680px;
}

.status {
  border: 1px solid #d4deec;
  background: #edf3fb;
}

.empty {
  border-radius: 9px;
}

dialog {
  border: 1px solid rgba(209, 219, 233, .9);
  box-shadow: 0 24px 70px rgba(5, 25, 61, .3);
}

dialog header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.print-document {
  border-top: 5px solid var(--navy);
}

.catalog-status {
  margin: 0 0 16px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: 9px;
  line-height: 1.45;
}

.catalog-warning {
  color: #8a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.catalog-ok {
  color: #166534;
  background: #f0fdf4;
  border-color: #86efac;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none !important;
}

.clean-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.danger-link {
  color: #b91c1c;
}

.field-feedback {
  color: #52617a;
  font-weight: 400;
  line-height: 1.35;
}

.cargo-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.cargo-section .panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cargo-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.cargo-row label,
.delivery-products label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.cargo-row input,
.cargo-row select,
.delivery-products input {
  width: 100%;
  min-height: 43px;
  border: 1px solid #c5d0df;
  border-radius: 7px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

.delivery-card {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}

.delivery-card .delivery-row {
  grid-template-columns: minmax(190px, 1.4fr) minmax(190px, 1.2fr) minmax(200px, 1.4fr) auto;
  padding-top: 0;
}

.delivery-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 13px;
}

@media (max-width: 780px) {
  .cargo-row,
  .delivery-card .delivery-row,
  .delivery-products { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 215px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .content { padding-inline: 22px; }
}

@media (max-width: 780px) {
  .app-shell { grid-template-columns: 150px minmax(0, 1fr); }
  .brand img { width: 40px; height: 40px; }
  .content { padding: 18px 14px; }
  .stat-grid article { min-height: 92px; }
  .topbar { align-items: flex-start; }
  .section-head { flex-direction: column; align-items: stretch; }
  .section-head .primary,
  .section-head .secondary { align-self: flex-start; }
  .form-actions { flex-wrap: wrap; }
}

@media print {
  .panel,
  .print-document { box-shadow: none; }
}
