/* ЭПЛ: тёмный только сайдбар; основная область — светлая */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* Светлый контент */
  --bg-app: #f7f8fa;
  --bg-panel: #ffffff;
  --bg-panel-solid: #ffffff;
  --bg-raised: #f1f3f6;
  --bg-sidebar: #181818;
  --bg-hover: rgba(103, 136, 255, 0.08);
  --bg-active: rgba(103, 136, 255, 0.12);
  --border: rgba(27, 31, 59, 0.12);
  --border-subtle: rgba(27, 31, 59, 0.06);
  --text: #1b1f3b;
  --text-muted: rgba(27, 31, 59, 0.65);
  --text-dim: rgba(27, 31, 59, 0.4);
  --accent: #6788ff;
  --accent-dim: rgba(103, 136, 255, 0.22);
  --primary: #6788ff;
  --primary-dark: #526ed3;
  --primary-light: rgba(103, 136, 255, 0.16);
  --primary-glow: rgba(103, 136, 255, 0.09);
  --accent-line: #6788ff;
  --sidebar-w: 260px;
  --gray-50: #f7f8fa;
  --gray-100: #eef0f4;
  --gray-200: #e2e5eb;
  --gray-300: #cfd4dc;
  --gray-400: rgba(0, 0, 0, 0.45);
  --gray-500: rgba(0, 0, 0, 0.5);
  --gray-600: rgba(0, 0, 0, 0.65);
  --gray-700: rgba(0, 0, 0, 0.75);
  --gray-800: rgba(0, 0, 0, 0.88);
  --success: #44c596;
  --warning: #b8860b;
  --danger: #dd4c1e;
  --radius: 12px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(27, 31, 59, 0.04);
  --shadow-md: 0 12px 32px rgba(27, 31, 59, 0.12);
  --shadow-card: 0 2px 10px rgba(27, 31, 59, 0.08);
  --bg-input: #ffffff;
  --bg-surface-muted: rgba(27, 31, 59, 0.04);
  --bg-surface-strong: rgba(27, 31, 59, 0.06);
  --bg-table-head: rgba(27, 31, 59, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  background: var(--bg-app);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary-dark); }

h1, h2, h3,
.page-header h1,
.brand-link,
.sidebar-nav .nav-item,
.sidebar-nav .nav-sub-item,
.sidebar-below-main .nav-item,
.card-header h2,
.modal-header h3,
.btn,
th,
.badge,
.stat-tile__value,
.dash-section__title {
  font-family: var(--font-ui);
  letter-spacing: 0;
}

.page-header h1 { font-weight: 600; }
.nav-item { font-weight: 500; }
th { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

.app-layout { display: flex; min-height: 100vh; }
.app-layout.sidebar-collapsed { --sidebar-w: 72px; }

.app-layout.auth-only .sidebar {
  display: none;
  width: 0;
  border: none;
  overflow: hidden;
}

.app-layout.auth-only .main-content {
  flex: 1;
  max-width: 100%;
}

.app-layout.auth-only #login-view.auth-page {
  min-height: 100vh;
  width: 100%;
}

/* Sidebar — отдельная тёмная палитра (переменные только внутри панели) */
.sidebar {
  --border: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.55);
  --text-dim: rgba(255, 255, 255, 0.4);
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.1);
  --primary-light: rgba(107, 158, 255, 0.18);
  --accent: #6b9eff;
  --primary: #6b9eff;
  --primary-dark: #8fb4ff;
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  box-shadow: none;
  color: var(--text);
  transition: width 0.2s ease;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sidebar-brand {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.brand-link:hover { color: #ffffff; text-decoration: none; }

.brand-link i {
  font-size: 22px;
  color: var(--accent);
  filter: none;
}

.sidebar-collapse-btn {
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-collapse-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.sidebar-pin-btn {
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-pin-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.app-layout.sidebar-pinned .sidebar-pin-btn {
  color: var(--accent);
  border-color: rgba(107, 158, 255, 0.45);
  background: var(--primary-light);
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 12px;
}

.sidebar-below-main {
  flex-shrink: 0;
  padding: 6px 0 10px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 10px 0 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin: 1px 8px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--bg-active);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-item i { font-size: 18px; opacity: 0.9; flex-shrink: 0; }
.nav-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-group .nav-sub { display: none; padding: 2px 0 6px; }
.nav-group.open .nav-sub { display: block; }

.nav-sub-item {
  display: block;
  padding: 6px 14px 6px 40px;
  margin: 1px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.12s, background 0.12s;
}

.nav-sub-item:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

.nav-sub-item.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--primary-light);
}

.sidebar a:hover {
  color: var(--primary-dark);
}

.nav-chevron { margin-left: auto; transition: transform 0.15s ease; opacity: 0.5; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }

.app-layout.sidebar-collapsed .brand-link span,
.app-layout.sidebar-collapsed .nav-label,
.app-layout.sidebar-collapsed .nav-chevron,
.app-layout.sidebar-collapsed .nav-sub {
  display: none !important;
}

.app-layout.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 10px 8px;
}

.app-layout.sidebar-collapsed .brand-link {
  flex: 0 0 auto;
  justify-content: center;
}

.app-layout.sidebar-collapsed .nav-item {
  justify-content: center;
  width: calc(100% - 10px);
  margin: 2px 5px;
  padding: 9px 0;
  gap: 0;
}

.app-layout.sidebar-collapsed .sidebar-collapse-btn {
  width: 26px;
  height: 26px;
}

.app-layout.sidebar-collapsed .sidebar-pin-btn {
  width: 26px;
  height: 26px;
}

/* Main */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-panel-solid);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.page-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.page-header-left { display: flex; align-items: center; gap: 12px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.page-content {
  padding: 16px 20px 32px;
  max-width: 1280px;
  width: 100%;
}

/* Cards */
.card {
  background: var(--bg-panel-solid);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-surface-muted);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-header h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.card-body { padding: 14px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: none; opacity: 0.9; }

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text);
  background: var(--bg-hover);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--gray-200); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-danger { background: rgba(221, 76, 30, 0.12); color: #b93b18; border-color: rgba(221, 76, 30, 0.35); }
.btn-danger:hover { background: rgba(221, 76, 30, 0.18); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 16px; font-size: 13px; }

/* Forms */
.form-control {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.12s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.form-control::placeholder { color: var(--text-dim); }

.form-group { margin-bottom: 12px; }

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 700px) {
  .form-row { grid-template-columns: 1fr; }
  .ui-list-row { padding: 14px 12px; }
  .ui-list-row__top { flex-direction: column; align-items: flex-start; }
  .ui-list-row__actions { justify-content: flex-start; }
  .modal { max-width: 100%; }
  .modal-body { padding: 12px; }
  .modal-footer { padding: 10px 12px; }
}

.form-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.req { color: var(--danger); }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 1;
}
.search-input { padding-left: 32px !important; }

select.form-control {
  cursor: pointer;
  appearance: auto;
  background-color: var(--bg-input);
  color: var(--text);
}

textarea.form-control { resize: vertical; min-height: 64px; }

.addr-suggest-wrap { position: relative; }
.addr-suggest-dd {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 600;
  font-size: 13px;
}
.addr-suggest-dd.is-open { display: block; }
.addr-suggest-item {
  padding: 8px 12px;
  cursor: pointer;
  line-height: 1.35;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}
.addr-suggest-item:last-child { border-bottom: none; }
.addr-suggest-item:hover { background: var(--bg-hover); }
.addr-suggest-item small { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  background: var(--bg-table-head);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text);
}

tbody tr { transition: background 0.1s; }

tbody tr:hover { background: var(--bg-hover); }

tbody tr:last-child td { border-bottom: none; }

.td-main { font-weight: 600; color: var(--text); }
.td-muted { font-size: 11px; color: var(--text-muted); }

.action-btns { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
}

.badge-draft { background: var(--bg-surface-strong); color: var(--text-muted); }
.badge-active { background: rgba(68, 197, 150, 0.15); color: var(--success); }
.badge-inactive { background: rgba(221, 76, 30, 0.12); color: #b93b18; }
.badge-completed { background: var(--primary-light); color: var(--accent); }
.badge-cancelled { background: rgba(221, 76, 30, 0.12); color: #b93b18; }

/* States */
.loading-state,
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-icon { font-size: 40px; color: var(--text-dim); margin-bottom: 8px; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  animation: modalIn 0.15s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface-muted);
}

.modal-header h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); }

.modal-close {
  border: none;
  background: var(--bg-hover);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}

.modal-close:hover { background: var(--bg-active); color: var(--text); }

.modal-body { padding: 14px; overflow-y: auto; flex: 1; }

.modal-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-surface-muted);
}

/* Alerts */
.alert {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}

.alert-error { background: rgba(221, 76, 30, 0.08); color: #b93b18; border-color: rgba(221, 76, 30, 0.22); }
.alert-warning { background: rgba(184, 134, 11, 0.1); color: #7a5a00; border-color: rgba(184, 134, 11, 0.25); }
.alert-success { background: rgba(68, 197, 150, 0.12); color: var(--success); border-color: rgba(68, 197, 150, 0.25); }

/* Filters */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-panel-solid);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.filter-group label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.filter-control {
  min-width: 130px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text);
}

.filter-control:focus {
  outline: none;
  border-color: var(--accent);
}

/* Pagination */
.pagination-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.page-btn {
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  border-radius: var(--radius);
  cursor: pointer;
  margin: 0 2px;
  font-family: inherit;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.page-btn:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text);
  background: var(--bg-hover);
}

.page-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

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

.pagination-info { font-size: 12px; color: var(--text-muted); }

/* Auth — светлая страница как остальной контент */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-app);
  position: relative;
}

.auth-page::before { display: none; }

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--bg-panel-solid);
  padding: 24px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.auth-card--wide { max-width: 460px; }

.auth-card h1 {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.auth-card .text-muted { color: var(--text-muted); }

.auth-card .form-group label { color: var(--text-muted); }

.auth-card a { color: var(--accent); }

/* Waybill form sections */
.form-section {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.form-section:last-child { border-bottom: none; }

.form-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Shared UI blocks (bank-like) */
.ui-block-title {
  font-size: 15px;
  margin: 24px 0 8px;
  font-weight: 600;
  color: var(--text);
}

.ui-section {
  margin-bottom: 16px;
}

.ui-section:last-child { margin-bottom: 0; }

.ui-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Consistent list rows (cards/journal items) */
.ui-list-row {
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
}

.ui-list-row:last-child { border-bottom: none; }

.ui-list-row__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ui-list-row__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ui-list-row__title {
  font-weight: 700;
  color: var(--text);
}

.ui-list-row__meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.ui-list-row__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.ui-list-row__actions .btn { white-space: nowrap; }

.ui-list-row__actions--nowrap {
  flex-wrap: nowrap;
  justify-content: flex-end;
}


/** Кнопки «Изменить / Удалить» в таблицах (медтерминалы, точки медосмотра): без сжатия колонки и переноса. */
.ui-table-actions-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  text-align: right;
}
.ui-table-actions-inner {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.ui-table-actions-inner .btn { white-space: nowrap; }

/* Settings — invite widgets (moved to shared stylesheet) */
.settings-invite-row { display: flex; align-items: stretch; gap: 8px; max-width: 100%; }
.settings-invite-row .form-control {
  flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-weight: 600; letter-spacing: 0.04em;
}

.settings-invite-copy {
  flex-shrink: 0; width: 42px; min-height: 40px; padding: 0; border: 1px solid var(--gray-200);
  border-radius: 8px; background: #fff; color: var(--gray-700); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
}

.settings-invite-copy:hover { border-color: var(--primary); color: var(--primary); }

/* Титулы T1–T6 */
.wb-title-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 220px;
}

.wb-title-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius);
  line-height: 1;
  border: 1px solid transparent;
  cursor: default;
  font-variant-numeric: tabular-nums;
}

.wb-title-pill--signed {
  background: rgba(107, 207, 127, 0.2);
  color: var(--success);
  border-color: rgba(107, 207, 127, 0.35);
}

.wb-title-pill--rejected {
  background: rgba(217, 48, 48, 0.12);
  color: #b71c1c;
  border-color: rgba(217, 48, 48, 0.35);
}

.wb-title-pill--na {
  background: var(--bg-surface-strong);
  color: var(--text-dim);
  border-color: var(--border);
}

.wb-title-pill--pending {
  background: rgba(229, 192, 123, 0.12);
  color: var(--warning);
  border-color: rgba(229, 192, 123, 0.25);
}

/* T1: ЭПЛ создан по запросу из приложения водителя (список ЭПЛ) */
.wb-title-pill.wb-title-pill--driver-app-req {
  outline: 1px solid var(--primary);
  outline-offset: 0;
}

.wb-title-pill.wb-title-pill--driver-app-req-missing {
  outline: 1px solid var(--danger);
  outline-offset: 0;
}

/* Маркер QR ГИС ЭПД между T4 и T5 */
.wb-title-qr-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius);
  border: 1px dashed transparent;
  color: var(--warning);
  background: rgba(229, 192, 123, 0.12);
  font-size: 12px;
  line-height: 1;
}
.title-progress .wb-title-qr-marker {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-lg);
  align-self: center;
}
.wb-title-qr-marker--pending {
  color: var(--warning);
  background: rgba(229, 192, 123, 0.12);
  border-color: rgba(229, 192, 123, 0.25);
}
.wb-title-qr-marker--signed {
  color: var(--success);
  background: rgba(107, 207, 127, 0.2);
  border-color: rgba(107, 207, 127, 0.35);
}

/* Dashboard */
a.card[href] {
  transition: border-color 0.15s, background 0.15s;
}

a.card[href]:hover {
  transform: none;
  border-color: rgba(47, 111, 237, 0.35);
  background: rgba(47, 111, 237, 0.06);
  text-decoration: none;
}

a.card[href] h3 { color: var(--text); font-size: 14px; font-weight: 600; }

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Аналитика главной */
.dash-analytics { margin-bottom: 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.stat-tile {
  padding: 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-panel-solid);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-card);
}

.stat-tile:hover { border-color: rgba(0, 0, 0, 0.12); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); }

.stat-tile__value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
}

.stat-tile__value--primary { color: var(--accent); }
.stat-tile__value--success { color: var(--success); }
.stat-tile__value--muted { color: var(--text-muted); font-size: 1.4rem; }

.stat-tile__label {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-ui);
}

.dash-section__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.recent-wrap { margin-top: 6px; }

.recent-wrap .table-wrapper {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.recent-wrap table { font-size: 12px; }
.recent-wrap th { font-size: 10px; }

.dash-quick h3 { font-weight: 600; font-size: 14px; }

/* Modal-specific helpers */
.ui-modal-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; line-height: 1.45; }
.ui-custom-field { margin-top: 8px; }
