:root {
  color-scheme: light;
  --ink: #20242a;
  --muted: #69717d;
  --line: #d6d9de;
  --soft: #f1f2f4;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --input: #ffffff;
  --table-head: #eef0f3;
  --hover: #fff4ea;
  --accent: #f97316;
  --accent-strong: #ea580c;
  --accent-soft: #fff1e6;
  --accent-2: #555b64;
  --warn: #d97706;
  --danger: #dc2626;
  --sidebar: #2f3338;
  --sidebar-active: #454b54;
  --shadow: 0 10px 24px rgba(25, 29, 35, 0.08);
  --radius: 8px;
  --app-max-width: 1504px;
  --content-max-width: 1040px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3f4f6;
  --muted: #a7adb7;
  --line: #3c424b;
  --soft: #17191d;
  --panel: #22262c;
  --panel-2: #2a2f37;
  --input: #1c2026;
  --table-head: #2f3540;
  --hover: #35291f;
  --accent: #fb923c;
  --accent-strong: #f97316;
  --accent-soft: #3a2a1f;
  --accent-2: #9ca3af;
  --warn: #f59e0b;
  --danger: #f87171;
  --sidebar: #111315;
  --sidebar-active: #31363d;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

button.secondary,
.button.secondary,
button.ghost {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

button.secondary:hover,
.button.secondary:hover,
button.ghost:hover {
  background: var(--panel-2);
  border-color: var(--accent);
  color: var(--ink);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

button.danger-outline {
  background: transparent;
  color: var(--danger);
}

button.danger-outline:hover {
  background: var(--danger);
  color: white;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--ink);
  padding: 6px 9px;
}

textarea {
  min-height: 58px;
  resize: vertical;
}

h1,
h2 {
  margin: 0 0 12px;
  line-height: 1.2;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 16px;
}

.hidden {
  display: none !important;
}

.access-denied {
  display: none !important;
}

.access-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(85, 91, 100, 0.12)),
    var(--soft);
}

.login-panel {
  width: min(360px, 100%);
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.password-field {
  position: relative;
  display: block;
  min-width: 0;
}

.password-field > input {
  width: 100%;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: var(--panel-2);
  color: var(--ink);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-panel .login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
}

.login-remember input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width, 232px) minmax(0, 1fr) 320px;
  transition: grid-template-columns 0.18s ease;
}

.app-shell.notes-collapsed {
  grid-template-columns: var(--sidebar-width, 232px) minmax(0, 1fr) 38px;
}

.app-shell.nav-collapsed {
  --sidebar-width: 70px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 10px;
  background: var(--sidebar);
  color: white;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  margin-bottom: 6px;
}

.sidebar-toggle {
  flex: 0 0 36px;
  width: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 0;
  border-color: transparent;
  background: color-mix(in srgb, white 7%, transparent);
}

.sidebar-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  margin: 2px 0;
  border-radius: 999px;
  background: #e5e7eb;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 800;
  font-size: 20px;
  white-space: nowrap;
}

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

.nav-button {
  position: relative;
  min-height: 44px;
  gap: 9px;
  justify-content: flex-start;
  padding: 0 9px;
  border-color: transparent;
  background: transparent;
  color: #cbd5e1;
  overflow: hidden;
}

.nav-button:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: white;
}

.nav-button.active {
  background: var(--sidebar-active);
  color: white;
}

.nav-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, white 9%, transparent);
  color: white;
  font-weight: 800;
}

.nav-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-collapsed .sidebar {
  padding-inline: 8px;
}

.nav-collapsed .sidebar-head {
  justify-content: center;
}

.nav-collapsed .brand,
.nav-collapsed .nav-label {
  display: none;
}

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

.nav-collapsed .nav-icon {
  flex-basis: 40px;
  width: 40px;
  height: 40px;
}

.nav-collapsed .notify-badge {
  top: 0;
  right: 2px;
}

.workspace {
  min-width: 0;
  width: 100%;
  justify-self: stretch;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  width: min(calc(100% - 32px), var(--content-max-width));
  margin: 0 auto;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(10px);
}

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

.connection-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  background: #fffbeb;
  color: #92400e;
  font-size: 11px;
  font-weight: 800;
}

body[data-theme="dark"] .connection-badge {
  background: #422006;
  color: #fde68a;
}

.connection-badge.is-offline::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #f97316;
}

.theme-toggle {
  min-width: 68px;
}

.notes-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.notes-panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.notes-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.notes-head h2 {
  margin-bottom: 2px;
}

.notes-tab {
  display: none;
}

.notes-collapsed .notes-panel {
  display: none;
}

.notes-collapsed .notes-tab {
  position: sticky;
  top: 68px;
  display: flex;
  width: 32px;
  min-height: 112px;
  margin: 10px 3px;
  padding: 9px 4px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0;
}

.note-form {
  display: grid;
  gap: 8px;
}

.note-form textarea {
  min-height: 82px;
}

.note-form-bottom,
.note-actions,
.note-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-form-bottom {
  justify-content: space-between;
}

.note-form-bottom select,
.note-meta select {
  width: auto;
  min-width: 104px;
}

.notes-list {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.note-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--note-color) 58%, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--note-color) 92%, white), color-mix(in srgb, var(--note-color) 76%, white));
  color: #20242a;
  box-shadow: 0 8px 16px rgba(25, 29, 35, 0.08);
}

.note-card textarea {
  min-height: 90px;
  border-color: rgba(32, 36, 42, 0.12);
  background: rgba(255, 255, 255, 0.32);
  color: #20242a;
}

.note-meta {
  justify-content: space-between;
  color: rgba(32, 36, 42, 0.64);
  font-size: 12px;
}

.note-actions {
  justify-content: flex-end;
}

.empty-notes {
  padding: 8px;
}

.panel {
  display: none;
  width: min(calc(100% - 32px), var(--content-max-width));
  margin: 0 auto;
  padding: 12px;
}

.panel.active {
  display: grid;
  gap: 10px;
}

.surface {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.collapsible-surface {
  display: block;
}

.collapsible-surface > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.collapsible-surface > summary::-webkit-details-marker {
  display: none;
}

.collapsible-surface > summary::before {
  content: "▸";
  color: var(--accent);
}

.collapsible-surface[open] > summary::before {
  content: "▾";
}

.collapsible-body {
  margin-top: 10px;
}

.counter-badge {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.client-area {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-area {
  border-left-color: var(--accent);
}

.add-area {
  border-left-color: #6b7280;
}

.list-area {
  border-left-color: var(--warn);
}

.area-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 10px;
}

.stacked-panel {
  display: grid;
  gap: 10px;
}

.grid.two {
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
}

.toolbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.search-row input {
  min-height: 38px;
  font-size: 15px;
}

.compact-search input {
  min-height: 32px;
  font-size: 14px;
}

.search-result {
  min-height: 22px;
}

.client-card-host {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.client-add-launch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client-add-launch h2 {
  margin-bottom: 2px;
}

.client-create-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.client-create-modal.hidden {
  display: none;
}

.client-create-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(17, 24, 39, 0.62);
  cursor: default;
}

.client-create-dialog {
  position: relative;
  width: min(900px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.34);
}

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

.client-create-head h2 {
  margin-bottom: 2px;
}

body.client-create-open {
  overflow: hidden;
}

.client-card {
  display: grid;
  gap: 8px;
}

.client-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.client-card-copy {
  max-width: 100%;
  white-space: normal;
}

.clipboard-copy-buffer {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 1px;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.client-create-form,
.client-inline-edit-form {
  display: grid;
  gap: 8px;
}

.client-create-form [data-client-required-row] .field-label b {
  color: var(--danger);
}

.client-create-form [data-client-required-row].client-required-missing {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 16%, transparent);
}

.client-create-form [data-client-required-row].client-required-missing .field-label,
.client-create-form [data-client-required-row].client-required-missing input {
  color: var(--danger);
}

.client-create-error {
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 44%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 9%, var(--panel));
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.client-create-footer {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding-top: 4px;
}

.client-create-progress {
  display: grid;
  gap: 5px;
}

.client-create-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.client-create-progress-head strong {
  color: var(--ink);
}

.client-create-progress-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}

.client-create-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #dc2626;
  transition: width 180ms ease, background-color 180ms ease;
}

.client-create-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 14px;
}

.client-create-options .check {
  margin: 0;
  white-space: nowrap;
}

.client-create-options .remind-days {
  width: min(190px, 100%);
}

.client-create-phone,
.client-inline-phone {
  width: min(100%, 520px);
}

.client-create-columns,
.client-inline-edit-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  align-items: start;
  gap: 10px;
}

.client-create-column {
  display: grid;
  gap: 7px;
}

.client-create-form .field-row input,
.client-create-form .field-row select,
.client-inline-edit-form .field-row input,
.client-inline-edit-form .field-row select,
.client-inline-edit-form .field-row textarea {
  min-width: 0;
  padding: 4px 2px;
  border-color: transparent;
  background: transparent;
}

.client-create-form .field-row input:focus,
.client-create-form .field-row select:focus,
.client-inline-edit-form .field-row input:focus,
.client-inline-edit-form .field-row select:focus,
.client-inline-edit-form .field-row textarea:focus {
  outline: none;
}

.client-inline-edit-form {
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.inline-client-edit-head,
.inline-client-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inline-client-edit-head > div {
  display: grid;
  gap: 2px;
}

.inline-client-edit-head span {
  color: var(--muted);
  font-size: 12px;
}

.inline-client-edit-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.representative-messenger-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 14px;
}

.representative-messenger-options .check {
  margin: 0;
  white-space: nowrap;
}

.rep-import-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(210px, 1.2fr) auto auto auto;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.rep-import-copy {
  display: grid;
  gap: 2px;
}

.rep-import-result {
  grid-column: 1 / -1;
}

.rep-import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rep-import-summary span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.rep-import-samples {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.rep-import-sample {
  display: grid;
  grid-template-columns: 70px minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(160px, 1fr);
  gap: 8px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.representative-client-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
}

.reps-table {
  min-width: 0;
  table-layout: fixed;
}

.reps-table th,
.reps-table td {
  padding: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.reps-table .col-resizer {
  display: none;
}

.reps-table th:nth-child(1) { width: 13%; }
.reps-table th:nth-child(2) { width: 11%; }
.reps-table th:nth-child(3) { width: 15%; }
.reps-table th:nth-child(4) { width: 18%; }
.reps-table th:nth-child(5) { width: 17%; }
.reps-table th:nth-child(6) { width: 12%; }
.reps-table th:nth-child(7) { width: auto; }
.reps-table th:nth-child(8) { width: 40px; }

.representative-table-contact {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.representative-table-contact span {
  white-space: nowrap;
}

.representative-table-contact small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reps-comment-cell {
  max-width: 0;
  white-space: nowrap !important;
}

.reps-edit-cell {
  padding-inline: 3px !important;
  text-align: center;
}

.reps-edit-cell .square-icon-button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
}

.inline-client-actions {
  justify-content: flex-end;
}

.client-status-attention {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  padding: 7px 9px;
  border: 1px solid #f59e0b;
  border-left-width: 4px;
  border-radius: var(--radius);
  background: color-mix(in srgb, #fbbf24 16%, var(--panel));
  color: var(--ink);
  font-size: 12px;
}

.client-status-attention span {
  color: var(--muted);
}

.status-attention-marker {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 4px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}

.client-attention-row > td:first-child {
  box-shadow: inset 4px 0 #f59e0b;
}

.client-card-icon {
  color: #b24b3f;
}

.client-meta {
  margin-top: -6px;
  font-size: 12px;
}

.client-extra {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.client-extra summary {
  cursor: pointer;
  font-weight: 700;
}

.client-extra[open] summary {
  margin-bottom: 10px;
}

.labeled-grid {
  align-items: start;
}

.field-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 72%, var(--panel-2));
}

.field-row:focus-within {
  border-color: var(--accent);
  background: var(--panel);
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}

.client-card .field-row input,
.client-card .field-row select,
.client-card .field-row textarea {
  min-width: 0;
  border-color: transparent;
  background: transparent;
  padding: 4px 2px;
}

.client-card .field-row input:focus,
.client-card .field-row select:focus,
.client-card .field-row textarea:focus {
  outline: none;
}

.field-row-wide {
  margin-top: 8px;
  align-items: start;
}

.field-row-wide .field-label {
  padding-top: 7px;
}

.client-history {
  background: var(--panel);
}

.rep-card,
#repForm,
#tripForm {
  display: grid;
  gap: 8px;
}

.client-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.client-tab {
  position: relative;
  gap: 8px;
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.client-tab:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}

.client-tab.active {
  background: var(--sidebar);
  border-color: var(--sidebar);
  color: white;
}

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

.filters,
.actions,
.inline-form,
.form-actions,
.form-grid {
  display: grid;
  gap: 8px;
}

.filters {
  flex: 1;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.actions {
  grid-auto-flow: column;
}

.form-actions {
  justify-content: start;
}

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

.inline-form {
  grid-template-columns: repeat(6, minmax(105px, 1fr));
  align-items: end;
}

#tripItemForm {
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  align-items: end;
}

#tripItemForm > *,
#expenseForm > * {
  min-width: 0;
}

#tripItemForm button[type="submit"] {
  width: 100%;
  min-width: 0;
}

#expenseForm {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

#expenseForm button[type="submit"] {
  width: 100%;
  min-width: 0;
}

#tripDetail .section-head {
  min-width: 0;
}

#tripTitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-finance-summary {
  margin: 8px 0 10px;
}

.trip-finance-grid {
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(210px, 1fr);
  gap: 10px;
  align-items: start;
}

.trip-finance-table-wrap {
  overflow-x: auto;
}

.trip-finance-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  background: var(--panel);
}

.trip-finance-table th,
.trip-finance-table td {
  padding: 4px 7px;
  border: 1px solid var(--line);
}

.trip-finance-table th {
  background: var(--table-head);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.trip-finance-table td:nth-child(2),
.trip-finance-table td:nth-child(3) {
  text-align: right;
}

.finance-total-row,
.finance-net-row,
.finance-company-row {
  font-weight: 800;
}

.finance-share-control {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 6px;
}

.finance-share-control input,
.finance-share-control button {
  min-height: 28px;
}

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

.trip-finance-cards > div {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.trip-finance-cards span {
  color: var(--muted);
  font-size: 12px;
}

.trip-finance-cards b {
  font-size: 16px;
}

.trip-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
}

.trip-region-picker {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.region-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.region-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  cursor: pointer;
}

.region-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.region-choice input {
  width: 15px;
  min-height: 15px;
}

.trip-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.trip-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--status-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-bg) 22%, var(--panel));
  color: var(--ink);
  white-space: nowrap;
}

button.trip-status-chip {
  width: auto;
  min-height: 30px;
  padding: 4px 9px;
  border-color: var(--status-border, var(--line));
  background: color-mix(in srgb, var(--status-bg, var(--panel)) 22%, var(--panel));
  color: var(--ink);
}

.trip-status-chip.active {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-border, var(--accent)) 38%, transparent);
}

.trip-status-chip small {
  color: var(--muted);
}

.trip-status-swatch {
  width: 10px;
  height: 10px;
  border: 1px solid var(--status-border);
  border-radius: 999px;
  background: var(--status-bg);
}

.trip-status-control {
  display: grid;
  gap: 3px;
  min-width: 150px;
  padding: 4px;
  border: 1px solid var(--status-border);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--status-bg) 18%, var(--panel));
}

.trip-status-select {
  min-height: 28px;
  border-color: transparent;
  background: var(--status-bg);
  color: var(--status-text);
  font-weight: 700;
}

.trip-status-note {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}

.trip-service-cell {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(112px, 0.75fr) minmax(116px, 0.8fr) auto;
  gap: 6px;
  min-width: 470px;
  overflow: visible;
}

.trip-items-list {
  --trip-col-status: 105px;
  --trip-col-city: 62px;
  --trip-col-phone: 122px;
  --trip-col-name: 65px;
  --trip-col-auto: 86px;
  --trip-col-comment: 108px;
  --trip-col-price: 52px;
  --trip-col-ownshare: 60px;
  --trip-col-payment: 72px;
  --trip-route-columns: 28px minmax(var(--trip-col-status), 1.1fr) minmax(var(--trip-col-city), 0.7fr)
    minmax(var(--trip-col-phone), 1.2fr) minmax(var(--trip-col-name), 0.75fr) minmax(var(--trip-col-auto), 1fr)
    minmax(var(--trip-col-comment), 1.35fr) minmax(var(--trip-col-price), 0.62fr)
    minmax(var(--trip-col-ownshare), 0.72fr) minmax(var(--trip-col-payment), 0.82fr) 48px;
  display: grid;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.trip-client-picker {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.trip-client-results {
  display: grid;
  gap: 4px;
}

.trip-client-results:empty {
  display: none;
}

.trip-client-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.trip-client-result > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.trip-client-result > div:first-child span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trip-client-result-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trip-manual-add {
  margin-bottom: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.trip-manual-add summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.trip-manual-add[open] summary {
  margin-bottom: 8px;
}

.trip-empty {
  padding: 10px;
}

.trip-items-header,
.trip-item-card {
  display: grid;
  grid-template-columns: var(--trip-route-columns);
  gap: 5px;
  align-items: stretch;
  min-width: 860px;
}

.trip-items-header {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.trip-column-head {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding-right: 5px;
  overflow: hidden;
  white-space: nowrap;
}

.trip-col-resizer {
  position: absolute;
  top: 0;
  right: -2px;
  z-index: 2;
  width: 7px;
  height: 100%;
  cursor: col-resize;
}

.trip-col-resizer::after {
  content: "";
  position: absolute;
  top: 18%;
  right: 3px;
  width: 1px;
  height: 64%;
  background: var(--line-strong);
}

.trip-col-resizer:hover::after,
body.resizing-columns .trip-col-resizer::after {
  width: 2px;
  background: var(--accent);
}

.trip-item-card {
  overflow: hidden;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--trip-row-border) 74%, var(--line));
  border-left: 5px solid var(--trip-row-border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--trip-row-color) 58%, var(--panel));
  box-shadow: 0 3px 8px rgba(25, 29, 35, 0.06);
}

body[data-theme="dark"] .trip-item-card {
  background: color-mix(in srgb, var(--trip-row-color) 32%, var(--panel));
}

body[data-theme="light"] #tripsPanel td,
body[data-theme="light"] #tripsPanel .trip-item-card,
body[data-theme="light"] #tripsPanel .trip-item-card input,
body[data-theme="light"] #tripsPanel .trip-item-card select {
  color: #111827;
}

body[data-theme="light"] #tripsPanel th,
body[data-theme="light"] #tripsPanel .trip-item-card .muted,
body[data-theme="light"] #tripsPanel .trip-item-field > span,
body[data-theme="light"] #tripsPanel .trip-status-note {
  color: #1f2937;
}

body[data-theme="light"] #tripsPanel .trip-status-select {
  color: var(--status-text);
}

.trip-item-card:hover {
  border-color: var(--trip-row-border);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--trip-row-border) 22%, transparent);
}

.trip-item-card.dragging {
  opacity: 0.55;
  border-style: dashed;
}

.trip-drag-handle {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  cursor: grab;
  font-weight: 800;
  user-select: none;
}

.trip-new-badge {
  display: block;
  padding: 1px 2px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 7px;
  line-height: 1.1;
}

.trip-drag-handle:active {
  cursor: grabbing;
}

.trip-drag-handle.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.trip-item-field {
  display: grid;
  align-items: stretch;
  min-width: 0;
}

.trip-item-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.trip-item-field input,
.trip-item-field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  height: 30px;
  border-color: color-mix(in srgb, var(--trip-row-border) 34%, var(--line));
  background: color-mix(in srgb, #ffffff 72%, transparent);
  color: #111827;
}

body[data-theme="dark"] .trip-item-field input,
body[data-theme="dark"] .trip-item-field select {
  background: color-mix(in srgb, var(--panel) 78%, #ffffff);
  color: var(--ink);
}

.trip-phone-field input {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.trip-item-status-field .trip-status-control {
  width: 100%;
  min-width: 0;
  height: auto;
}

.trip-item-actions {
  display: grid;
  grid-template-columns: 18px 30px;
  align-items: center;
  justify-content: end;
  gap: 4px;
  min-width: 0;
}

.trip-item-actions button {
  min-width: 0;
  min-height: 26px;
  padding: 0 3px;
  font-size: 11px;
}

.trip-save-state {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #166534;
  font-size: 11px;
  font-weight: 900;
}

.trip-save-state--saving {
  color: #92400e;
}

.trip-save-state--queued {
  border-radius: 50%;
  background: #fef3c7;
  color: #92400e;
}

.trip-save-state--error {
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
}

.trip-item-delete {
  width: 30px;
  min-width: 30px;
}

.trip-item-preview {
  grid-column: 2 / -1;
  min-width: 0;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.trip-preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.user-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.list-row.user-row {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.user-row > button {
  justify-self: end;
}

.user-password-admin {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 6px;
  min-width: 0;
}

.user-password-admin > button {
  min-height: 36px;
  padding-inline: 9px;
  white-space: nowrap;
}

.permission-tree {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.permission-group {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.permission-parent {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}

.permission-children {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  padding-left: 22px;
}

.permission-child {
  margin: 0;
}

.permission-matrix-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.permission-matrix {
  min-width: 720px;
  border: 0;
  border-radius: 0;
}

.permission-matrix th,
.permission-matrix td {
  padding: 6px 8px;
  vertical-align: middle;
}

.permission-matrix th:not(:first-child),
.permission-matrix td:not(:first-child) {
  width: 116px;
  min-width: 116px;
  text-align: center;
}

.role-head-cell {
  display: grid;
  gap: 5px;
  justify-items: center;
}

.mini-button {
  min-height: 24px;
  padding: 0 7px;
  font-size: 12px;
}

.permission-action-label {
  display: grid;
  gap: 1px;
}

.permission-action-label strong {
  font-size: 13px;
}

.permission-action-label span {
  color: var(--muted);
  font-size: 12px;
}

.permission-section-row td {
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.permission-check-cell input {
  width: 18px;
  min-height: 18px;
}

.region-admin-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.region-admin-row {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.region-admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.region-city-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.region-city-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.city-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 4px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
}

.city-chip button {
  width: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.city-chip button:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.compact-hint {
  margin-top: 8px;
  font-size: 12px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 7px 12px 7px 0;
  color: var(--muted);
}

.check input {
  width: 16px;
  min-height: 16px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.clients-list-table {
  min-width: 790px;
}

.clients-list-table th,
.clients-list-table td {
  padding: 5px 6px;
}

.clients-list-table .client-created-short {
  width: 54px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.clients-list-table .client-status-control {
  grid-template-columns: 6px minmax(70px, 1fr);
  gap: 4px;
  width: min(100%, 138px);
  min-height: 25px;
  padding: 1px 5px;
}

.clients-list-table .client-status-dot {
  width: 6px;
  height: 6px;
}

.clients-list-table .client-status-control select {
  min-height: 21px;
  font-size: 11px;
}

.client-comment-cell {
  min-width: 112px;
  max-width: 210px;
}

.client-comment-cell span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  line-height: 1.2;
  font-size: 12px;
}

.client-edit-cell {
  width: 74px;
  text-align: center;
}

.client-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.square-icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.square-icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  table-layout: auto;
}

table.resizable-table {
  table-layout: auto;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: relative;
  color: var(--muted);
  font-weight: 700;
  background: var(--table-head);
  white-space: nowrap;
  user-select: none;
}

td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 1;
  width: 7px;
  height: 100%;
  cursor: col-resize;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  right: 3px;
  width: 1px;
  height: 60%;
  background: transparent;
}

.col-resizer:hover::after,
body.resizing-columns .col-resizer::after {
  background: var(--accent);
}

body.resizing-columns {
  cursor: col-resize;
  user-select: none;
}

.clickable-row,
.clickable-card {
  cursor: pointer;
}

.clickable-row:hover,
.selected-row {
  background: var(--hover);
}

.client-preview-row td {
  padding: 0;
  background: var(--panel-2);
}

.inline-client-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.inline-client-card--attention {
  box-shadow: inset 4px 0 #f59e0b;
}

.inline-client-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}

.inline-client-card__head strong {
  font-size: 15px;
}

.inline-client-card__head span {
  color: var(--muted);
}

.inline-client-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 7px;
}

.inline-client-field {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.inline-client-field span,
.inline-client-comment span {
  color: var(--muted);
  font-size: 12px;
}

.inline-client-field b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 650;
}

.inline-client-comment {
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.inline-client-comment p {
  margin: 0;
  white-space: pre-wrap;
}

.badge,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-status-control {
  display: inline-grid;
  grid-template-columns: 8px minmax(110px, 1fr);
  align-items: center;
  gap: 7px;
  width: min(100%, 190px);
  min-height: 28px;
  padding: 2px 7px;
  border: 1px solid var(--client-status-color, #64748b);
  border-radius: 999px;
  background: var(--client-status-color, #64748b);
}

.client-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--client-status-text, #ffffff);
  opacity: 0.9;
}

.client-status-control select {
  width: 100%;
  min-height: 22px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--client-status-text, #ffffff);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.client-status-control option {
  background: #ffffff;
  color: #111827;
}

.client-status-control select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.client-status-control select:disabled {
  cursor: progress;
  opacity: 0.7;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.trip-expense-list {
  display: grid;
  margin-top: 8px;
}

.trip-expense-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
}

.trip-expense-summary {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.trip-expense-summary:hover {
  background: var(--hover);
  color: var(--ink);
}

.trip-expense-summary > span {
  display: grid;
  gap: 1px;
}

.trip-expense-summary small {
  color: var(--muted);
  font-size: 12px;
}

.trip-expense-summary b {
  white-space: nowrap;
}

.trip-expense-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 8px 8px;
  border-top: 1px solid var(--line);
}

.trip-expense-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 24px;
  padding: 2px 3px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
}

.trip-expense-pill > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trip-expense-pill button {
  width: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.trip-expense-pill button:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.trip-expense-empty {
  padding: 2px 4px;
}

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

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  display: grid;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.import-form {
  grid-template-columns: minmax(180px, 1fr) minmax(150px, auto) minmax(150px, auto);
}

.import-result {
  display: grid;
  gap: 10px;
}

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.import-summary span {
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.import-sample-list {
  display: grid;
  gap: 6px;
}

.import-sample > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.danger-text {
  color: var(--danger);
  font-weight: 700;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.trip-list-row {
  padding: 0;
  overflow: hidden;
  color: var(--ink);
}

.trip-list-main {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: stretch;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  white-space: normal;
}

.trip-list-main:hover {
  border-color: transparent;
  background: var(--hover);
  color: var(--ink);
}

.trip-list-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
}

.trip-list-copy strong,
.trip-list-copy span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trip-list-copy strong {
  flex-shrink: 0;
}

.trip-list-copy span {
  color: var(--muted);
}

.trip-list-status {
  color: var(--ink);
  font-weight: 700;
}

.trip-list-actions {
  display: flex;
  gap: 4px;
  padding: 5px 6px 5px 0;
}

.trip-list-actions .square-icon-button {
  width: 30px;
  min-height: 30px;
}

.list-row > * {
  min-width: 0;
}

.list-row strong,
.list-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fresh-row {
  border-color: #38bdf8;
  background: color-mix(in srgb, #38bdf8 12%, var(--panel));
}

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

.notify-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: #dc2626;
  color: white;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.rep-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 5px 0;
}

.rep-stats span {
  display: inline-flex;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
}

.rep-stats-details {
  margin-top: 5px;
  color: var(--muted);
}

.rep-stats-details > summary {
  width: fit-content;
  cursor: pointer;
  font-size: 12px;
}

.rep-stats-muted {
  margin: 4px 0 0;
  opacity: 0.72;
}

.rep-stats-muted span {
  padding: 1px 4px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.rep-stats-muted b {
  color: inherit;
  font-weight: 600;
}

.rep-name-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.rep-assignment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.rep-assignment-badges--compact {
  display: inline-flex;
  margin-top: 0;
}

.rep-assignment-badge,
.rep-client-wait {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.rep-assignment-badge--new,
.rep-client-wait--new {
  border-color: #38bdf8;
  background: color-mix(in srgb, #38bdf8 16%, var(--panel));
  color: color-mix(in srgb, #0284c7 80%, var(--ink));
}

.rep-assignment-badge--overdue,
.rep-client-wait--overdue {
  border-color: #ef4444;
  background: color-mix(in srgb, #ef4444 14%, var(--panel));
  color: color-mix(in srgb, #dc2626 82%, var(--ink));
}

.rep-assignments {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin-top: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

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

.rep-assignments-head h3 {
  margin: 0;
  font-size: 14px;
}

.rep-assignments-head > span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.rep-assignments-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.rep-assignments-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

.rep-assignments-table th,
.rep-assignments-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.rep-assignments-table th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 11px;
}

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

.rep-assignments-table th:nth-child(1) { width: 150px; }
.rep-assignments-table th:nth-child(2) { width: 165px; }
.rep-assignments-table th:nth-child(3) { width: 155px; }
.rep-assignments-table th:nth-child(4) { width: 110px; }
.rep-assignments-table th:nth-child(5) { width: 185px; }
.rep-assignments-table th:nth-child(6) { width: 76px; }

.rep-assignments-table td:nth-child(2) strong,
.rep-assignments-table td:nth-child(2) small {
  display: block;
}

.rep-assignments-table td:nth-child(2) small {
  margin-top: 2px;
  color: var(--muted);
  white-space: nowrap;
}

.rep-client-row--new {
  background: color-mix(in srgb, #38bdf8 6%, var(--panel));
}

.rep-client-row--overdue {
  background: color-mix(in srgb, #ef4444 7%, var(--panel));
}

.rep-client-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.rep-client-open {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.top-reps {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.top-rep {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.top-index {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.inline-report-form {
  display: inline-grid;
  grid-template-columns: 120px auto auto;
  gap: 8px;
  align-items: center;
}

.promo-row {
  align-items: start;
}

.lead-row {
  align-items: start;
}

.lead-editor,
#leadForm {
  display: grid;
  gap: 8px;
}

.ats-overview,
.ats-edit-form,
.ats-import-form,
.ats-field > label,
.ats-edit-form > label,
.ats-import-form label {
  display: grid;
  gap: 10px;
}

.ats-overview .section-head,
.ats-edit-form .section-head {
  align-items: start;
}

.ats-intro {
  margin: 5px 0 0;
  max-width: 760px;
}

.ats-connection {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.ats-category-filters,
.ats-category-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ats-category-filters > button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.ats-category-filters > button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #171a1e;
}

.ats-category-help {
  margin: 0;
  font-size: 12px;
}

.ats-category-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--panel);
  font-size: 12px;
}

.ats-category-new_request { border-color: var(--accent); }
.ats-category-aftercare { border-color: #42b8a3; }
.ats-category-additional_vehicle { border-color: #a582e8; }
.ats-category-review { border-color: #caa14b; }
.ats-category-pending { color: var(--muted); }

.ats-classification {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.ats-classification > p { margin: 0; }
.ats-category-editor { max-width: 440px; }
.ats-category-evidence summary { cursor: pointer; }
.ats-category-evidence > div { margin-top: 10px; }
.ats-category-evidence blockquote {
  margin: 4px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ats-filters {
  display: grid;
  grid-template-columns: minmax(170px, 2fr) minmax(125px, 1fr) minmax(155px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.ats-filters label,
.ats-source-metadata label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ats-drafts-list,
.ats-edit-fields,
.ats-source-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ats-draft-card {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  min-width: 0;
  overflow-wrap: anywhere;
}

.ats-draft-card.ats-selected {
  border-color: var(--accent);
}

.ats-card-head,
.ats-card-footer,
.ats-recording {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ats-card-head strong {
  font-size: 15px;
}

.ats-statuses,
.ats-card-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ats-status,
.ats-card-fields > span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
  background: var(--panel);
}

.ats-status.ats-processing-ready,
.ats-status.ats-review-saved {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.ats-status.ats-processing-error {
  color: var(--danger);
  border-color: var(--danger);
}

.ats-status.ats-review-rejected {
  color: var(--muted);
}

.ats-card-phone {
  font-size: 16px;
  font-weight: 600;
}

.ats-card-warning {
  font-size: 12px;
  color: var(--warn);
}

.ats-empty {
  grid-column: 1 / -1;
  padding: 18px 0;
  margin: 0;
}

.ats-editor-host {
  scroll-margin-top: 20px;
}

.ats-edit-form {
  gap: 18px;
}

.ats-source-metadata,
.ats-recording,
.ats-summary,
.ats-existing-client {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.ats-source-details {
  display: grid;
  gap: 5px;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ats-source-metadata input[readonly] {
  background: var(--panel-2);
  color: var(--ink);
}

.ats-recording p,
.ats-summary p,
.ats-existing-client p {
  margin: 4px 0;
}

.ats-recording audio {
  width: 100%;
  max-width: 100%;
  flex: 1 0 100%;
}

.ats-field {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ats-field-evidence {
  margin-top: 10px;
  font-size: 12px;
}

.ats-evidence-missing > strong,
.ats-evidence-unclear > strong {
  color: var(--warn);
}

.ats-evidence-manual > strong {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--ink);
}

.ats-evidence-note,
.ats-evidence-source-label {
  display: block;
  margin-top: 6px;
}

.ats-evidence-source-label {
  font-weight: 600;
}

.ats-evidence-item {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.ats-evidence-item blockquote {
  margin: 0;
  padding: 5px 8px;
  border-left: 2px solid var(--accent);
  background: var(--panel-2);
  white-space: pre-wrap;
}

.ats-field-help {
  font-size: 12px;
  line-height: 1.4;
}

.ats-message {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow-wrap: anywhere;
}

.ats-message-warning {
  border-color: var(--warn);
}

.ats-message-error {
  border-color: var(--danger);
  color: var(--danger);
}

.ats-message ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.ats-transcript {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ats-transcript summary {
  cursor: pointer;
  font-weight: 600;
}

.ats-transcript-text {
  margin-top: 12px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.ats-convert-button {
  margin-left: auto;
}

@media (max-width: 900px) {
  .ats-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ats-filters button {
    align-self: end;
  }
}

@media (max-width: 620px) {
  .ats-drafts-list,
  .ats-edit-fields,
  .ats-source-metadata,
  .ats-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .ats-header-actions {
    grid-auto-flow: row;
    width: 100%;
  }
  .ats-editor-actions > button {
    flex: 1 1 160px;
    white-space: normal;
  }
  .ats-convert-button {
    margin-left: 0;
  }
  .ats-pager {
    flex-wrap: wrap;
  }
  .ats-pager > span {
    flex: 1 0 100%;
  }
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.lead-meta span {
  display: inline-flex;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
}

.knowledge-results {
  display: grid;
  gap: 8px;
}

.knowledge-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.knowledge-card.is-muted {
  opacity: 0.65;
}

.knowledge-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.knowledge-card p {
  margin: 0;
  white-space: pre-wrap;
}

.knowledge-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.catalog-result-head {
  color: var(--muted);
  font-weight: 800;
}

.catalog-card {
  border-left: 4px solid var(--accent);
}

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

.error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--sidebar);
  color: white;
  box-shadow: var(--shadow);
}

.password-result-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.56);
}

.password-result-modal.hidden {
  display: none;
}

.password-result-dialog {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.password-result-dialog h2 {
  margin: 0;
}

.password-result-field input {
  min-height: 44px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 17px;
  font-weight: 800;
}

.password-result-actions {
  justify-content: flex-end;
}

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

.daily-vcf-card {
  border-left: 4px solid var(--line);
}

.daily-vcf-card--ready {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 38%, var(--panel));
}

.daily-vcf-card--empty {
  border-left-color: var(--line);
}

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

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

  .workspace {
    width: 100%;
    padding-right: 64px;
  }

  .notes-rail {
    position: fixed;
    top: 0;
    right: 16px;
    z-index: 5;
    width: min(320px, calc(100vw - 58px));
    box-shadow: var(--shadow);
    transform: translateX(0);
    transition: transform 0.18s ease;
  }

  .notes-tab {
    position: absolute;
    left: -36px;
    top: 70px;
    display: flex;
    width: 34px;
    min-height: 112px;
    padding: 9px 4px;
    border-radius: var(--radius) 0 0 var(--radius);
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }

  .notes-collapsed .notes-rail {
    transform: translateX(100%);
    overflow: visible;
  }

  .notes-collapsed .notes-panel {
    display: grid;
  }

  .notes-collapsed .notes-tab {
    position: absolute;
    top: 70px;
    left: -36px;
    margin: 0;
  }
}

@media (max-width: 760px) {
  .reps-table {
    min-width: 720px;
    table-layout: auto;
  }

  .rep-assignments-table-wrap {
    overflow: visible;
    border: 0;
  }

  .rep-assignments-table,
  .rep-assignments-table tbody {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 7px;
  }

  .rep-assignments-table thead {
    display: none;
  }

  .rep-assignments-table tr {
    display: grid;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .rep-assignments-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 7px;
    padding: 2px 0;
    border: 0;
  }

  .rep-assignments-table td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
  }

  .rep-assignments-table td:last-child {
    display: block;
    padding-top: 4px;
  }

  .rep-client-open {
    width: 100%;
  }

  .app-shell,
  .app-shell.nav-collapsed,
  .app-shell.notes-collapsed,
  .app-shell.nav-collapsed.notes-collapsed {
    width: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    margin: 0;
    padding-bottom: 78px;
  }

  .workspace {
    padding-right: 0;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 6;
    height: 74px;
    padding: 8px 9px;
    border-top: 1px solid color-mix(in srgb, white 12%, transparent);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.24);
  }

  .sidebar-head {
    display: none;
  }

  .brand {
    height: 32px;
    font-size: 18px;
  }

  .topbar {
    height: 46px;
    padding: 0 12px;
  }

  .nav {
    height: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(54px, 1fr);
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    align-items: center;
  }

  .nav-button {
    display: grid;
    grid-template-rows: 40px 1fr;
    justify-content: center;
    justify-items: center;
    align-content: center;
    min-height: 58px;
    min-width: 0;
    padding: 4px 6px;
    gap: 2px;
    font-size: 11px;
    line-height: 1.1;
  }

  .nav-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .nav-icon svg {
    width: 23px;
    height: 23px;
  }

  .nav-label {
    display: block;
    max-width: 72px;
    white-space: nowrap;
  }

  .nav-button[title="Скидки и акции"] .nav-label,
  .nav-button[title="Администрирование"] .nav-label {
    max-width: 58px;
  }

  .notes-tab,
  .notes-collapsed .notes-tab {
    top: auto;
    bottom: 90px;
  }

  .notes-rail {
    right: 0;
    width: min(320px, calc(100vw - 42px));
  }

  .panel {
    padding: 10px 12px 12px;
  }

  .panel.active {
    gap: 10px;
  }

  .trip-finance-grid,
  .trip-finance-cards {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .filters,
  .search-row,
  .command-row,
  .inline-form,
  .inline-report-form,
  .user-edit-grid,
  .top-reps {
    grid-template-columns: 1fr;
  }

  .client-create-columns,
  .client-inline-edit-columns {
    grid-template-columns: 1fr;
  }

  .client-create-modal {
    place-items: stretch;
    padding: 8px;
  }

  .client-create-dialog {
    width: 100%;
    max-height: calc(100vh - 16px);
    padding: 12px;
  }

  .user-password-admin {
    grid-template-columns: 1fr;
  }

  .client-create-footer,
  .rep-import-form {
    grid-template-columns: 1fr;
  }

  .rep-import-result,
  .rep-import-sample {
    grid-column: auto;
  }

  .rep-import-sample {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .client-create-phone,
  .client-inline-phone {
    width: 100%;
  }

  .trip-items-list {
    display: grid;
    overflow: visible;
  }

  .trip-items-header {
    display: none;
  }

  .trip-item-card {
    grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr);
    min-width: 0;
    gap: 7px;
    padding: 8px;
  }

  .trip-drag-handle {
    grid-column: 1;
    grid-row: 1 / span 7;
  }

  .trip-item-field::before {
    content: attr(data-trip-column);
    display: block;
    margin: 0 2px 3px;
    color: color-mix(in srgb, var(--ink) 72%, var(--muted));
    font-size: 10px;
    font-weight: 800;
  }

  .trip-item-status-field {
    grid-column: 2 / -1;
    grid-row: 1;
  }

  .trip-item-card > .trip-item-field:nth-of-type(2) {
    grid-column: 2;
    grid-row: 2;
  }

  .trip-item-card > .trip-item-field:nth-of-type(3) {
    grid-column: 3;
    grid-row: 2;
  }

  .trip-item-card > .trip-item-field:nth-of-type(4) {
    grid-column: 2;
    grid-row: 3;
  }

  .trip-item-card > .trip-item-field:nth-of-type(5) {
    grid-column: 3;
    grid-row: 3;
  }

  .trip-item-card > .trip-item-field:nth-of-type(6) {
    grid-column: 2 / -1;
    grid-row: 4;
  }

  .trip-item-card > .trip-item-field:nth-of-type(7) {
    grid-column: 2;
    grid-row: 5;
  }

  .trip-item-card > .trip-item-field:nth-of-type(8) {
    grid-column: 3;
    grid-row: 5;
  }

  .trip-item-card > .trip-item-field:nth-of-type(9) {
    grid-column: 2 / -1;
    grid-row: 6;
  }

  .trip-item-actions {
    grid-column: 2 / -1;
    grid-row: 7;
    justify-content: end;
  }

  .trip-item-preview {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding: 7px 8px;
  }

  .brand {
    height: 26px;
    font-size: 17px;
  }

  .nav-button {
    grid-template-rows: 1fr;
    min-height: 56px;
  }

  .nav-label {
    display: none;
  }

  .topbar {
    position: static;
    height: auto;
    min-height: 40px;
    padding: 7px 10px;
  }

  .panel {
    padding: 8px 10px 12px;
  }

  .toolbar,
  .section-head,
  .area-head {
    align-items: stretch;
    flex-direction: column;
  }

  .client-add-launch {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .trip-list-copy {
    display: grid;
    gap: 1px;
  }

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

  .trip-client-result-actions {
    justify-content: space-between;
  }

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

  .inline-client-actions > button {
    flex: 1 1 100%;
  }

  .region-city-form {
    grid-template-columns: 1fr;
  }

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

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .nav-button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
  }
}
