:root {
  --navy: #003366;
  --blue: #0f5f9f;
  --orange: #ff6600;
  --green: #0c7a5f;
  --red: #b42318;
  --amber: #b54708;
  --ink: #111827;
  --muted: #667085;
  --line: #d9dee8;
  --line-soft: #eef1f5;
  --paper: #ffffff;
  --soft: #f6f8fb;
  --sidebar: #101828;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
code { color: var(--navy); font-weight: 700; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  color: #eef2f6;
  background: var(--sidebar);
  border-right: 1px solid #1d2939;
  overflow: auto;
}

.app-menu-backdrop[hidden] {
  display: none !important;
}

.sidebar-head {
  display: block;
}

.sidebar-close,
.app-menu-toggle {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 18px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 16px;
  line-height: 1.1;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #98a2b3;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 3px;
}

.nav-label {
  margin: 14px 8px 5px;
  color: #98a2b3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav a {
  min-height: 36px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
}

.nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}

.nav a.active {
  color: #fff;
  background: #1d2939;
  box-shadow: inset 3px 0 0 var(--orange);
}

.nav i {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #d0d5dd;
  background: rgba(255,255,255,.06);
  border-radius: 5px;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
}

.side-card {
  margin: 16px 2px 0;
  padding: 12px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  font-size: 13px;
}

.side-card span, .side-card small { color: #98a2b3; }
.db-ok { color: #7ce0bc; }
.db-off { color: #fdb022; }

.main {
  min-width: 0;
  background: var(--soft);
}

.topbar {
  min-height: 82px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.title-block { min-width: 240px; }

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-stats {
  margin-left: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 8px;
}

.top-stats span {
  min-height: 46px;
  padding: 8px 10px;
  display: grid;
  align-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fafbfc;
}

.top-stats b { color: var(--ink); font-size: 15px; }
.top-stats small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.app-language-switch {
  min-height: 42px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.app-language-switch button {
  min-width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.app-language-switch button.active {
  color: #fff;
  background: var(--navy);
}

.user-chip {
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: #344054;
  background: #f9fafb;
  font-size: 12px;
  font-weight: 800;
}

.logout-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.logout-button:hover {
  border-color: #ff6b1a;
  box-shadow: 0 8px 20px rgba(255, 107, 26, .14);
  transform: translateY(-1px);
}

.logout-button svg {
  width: 21px;
  height: 21px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.content { padding: 20px 22px; }

.module-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.module-tabs a {
  min-height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.module-tabs a.active {
  color: #fff;
  background: var(--sidebar);
}

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(16,24,40,.54);
}

.tour-panel {
  position: fixed;
  z-index: 100;
  width: min(360px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 72px rgba(16,24,40,.24);
}

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

.tour-head span {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tour-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  background: #f2f4f7;
  font-size: 18px;
  line-height: 1;
}

.tour-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
}

.tour-panel p {
  margin: 8px 0 14px;
  color: #475467;
  font-size: 14px;
  line-height: 1.5;
}

.tour-progress {
  height: 5px;
  margin-bottom: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #eaecf0;
}

.tour-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--orange);
  transition: width .2s ease;
}

.tour-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tour-highlight {
  position: relative;
  z-index: 90;
  outline: 3px solid rgba(255,102,0,.82);
  outline-offset: 3px;
  box-shadow: 0 0 0 9999px rgba(16,24,40,.06);
}

.tour-active .tour-highlight {
  transition: outline-color .2s ease;
}

.btn {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 7px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn.primary { color: #fff; background: var(--orange); }
.btn.secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.btn.dark { color: #fff; background: var(--navy); }
.btn.danger { color: var(--red); background: #fff; border: 1px solid #fecdca; }
.btn.block { width: 100%; }

.icon-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover { background: #f9fafb; }
.icon-btn.danger { color: var(--red); border-color: #fecdca; }

.notice {
  padding: 11px 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.notice.warn {
  color: var(--amber);
  border-color: #fedf89;
  background: #fffbeb;
}

.notice.success {
  color: var(--green);
  border-color: #abefc6;
  background: #ecfdf3;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-kpi-group {
  margin-bottom: 16px;
}

.dashboard-kpi-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 8px;
}

.dashboard-kpi-title h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.dashboard-kpi-title small {
  color: var(--muted);
  font-weight: 700;
}

.dashboard-finance-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-ops-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi, .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi {
  min-height: 110px;
  padding: 14px;
  display: grid;
  align-content: space-between;
}

.kpi span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.kpi small { color: var(--green); font-weight: 700; }
.kpi.warn small { color: var(--amber); }
.kpi.bad small { color: var(--red); }
.dashboard-mini .kpi {
  min-height: 88px;
}

.dashboard-mini .kpi strong {
  font-size: 21px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.card { padding: 16px; min-width: 0; }
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

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

.card-head h2, .card-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.muted { color: var(--muted); }
.subhead { margin: 0 0 10px; color: var(--ink); font-size: 14px; }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--blue);
  background: #eff6ff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.ok { color: var(--green); background: #ecfdf3; }
.status.warn { color: var(--amber); background: #fffaeb; }
.status.bad { color: var(--red); background: #fef3f2; }
.status.dark { color: #fff; background: var(--navy); }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric-card {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 6px;
  min-height: 104px;
}

.metric-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.metric-card strong {
  color: var(--ink);
  font-size: 27px;
  line-height: 1;
}

.metric-card small {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.filter-bar label {
  display: grid;
  gap: 6px;
}

.filter-bar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.filter-bar select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 700;
}

.data-table th a {
  color: inherit;
  text-decoration: none;
}

.data-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 26px 12px;
}

.btn.small,
.icon-action {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: #fff;
  font-weight: 900;
  text-decoration: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 760px;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: #f9fafb;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
.mono { font-family: "Segoe UI Mono", Consolas, monospace; color: var(--navy); font-weight: 800; }

.progress {
  height: 7px;
  width: 120px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.payment-preview {
  min-width: 150px;
  display: grid;
  gap: 6px;
}

.payment-preview.compact {
  min-width: 118px;
}

.payment-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.payment-preview-head strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.payment-preview-head small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.payment-progress {
  width: 100%;
  height: 8px;
}

.payment-preview.supplier .payment-progress i,
.payment-detail-card.supplier .payment-progress i {
  background: var(--orange);
}

.payment-preview.client .payment-progress i,
.payment-detail-card.client .payment-progress i {
  background: var(--green);
}

.payment-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.payment-detail-card {
  padding: 14px;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.payment-detail-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.payment-detail-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.payment-detail-card small {
  color: var(--muted);
  font-weight: 800;
}

.payment-form {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fafbfc;
}

.payment-table {
  margin-top: 8px;
}

.workflow-card .card-head p {
  margin: 4px 0 0;
  font-size: 13px;
}

.workflow-progress {
  height: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.workflow-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--green));
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.workflow-step {
  min-height: 92px;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

a.workflow-step {
  color: inherit;
  text-decoration: none;
}

a.workflow-step:hover {
  border-color: #9ec5ff;
  box-shadow: 0 8px 18px rgba(16, 24, 40, .08);
}

.workflow-step span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #98a2b3;
  background: #f2f4f7;
  font-size: 12px;
  font-weight: 900;
}

.workflow-step strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}

.workflow-step small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.workflow-step.active {
  border-color: #fed7aa;
  background: #fff7ed;
}

.workflow-step.active span {
  background: var(--orange);
  color: #fff;
}

.workflow-step.done {
  border-color: #abefc6;
  background: #ecfdf3;
}

.workflow-step.done span {
  background: var(--green);
  color: #fff;
}

.workflow-step.selected {
  outline: 2px solid rgba(0, 69, 119, .28);
  outline-offset: 2px;
}

.workflow-panel {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .9fr) minmax(260px, .9fr);
  gap: 12px;
}

.workflow-next,
.workflow-form {
  padding: 12px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.workflow-next span {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.workflow-next strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.workflow-doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-doc-tags span {
  min-height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  color: #344054;
  background: #f2f4f7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.transaction-timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 108px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 0 0 4px #fff3eb;
}

.timeline-date {
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.timeline-content {
  display: grid;
  gap: 4px;
  padding-left: 16px;
  border-left: 1px solid var(--line-soft);
}

.timeline-content strong {
  color: var(--ink);
  font-size: 14px;
}

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

.timeline-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.timeline-metrics span {
  min-height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  color: #344054;
  background: #f2f4f7;
  font-size: 11px;
  font-weight: 800;
}

.dashboard-chart-card {
  overflow: hidden;
}

.dashboard-chart {
  min-height: 260px;
  padding: 18px 12px 10px;
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(#eef1f5 1px, transparent 1px) 0 0 / 100% 25%,
    #fff;
}

.chart-month {
  min-width: 0;
  height: 220px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  justify-items: center;
}

.chart-bars {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 6px;
}

.chart-bars i {
  width: min(24px, 38%);
  min-height: 4px;
  border-radius: 5px 5px 2px 2px;
  transition: height .2s ease;
}

.chart-bars .sales,
.chart-legend .sales {
  background: var(--navy);
}

.chart-bars .profit,
.chart-legend .profit {
  background: var(--orange);
}

.chart-month strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.chart-legend {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.empty-state {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.field { display: grid; gap: 5px; grid-column: span 4; }
.field.wide { grid-column: span 8; }
.field.full { grid-column: span 12; }
.field.half { grid-column: span 6; }
.field.third { grid-column: span 4; }

.contract-builder .field.full h3 {
  margin: 14px 0 2px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--navy);
  font-size: 14px;
}

.contract-builder .field.full:first-of-type h3 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

label {
  color: #344054;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 84px;
  padding-top: 9px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(15,95,159,.12);
}

input.is-readonly,
textarea.is-readonly {
  color: #475467;
  background: #f3f5f8;
}

.field.is-hidden {
  display: none;
}

.calc-panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: var(--sidebar);
  color: #fff;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.calc-row:last-child { border-bottom: 0; padding-bottom: 0; }
.calc-row span { color: #98a2b3; }
.calc-row strong { font-size: 16px; }

.pipeline { display: grid; gap: 8px; }

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

.dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--navy);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
}

.dot.warn { background: var(--orange); }
.dot.muted { background: #98a2b3; }
.step strong { display: block; color: var(--ink); font-size: 13px; }
.step small { color: var(--muted); font-size: 12px; }

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

.doc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.doc strong { display: block; font-size: 13px; }
.doc small { color: var(--muted); font-size: 12px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo {
  min-height: 132px;
  display: flex;
  align-items: flex-end;
  padding: 10px;
  border-radius: 8px;
  overflow: hidden;
  color: #fff;
  background-size: cover;
  background-position: center;
  position: relative;
}

.photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, rgba(17,24,39,.74));
}

.photo strong { position: relative; z-index: 1; font-size: 12px; }
.photo.one { background-image: url("https://cajinco.com/wp-content/themes/transport-services/images/logistic2.png"); }
.photo.two { background-image: url("https://cajinco.com/wp-content/themes/transport-services/images/logistic3.png"); }
.photo.three { background-image: url("https://cajinco.com/wp-content/themes/transport-services/images/logistic4.png"); }

.match-map {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  gap: 10px;
  align-items: center;
}

.match-stack { display: grid; gap: 8px; }

.match-node {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.match-node strong { display: block; color: var(--ink); font-size: 13px; }
.match-node small { color: var(--muted); font-size: 12px; }

.match-link {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.risk-meter {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.risk-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #f79009, var(--red));
}

.exchange-frame {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exchange-frame iframe {
  width: 100%;
  height: 620px;
  display: block;
  border: 0;
  background: #fff;
}

.exchange-fallback {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 14px 40px rgba(16,24,40,.16);
}

.exchange-fallback strong {
  color: var(--ink);
  font-size: 13px;
}

.exchange-fallback span,
.exchange-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.exchange-converter {
  display: grid;
  gap: 12px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(16,24,40,.96), rgba(16,24,40,.82)),
    url("https://cajinco.com/wp-content/themes/transport-services/images/logistic2.png") center/cover;
}

.auth-shell {
  width: min(980px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}

.auth-panel {
  padding: 34px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px;
}

.auth-brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

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

.auth-copy h1 {
  margin: 0;
  font-size: 31px;
  line-height: 1.05;
}

.auth-copy p {
  max-width: 340px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-hint {
  margin-top: auto;
  padding-top: 18px;
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line-soft);
}

.auth-hint span,
.auth-hint small {
  color: var(--muted);
  font-size: 12px;
}

.auth-hint strong {
  color: var(--ink);
  font-size: 13px;
}

.auth-aside {
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(0,51,102,.88), rgba(16,24,40,.94)),
    url("https://cajinco.com/wp-content/themes/transport-services/images/logistic3.png") center/cover;
}

.auth-aside h2 {
  max-width: 410px;
  margin: 8px 0 0;
  font-size: 35px;
  line-height: 1.04;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.auth-metrics span {
  min-height: 76px;
  padding: 12px;
  display: grid;
  align-content: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 7px;
  background: rgba(255,255,255,.08);
}

.auth-metrics b {
  font-size: 20px;
}

.auth-metrics small {
  margin-top: 3px;
  color: rgba(255,255,255,.72);
  font-size: 11px;
}

@media (max-width: 1120px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(304px, 88vw);
    height: 100dvh;
    padding: 16px;
    transform: translateX(-104%);
    transition: transform .24s ease;
    box-shadow: 22px 0 70px rgba(16,24,40,.26);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .app-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(16,24,40,.54);
    opacity: 0;
    backdrop-filter: blur(4px);
    transition: opacity .2s ease;
  }

  .app-menu-backdrop.is-open {
    opacity: 1;
  }

  body.app-menu-open {
    overflow: hidden;
  }

  .sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  .sidebar-head .brand {
    padding: 0;
    margin: 0;
    border-bottom: 0;
  }

  .sidebar-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    color: #fff;
    background: rgba(255,255,255,.08);
    font-size: 23px;
    line-height: 1;
  }

  .sidebar-close:hover {
    background: rgba(255,255,255,.14);
  }

  .app-menu-toggle {
    min-width: 90px;
    height: 40px;
    padding: 0 11px;
    position: relative;
    display: inline-grid;
    grid-template-columns: 18px auto;
    align-items: center;
    column-gap: 9px;
    row-gap: 3px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: #fff;
    font-weight: 900;
  }

  .app-menu-toggle span {
    grid-column: 1;
    width: 18px;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: #344054;
  }

  .app-menu-toggle b {
    grid-column: 2;
    grid-row: 1 / 4;
    font-size: 13px;
  }

  .nav a {
    min-height: 40px;
    padding: 0 10px;
  }

  .nav { grid-template-columns: 1fr; }
  .nav-label { grid-column: auto; }
  .side-card { margin-top: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-panel { grid-template-columns: 1fr; }
  .top-stats { margin-left: 0; }
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
  }

  .title-block {
    min-width: 0;
  }

  .top-stats,
  .top-actions {
    grid-column: 1 / -1;
  }

  .top-actions {
    justify-content: flex-start;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-head h2 { margin: 4px 0 6px; }
.page-head p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.tabs a {
  padding: 9px 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.tabs a.active { color: #fff; background: var(--navy); border-color: var(--navy); }
.tabs a strong { margin-left: 4px; }
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 3px 6px;
  color: #fff;
  background: var(--orange);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}
.onboarding-kpis { margin-bottom: 18px; }
.inline-form { display: grid; gap: 7px; min-width: 230px; }
.inline-form select, .inline-form input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap td small { display: block; margin-top: 3px; color: var(--muted); }
.empty { display: grid; gap: 5px; padding: 26px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); }

@media (max-width: 760px) {
  .auth-page { padding: 12px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .auth-shell { grid-template-columns: 1fr; min-height: 0; }
  .auth-aside { display: none; }
  .auth-panel { padding: 24px; }
  .auth-copy h1 { font-size: 28px; }
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .app-menu-toggle {
    width: 40px;
    min-width: 40px;
    padding: 0;
    grid-template-columns: 18px;
    justify-content: center;
    row-gap: 2px;
  }

  .app-menu-toggle b {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .title-block {
    align-self: center;
  }

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

  .topbar p {
    display: none;
  }

  .top-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1 1 calc(50% - 8px); }
  .nav { grid-template-columns: 1fr; }
  .kpis, .doc-list, .photo-grid, .match-map, .payment-detail-grid { grid-template-columns: 1fr; }
  .filter-bar {
    grid-template-columns: 1fr;
  }
  .dashboard-kpi-title { align-items: flex-start; flex-direction: column; gap: 3px; }
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
  .field, .field.wide, .field.full, .field.half, .field.third { grid-column: span 12; }
  .step { grid-template-columns: 28px minmax(0, 1fr); }
  .step .status { grid-column: 2; justify-self: start; }
  .timeline-item {
    grid-template-columns: 1fr;
  }
  .timeline-item::before {
    display: none;
  }
  .timeline-content {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 460px) {
  .top-stats { grid-template-columns: 1fr; }
  .top-actions .btn,
  .top-actions .user-chip {
    flex: 1 1 100%;
  }
}
