:root {
  --bg: #f5f8fc;
  --surface: #ffffff;
  --surface-muted: #edf5fb;
  --ink: #111827;
  --muted: #596a80;
  --line: #d5e1ee;
  --line-strong: #9bb0c7;
  --accent: #00b8dc;
  --accent-dark: #03799d;
  --accent-soft: #e6f9ff;
  --accent-blue: #2e7bff;
  --accent-violet: #8d5cff;
  --warning: #a46009;
  --danger: #b13b5c;
  --ok: #16784d;
  --topbar-bg: #07162f;
  --topbar-bg-2: #082e4b;
  --shadow: 0 14px 34px rgba(7, 22, 47, 0.08);
  --radius: 6px;
  --app-max-width: 1720px;
  --topbar-height: 82px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #edf4fb;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: var(--topbar-height);
  background:
    linear-gradient(90deg, rgba(141, 92, 255, 0.42), rgba(0, 184, 220, 0.58)) left bottom / 100% 3px no-repeat,
    linear-gradient(112deg, var(--topbar-bg) 0%, #081c38 48%, var(--topbar-bg-2) 100%);
  color: #fff;
  border-bottom: 1px solid #051024;
}

.topbar-inner {
  width: min(100%, var(--app-max-width));
  min-height: var(--topbar-height);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 20px;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.client-logo {
  width: clamp(150px, 17vw, 230px);
  height: auto;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 184, 220, 0.12);
}

.app-title {
  min-width: max-content;
}

.maker-badge {
  display: grid;
  gap: 3px;
  align-items: center;
  justify-items: start;
  padding-left: 14px;
  border-left: 1px solid rgba(0, 184, 220, 0.28);
}

.maker-badge span {
  color: #9befff;
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.maker-badge img {
  width: clamp(92px, 9vw, 128px);
  height: auto;
  display: block;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: #9befff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-btn,
.icon-text-btn,
.secondary-btn,
.status-btn,
.table-icon-btn {
  min-height: 34px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  background: var(--surface);
  color: var(--ink);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent));
  color: #fff;
  border-color: rgba(0, 184, 220, 0.88);
  box-shadow: 0 8px 18px rgba(0, 184, 220, 0.16);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #2569e6, #00a6c9);
}

.icon-text-btn {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-color: rgba(155, 239, 255, 0.22);
}

.icon-text-btn:hover {
  background: rgba(0, 184, 220, 0.16);
  border-color: rgba(155, 239, 255, 0.42);
}

.mode-btn.active {
  background: #ffffff;
  color: #07325c;
  border-color: rgba(0, 184, 220, 0.5);
}

.nav-badge {
  min-width: 20px;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-violet);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.user-info {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  color: #dff8ff;
  border-left: 1px solid rgba(0, 184, 220, 0.26);
  padding-left: 12px;
  font-weight: 650;
}

.secondary-btn {
  border-color: var(--line);
  background: var(--surface);
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.workspace {
  flex: 1;
  width: min(100%, var(--app-max-width));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 0;
  background: var(--bg);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.sidebar {
  background: linear-gradient(180deg, #eef8fd 0%, #f6f8fc 100%);
  border-right: 1px solid var(--line);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - var(--topbar-height));
}

.filters {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 9px;
  background: #fff;
  color: var(--ink);
  min-height: 34px;
  display: block;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(0, 184, 220, 0.18);
  outline-offset: 0;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.orders-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.full-width {
  width: 100%;
}

.order-list-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

.order-list-item:hover,
.order-list-item.active {
  border-color: var(--accent);
  background: #f7fcff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.order-list-item.needs-attention {
  border-color: #e4b35b;
  background: #fffaf0;
  box-shadow: inset 3px 0 0 #e4b35b;
}

.order-list-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-weight: 650;
}

.order-list-meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-list-alert {
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-panel {
  min-width: 0;
  padding: clamp(20px, 2vw, 34px);
  overflow: auto;
  display: flex;
  justify-content: center;
}

.empty-state {
  min-height: calc(100vh - 120px);
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--ink);
}

.order-form {
  width: 100%;
}

.detail-column {
  width: min(100%, 1280px);
  display: grid;
  align-content: start;
  gap: 16px;
}

.order-form {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 16px;
}

.form-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  padding: 2px 0 6px;
}

.form-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.header-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 620px;
}

.order-overview {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 680px);
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.overview-main {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
}

.overview-label,
.compact-stat span,
.route-index,
.route-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.overview-main strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.overview-main > span:last-child {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.compact-stat {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
  display: grid;
  align-content: center;
  gap: 4px;
}

.compact-stat strong {
  font-size: 17px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.tab-button {
  min-height: 42px;
  height: auto;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  white-space: nowrap;
  font-weight: 650;
  align-self: center;
}

.tab-button span {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f1fb;
  color: var(--muted);
  font-size: 12px;
}

.tab-button.active {
  border-color: var(--accent);
  color: #07325c;
  background: linear-gradient(180deg, #ffffff, var(--accent-soft));
  box-shadow: inset 0 -2px 0 var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .tab-button:hover {
    border-color: var(--accent);
    color: #07325c;
    background: var(--accent-soft);
  }
}

.tab-button.active span {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent));
  color: #fff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-muted);
  color: var(--ink);
}

.status-draft {
  background: #e8ecef;
}

.status-submitted {
  background: #e8f0ff;
  color: #2453b8;
}

.status-returned {
  background: #fff3d8;
  color: var(--warning);
}

.status-approved,
.status-settlement {
  background: #e7f6ee;
  color: var(--ok);
}

.status-imported {
  background: #e8fbff;
  color: var(--accent-dark);
}

.status-closed {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.status-rejected {
  background: #f7e7e5;
  color: var(--danger);
}

.status-btn {
  border-color: var(--line);
  background: #fff;
}

.status-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.status-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #f8fbff, #ffffff);
}

.section-header h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
  color: #0b2948;
}

.section-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-body {
  padding: 16px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 13px 14px;
}

.wide {
  grid-column: 1 / -1;
}

.summary-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 390px);
  gap: 14px;
}

.document-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.file-picker input {
  padding: 7px;
  background: #f8fbff;
}

.attachment-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.attachment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.attachment-card strong,
.attachment-card p,
.attachment-card small {
  overflow-wrap: anywhere;
}

.attachment-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.attachment-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-inline {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #f8fbff;
}

.rate-monitor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.rate-monitor h4 {
  margin: 7px 0 4px;
  font-size: 16px;
}

.rate-monitor p {
  margin: 0;
  color: var(--muted);
}

.monitor-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
}

.monitor-pill.ok {
  background: #e5f1e9;
  color: var(--ok);
}

.monitor-pill.warn {
  background: #f7ead8;
  color: var(--warning);
}

.monitor-pill.neutral {
  background: #eef4fb;
  color: var(--muted);
}

.rate-source {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.rate-source a {
  color: var(--accent-dark);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #f8fbff;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.15;
}

.calc-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.calc-table th,
.calc-table td,
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.calc-table th,
.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #f6f9fd;
}

.calc-table td:last-child,
.calc-table th:last-child {
  text-align: right;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.data-table {
  min-width: 1350px;
}

.data-table input,
.data-table select {
  min-width: 110px;
  padding: 6px 7px;
}

.data-table input[type="number"] {
  min-width: 86px;
}

.computed-cell {
  white-space: nowrap;
  font-weight: 650;
  text-align: right;
}

.route-stack {
  display: grid;
  gap: 12px;
}

.route-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.route-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.route-card-head strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.route-total {
  display: grid;
  justify-items: end;
  gap: 3px;
  white-space: nowrap;
}

.route-total strong {
  margin: 0;
}

.route-grid,
.route-costs {
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 1fr));
  gap: 12px;
  padding: 12px;
}

.route-costs {
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.route-foreign-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #bdeefa;
  border-radius: var(--radius);
  background: #effcff;
  color: #065c73;
  font-size: 13px;
  font-weight: 650;
}

.route-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 12px 12px;
}

.table-icon-btn {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-color: var(--line);
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
}

.table-icon-btn:hover {
  border-color: var(--danger);
  background: #fff5f3;
}

.helper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.readonly-input {
  background: #f4f8fc;
}

.print-sheet {
  display: none;
}

.login-mode .workspace {
  display: none;
}

.login-mode .sidebar,
.login-mode .main-panel {
  display: none;
}

.login-overlay {
  position: fixed;
  inset: var(--topbar-height) 0 0;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: clamp(18px, 5vh, 44px) 24px 24px;
  background: var(--bg);
  z-index: 20;
  overflow: auto;
}

.login-panel {
  width: min(100%, 380px);
  display: grid;
  gap: 14px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-panel h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.login-error {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #e1aaa6;
  border-radius: var(--radius);
  background: #fff3f1;
  color: var(--danger);
}

.inline-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
  color: var(--muted);
}

.return-notice {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 13px 14px;
  border: 1px solid #e4b35b;
  border-left: 4px solid #e4b35b;
  border-radius: var(--radius);
  background: #fffaf0;
  color: var(--ink);
}

.return-notice div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.return-notice strong {
  color: var(--warning);
}

.return-notice span,
.return-notice p {
  margin: 0;
  color: var(--muted);
}

.return-notice p {
  color: var(--ink);
  line-height: 1.45;
}

.field-caption {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.checkbox-line {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.role-option {
  align-items: flex-start;
}

.role-option span {
  display: grid;
  gap: 2px;
}

.role-option small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.role-grid,
.sync-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.approver-option-list {
  display: grid;
  gap: 8px;
}

.approver-option {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.approver-option input {
  width: auto;
  min-height: auto;
}

.approver-option span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.approver-option small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-list {
  display: grid;
  gap: 12px;
}

.vehicle-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.vehicle-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.vehicle-card .form-grid {
  padding: 12px;
}

.vehicle-documents {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.vehicle-documents-head,
.vehicle-document {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vehicle-documents-head span {
  font-weight: 700;
  color: var(--ink);
}

.file-action {
  cursor: pointer;
}

.vehicle-document-list {
  display: grid;
  gap: 8px;
}

.vehicle-document {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.vehicle-document strong,
.vehicle-document small {
  overflow-wrap: anywhere;
}

.vehicle-document small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.vehicle-document-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.approval-sidebar {
  display: grid;
  gap: 10px;
}

.notification-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.notification-item span {
  font-weight: 700;
}

.notification-item small {
  color: var(--muted);
  line-height: 1.35;
}

.approval-stack {
  display: grid;
  gap: 10px;
}

.approval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.approval-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.approval-card h3 {
  margin: 3px 0 4px;
  font-size: 16px;
}

.approval-card p {
  margin: 0;
  color: var(--muted);
}

.approval-amount {
  display: grid;
  gap: 3px;
  text-align: right;
  white-space: nowrap;
}

.approval-amount span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.approval-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.approval-detail-body {
  display: grid;
  gap: 14px;
}

.approval-check-grid,
.approval-total-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.approval-total-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.approval-check,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.approval-check {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 78px;
  padding: 10px 12px;
}

.approval-check span,
.detail-row span,
.approval-attachment small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.approval-check strong {
  overflow-wrap: anywhere;
}

.approval-check small {
  color: var(--muted);
}

.approval-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-panel {
  padding: 12px;
}

.detail-panel h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.36fr) minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.detail-row:first-of-type {
  border-top: 0;
}

.detail-row strong {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.approval-lines-table th,
.approval-lines-table td {
  vertical-align: top;
}

.approval-lines-table small {
  color: var(--muted);
}

.approval-attachment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.approval-attachment:first-of-type {
  border-top: 0;
}

.approval-attachment > div {
  display: grid;
  gap: 3px;
}

.approval-attachment > div:last-child {
  justify-items: end;
  text-align: right;
}

@media (max-width: 1100px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .orders-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    max-height: 250px;
  }

  .summary-layout,
  .form-header,
  .order-overview,
  .rate-monitor,
  .approval-check-grid,
  .approval-total-strip,
  .approval-detail-grid {
    grid-template-columns: 1fr;
  }

  .overview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .app-shell {
    padding-bottom: 104px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    line-height: 1.25;
    min-height: 40px;
  }

  label,
  .section,
  .section-body,
  .form-grid,
  .route-card,
  .route-grid,
  .route-costs,
  .vehicle-card,
  .vehicle-card .form-grid,
  .summary-layout,
  .document-upload-grid,
  .approval-detail-body,
  .detail-column,
  .order-form,
  .main-panel {
    min-width: 0;
    max-width: 100%;
  }

  .login-mode .app-shell {
    padding-bottom: 0;
  }

  .login-mode .top-actions {
    display: none;
  }

  .login-overlay {
    position: fixed;
    inset: var(--topbar-height) 0 0;
    min-height: 0;
    align-items: start;
    padding: 12px 14px 20px;
  }

  .login-panel {
    width: 100%;
    max-width: 420px;
    gap: 10px;
    padding: 16px;
  }

  .login-panel h2 {
    font-size: 21px;
  }

  .topbar-inner {
    min-height: auto;
    padding: 10px 12px;
    gap: 8px;
  }

  .brand-lockup {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(116px, 136px) minmax(0, 1fr) 64px;
    align-items: center;
    gap: 8px;
  }

  .client-logo {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    padding: 6px 7px;
  }

  .app-title {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .maker-badge {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    padding-left: 8px;
  }

  .maker-badge span {
    display: none;
  }

  .maker-badge img {
    width: 56px;
  }

  .topbar h1 {
    font-size: 18px;
    white-space: normal;
  }

  .eyebrow {
    display: none;
  }

  .top-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
    align-items: stretch;
    gap: 7px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background:
      linear-gradient(90deg, rgba(141, 92, 255, 0.48), rgba(0, 184, 220, 0.6)) left top / 100% 3px no-repeat,
      linear-gradient(112deg, var(--topbar-bg) 0%, var(--topbar-bg-2) 100%);
    border-top: 1px solid rgba(155, 239, 255, 0.16);
    box-shadow: 0 -8px 22px rgba(7, 22, 47, 0.22);
  }

  .top-actions > button,
  .top-actions > .user-info {
    width: 100%;
    min-width: 0;
  }

  .top-actions > button {
    position: relative;
    min-height: 36px;
    padding: 6px 7px;
    gap: 5px;
    font-size: 12px;
    line-height: 1.15;
    overflow: hidden;
  }

  .top-actions > button span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #printBtn,
  #exportBtn {
    display: none;
  }

  .user-info {
    display: none;
  }

  .nav-badge {
    position: absolute;
    top: -3px;
    right: 4px;
    min-width: 17px;
    min-height: 17px;
    padding: 1px 5px;
    font-size: 11px;
  }

  .main-panel {
    padding: 14px;
  }

  .tabbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
  }

  .tab-button {
    min-width: 128px;
    flex: 0 0 auto;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid,
  .input-action-row,
  .document-upload-grid,
  .route-grid,
  .route-costs,
  .role-grid,
  .sync-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .approval-card {
    grid-template-columns: 1fr;
  }

  .approval-amount {
    text-align: left;
  }

  .detail-row,
  .approval-attachment {
    grid-template-columns: 1fr;
  }

  .approval-attachment > div:last-child {
    justify-items: start;
    text-align: left;
  }

  .rate-source {
    justify-items: start;
    text-align: left;
  }

  .attachment-card {
    grid-template-columns: 1fr;
  }

  .attachment-actions {
    justify-content: flex-start;
  }

  .route-card-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .route-total {
    justify-items: start;
  }

  .route-card-head .table-icon-btn {
    grid-column: 2;
    grid-row: 1;
  }

  .route-card-actions {
    padding: 0 12px 12px;
  }

  .route-card-actions .primary-btn {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .topbar,
  .sidebar,
  .order-form {
    display: none !important;
  }

  .workspace,
  .main-panel {
    display: block;
    padding: 0;
    overflow: visible;
  }

  .print-sheet {
    display: block;
    padding: 0;
    font-size: 11px;
  }

  .print-sheet h1,
  .print-sheet h2 {
    margin: 0 0 8px;
    text-align: center;
  }

  .print-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px 10px;
    margin: 10px 0;
  }

  .print-line {
    border-bottom: 1px solid #000;
    min-height: 20px;
    padding: 2px 0;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #000;
    padding: 4px;
    vertical-align: top;
  }
}
