/* ═══════════════════════════════════════════════════
   Fuel Delivery — основные стили
   ═══════════════════════════════════════════════════ */

/* ── Общее ─────────────────────────────────────────── */
:root {
  --sidebar-bg:      #1e2a3a;
  --sidebar-hover:   #2d3f55;
  --sidebar-active:  #3a5270;
  --sidebar-text:    #adb5bd;
  --sidebar-width:   220px;
  --accent:          #0d6efd;
  --accent-light:    #eef4ff;
  --calc-bg:         #eef6ff;
  --calc-border:     #b6d4fe;
  --card-shadow:     0 1px 8px rgba(0,0,0,.08);
  --radius:          10px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .9rem;
  background: #f0f4f8;
  color: #212529;
  margin: 0;
}

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
  height: 54px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  z-index: 1030;
  position: sticky;
  top: 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .4px;
  color: #fff !important;
}

.navbar-brand i {
  color: #f0a500;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - 54px);
  background: var(--sidebar-bg);
  padding: 1rem .75rem;
  position: sticky;
  top: 54px;
  height: calc(100vh - 54px);
  overflow-y: auto;
}

.sidebar .nav-section-title {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #5a7a9a;
  padding: .4rem .6rem .2rem;
  margin-top: .5rem;
}

.sidebar .nav-link {
  color: var(--sidebar-text);
  padding: .5rem .75rem;
  border-radius: 7px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .15s, color .15s;
}

.sidebar .nav-link i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.sidebar .nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.sidebar hr {
  border-color: #2d3f55;
  margin: .6rem 0;
}

/* ── Main content ────────────────────────────────────── */
.main-content {
  padding: 1.5rem 1.75rem;
  min-height: calc(100vh - 54px);
}

/* ── Cards ───────────────────────────────────────────── */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  background: #fff;
}

.card-header-custom {
  background: #f8fafc;
  border-bottom: 1px solid #e9ecef;
  padding: .85rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  font-size: .9rem;
  color: #344054;
}

/* ── Tables ──────────────────────────────────────────── */
.table {
  font-size: .82rem;
}

.table thead th {
  background: #f0f4f8;
  color: #5a6a7a;
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .45px;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
  padding: .6rem .75rem;
}

.table tbody td {
  padding: .5rem .75rem;
  vertical-align: middle;
  border-color: #f0f4f8;
}

.table tbody tr:hover {
  background: #f8fbff;
}

.table-responsive {
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Расчётные поля ──────────────────────────────────── */
.calc-field {
  background: var(--calc-bg) !important;
  border-color: var(--calc-border) !important;
  color: #1a4a8a !important;
  font-weight: 500;
  cursor: default;
}

.calc-field:focus {
  box-shadow: 0 0 0 .2rem rgba(13,110,253,.1) !important;
}

.calc-legend {
  background: #f8fbff;
  border: 1px solid #d0e4ff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.calc-legend li {
  margin-bottom: .35rem;
  color: #4a6080;
}

/* ── Badges ──────────────────────────────────────────── */
.badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .3em .65em;
  border-radius: 5px;
}

.badge-role-admin      { background: #dc3545 !important; }
.badge-role-receiver   { background: #0d6efd !important; }
.badge-role-accountant { background: #198754 !important; }

/* ── Кнопки ──────────────────────────────────────────── */
.btn {
  border-radius: 7px;
  font-size: .85rem;
  font-weight: 500;
}

.btn-sm {
  font-size: .8rem;
  padding: .3rem .7rem;
}

.btn-xs {
  font-size: .75rem;
  padding: .15rem .45rem;
  border-radius: 5px;
}

/* ── Формы ───────────────────────────────────────────── */
.form-label {
  font-size: .82rem;
  font-weight: 500;
  color: #344054;
  margin-bottom: .3rem;
}

.form-control, .form-select {
  border-radius: 7px;
  font-size: .85rem;
  border-color: #ced4da;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}

.form-section-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #6c757d;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

/* ── Итоговые карточки ───────────────────────────────── */
.totals-card {
  border-radius: 8px;
  padding: .6rem .9rem;
  text-align: center;
  background: #fff;
  box-shadow: var(--card-shadow);
  border-left: 3px solid var(--accent);
}

.totals-card .totals-label {
  font-size: .7rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: .15rem;
}

.totals-card .totals-value {
  font-size: .95rem;
  font-weight: 700;
  color: #1a2a3a;
}

.totals-card.accent-green  { border-left-color: #198754; }
.totals-card.accent-orange { border-left-color: #f0a500; }
.totals-card.accent-red    { border-left-color: #dc3545; }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  font-size: .85rem;
  border: none;
}

/* ── Pagination ──────────────────────────────────────── */
.pagination .page-link {
  border-radius: 6px !important;
  margin: 0 2px;
  font-size: .82rem;
  color: var(--accent);
  border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Login page ──────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e2a3a 0%, #2d4a6a 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 14px;
  padding: 2.5rem 2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}

.login-logo {
  font-size: 2.5rem;
  color: #f0a500;
}

.login-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a2a3a;
  margin-bottom: .25rem;
}

.login-subtitle {
  font-size: .82rem;
  color: #6c757d;
}

/* ── Пустое состояние ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #adb5bd;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: .75rem;
  display: block;
}

/* ── Числа в таблице ─────────────────────────────────── */
.num { font-variant-numeric: tabular-nums; }
.text-blue   { color: #0d6efd !important; }
.text-green  { color: #198754 !important; }
.text-orange { color: #f0a500 !important; }

/* ── Адаптив ─────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .sidebar { display: none !important; }
  .main-content { padding: 1rem; }
  .totals-card .totals-value { font-size: .85rem; }
}