* { box-sizing: border-box; }
body {
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(circle at 15% 10%, rgba(255,255,255,0.55), transparent 45%),
              linear-gradient(180deg, #e5e7eb 0%, #64748b 100%);
  background-attachment: fixed;
  margin: 0; padding: 20px; color: #1f2937;
  min-height: 100vh;
}
h1 { margin: 0 0 20px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 17px; color: #374151; }

.container { max-width: 1250px; margin: 0 auto; }

.card {
  background: #fff; border-radius: 10px; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 18px;
}

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.field {
  flex: 1 1 200px;
  min-width: 0;
  display: flex; flex-direction: column;
}
.field label { font-size: 12px; color: #6b7280; margin-bottom: 4px; }

.field-date { flex: 0 0 140px; max-width: 140px; }
.field-date .depDate {
  width: 100%;
  min-width: 0;
  max-width: 140px;
  box-sizing: border-box;
}

.field-pax select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%236b7280' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 26px;
  cursor: pointer;
}

.row-ac {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.field-ac { display: flex; flex-direction: column; }
.field-ac label { font-size: 12px; color: #6b7280; margin-bottom: 4px; }

.field-ac input,
.field-ac select {
  width: 14ch;
  min-width: 14ch;
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  line-height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  vertical-align: middle;
}
.field-ac input:focus,
.field-ac select:focus { border-color: #2563eb; }
.field-ac input[readonly] { background: #f3f4f6; }

.field-ac select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%236b7280' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 26px;
  cursor: pointer;
}

input, select {
  padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; width: 100%; outline: none;
}
input:focus, select:focus { border-color: #2563eb; }
input[readonly] { background: #f3f4f6; }

.airport-input-wrap { position: relative; }

.airport-search {
  text-transform: none;
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 18px 13px;
  transition: padding-left .15s;
}
.airport-search.has-flag { padding-left: 34px; }
.airport-search.eet-error {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.airport-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  display: none;
}
.airport-dropdown.open { display: block; }

.airport-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}
.airport-item:last-child { border-bottom: none; }
.airport-item:hover,
.airport-item.active { background: #eff6ff; }

.airport-item-icao {
  flex: 0 0 auto;
  display: inline-block;
  min-width: 52px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-weight: 700;
  color: #2563eb;
  font-size: 12px;
}
.airport-item-desc { flex: 1 1 auto; color: #374151; }
.airport-item-empty {
  padding: 10px 12px;
  color: #9ca3af;
  font-size: 12px;
  font-style: italic;
}

.depDate.date-error { border-color: #ef4444; background: #fef2f2; }

.info { font-size: 13px; color: #2563eb; margin-top: 4px; min-height: 18px; }
.info.eet-warning { color: #b91c1c; font-weight: 600; }

.special-note {
  margin-top: 6px;
  padding: 8px 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  font-size: 12px;
  color: #78350f;
  line-height: 1.35;
}
.special-note b { color: #92400e; }
.special-note .special-note-head {
  display: block;
  font-weight: 700;
  margin-bottom: 3px;
  color: #b45309;
}

.fuel-check-warning {
  margin-top: 6px;
  padding: 8px 12px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: 6px;
  font-size: 12px;
  color: #7f1d1d;
  line-height: 1.35;
}
.fuel-check-warning .fuel-check-head {
  display: block;
  font-weight: 700;
  margin-bottom: 3px;
  color: #b91c1c;
}
.fuel-check-warning .fuel-check-sub {
  display: block;
  font-size: 11px;
  color: #991b1b;
}

.fees-check-warning {
  margin-top: 6px;
  padding: 8px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f97316;
  border-radius: 6px;
  font-size: 12px;
  color: #7c2d12;
  line-height: 1.35;
}
.fees-check-warning .fees-check-head {
  display: block;
  font-weight: 700;
  margin-bottom: 3px;
  color: #c2410c;
}
.fees-check-warning .fees-check-sub {
  display: block;
  font-size: 11px;
  color: #9a3412;
}

button { padding: 10px 18px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #e5e7eb; color: #111827; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger    { background: #fee2e2; color: #b91c1c; padding: 6px 12px; font-size: 12px; }

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #4b5563;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-copy:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #1f2937;
}
.btn-copy:active { background: #e5e7eb; }
.btn-copy .btn-copy-icon { flex: 0 0 auto; display: block; }
.btn-copy.btn-copy-success {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.leg {
  border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 14px; margin-bottom: 12px; background: #fafafa;
}
.leg-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.leg-header b { color: #111827; }

.result-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 10px; table-layout: fixed; }
.result-table th, .result-table td {
  padding: 6px 5px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left; vertical-align: top;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.result-table th { background: #f9fafb; font-weight: 600; color: #4b5563; font-size: 10px; }
.result-table td.num, .result-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.result-table td.date-cell { white-space: nowrap; font-size: 10.5px; letter-spacing: -0.2px; }

.result-table tr.row-detail td {
  padding-top: 0;
  padding-bottom: 8px;
  color: #9ca3af;
  font-size: 9px;
  line-height: 1.3;
  vertical-align: top;
}

.grand-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding: 14px 18px; background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px; font-size: 16px;
}
.grand-total b { font-size: 19px; color: #1d4ed8; }

.hour-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding: 12px 18px; background: #fef3c7;
  border: 1px solid #fcd34d; border-radius: 8px; font-size: 15px;
}
.hour-total b { font-size: 18px; color: #b45309; }

.badge-dom    { background: #dcfce7; color: #166534; padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 600; white-space: nowrap; }
.badge-intl   { background: #fee2e2; color: #b91c1c; padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 600; white-space: nowrap; }
.badge-no-eet { background: #fef3c7; color: #92400e; padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 600; white-space: nowrap; }

.sale-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}
.sale-field { display: flex; flex-direction: column; }
.sale-field label { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.sale-field select {
  width: 14ch;
  min-width: 14ch;
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  line-height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%236b7280' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 26px;
  cursor: pointer;
}
.sale-result {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 14px 18px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 14px;
}
.sale-result .sale-label { color: #166534; }
.sale-result .sale-value { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.sale-result .sale-total {
  grid-column: 1 / -1;
  border-top: 1px dashed #86efac;
  padding-top: 10px;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 16px;
}
.sale-result .sale-total b { color: #15803d; font-size: 19px; }

.copy-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.copy-block-section { margin-top: 16px; }
.copy-message-preview {
  margin-top: 10px;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  color: #374151;
  white-space: pre-wrap;
  line-height: 1.5;
}

@media (max-width: 720px) {
  body { padding: 12px; }
  h1 { font-size: 18px; margin-bottom: 14px; }
  h2 { font-size: 15px; }
  .card { padding: 14px 14px; }

  .field-date { flex: 1 1 100%; max-width: none; }
  .field-date .depDate { max-width: none; }

  .airport-dropdown { max-height: 200px; }

  .result-table thead { display: none; }

  .result-table,
  .result-table tbody,
  .result-table tr,
  .result-table td {
    display: block;
    width: 100%;
  }

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

  .result-table tr {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
  }

  .result-table tr.row-sum {
    border-radius: 10px 10px 0 0;
    border-bottom: none;
    padding-bottom: 4px;
    margin-bottom: 0;
    box-shadow: none;
  }

  .result-table tr.row-detail {
    border-radius: 0 0 10px 10px;
    border-top: 1px dashed #e5e7eb;
    padding-top: 4px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
  }
  .result-table tr.row-detail td:not(.has-detail) { display: none; }
  .result-table tr.row-detail td.has-detail {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    padding: 4px 0;
    font-size: 10px;
    color: #9ca3af;
    border-bottom: 1px dashed #eef0f3;
    text-align: left !important;
  }
  .result-table tr.row-detail td.has-detail:last-of-type { border-bottom: none; }
  .result-table tr.row-detail td.has-detail::before {
    content: attr(data-label);
    flex: 0 0 26%;
    color: #6b7280;
    font-size: 10px;
    font-weight: 500;
  }
  .result-table tr.row-detail td.has-detail > * {
    flex: 1 1 74%;
    text-align: right;
    min-width: 0;
    color: #6b7280;
  }

  .result-table tr.row-sum td {
    border: none;
    border-bottom: 1px dashed #eef0f3;
    padding: 6px 0;
    text-align: left !important;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
  }
  .result-table tr.row-sum td:last-child { border-bottom: none; }

  .result-table tr.row-sum td::before {
    content: attr(data-label);
    flex: 0 0 26%;
    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
    padding-top: 1px;
  }

  .result-table tr.row-sum td > * {
    flex: 1 1 74%;
    text-align: right;
    min-width: 0;
  }

  .result-table tr.row-sum td:nth-child(1) {
    font-weight: 700;
    font-size: 13px;
    color: #111827;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 4px;
    border-bottom: none;
  }
  .result-table tr.row-sum td:nth-child(1)::before {
    content: "Плечо";
    font-weight: 600;
    color: #111827;
  }

  .result-table tr.row-sum td:nth-child(2) {
    font-weight: 600;
    color: #1f2937;
  }

  .sale-result { font-size: 13px; padding: 12px 14px; }
  .sale-result .sale-total { font-size: 14px; }
  .sale-result .sale-total b { font-size: 17px; }

  .hour-total { font-size: 13px; padding: 10px 14px; }
  .hour-total b { font-size: 16px; }
}

@media (max-width: 420px) {
  .result-table tr { padding: 8px 10px; }
  .result-table tr.row-sum td { font-size: 11.5px; padding: 5px 0; }
  .result-table tr.row-sum td::before { flex: 0 0 24%; font-size: 10.5px; }
  .result-table tr.row-sum td > * { flex: 1 1 76%; }
  .result-table tr.row-detail td.has-detail { font-size: 9.5px; }
}
/* ===== Экраны авторизации ===== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.auth-title {
  margin: 0 0 14px;
  font-size: 22px;
  color: #1f2937;
}
.auth-text {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.5;
  color: #4b5563;
}
.auth-btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 15px;
}
.auth-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Шапка приложения ===== */
.app-header {
  max-width: 1250px;
  margin: 0 auto 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: 10px;
  padding: 12px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.app-user {
  font-size: 14px;
  color: #6b7280;
}
.app-user b {
  color: #1f2937;
  font-weight: 600;
}
.btn-logout {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.btn-logout:hover {
  background: #e5e7eb;
  color: #1f2937;
}

/* ===== Поля первого раздела (Тип ВС, МВМ) — шире ===== */
.row-ac .field-ac input,
.row-ac .field-ac select {
  width: 20ch;
  min-width: 20ch;
}

/* ============================================================
 *  Layout с сайдбаром
 * ============================================================ */
#appScreen {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px 20px;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 12px;
}
.sidebar-logo {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
}
.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  font-size: 26px;
  color: #6b7280;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #374151;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.35;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #f3f4f6; }
.nav-item.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}
.nav-item-disabled {
  color: #9ca3af;
  cursor: not-allowed;
  opacity: .7;
}
.nav-item-disabled:hover { background: transparent; }

.nav-icon { flex: 0 0 auto; font-size: 16px; }
.nav-text { flex: 1; }
.nav-badge {
  font-size: 10px;
  background: #f3f4f6;
  color: #6b7280;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar-footer {
  border-top: 1px solid #f3f4f6;
  padding: 12px 8px 4px;
  margin-top: 12px;
}
.sidebar-user {
  margin-bottom: 10px;
}
.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 2px;
}
.sidebar-user-email {
  font-size: 11px;
  color: #9ca3af;
  word-break: break-all;
}
.sidebar-footer .btn-logout {
  width: 100%;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 20px;
}

.burger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 90;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  padding: 0;
  line-height: 1;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 95;
  opacity: 0;
  transition: opacity .2s;
}
.sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* ============================================================
 *  Дашборд
 * ============================================================ */
.dash-greeting {
  font-size: 26px;
  margin: 0 0 6px;
  color: #1f2937;
}
.dash-subtitle {
  margin: 0 0 24px;
  color: #6b7280;
  font-size: 15px;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  max-width: 900px;
}
.dash-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border: 2px solid transparent;
}
.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(37,99,235,.15);
  border-color: #93c5fd;
}
.dash-card-icon {
  font-size: 32px;
  margin-bottom: 12px;
  line-height: 1;
}
.dash-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
}
.dash-card-text {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}
.dash-card-disabled {
  cursor: not-allowed;
  opacity: .55;
}
.dash-card-disabled:hover {
  transform: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border-color: transparent;
}

/* ============================================================
 *  Вкладки внутри модуля
 * ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e5e7eb;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: #374151; }
.tab.active {
  color: #2563eb;
  font-weight: 600;
  border-bottom-color: #2563eb;
}

/* ============================================================
 *  Мобильная версия — сайдбар уезжает
 * ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 280px;
    min-width: 280px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.2);
  }
  .sidebar-close {
    display: block;
  }
  .burger {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .main {
    padding: 12px;
    padding-top: 66px;
  }
}

@media (min-width: 901px) {
  .sidebar-overlay { display: none !important; }
}

/* ============================================================
 *  Sticky-панель модуля
 * ============================================================ */
.module-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin: 0 -20px 16px;
  background: rgba(244, 246, 249, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.module-toolbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}
.module-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
 *  Модальное окно
 * ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px 26px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.modal h3 {
  margin: 0 0 18px;
  font-size: 18px;
  color: #1f2937;
}
.modal label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}
.modal input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 20px;
  box-sizing: border-box;
}
.modal input:focus {
  border-color: #2563eb;
  outline: none;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================================================
 *  Список сохранённых расчётов
 * ============================================================ */
.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.saved-card {
  background: #fff;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.saved-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.35;
  word-break: break-word;
}
.saved-card-date {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 4px;
}
.saved-card-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #6b7280;
}
.saved-card-row b {
  color: #1f2937;
  font-weight: 600;
  white-space: nowrap;
}
.saved-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}
.btn-sm {
  padding: 6px 12px !important;
  font-size: 13px !important;
}
.saved-loading {
  padding: 20px;
  color: #6b7280;
  font-size: 14px;
}

/* Мобильные правки для sticky-панели */
@media (max-width: 900px) {
  .module-toolbar {
    top: 0;
    padding-left: 64px;
    margin-left: -12px;
    margin-right: -12px;
    padding-right: 12px;
  }
  .module-toolbar-title {
    font-size: 14px;
  }
  .module-toolbar-actions button {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* ===== Кнопки в панели модуля — одинаковая ширина ===== */
.module-toolbar-actions .btn-secondary,
.module-toolbar-actions .btn-primary {
  min-width: 145px;
  text-align: center;
  justify-content: center;
}

/* ===== Множественное удаление в "Моих расчётах" ===== */
.saved-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.saved-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  user-select: none;
  margin: 0;
}
.saved-select-all input {
  width: auto;
  cursor: pointer;
  margin: 0;
}
#savedDeleteSelectedBtn {
  padding: 8px 14px;
  font-size: 13px;
}
#savedDeleteSelectedBtn:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}
.saved-card {
  position: relative;
}
.saved-card .saved-card-name {
  padding-right: 30px;
}
.saved-card-check {
  position: absolute;
  top: 14px;
  right: 14px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.saved-card-check input {
  width: auto;
  cursor: pointer;
  margin: 0;
}

/* ===== Сайдбар: скруглённые углы в тон карточкам ===== */
.sidebar {
  border-radius: 10px;
  border-right: none;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin: 12px 0 12px 12px;
  height: calc(100vh - 24px);
}

#appScreen {
  gap: 0;
}

.main {
  padding-left: 16px;
}

/* Мобильный вариант — сайдбар выезжает, оставляем скругление справа */
@media (max-width: 900px) {
  .sidebar {
    margin: 0;
    height: 100vh;
    border-radius: 0 10px 10px 0;
    border-right: 1px solid #e5e7eb;
    border-left: none;
    border-top: none;
    border-bottom: none;
  }
}

/* ===== Мини-уведомление (тост) ===== */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #16a34a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 480px) {
  .app-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }
}

/* ===== Sticky-панель модуля — скруглённые углы ===== */
.module-toolbar {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  top: 12px;
}

@media (max-width: 900px) {
  .module-toolbar {
    top: 66px;
    margin-left: 0;
    margin-right: 0;
  }
}

/* ============================================================
 *  Просмотр сохранённого расчёта
 * ============================================================ */
.view-topbar {
  margin-bottom: 16px;
}
.view-title {
  font-size: 22px;
  margin: 0 0 6px;
  color: #1f2937;
  line-height: 1.3;
}
.view-meta {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 16px;
}
.view-aircraft {
  padding-top: 14px;
  border-top: 1px solid #f3f4f6;
}
.view-aircraft-row {
  display: flex;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 6px;
}
.view-aircraft-row > span:first-child {
  flex: 0 0 110px;
  color: #6b7280;
}
.view-aircraft-row > b,
.view-aircraft-row > span:last-child {
  color: #1f2937;
}

.view-route-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.view-route-table tr {
  border-bottom: 1px solid #f3f4f6;
}
.view-route-table tr:last-child {
  border-bottom: none;
}
.view-route-table td {
  padding: 10px 8px;
  vertical-align: top;
}
.view-route-date {
  white-space: nowrap;
  color: #6b7280;
  width: 100px;
}
.view-route-pax {
  white-space: nowrap;
  text-align: right;
  color: #6b7280;
  width: 90px;
}

.view-sale {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 20px;
  align-items: center;
  font-size: 14px;
}
.view-sale-row {
  display: contents;
}
.view-sale-row > span {
  color: #6b7280;
}
.view-sale-row > b {
  color: #1f2937;
  text-align: right;
  white-space: nowrap;
}
.view-rate-select {
  width: 100px;
  min-width: 100px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
}
.view-sale-divider {
  padding-top: 12px;
  border-top: 1px dashed #e5e7eb;
}
.view-sale-divider > span,
.view-sale-divider > select {
  padding-top: 12px;
}
.view-sale-total {
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 16px;
}
.view-sale-total > span,
.view-sale-total > b {
  padding-top: 12px;
  font-weight: 700;
}
.view-sale-total > b {
  color: #15803d;
  font-size: 18px;
}
.view-sale-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}

/* ===== Кастомное подтверждение ===== */
.confirm-modal {
  max-width: 440px;
}
.confirm-title {
  margin: 0 0 10px;
  font-size: 18px;
  color: #1f2937;
  line-height: 1.3;
}
.confirm-message {
  margin: 0 0 22px;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
}
.btn-danger-confirm {
  background: #dc2626;
  color: #fff;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.btn-danger-confirm:hover {
  background: #b91c1c;
}
.btn-danger-confirm:focus {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

/* ===== Тосты по типам ===== */
.app-toast.app-toast-success { background: #16a34a; color: #fff; }
.app-toast.app-toast-error   { background: #dc2626; color: #fff; }
.app-toast.app-toast-warning { background: #f59e0b; color: #fff; }
.app-toast.app-toast-info    { background: #2563eb; color: #fff; }
