﻿:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafd;
  --ink: #101a2b;
  --muted: #637083;
  --line: #d7e0ec;
  --blue: #1f5fbf;
  --blue-weak: #eaf1ff;
  --green: #087f5b;
  --green-weak: #e8f6ef;
  --orange: #b76a00;
  --orange-weak: #fff4df;
  --red: #c83232;
  --red-weak: #fff0f0;
  --yellow: #ca8a04;
  --yellow-weak: #fff8db;
  --sidebar: #0d1726;
  --sidebar-2: #132238;
  --shadow: 0 12px 30px rgba(20, 32, 52, .07);
  --radius: 6px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

.captcha-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
  align-items: end;
}

.captcha-field label {
  min-width: 0;
}

.captcha-preview {
  position: relative;
  width: 132px;
  height: 40px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.captcha-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.captcha-preview span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted-strong);
  font-size: 12px;
}

.permission-editor {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.permission-editor-head {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

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

.permission-group {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft, #f7f9fc);
}

.permission-group legend {
  padding: 0 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.permission-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.permission-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
}

.permission-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.permission-check.is-locked {
  color: var(--muted);
}

.permission-template-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.permission-template-grid small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .permission-template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .captcha-field,
  .permission-editor-head,
  .permission-groups,
  .permission-template-grid {
    grid-template-columns: 1fr;
  }

  .captcha-preview {
    width: 100%;
  }
}

/* V3 order operations, readiness, documents, and settlement workbench. */
.order-operation-sections {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.order-operation-section {
  min-width: 0;
}

.order-operation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.order-operation-head > div {
  min-width: 0;
}

.order-operation-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.order-operation-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.compact-operation-table {
  min-width: 820px;
}

.compact-operation-table th,
.compact-operation-table td,
.settlement-version-table th,
.settlement-version-table td {
  vertical-align: top;
}

.sensitive-hidden-note,
.readiness-error,
.readiness-clear {
  margin: 0 0 10px;
  padding: 9px 11px;
  border-left: 3px solid #4a8aa8;
  color: var(--muted-strong);
  background: #edf5f8;
  font-size: 12px;
  line-height: 1.5;
}

.readiness-error {
  border-left-color: var(--red);
  color: #8b2b25;
  background: #fff1f0;
}

.readiness-clear {
  border-left-color: var(--green);
  color: #226644;
  background: #edf8f2;
}

.document-upload-form,
.document-upload-form .field {
  min-width: 0;
}

.document-upload-form input[type="file"] {
  width: 100%;
  max-width: 100%;
}

.document-sensitive-toggle {
  align-self: end;
  min-height: 40px;
}

.readiness-panel .panel-head > div,
.order-settlement-panel .panel-head > div {
  min-width: 0;
}

.readiness-issues {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.readiness-issue {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(220px, 1.2fr);
  gap: 12px;
  padding: 9px 11px;
  border-left: 3px solid var(--line-strong);
  background: #f7f8f9;
  font-size: 12px;
  line-height: 1.45;
}

.readiness-issue.danger {
  border-left-color: var(--red);
  background: #fff1f0;
}

.readiness-issue.warn {
  border-left-color: #c48419;
  background: #fff8e8;
}

.readiness-issue span {
  color: var(--muted-strong);
  overflow-wrap: anywhere;
}

.readiness-actions,
.itinerary-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.departure-confirm-body {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.settlement-ready-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.settlement-ready-list > div:not(.empty-state) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.settlement-ready-list > div:last-child {
  border-bottom: 0;
}

.settlement-ready-list span {
  display: flex;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

.settlement-version-table {
  min-width: 1040px;
}

@media (max-width: 760px) {
  .order-operation-sections {
    gap: 16px;
  }

  .order-operation-head,
  .settlement-ready-list > div:not(.empty-state) {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .order-operation-head > button,
  .settlement-ready-list button {
    width: 100%;
  }

  .compact-operation-table {
    min-width: 760px;
  }

  .readiness-issue {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .readiness-actions,
  .itinerary-toolbar-actions {
    align-items: stretch;
    justify-content: stretch;
  }

  .readiness-actions button,
  .itinerary-toolbar-actions button {
    flex: 1 1 132px;
    min-width: 0;
    white-space: normal;
  }

  .document-sensitive-toggle {
    align-self: stretch;
  }

  .departure-confirm-body,
  .order-settlement-panel,
  .settlement-ready-list,
  .order-operation-section {
    max-width: 100%;
    overflow: hidden;
  }
}

.erp-plain-list {
  border-top: 1px solid var(--line);
}

.erp-plain-row {
  display: flex;
  min-width: 0;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.erp-plain-row > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.erp-plain-row span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.inventory-cell {
  display: grid;
  width: 76px;
  gap: 5px;
}

.inventory-cell > span {
  height: 5px;
  overflow: hidden;
  border-radius: 2px;
  background: #e1e6e9;
}

.inventory-cell i {
  display: block;
  height: 100%;
  background: var(--green);
}

.erp-context-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(140px, 1fr));
  border: 1px solid var(--line-strong);
  background: #fff;
}

.erp-context-bar > label,
.erp-context-bar > div {
  display: grid;
  min-width: 0;
  gap: 5px;
  align-content: center;
  padding: 11px 13px;
  border-right: 1px solid var(--line);
}

.erp-context-bar > :last-child {
  border-right: 0;
}

.erp-context-bar span,
.reservation-summary span,
.itinerary-editor-toolbar span {
  color: var(--muted);
  font-size: 11px;
}

.erp-context-bar select {
  width: 100%;
  min-width: 0;
}

.reservation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
}

.reservation-summary > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 11px 13px;
  border-right: 1px solid var(--line);
}

.reservation-summary > div:last-child {
  border-right: 0;
}

.itinerary-editor {
  min-width: 0;
}

.itinerary-editor-toolbar,
.itinerary-day-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.itinerary-editor-toolbar {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
}

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

.itinerary-day-list {
  display: grid;
  gap: 14px;
  padding-top: 14px;
}

.itinerary-day-editor {
  border: 1px solid var(--line-strong);
  background: #fafbfb;
}

.itinerary-day-head {
  min-height: 42px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--line);
  background: #eef1f3;
}

.itinerary-day-head button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  border-color: #d7a6a6;
  color: var(--red);
  background: #fff;
}

.compact-form-grid {
  padding: 12px;
}

@media (max-width: 760px) {
  .erp-context-bar,
  .reservation-summary,
  .compact-form-grid {
    grid-template-columns: 1fr;
  }

  .erp-context-bar > label,
  .erp-context-bar > div,
  .reservation-summary > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .erp-context-bar > :last-child,
  .reservation-summary > div:last-child {
    border-bottom: 0;
  }

  .erp-plain-row,
  .itinerary-editor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .erp-plain-row button,
  .itinerary-editor-toolbar button {
    width: 100%;
  }

  .itinerary-day-editor,
  .itinerary-day-list,
  .itinerary-editor,
  .form-grid,
  .form-grid .field {
    min-width: 0;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(31, 95, 191, .06), rgba(31, 95, 191, 0) 260px),
    var(--bg);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
  border: 0;
}

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

input,
select,
textarea {
  outline: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
  border-color: var(--blue);
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f7;
}

.login-panel {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
  align-items: stretch;
}

.login-copy,
.login-form {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(220, 229, 241, .9);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.login-copy {
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-mark {
  color: var(--blue);
  font-weight: 760;
  margin-bottom: 16px;
}

.login-copy h1 {
  margin: 0;
  max-width: 560px;
  font-size: clamp(30px, 5vw, 50px);
  line-height: 1.08;
}

.login-copy p {
  max-width: 520px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.login-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.login-proof span,
.pill,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.login-proof span {
  color: var(--blue);
  background: var(--blue-weak);
  border: 1px solid #cfe0ff;
}

.login-form {
  padding: 34px;
  align-self: center;
}

.login-form h2 {
  margin: 0 0 20px;
  font-size: 22px;
}

.login-form label,
.field label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.login-form input,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
}

.login-form label + label {
  margin-top: 14px;
}

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

.role-login-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.role-login-panel > b,
.role-login-panel > span {
  display: block;
}

.role-login-panel > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.role-login-panel > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.role-login-panel button {
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.role-login-panel button.active {
  border-color: #b8cdf7;
  background: var(--blue-weak);
}

.role-login-panel button b,
.role-login-panel button small {
  display: block;
  min-width: 0;
}

.role-login-panel button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 12px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #d8e2f0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .05);
}

.brand {
  padding: 10px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

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

.brand span {
  display: block;
  margin-top: 6px;
  color: #91a6c1;
  font-size: 12px;
}

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

.nav button {
  width: 100%;
  min-height: 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border-radius: 6px;
  color: #b8c7da;
  background: transparent;
  text-align: left;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.nav button:hover,
.nav button.active {
  background: rgba(96, 165, 250, .14);
  color: #fff;
  box-shadow: inset 2px 0 0 #60a5fa;
}

.nav small {
  min-width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #cfe0f7;
  background: rgba(255, 255, 255, .1);
  font-size: 11px;
}

.sync-card {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
}

.sync-card b {
  font-size: 13px;
}

.sync-card small {
  display: block;
  margin-top: 8px;
  color: #91a6c1;
  line-height: 1.5;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 60px;
  display: grid;
  grid-template-columns: minmax(260px, 460px) minmax(180px, 1fr) minmax(220px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 252, .96);
  backdrop-filter: blur(8px);
}

.global-search {
  position: relative;
  display: block;
}

.global-search span {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
}

.global-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px 0 52px;
  background: #fff;
}

.top-alerts {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.tenant-switcher {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.tenant-switcher span,
.tenant-switcher small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tenant-switcher select {
  min-width: 0;
  height: 30px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 760;
}

button.is-disabled,
.is-disabled {
  cursor: not-allowed !important;
  opacity: .48;
  box-shadow: none !important;
}

.danger-confirm {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #f0b9b9;
  border-radius: var(--radius);
  background: var(--red-weak);
}

.danger-confirm p {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
}

.danger-confirm small {
  color: var(--muted);
  line-height: 1.5;
}

.view-root {
  padding: 20px 22px 28px;
  display: grid;
  gap: 14px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.page-head h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.system-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid #bfd1eb;
  border-radius: var(--radius);
  color: #1f4e94;
  background: #f3f7ff;
}

.system-banner b,
.system-banner span {
  min-width: 0;
}

.system-banner span {
  color: #52627a;
  font-size: 13px;
  line-height: 1.45;
}

.system-banner.loading b::before {
  content: "";
  width: 9px;
  height: 9px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(31, 95, 191, .12);
}

.system-banner.danger {
  border-color: #f0b9b9;
  color: var(--red);
  background: var(--red-weak);
}

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

.compact-toolbar {
  justify-content: flex-end;
}

.compact-toolbar .secondary-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 700;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.primary-btn {
  width: 100%;
  margin-top: 20px;
  color: #fff;
  background: var(--blue);
}

.primary-btn:hover,
.secondary-btn.primary:hover {
  background: #1d4ed8;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .22);
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.danger-btn:active {
  transform: scale(.98);
}

.secondary-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.secondary-btn:hover,
.ghost-btn:hover {
  background: #f7faff;
  border-color: #b8c8dc;
}

.secondary-btn.primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.ghost-btn {
  color: var(--blue);
  background: var(--blue-weak);
}

.danger-btn {
  color: #fff;
  background: var(--red);
}

.pill {
  border: 1px solid transparent;
  background: #edf1f6;
  color: var(--muted);
}

.pill.info,
.tag.info {
  color: var(--blue);
  background: var(--blue-weak);
  border-color: #cfe0ff;
}

.pill.good,
.tag.good {
  color: var(--green);
  background: var(--green-weak);
  border-color: #bdebd4;
}

.pill.warn,
.tag.warn {
  color: var(--orange);
  background: var(--orange-weak);
  border-color: #ffd89a;
}

.pill.danger,
.tag.danger {
  color: var(--red);
  background: var(--red-weak);
  border-color: #ffc9c9;
}

.tag.yellow {
  color: var(--yellow);
  background: var(--yellow-weak);
  border-color: #f8df74;
}

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

.stat-card,
.panel,
.mini-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(16, 32, 51, .035);
}

.stat-card {
  min-height: 96px;
  padding: 13px 14px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 780;
  line-height: 1;
}

.stat-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.stat-card.good .stat-value {
  color: var(--green);
}

.stat-card.warn .stat-value {
  color: var(--orange);
}

.stat-card.danger .stat-value {
  color: var(--red);
}

.panel {
  min-width: 0;
  box-shadow: 0 8px 18px rgba(16, 32, 51, .035);
}

.panel-head {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fbfcfe);
}

.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 760;
}

.panel-body {
  padding: 14px;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  gap: 10px;
}

.kpi {
  min-height: 92px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 8px 18px rgba(16, 32, 51, .03);
}

.kpi.is-clickable {
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.kpi.is-clickable:hover {
  border-color: rgba(31, 95, 191, .36);
  box-shadow: 0 12px 24px rgba(16, 32, 51, .08);
  transform: translateY(-1px);
}

.kpi span,
.kpi small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.kpi b {
  display: block;
  margin: 7px 0 5px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.kpi.good b {
  color: var(--green);
}

.kpi.warn b {
  color: var(--orange);
}

.kpi.danger b {
  color: var(--red);
}

.ops-board {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, .9fr);
  gap: 14px;
  align-items: start;
}

.board-lanes {
  display: grid;
  gap: 10px;
}

.lane {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.lane b {
  color: var(--ink);
  font-size: 13px;
}

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

.ops-pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ops-pipeline div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.ops-pipeline span {
  grid-row: span 2;
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-weak);
  font-size: 12px;
  font-weight: 800;
}

.ops-pipeline b {
  font-size: 13px;
}

.ops-pipeline small {
  color: var(--muted);
  line-height: 1.45;
}

.two-col {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 14px;
  align-items: start;
}

.three-col {
  display: grid;
  grid-template-columns: 290px minmax(360px, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.table-search {
  width: min(420px, 100%);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
}

.table-search:focus {
  outline: 2px solid rgba(31, 95, 191, 0.16);
  border-color: rgba(31, 95, 191, 0.42);
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #fff;
  border-radius: 999px;
  background: #bdc9d8;
}

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

th {
  height: 38px;
  padding: 0 10px;
  color: var(--muted);
  background: #f6f8fb;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

td {
  height: 48px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  line-height: 1.45;
}

tr:hover td {
  background: #fafcff;
}

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

.erp-table th {
  height: 34px;
  color: #5f6d80;
  background: #f3f6fa;
  font-weight: 760;
}

.erp-table td {
  height: 52px;
}

.erp-table td:first-child,
.erp-table th:first-child {
  padding-left: 14px;
}

.erp-table td:last-child,
.erp-table th:last-child {
  padding-right: 14px;
}

.money {
  font-weight: 760;
}

.muted {
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-weak);
  font-size: 12px;
  font-weight: 700;
}

.row-actions .danger-action {
  color: var(--red);
  background: var(--red-weak);
}

.empty-cell,
.empty-state {
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.list-stack {
  display: grid;
  gap: 10px;
}

.alert-item,
.customer-item,
.evidence-item {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.alert-item {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
}

.alert-dot.red {
  background: var(--red);
}

.alert-dot.green {
  background: var(--green);
}

.customer-item {
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.customer-item.active,
.customer-item:hover {
  border-color: #a8c2ff;
  background: #f4f8ff;
}

.customer-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.customer-line b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.date-line {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.msg {
  max-width: 80%;
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  line-height: 1.6;
}

.msg.staff {
  margin-left: auto;
  background: var(--blue-weak);
  border-color: #cfe0ff;
}

.msg.system {
  max-width: 100%;
  background: #fbf7eb;
  border-color: #f3de9a;
}

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

.analysis-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.notice-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #f3d89c;
  border-radius: var(--radius);
  color: #7a4a00;
  background: #fff8e8;
  font-size: 13px;
}

.analysis-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf3;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--green);
}

.progress.compact {
  width: 120px;
  height: 7px;
  margin-bottom: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
  align-items: start;
}

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

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

.permission-matrix-wrap {
  border-bottom: 1px solid var(--line);
}

.permission-matrix {
  min-width: 860px;
}

.permission-cell {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.permission-cell.good {
  color: var(--green);
  background: var(--green-weak);
}

.permission-cell.info {
  color: var(--blue);
  background: var(--blue-weak);
}

.permission-cell.muted {
  color: var(--muted);
  background: #eef2f6;
}

.role-test-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) repeat(2, minmax(0, .9fr));
  gap: 10px;
}

.role-switch-card,
.role-scope-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.role-switch-card > span,
.role-scope-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.role-switch-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.role-switch-buttons button {
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.role-switch-buttons button.active {
  border-color: #b8cdf7;
  background: var(--blue-weak);
}

.role-switch-buttons b,
.role-switch-buttons small {
  display: block;
}

.role-switch-buttons small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.role-scope-card.good {
  border-color: #b8dfcf;
  background: var(--green-weak);
}

.role-scope-card.info {
  border-color: #bfd1eb;
  background: var(--blue-weak);
}

.role-scope-card.warn {
  border-color: #f1d89d;
  background: var(--orange-weak);
}

.smoke-table {
  min-width: 980px;
}

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

.issue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.issue-item.warn {
  border-color: #f1d89d;
  background: #fffbf1;
}

.issue-item.danger {
  border-color: #f1b9b9;
  background: #fff7f7;
}

.issue-item b,
.issue-item small {
  display: block;
  min-width: 0;
}

.issue-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.field textarea {
  min-height: 86px;
  padding: 10px;
  resize: vertical;
}

.screenshot-import {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.screenshot-source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(180px, .65fr);
  gap: 10px;
  min-width: 0;
}

.screenshot-upload,
.screenshot-paste-area {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 112px;
  padding: 14px;
  border: 1px dashed #9eb4c5;
  border-radius: var(--radius);
  background: #f7fafc;
}

.screenshot-upload span,
.screenshot-paste-area b {
  color: var(--ink);
  font-size: 14px;
}

.screenshot-upload small,
.screenshot-paste-area span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.screenshot-upload input {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
}

.screenshot-paste-area {
  cursor: text;
  outline: none;
}

.screenshot-paste-area:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 107, 145, .14);
}

.screenshot-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.screenshot-preview-head b {
  font-size: 13px;
}

.screenshot-preview-head span {
  color: var(--muted);
  font-size: 12px;
}

.screenshot-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.screenshot-empty {
  grid-column: 1 / -1;
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
}

.screenshot-thumb {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.screenshot-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-soft);
}

.screenshot-thumb figcaption {
  overflow: hidden;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screenshot-thumb button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  color: #fff;
  background: rgba(30, 42, 54, .78);
  font-size: 20px;
  line-height: 1;
}

.screenshot-fields {
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 760;
}

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

.trip-file {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.trip-file-modal {
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trip-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.trip-section h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f8fb;
  font-size: 13px;
}

.trip-section.good h3 {
  color: var(--green);
}

.trip-section.warn h3 {
  color: var(--orange);
}

.trip-section.danger h3 {
  color: var(--red);
}

.trip-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trip-fields div {
  min-height: 54px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.trip-fields div:nth-child(2n) {
  border-right: 0;
}

.trip-fields span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.trip-fields b {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.detail-trip {
  padding-top: 0;
}

.trip-list {
  display: grid;
}

.trip-list-item {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.trip-list-item:last-child {
  border-bottom: 0;
}

.trip-list-item b,
.trip-list-item span {
  display: block;
  overflow-wrap: anywhere;
}

.trip-list-item b {
  font-size: 13px;
}

.trip-list-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.trip-list-item .tag {
  margin-left: 6px;
  vertical-align: middle;
}

.trip-list-item .row-actions {
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.trip-list-item .row-actions button {
  min-width: 56px;
  white-space: nowrap;
}

.trip-modal {
  display: grid;
  gap: 14px;
}

.trip-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.trip-hero b,
.trip-hero span {
  display: block;
}

.trip-hero span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.mini-panel {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.mini-panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.compact-evidence {
  display: grid;
  gap: 8px;
}

.compact-evidence p {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #253246;
  line-height: 1.55;
}

.compact-evidence b {
  margin-right: 8px;
  color: var(--blue);
}

.timeline-list {
  display: grid;
  gap: 9px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-row:last-child {
  border-bottom: 0;
}

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

.timeline-row b,
.timeline-row span {
  display: block;
}

.timeline-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mini-card {
  padding: 13px;
}

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

.mini-card b {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.copy-code {
  display: block;
  margin-top: 6px;
  padding: 9px 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #0f3f85;
  background: var(--blue-weak);
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.chart {
  height: 270px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(to top, rgba(37,99,235,.16) 0 0) no-repeat 8% 70%/7% 30%,
    linear-gradient(to top, rgba(37,99,235,.26) 0 0) no-repeat 20% 50%/7% 50%,
    linear-gradient(to top, rgba(5,150,105,.18) 0 0) no-repeat 32% 62%/7% 38%,
    linear-gradient(to top, rgba(37,99,235,.33) 0 0) no-repeat 44% 35%/7% 65%,
    linear-gradient(to top, rgba(5,150,105,.24) 0 0) no-repeat 56% 44%/7% 56%,
    linear-gradient(to top, rgba(37,99,235,.40) 0 0) no-repeat 68% 28%/7% 72%,
    linear-gradient(to top, rgba(5,150,105,.32) 0 0) no-repeat 80% 38%/7% 62%,
    repeating-linear-gradient(to top, transparent 0, transparent 51px, #e8eef7 52px),
    #fff;
}

.compact-chart {
  height: 220px;
}

.ads-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, .9fr);
  gap: 12px;
  align-items: start;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 27, 45, .48);
}

.modal {
  width: min(1080px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(15, 27, 45, .28);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

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

.modal-body {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.import-sample {
  max-width: 100%;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #f6f8fb;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

.modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  min-width: 240px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #fff;
  background: #102033;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .brand span,
  .nav span,
  .sync-card {
    display: none;
  }

  .brand strong {
    font-size: 13px;
  }

  .nav button {
    justify-content: center;
    padding: 0 8px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .tenant-switcher {
    grid-column: 1 / -1;
  }

  .top-alerts {
    display: none;
  }

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

  .kpi-strip,
  .ops-pipeline,
  .ops-board,
  .trip-file,
  .trip-file-modal,
  .ads-summary {
    grid-template-columns: 1fr 1fr;
  }

  .three-col,
  .detail-grid,
  .two-col,
  .permission-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .login-panel,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-copy,
  .login-form {
    padding: 24px;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
  }

  .brand {
    min-width: 128px;
    border-bottom: 0;
  }

  .nav {
    display: flex;
  }

  .nav button {
    min-width: 88px;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .account {
    display: none;
  }

  .tenant-switcher {
    grid-template-columns: 1fr;
  }

  .tenant-switcher select {
    width: 100%;
  }

  .view-root {
    padding: 14px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cards-grid,
  .form-grid,
  .profit-grid,
  .kpi-strip,
  .ops-pipeline,
  .ops-board,
  .trip-file,
  .trip-file-modal,
  .ads-summary {
    grid-template-columns: 1fr;
  }

  .trip-fields {
    grid-template-columns: 1fr;
  }

  .trip-fields div,
  .trip-fields div:nth-child(2n) {
    border-right: 0;
  }

  .trip-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .trip-list-item .row-actions {
    justify-content: stretch;
  }

  .trip-list-item .row-actions button {
    flex: 1 1 76px;
  }

  .modal-actions {
    justify-content: stretch;
  }

  .modal-actions button {
    flex: 1 1 128px;
  }

  .msg {
    max-width: 100%;
  }
}

/*
 * ERP visual system V2: trip operations desk
 * Dense, flat, audit-friendly surfaces for daily travel operations.
 * Reference grammar: IBM Carbon structure, Intercom sharp geometry,
 * Travel Operations task hierarchy, and Trip File dossier composition.
 */

:root {
  --bg: #f1f3f5;
  --surface: #ffffff;
  --surface-soft: #f6f7f8;
  --surface-strong: #e9edf0;
  --ink: #17212b;
  --muted: #68737f;
  --muted-strong: #4f5b66;
  --line: #d9dee3;
  --line-strong: #bdc6ce;
  --blue: #176b9e;
  --blue-strong: #0f547f;
  --blue-weak: #e6f1f7;
  --green: #187456;
  --green-weak: #e6f3ed;
  --orange: #a85a12;
  --orange-weak: #f8eee3;
  --red: #b83b3b;
  --red-weak: #f9e9e8;
  --yellow: #8a6a12;
  --yellow-weak: #f5f0de;
  --sidebar: #202830;
  --sidebar-2: #29333d;
  --shadow: 0 12px 32px rgba(26, 35, 44, .14);
  --radius: 4px;
  font-family: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button {
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  box-shadow: none;
}

.login-screen {
  min-height: 100vh;
  padding: 0;
  background: #e9ecef;
}

.login-panel {
  width: 100%;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  gap: 0;
}

.login-copy,
.login-form {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.login-copy {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 7vw, 108px);
  color: #f8fafb;
  background: #202830;
}

.login-copy::after {
  content: "会话同步  /  订单确认  /  计调派单  /  财务核验";
  position: absolute;
  right: 48px;
  bottom: 40px;
  left: 48px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .18);
  color: rgba(255, 255, 255, .56);
  font-size: 12px;
}

.product-mark {
  margin-bottom: 56px;
  color: #77b7da;
  font-size: 13px;
  font-weight: 600;
}

.login-copy h1 {
  max-width: 680px;
  color: #fff;
  font-size: clamp(36px, 5vw, 68px);
  font-weight: 500;
  line-height: 1.12;
}

.login-copy p {
  max-width: 620px;
  margin-top: 28px;
  color: rgba(255, 255, 255, .7);
  font-size: 16px;
  line-height: 1.85;
}

.login-proof {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  max-width: 620px;
  margin-top: 56px;
  border-top: 1px solid rgba(255, 255, 255, .16);
  border-left: 1px solid rgba(255, 255, 255, .16);
}

.login-proof span {
  min-height: 48px;
  justify-content: flex-start;
  padding: 0 16px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, .16);
  border-bottom: 1px solid rgba(255, 255, 255, .16);
  border-radius: 0;
  color: rgba(255, 255, 255, .78);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
}

.login-form {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(42px, 6vw, 92px);
  background: #fff;
}

.login-form h2 {
  margin-bottom: 32px;
  font-size: 26px;
  font-weight: 600;
}

.login-form label,
.field label {
  gap: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.login-form input,
.field input,
.field select,
.field textarea {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
}

.login-form .primary-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 22px;
}

.role-login-panel {
  gap: 10px;
  margin-top: 20px;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.role-login-panel > div {
  gap: 6px;
}

.role-login-panel button {
  min-height: 54px;
  padding: 9px 10px;
  border-color: var(--line);
  border-radius: 3px;
}

.role-login-panel button:hover,
.role-login-panel button.active {
  border-color: var(--blue);
  color: var(--blue-strong);
  background: var(--blue-weak);
}

.form-note {
  color: #8a949e;
}

.app-shell {
  grid-template-columns: 228px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  z-index: 20;
  height: 100vh;
  padding: 0;
  overflow-y: auto;
  border-right: 1px solid #111820;
  color: #d8dee4;
  background: var(--sidebar);
  box-shadow: none;
  scrollbar-width: thin;
  scrollbar-color: #46525d transparent;
}

.brand {
  min-height: 76px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.brand strong {
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: #8e9aa5;
  font-size: 11px;
}

.nav {
  gap: 0;
  padding: 10px 10px 132px;
}

.nav-group {
  display: grid;
  gap: 2px;
  margin-top: 14px;
}

.nav-group:first-child {
  margin-top: 0;
}

.nav-group-label {
  padding: 7px 10px 5px;
  color: #77848f;
  font-size: 11px;
  font-weight: 600;
}

.nav button {
  position: relative;
  min-height: 37px;
  padding: 0 9px 0 12px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #b9c2ca;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
}

.nav button > span {
  display: inline;
}

.nav button:hover {
  color: #fff;
  background: #29343e;
}

.nav button.active {
  color: #fff;
  border-color: rgba(255, 255, 255, .08);
  background: #33414d;
  box-shadow: inset 2px 0 0 #5aa4cd;
}

.nav small {
  min-width: 21px;
  height: 20px;
  padding: 0 6px;
  border-radius: 3px;
  color: #dfe7ed;
  background: rgba(255, 255, 255, .09);
  font-size: 11px;
}

.nav button.active small {
  color: #16364b;
  background: #9dc9df;
}

.sync-card {
  right: 10px;
  bottom: 10px;
  left: 10px;
  padding: 13px 10px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .1);
  border-radius: 0;
  background: var(--sidebar);
}

.sync-card b {
  color: #d9e2e8;
  font-size: 12px;
  font-weight: 500;
}

.sync-card small {
  color: #7f8c97;
  line-height: 1.5;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #55b88a;
  box-shadow: none;
}

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

.topbar {
  display: flex;
  z-index: 15;
  min-height: 64px;
  padding: 10px 22px;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .98);
  box-shadow: none;
}

.global-search {
  flex: 1 1 260px;
  min-width: 260px;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f7f8f9;
}

.global-search span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.global-search input {
  min-height: 36px;
  color: var(--ink);
}

.top-alerts {
  gap: 5px;
}

.account {
  flex: 0 0 auto;
  gap: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 12px;
  white-space: nowrap;
}

.tenant-switcher {
  flex: 0 1 296px;
  grid-column: auto;
  min-height: 38px;
  padding: 4px 8px;
  gap: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.tenant-switcher span {
  color: var(--muted);
  font-size: 10px;
}

.tenant-switcher small {
  color: #7d8790;
  font-size: 10px;
}

.tenant-switcher select {
  min-width: 144px;
  padding: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.view-root {
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 20px 24px 36px;
}

.page-head {
  min-height: 54px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-strong);
}

.page-head h1 {
  color: var(--ink);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
}

.page-head p {
  max-width: 780px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.system-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #b9d3e2;
  border-radius: 3px;
  background: var(--blue-weak);
}

.system-banner.danger {
  border-color: #e0b5b3;
  background: var(--red-weak);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.primary-btn,
.secondary-btn.primary {
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
}

.primary-btn:hover,
.secondary-btn.primary:hover {
  border-color: var(--blue-strong);
  background: var(--blue-strong);
  box-shadow: none;
}

.secondary-btn {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: #fff;
}

.secondary-btn:hover,
.ghost-btn:hover {
  border-color: #98a6b1;
  color: var(--ink);
  background: #f1f3f5;
}

.ghost-btn {
  border: 1px solid transparent;
  color: var(--muted-strong);
  background: transparent;
}

.danger-btn {
  border: 1px solid var(--red);
  color: #fff;
  background: var(--red);
}

.danger-btn:hover {
  background: #982f2f;
}

.pill,
.tag {
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.pill.info,
.tag.info {
  color: #155d88;
  border-color: #bfd9e7;
  background: var(--blue-weak);
}

.pill.good,
.tag.good {
  color: #176548;
  border-color: #bddbcd;
  background: var(--green-weak);
}

.pill.warn,
.tag.warn,
.tag.yellow {
  color: #8a4c13;
  border-color: #e3c9ad;
  background: var(--orange-weak);
}

.pill.danger,
.tag.danger {
  color: #a33434;
  border-color: #e2b9b7;
  background: var(--red-weak);
}

.cards-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.stat-card {
  min-height: 112px;
  padding: 17px 18px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.stat-card:last-child {
  border-right: 0;
}

.stat-label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 500;
}

.stat-value {
  margin-top: 12px;
  color: var(--ink);
  font-size: 27px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.stat-card.good .stat-value { color: var(--green); }
.stat-card.warn .stat-value { color: var(--orange); }
.stat-card.danger .stat-value { color: var(--red); }

.panel,
.mini-card,
.mini-panel,
.role-switch-card,
.role-scope-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 46px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f8f9;
}

.panel-title,
.panel-head h2 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.panel-body {
  padding: 14px;
}

.kpi-strip {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.workbench-kpis {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.kpi {
  min-height: 88px;
  padding: 14px 15px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.kpi:last-child {
  border-right: 0;
}

.kpi.is-clickable:hover {
  background: #f5f8fa;
  box-shadow: inset 0 -2px 0 var(--blue);
}

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

.kpi b {
  margin-top: 7px;
  color: var(--ink);
  font-size: 23px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ops-board,
.lane,
.ops-pipeline div {
  border-color: var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.lane {
  min-height: 94px;
  padding: 13px;
}

.lane b {
  font-size: 12px;
}

.ops-pipeline {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.ops-pipeline div {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}

.ops-pipeline div:last-child {
  border-right: 0;
}

.two-col,
.three-col,
.report-grid {
  gap: 12px;
}

.table-wrap {
  border: 0;
  border-radius: 0;
  background: #fff;
}

.table-search {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
}

.erp-table {
  min-width: 940px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.erp-table th {
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-strong);
  color: #4f5a64;
  background: #eef1f3;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.erp-table td {
  min-height: 44px;
  padding: 9px 12px;
  border-bottom: 1px solid #e8ebee;
  color: #2b3540;
  vertical-align: middle;
}

.erp-table tbody tr:nth-child(even) td {
  background: #fbfcfc;
}

.erp-table tbody tr:hover td {
  background: #edf5f9;
}

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

.money {
  color: #1d2d3a;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  gap: 4px;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 27px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: #365061;
  background: #fff;
  font-size: 11px;
}

.row-actions button:hover {
  border-color: #9cb5c5;
  color: var(--blue-strong);
  background: var(--blue-weak);
}

.row-actions .danger-action {
  color: var(--red);
}

.row-actions .danger-action:hover {
  border-color: #d9aaa8;
  color: #962f2f;
  background: var(--red-weak);
}

.empty-state,
.empty-cell {
  color: var(--muted);
  background: #f7f8f9;
}

.empty-state {
  min-height: 108px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 3px;
}

.alert-item,
.customer-item,
.evidence-item,
.issue-item,
.report-rank div:not(.empty-state) {
  border-color: var(--line);
  border-radius: 3px;
  background: #fff;
  box-shadow: none;
}

.alert-item:hover,
.customer-item:hover,
.customer-item.active {
  border-color: #9db8c8;
  background: #eef5f8;
}

.alert-dot {
  width: 7px;
  height: 7px;
  background: var(--orange);
  box-shadow: none;
}

.message-flow {
  background: #eef1f3;
}

.msg {
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  box-shadow: none;
}

.msg.staff {
  border-color: #bdd5e3;
  background: #e8f2f7;
}

.msg.system {
  border-color: #d6d9dc;
  color: var(--muted-strong);
  background: #f4f5f6;
}

.analysis-card,
.notice-line {
  border-color: var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
}

.progress,
.usage-bar {
  height: 5px;
  border-radius: 1px;
  background: #e3e7ea;
}

.progress span,
.usage-bar span {
  border-radius: 1px;
  background: var(--blue);
}

.tabs,
.segmented,
.filter-strip {
  gap: 0;
  padding: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
}

.tabs button,
.segmented button,
.filter-strip button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted-strong);
  background: transparent;
  font-size: 12px;
}

.tabs button:hover,
.segmented button:hover,
.filter-strip button:hover {
  color: var(--ink);
  background: #eef1f3;
}

.tabs button.active,
.segmented button.active,
.filter-strip button.active {
  color: var(--blue-strong);
  border-bottom-color: var(--blue);
  background: transparent;
}

.trip-file,
.trip-file-modal,
.trip-modal {
  gap: 12px;
}

.trip-hero {
  min-height: 84px;
  padding: 16px 18px;
  border: 1px solid #c7d2d9;
  border-top: 2px solid var(--blue);
  border-radius: 3px;
  color: var(--ink);
  background: #e8edf0;
  box-shadow: none;
}

.trip-hero b {
  font-size: 17px;
  font-weight: 600;
}

.trip-hero span {
  color: var(--muted-strong);
}

.trip-section {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.trip-section h3 {
  margin: 0;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: #f5f6f7;
  font-size: 13px;
  font-weight: 600;
}

.trip-section.good h3,
.trip-section.warn h3,
.trip-section.danger h3 {
  color: var(--ink);
}

.trip-fields,
.trip-list,
.timeline-list,
.compact-evidence {
  padding: 12px;
}

.trip-fields {
  gap: 0;
  border: 0;
}

.trip-fields div {
  min-height: 52px;
  padding: 9px 11px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.trip-fields div:nth-child(2n) {
  background: #fafbfb;
}

.trip-fields span {
  color: var(--muted);
  font-size: 10px;
}

.trip-fields b {
  margin-top: 4px;
  font-size: 12px;
}

.trip-list-item {
  padding: 9px 0;
  border-bottom-color: #e7eaed;
}

.timeline-row {
  border-bottom-color: #e7eaed;
}

.modal-root {
  padding: 24px;
  background: rgba(22, 29, 35, .58);
  backdrop-filter: none;
}

.modal {
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid #aeb8c0;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-head {
  min-height: 52px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: #f1f3f5;
}

.modal-head h2 {
  font-size: 17px;
  font-weight: 600;
}

.modal-body {
  padding: 16px;
}

.modal-actions {
  gap: 6px;
  padding: 11px 16px;
  border-top: 1px solid var(--line-strong);
  background: #f7f8f9;
}

.danger-confirm {
  border-radius: 3px;
  background: var(--red-weak);
}

.toast {
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  padding: 11px 14px;
  border: 1px solid #303a43;
  border-radius: 3px;
  color: #fff;
  background: #202830;
  box-shadow: 0 10px 26px rgba(20, 28, 35, .22);
}

.report-filter-bar,
.filter-strip,
.match-summary div,
.import-tile,
.health-list > div:not(.empty-state),
.plan-mix > div,
.usage-row,
.brand-preview,
.saas-plan-card {
  border-color: var(--line);
  border-radius: 3px;
  background: #fff;
  box-shadow: none;
}

.report-chart {
  border-color: var(--line);
  border-radius: 3px;
  background:
    repeating-linear-gradient(to top, #fff 0, #fff 49px, #e9ecef 50px);
}

.report-chart span,
.report-chart span:nth-child(2n),
.report-chart span:nth-child(3n) {
  border-radius: 2px 2px 0 0;
  background: var(--blue);
  box-shadow: none;
}

.report-chart span:nth-child(2n) { background: #4a8aa8; }
.report-chart span:nth-child(3n) { background: #7aa7b8; }

.report-rank span:first-child {
  border-radius: 3px;
  color: var(--blue-strong);
  background: var(--blue-weak);
}

.import-tile:hover {
  border-color: #9bb7c8;
  background: #edf5f8;
  box-shadow: none;
}

.saas-hero {
  border-color: var(--line);
  border-top: 2px solid var(--blue);
  border-radius: 3px;
  color: var(--ink);
  background: #e9edf0;
  box-shadow: none;
}

.saas-eyebrow {
  color: var(--blue-strong);
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 208px minmax(0, 1fr);
  }

  .topbar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .view-root {
    padding-right: 18px;
    padding-left: 18px;
  }

  .workbench-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .top-alerts .pill {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid #111820;
  }

  .brand {
    min-height: 60px;
    padding: 13px 16px;
  }

  .nav {
    display: flex;
    gap: 8px;
    padding: 8px 12px 10px;
    overflow-x: auto;
  }

  .nav-group {
    display: flex;
    flex: 0 0 auto;
    gap: 3px;
    margin: 0;
  }

  .nav-group-label,
  .sync-card {
    display: none;
  }

  .nav button {
    min-width: max-content;
  }

  .topbar {
    position: sticky;
    top: 0;
    flex-wrap: wrap;
  }

  .global-search {
    order: 1;
    max-width: none;
    flex: 1 1 100%;
  }

  .top-alerts {
    margin-left: 0;
  }

  .cards-grid,
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card,
  .kpi {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .login-panel {
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: auto;
    padding: 32px 22px 44px;
  }

  .product-mark {
    margin-bottom: 24px;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .login-copy p {
    margin-top: 18px;
    font-size: 14px;
  }

  .login-proof {
    margin-top: 28px;
  }

  .login-copy::after {
    display: none;
  }

  .login-form {
    padding: 30px 22px 42px;
  }

  .topbar {
    gap: 8px;
    padding: 9px 12px;
  }

  .tenant-switcher {
    flex: 1 1 auto;
  }

  .tenant-switcher select {
    min-width: 110px;
  }

  .account {
    padding-left: 8px;
  }

  .account span {
    display: none;
  }

  .top-alerts {
    width: 100%;
    overflow-x: auto;
  }

  .top-alerts .pill {
    flex: 0 0 auto;
    max-width: none;
  }

  .view-root {
    padding: 14px 12px 28px;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-head h1 {
    font-size: 20px;
  }

  .page-head .actions {
    width: 100%;
    overflow: visible;
    flex-wrap: wrap;
  }

  .page-head .actions button {
    min-width: 0;
    min-height: 40px;
    flex: 1 1 calc(50% - 4px);
    white-space: normal;
  }

  .toolbar,
  .compact-toolbar {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .toolbar button,
  .compact-toolbar button {
    min-height: 40px;
    flex: 0 0 auto;
  }

  .cards-grid,
  .kpi-strip {
    grid-template-columns: 1fr;
  }

  .stat-card,
  .kpi {
    min-height: 96px;
    border-right: 0;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .danger-btn {
    min-height: 40px;
  }

  .row-actions button {
    min-height: 34px;
  }

  .modal-root {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 4px 4px 0 0;
  }

  .modal-actions {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .modal-actions button {
    min-height: 40px;
    flex: 0 0 auto;
  }

  .trip-fields {
    grid-template-columns: 1fr;
  }

  .trip-fields div {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.saas-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid #c9d7e8;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(31, 95, 191, .12), rgba(8, 127, 91, .06)),
    #fff;
  box-shadow: 0 10px 24px rgba(16, 32, 51, .045);
}

.saas-eyebrow {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #bfd1eb;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(255, 255, 255, .72);
  font-size: 12px;
  font-weight: 760;
}

.saas-hero h2 {
  margin: 12px 0 7px;
  font-size: 26px;
  line-height: 1.15;
}

.saas-hero p,
.saas-plan-card span,
.brand-preview span,
.usage-row span {
  color: var(--muted);
  line-height: 1.5;
}

.saas-plan-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .88);
}

.saas-plan-card strong {
  font-size: 24px;
  line-height: 1;
}

.saas-kpis {
  grid-template-columns: repeat(5, minmax(128px, 1fr));
}

.saas-business-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.saas-table {
  min-width: 1040px;
}

.health-list,
.plan-mix {
  display: grid;
  gap: 10px;
}

.health-list > div:not(.empty-state) {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.health-list > div:not(.empty-state) > span:first-child {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-weak);
  font-size: 14px;
  font-weight: 800;
}

.health-list > div.good > span:first-child {
  color: var(--green);
  background: var(--green-weak);
}

.health-list > div.warn > span:first-child {
  color: var(--orange);
  background: var(--orange-weak);
}

.health-list > div.danger > span:first-child {
  color: var(--red);
  background: var(--red-weak);
}

.health-list b,
.health-list small {
  display: block;
  min-width: 0;
}

.health-list small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.plan-mix > div {
  display: grid;
  grid-template-columns: minmax(72px, .35fr) minmax(110px, .65fr);
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.plan-mix b,
.plan-mix span {
  min-width: 0;
}

.plan-mix span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.plan-mix .usage-bar {
  grid-column: 1 / -1;
}

.plan-mix > div:nth-child(2) .usage-bar span {
  background: var(--blue);
}

.plan-mix > div:nth-child(3) .usage-bar span {
  background: var(--green);
}

.plan-mix > div:nth-child(4) .usage-bar span {
  background: var(--orange);
}

.usage-stack {
  display: grid;
  gap: 12px;
}

.usage-row {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.usage-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.usage-row b {
  font-size: 13px;
}

.usage-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.usage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.usage-row.warn .usage-bar span {
  background: var(--orange);
}

.usage-row.danger .usage-bar span {
  background: var(--red);
}

.brand-preview {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.brand-preview b,
.brand-preview span {
  display: block;
}

.brand-swatch {
  width: 42px;
  height: 42px;
  border: 4px solid #fff;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line), 0 8px 16px rgba(16, 32, 51, .1);
}

@media (max-width: 1180px) {
  .saas-hero,
  .saas-kpis,
  .saas-business-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .saas-hero,
  .saas-kpis,
  .saas-business-grid {
    grid-template-columns: 1fr;
  }

  .saas-plan-card strong,
  .saas-hero h2 {
    font-size: 22px;
  }

  .health-list > div:not(.empty-state) {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .health-list .tag {
    grid-column: 2;
    justify-self: start;
  }

  .plan-mix > div {
    grid-template-columns: 1fr;
  }

  .plan-mix span {
    text-align: left;
  }
}

.report-kpi-grid,
.finance-workbench {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 10px;
}

.report-filter-bar,
.filter-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.report-filter-bar > div:first-child {
  min-width: 190px;
  display: grid;
  gap: 3px;
  margin-right: auto;
}

.report-filter-bar b,
.report-filter-bar span {
  display: block;
}

.report-filter-bar b {
  font-size: 13px;
}

.report-filter-bar span {
  color: var(--muted);
  font-size: 12px;
}

.segmented,
.filter-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.segmented button,
.filter-strip button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.segmented button.active,
.filter-strip button.active {
  color: var(--blue);
  border-color: #b8cdf7;
  background: var(--blue-weak);
}

.tenant-segment {
  max-width: 100%;
}

.report-kpi-grid {
  grid-template-columns: repeat(8, minmax(120px, 1fr));
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 14px;
  align-items: start;
}

.report-panel-wide {
  min-height: 320px;
}

.report-chart {
  height: 252px;
  display: grid;
  grid-template-columns: repeat(7, minmax(18px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(to top, transparent 0, transparent 49px, #e8eef7 50px),
    linear-gradient(180deg, #fff, #f8fbff);
}

.report-chart span {
  min-height: 24px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #1f5fbf, #7aa7ff);
  box-shadow: inset 0 -8px 14px rgba(255, 255, 255, .18);
}

.report-chart span:nth-child(2n) {
  background: linear-gradient(180deg, #087f5b, #7fd7ae);
}

.report-chart span:nth-child(3n) {
  background: linear-gradient(180deg, #b76a00, #f3be63);
}

.report-rank {
  display: grid;
  gap: 9px;
}

.report-rank div:not(.empty-state) {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.report-rank span:first-child {
  grid-row: span 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-weak);
  font-weight: 800;
  font-size: 12px;
}

.report-rank b,
.report-rank strong,
.report-rank small {
  min-width: 0;
}

.monthly-settlement-table table {
  min-width: 1180px;
}

.settlement-order {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.report-rank strong {
  font-size: 14px;
}

.report-rank small {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.import-tile {
  display: grid;
  gap: 7px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fbfcff;
  text-align: left;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.import-tile:hover {
  border-color: #a8c2ff;
  background: #f5f8ff;
  box-shadow: 0 8px 16px rgba(31, 95, 191, .08);
}

.import-tile b,
.import-tile span {
  display: block;
}

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

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

.match-summary div {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
}

.match-summary b {
  font-size: 24px;
  line-height: 1;
}

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

@media (max-width: 1180px) {
  .report-kpi-grid,
  .finance-workbench {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .report-grid,
  .import-grid,
  .role-test-grid,
  .issue-grid {
    grid-template-columns: 1fr;
  }

  .role-switch-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .report-kpi-grid,
  .finance-workbench,
  .match-summary {
    grid-template-columns: 1fr;
  }

  .report-chart {
    height: 200px;
    gap: 7px;
  }

  .system-banner,
  .issue-item {
    align-items: flex-start;
  }

  .issue-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .role-login-panel > div,
  .role-switch-buttons {
    grid-template-columns: 1fr;
  }

  .issue-item .tag {
    grid-column: 2;
    justify-self: start;
  }
}

/* V2 final cascade: report and advanced-setting rules are declared late above. */
.saas-hero {
  border: 1px solid var(--line);
  border-top: 2px solid var(--blue);
  border-radius: 3px;
  color: var(--ink);
  background: #e9edf0;
  box-shadow: none;
}

.saas-eyebrow {
  color: var(--blue-strong);
}

.saas-plan-card,
.brand-preview,
.usage-row,
.health-list > div:not(.empty-state),
.plan-mix > div,
.report-filter-bar,
.match-summary div,
.import-tile {
  border-color: var(--line);
  border-radius: 3px;
  background: #fff;
  box-shadow: none;
}

.report-grid,
.report-kpi-grid,
.finance-workbench,
.import-grid,
.match-summary {
  gap: 12px;
}

.report-chart {
  border-color: var(--line);
  border-radius: 3px;
  background:
    repeating-linear-gradient(to top, #fff 0, #fff 49px, #e9ecef 50px);
}

.report-chart span,
.report-chart span:nth-child(2n),
.report-chart span:nth-child(3n) {
  border-radius: 2px 2px 0 0;
  background: var(--blue);
  box-shadow: none;
}

.report-chart span:nth-child(2n) {
  background: #4a8aa8;
}

.report-chart span:nth-child(3n) {
  background: #7aa7b8;
}

.report-rank div:not(.empty-state) {
  border-color: var(--line);
  border-radius: 3px;
  background: #fff;
}

.report-rank span:first-child {
  border-radius: 3px;
  color: var(--blue-strong);
  background: var(--blue-weak);
}

.import-tile:hover {
  border-color: #9bb7c8;
  background: #edf5f8;
  box-shadow: none;
}

@media (max-width: 760px) {
  .report-kpi-grid,
  .finance-workbench,
  .match-summary {
    grid-template-columns: 1fr;
  }
}

.role-login-details {
  width: 100%;
}

.role-login-details summary,
.more-actions summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  list-style: none;
}

.role-login-details summary::-webkit-details-marker,
.more-actions summary::-webkit-details-marker {
  display: none;
}

.role-login-details summary::after,
.more-actions summary::after {
  content: "+";
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.role-login-details[open] summary::after,
.more-actions[open] summary::after {
  content: "−";
}

.role-login-content {
  display: grid;
  gap: 8px;
  padding-top: 10px;
}

.role-login-content > span {
  color: var(--muted);
  font-size: 12px;
}

.role-login-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.more-actions {
  position: relative;
  margin-right: auto;
}

.more-actions summary {
  min-width: 88px;
}

.more-actions-menu {
  position: absolute;
  z-index: 80;
  bottom: calc(100% + 8px);
  left: 0;
  width: 252px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(22, 30, 38, .16);
}

.more-actions-menu button {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--ink);
  background: #f5f6f7;
  text-align: left;
  font-size: 12px;
}

.more-actions-menu button:hover {
  border-color: #b8ccd7;
  color: var(--blue-strong);
  background: var(--blue-weak);
}

@media (max-width: 760px) {
  body {
    padding-bottom: 62px;
  }

  .sidebar {
    min-height: 58px;
    padding: 0;
    overflow: visible;
  }

  .brand {
    min-width: 0;
    min-height: 58px;
    padding: 11px 14px;
  }

  .brand span {
    margin-top: 1px;
  }

  .nav {
    position: fixed;
    z-index: 70;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 62px;
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(64px, 1fr);
    gap: 0;
    padding: 5px 4px max(5px, env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--line-strong);
    color: var(--ink);
    background: #fff;
    box-shadow: 0 -6px 18px rgba(20, 28, 35, .08);
  }

  .nav-group {
    display: contents;
  }

  .nav button {
    display: none;
    min-width: 0;
    min-height: 50px;
    padding: 0 3px;
    justify-content: center;
    border: 0;
    border-radius: 3px;
    color: var(--muted-strong);
    background: transparent;
    font-size: 11px;
    text-align: center;
  }

  .nav button[data-view="dashboard"],
  .nav button[data-view="conversation"],
  .nav button[data-view="products"],
  .nav button[data-view="departures"],
  .nav button[data-view="quotations"],
  .nav button[data-view="orders"],
  .nav button[data-view="operations"],
  .nav button[data-view="finance"] {
    display: flex;
  }

  .nav button:hover,
  .nav button.active {
    color: var(--blue-strong);
    background: var(--blue-weak);
    box-shadow: inset 0 2px 0 var(--blue);
  }

  .nav small {
    position: absolute;
    top: 3px;
    right: 6px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    color: #fff;
    background: var(--red);
    font-size: 9px;
  }

  .topbar {
    position: sticky;
    top: 0;
    gap: 7px;
  }

  .tenant-switcher,
  .global-search {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }

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

  .workbench-kpis .kpi:nth-child(n + 5) {
    display: none;
  }

  .workbench-kpis .kpi {
    min-height: 106px;
  }

  .self-use-flow {
    display: none;
  }

  .role-login-options {
    grid-template-columns: 1fr;
  }

  .captcha-field {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .captcha-preview {
    width: 112px;
  }

  .screenshot-source-grid {
    grid-template-columns: 1fr;
  }

  .screenshot-upload,
  .screenshot-paste-area {
    min-height: 96px;
  }

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

  .screenshot-fields,
  .screenshot-fields .field {
    min-width: 0;
  }

  .modal-actions {
    overflow-x: visible;
    flex-wrap: wrap;
  }

  .modal-actions button {
    min-width: 0;
    flex: 1 1 132px;
    white-space: normal;
  }

  .more-actions {
    flex: 0 0 auto;
    margin-right: 0;
  }

  .more-actions-menu {
    position: fixed;
    right: 8px;
    bottom: 62px;
    left: 8px;
    width: auto;
  }

  .form-grid,
  .compact-form-grid,
  .erp-context-bar,
  .reservation-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-body,
  .itinerary-day-list,
  .itinerary-day-editor,
  .itinerary-editor {
    min-width: 0;
    max-width: 100%;
  }

}

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

.quotation-workbench,
.quotation-form,
.quotation-detail {
  min-width: 0;
}

.quotation-table {
  min-width: 1180px;
}

.quotation-table th,
.quotation-table td {
  vertical-align: top;
}

.quotation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: start;
}

.quotation-calculation {
  position: sticky;
  top: 0;
  display: grid;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #f8fafb;
}

.quotation-calculation > div,
.quotation-price-detail > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.quotation-calculation > div:last-of-type,
.quotation-price-detail > div:last-child {
  border-bottom: 0;
}

.quotation-calculation span,
.quotation-price-detail span,
.quotation-meta-grid span,
.quotation-review-summary span {
  color: var(--muted);
  font-size: 12px;
}

.quotation-calculation small {
  display: block;
  padding-top: 10px;
  color: var(--muted-strong);
  line-height: 1.45;
}

.quotation-calculation .quotation-subtotal,
.quotation-price-detail .quotation-total {
  margin-top: 4px;
  border-top: 1px solid var(--line-strong);
}

.quotation-calculation .quotation-total,
.quotation-price-detail .quotation-total {
  color: var(--blue-strong);
  font-size: 16px;
}

.quotation-detail {
  display: grid;
  gap: 18px;
}

.quotation-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.quotation-detail-head > div {
  min-width: 0;
}

.quotation-detail-head b,
.quotation-detail-head span {
  display: block;
  overflow-wrap: anywhere;
}

.quotation-detail-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.quotation-price-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}

.quotation-price-detail span small {
  display: block;
  margin-top: 3px;
}

.quotation-price-detail .quotation-total {
  grid-column: 1 / -1;
}

.quotation-meta-grid,
.quotation-review-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quotation-meta-grid > div,
.quotation-review-summary > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 0;
  overflow-wrap: anywhere;
}

.quotation-meta-grid small {
  color: var(--muted);
  line-height: 1.45;
}

.quotation-version-history h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

.quotation-version-history table {
  min-width: 620px;
}

.quotation-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding-top: 2px;
}

.quotation-notes p {
  margin: 6px 0 0;
  color: var(--muted-strong);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .quotation-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quotation-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .quotation-calculation {
    position: static;
  }
}

@media (max-width: 760px) {
  .quotation-kpis,
  .quotation-price-detail,
  .quotation-meta-grid,
  .quotation-review-summary,
  .quotation-notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .quotation-form,
  .quotation-form .form-grid,
  .quotation-calculation,
  .quotation-detail,
  .quotation-review-summary {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .quotation-calculation > div,
  .quotation-price-detail > div {
    gap: 8px;
  }

  .quotation-price-detail .quotation-total {
    grid-column: auto;
  }

  .quotation-detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .quotation-table {
    min-width: 980px;
  }
}

/* V3.1 reminder center and operation calendar. */
.reminder-center,
.reminder-list-panel,
.reminder-calendar-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.reminder-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reminder-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.reminder-toolbar > label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.reminder-toolbar select {
  min-width: 104px;
  max-width: 180px;
  height: 34px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.reminder-view-tabs,
.reminder-scope {
  flex: 0 0 auto;
}

.calendar-month-nav {
  display: grid;
  grid-template-columns: 34px minmax(96px, auto) 34px;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  text-align: center;
}

.calendar-month-nav button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.calendar-month-nav b {
  font-size: 13px;
  white-space: nowrap;
}

.reminder-error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border-color: #efb6b6;
  background: var(--red-weak);
}

.reminder-error span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.reminder-error button {
  flex: 0 0 auto;
  margin-left: auto;
}

.reminder-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.reminder-list {
  display: grid;
}

.reminder-item {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.reminder-item:first-child {
  border-top: 0;
}

.reminder-item.is-closed {
  opacity: .62;
}

.reminder-priority-marker {
  align-self: stretch;
  width: 4px;
  min-height: 42px;
  border-radius: 3px;
  background: var(--blue);
}

.reminder-priority-marker.danger { background: var(--red); }
.reminder-priority-marker.muted { background: #96a0ae; }

.reminder-item-main,
.reminder-item-title,
.reminder-item-meta {
  min-width: 0;
}

.reminder-item-title,
.reminder-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.reminder-item-title b {
  overflow-wrap: anywhere;
}

.reminder-item-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.reminder-item-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 6px;
  color: #a1abba;
}

.reminder-item p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.reminder-row-actions {
  justify-content: flex-end;
  max-width: 240px;
}

.calendar-weekdays,
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
}

.calendar-weekdays {
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.calendar-weekdays span {
  padding: 8px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.calendar-month-grid {
  padding: 8px;
}

.calendar-day {
  min-width: 0;
  min-height: 112px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.calendar-day:nth-child(7n + 1) {
  border-left: 1px solid var(--line);
}

.calendar-day:nth-child(-n + 7) {
  border-top: 1px solid var(--line);
}

.calendar-day.is-empty {
  background: var(--surface-soft);
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px var(--blue);
  background: var(--blue-weak);
}

.calendar-day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 5px;
}

.calendar-day-number b {
  font-size: 13px;
}

.calendar-day-number span,
.calendar-day-events small {
  color: var(--muted);
  font-size: 10px;
}

.calendar-day-events {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.calendar-event {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  overflow: hidden;
  border: 0;
  border-left: 3px solid var(--blue);
  border-radius: 3px;
  background: var(--blue-weak);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

button.calendar-event {
  cursor: pointer;
}

.calendar-event.priority-urgent,
.calendar-event.priority-high {
  border-left-color: var(--red);
  background: var(--red-weak);
}

.calendar-event.priority-low {
  border-left-color: #7c8796;
  background: #f0f2f5;
}

.calendar-event b,
.calendar-event span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event b {
  font-size: 11px;
}

.calendar-event span {
  color: var(--muted);
  font-size: 10px;
}

.calendar-mobile-list {
  display: none;
}

@media (max-width: 1180px) {
  .reminder-toolbar {
    flex-wrap: wrap;
  }

  .calendar-month-nav {
    margin-left: 0;
  }

  .calendar-day {
    min-height: 96px;
  }
}

@media (max-width: 760px) {
  .reminder-center .page-head,
  .reminder-center .page-head .actions,
  .reminder-toolbar,
  .reminder-error {
    align-items: stretch;
  }

  .reminder-center .page-head .actions,
  .reminder-toolbar,
  .reminder-error {
    flex-wrap: wrap;
  }

  .reminder-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reminder-toolbar > label {
    flex: 1 1 150px;
    justify-content: space-between;
  }

  .reminder-toolbar select {
    flex: 1 1 auto;
    max-width: none;
  }

  .calendar-month-grid {
    padding: 6px;
  }

  .calendar-day {
    min-height: 82px;
    padding: 5px;
  }

  .calendar-day-number span,
  .calendar-day-events small {
    display: none;
  }

  .reminder-item {
    grid-template-columns: 4px minmax(0, 1fr);
  }

  .reminder-row-actions {
    grid-column: 2;
    justify-content: flex-start;
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .reminder-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .reminder-view-tabs,
  .reminder-scope,
  .calendar-month-nav {
    width: 100%;
  }

  .reminder-view-tabs button,
  .reminder-scope button {
    flex: 1 1 0;
  }

  .calendar-month-nav {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .calendar-weekdays,
  .calendar-month-grid {
    display: none;
  }

  .calendar-mobile-list {
    display: grid;
  }

  .calendar-mobile-day {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
  }

  .calendar-mobile-day:first-child {
    border-top: 0;
  }

  .calendar-mobile-date {
    display: grid;
    align-content: start;
    gap: 3px;
  }

  .calendar-mobile-date b {
    font-size: 15px;
  }

  .calendar-mobile-date span {
    color: var(--muted);
    font-size: 11px;
  }

  .calendar-mobile-day > div:last-child {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .calendar-event {
    padding: 7px 8px;
  }

  .calendar-event b {
    font-size: 12px;
  }

  .reminder-error button {
    width: 100%;
    margin-left: 0;
  }
}

/* V3.2 group control board and procurement workspace. */
.control-procurement,
.control-board-panel,
.procurement-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.control-summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.control-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.control-toolbar > label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.control-toolbar input,
.control-toolbar select {
  min-width: 126px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.control-toolbar select {
  min-width: 112px;
  padding-right: 28px;
}

.control-view-tabs,
.control-scope {
  flex: 0 0 auto;
}

.control-error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border-color: #efb6b6;
  background: var(--red-weak);
}

.control-error span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.control-error button {
  flex: 0 0 auto;
  margin-left: auto;
}

.control-loading {
  min-height: 240px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.control-board-table {
  min-width: 1160px;
  table-layout: fixed;
}

.control-board-table th:nth-child(1) { width: 165px; }
.control-board-table th:nth-child(2) { width: 125px; }
.control-board-table th:nth-child(3) { width: 105px; }
.control-board-table th:nth-child(9) { width: 135px; }
.control-board-table th:nth-child(10) { width: 132px; }

.control-board-table td {
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.control-progress {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--blue-weak);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.control-progress.good {
  background: var(--green-weak);
  color: var(--green);
}

.control-progress.warn {
  background: var(--orange-weak);
  color: var(--orange);
}

.control-progress.danger {
  background: var(--red-weak);
  color: var(--red);
}

.control-progress.muted {
  background: #eef1f5;
  color: var(--muted);
}

.control-risk-note,
.procurement-spec {
  max-width: 190px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-board-mobile,
.procurement-mobile {
  display: none;
}

.procurement-table {
  min-width: 1080px;
}

.procurement-table td {
  vertical-align: middle;
}

.procurement-table .procurement-actions {
  min-width: 210px;
}

.procurement-actions {
  flex-wrap: wrap;
}

.procurement-form input,
.procurement-form select,
.procurement-form textarea,
.procurement-quote-form input,
.procurement-quote-form select,
.procurement-quote-form textarea {
  min-width: 0;
  max-width: 100%;
}

.procurement-detail {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.procurement-detail-head,
.procurement-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.procurement-detail-head > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.procurement-detail-head span {
  color: var(--muted);
  font-size: 12px;
}

.procurement-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.procurement-detail-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
}

.procurement-detail-grid span {
  color: var(--muted);
  font-size: 11px;
}

.procurement-detail-grid b,
.procurement-requirement p {
  overflow-wrap: anywhere;
}

.procurement-requirement {
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: var(--surface-soft);
}

.procurement-requirement p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.procurement-section-head {
  align-items: center;
  margin-bottom: 8px;
}

.procurement-section-head h3 {
  margin: 0;
  font-size: 14px;
}

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

.procurement-quote {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.procurement-quote.is-awarded {
  border-color: #70b69d;
  background: var(--green-weak);
}

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

.procurement-quote span {
  color: var(--muted);
  font-size: 11px;
}

.procurement-quote strong {
  color: var(--ink);
  white-space: nowrap;
}

.procurement-quote p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.procurement-quote > button {
  grid-column: 1 / -1;
  justify-self: end;
}

@media (max-width: 1180px) {
  .control-toolbar > label {
    flex: 1 1 170px;
    justify-content: space-between;
  }

  .control-toolbar input,
  .control-toolbar select {
    flex: 1 1 auto;
  }
}

@media (max-width: 760px) {
  .control-procurement .page-head,
  .control-procurement .page-head .actions,
  .control-error {
    align-items: stretch;
  }

  .control-procurement .page-head .actions,
  .control-error {
    flex-wrap: wrap;
  }

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

  .control-view-tabs,
  .control-scope {
    flex: 1 1 auto;
  }

  .control-view-tabs button,
  .control-scope button {
    flex: 1 1 0;
  }

  .procurement-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .control-summary-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .control-view-tabs,
  .control-scope {
    width: 100%;
  }

  .control-toolbar > label {
    flex: 1 1 100%;
  }

  .control-toolbar input,
  .control-toolbar select {
    min-width: 0;
    max-width: 70%;
  }

  .control-error button {
    width: 100%;
    margin-left: 0;
  }

  .control-board-desktop,
  .procurement-desktop {
    display: none;
  }

  .control-board-mobile,
  .procurement-mobile {
    display: grid;
  }

  .control-card,
  .procurement-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border-top: 1px solid var(--line);
  }

  .control-card:first-child,
  .procurement-card:first-child {
    border-top: 0;
  }

  .control-card-head,
  .procurement-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
  }

  .control-card-head > div,
  .procurement-card-head > div,
  .control-card-customer {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .control-card-head span,
  .procurement-card-head span,
  .control-card-customer span {
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .control-mobile-metrics,
  .procurement-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .control-mobile-metrics > div,
  .procurement-card-grid > div {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-soft);
  }

  .control-mobile-metrics span:first-child,
  .procurement-card-grid span {
    color: var(--muted);
    font-size: 10px;
  }

  .control-card p,
  .procurement-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .control-card .row-actions,
  .procurement-card .row-actions {
    justify-content: flex-start;
  }

  .procurement-detail-head,
  .procurement-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .procurement-quote {
    grid-template-columns: minmax(0, 1fr);
  }

  .procurement-quote strong,
  .procurement-quote p,
  .procurement-quote > button {
    grid-column: auto;
  }

  .procurement-quote > button {
    width: 100%;
    justify-self: stretch;
  }
}

