:root {
  --bg0: #0a1528;
  --bg1: #10233f;
  --bg2: #163456;
  --panel: rgba(236, 243, 252, 0.95);
  --panel-edge: rgba(20, 56, 110, 0.14);
  --ink: #13233d;
  --muted: #5a6e88;
  --accent: #3b82f6;
  --accent-deep: #1d4ed8;
  --accent-soft: #93c5fd;
  --ok: #2563eb;
  --err: #a33b2d;
  --line: rgba(19, 35, 61, 0.12);
  --radius: 18px;
  --nav-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "Manrope", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 8% -12%, #1e4b8c 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 8%, #3b6fb8 0%, transparent 48%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #07101f);
  background-attachment: fixed;
}

.app-shell {
  min-height: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px calc(var(--nav-h) + var(--safe-bottom) + 18px);
}

.topbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.user-login {
  color: rgba(232,240,251,.78);
  font-size: .85rem;
  font-weight: 600;
}
.logout-link {
  color: #bfdbfe;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(59,130,246,.16);
  border: 1px solid rgba(147,197,253,.25);
}
.logout-link:active { transform: scale(.98); }

.login-body {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-wrap {
  width: min(420px, 100%);
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 22px 18px 20px;
  display: grid;
  gap: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,.22);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--ink);
}
.login-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.login-brand small {
  color: var(--muted);
  font-size: .85rem;
}
.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8e2de;
  color: #7a2a20;
  border: 1px solid #e3b1a8;
  font-size: .92rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e8f0fb;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(145deg, #60a5fa, #1d4ed8);
  color: #f8fbff;
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}
.brand small {
  color: rgba(232,240,251,.72);
  font-size: .78rem;
}

.tank-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.tank-chip {
  position: relative;
  min-width: 132px;
  padding: 10px 12px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  color: #e8f0fb;
  border: 1px solid rgba(255,255,255,.12);
  overflow: hidden;
  flex: 0 0 auto;
}
.tank-chip span {
  display: block;
  font-size: .75rem;
  opacity: .8;
  margin-bottom: 2px;
}
.tank-chip b {
  font-family: var(--font-display);
  font-size: 1rem;
}
.tank-chip i {
  position: absolute;
  left: 0; bottom: 0; height: 3px;
  width: calc(var(--pct) * 1%);
  max-width: 100%;
  background: linear-gradient(90deg, #60a5fa, #1d4ed8);
}

.toast {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 500;
  animation: slideIn .28s ease;
}
.toast-ok { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }
.toast-err { background: #f8e2de; color: #7a2a20; border: 1px solid #e3b1a8; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 18px 16px 20px;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
}
.panel.tight { padding-top: 12px; }
.panel h1, .panel h2, .panel h3 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.panel h1 { font-size: 1.45rem; font-weight: 800; }
.panel h2 { font-size: 1.15rem; }
.panel h3 { font-size: 1rem; margin-top: 8px; }
.lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.35;
}

.stack-form, .nested { display: grid; gap: 12px; }
.nested { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

.field { display: grid; gap: 6px; }
.field span {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field input, .field select, .cancel-form input {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
}
.field input:focus, .field select:focus, .cancel-form input:focus {
  outline: 2px solid rgba(59,130,246,.4);
  border-color: var(--accent);
}
.field.compact span { text-transform: none; letter-spacing: 0; }

.btn-primary, .btn-secondary, .btn-danger-ghost {
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}
.btn-primary {
  background: linear-gradient(145deg, #60a5fa, #1d4ed8);
  color: #f8fbff;
  box-shadow: 0 12px 24px rgba(29,78,216,.28);
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  background: #13284a;
  color: #e8f0fb;
}
.btn-danger-ghost {
  min-height: 42px;
  background: transparent;
  color: var(--err);
  border: 1px solid rgba(163,59,45,.35);
  font-size: .9rem;
}
.btn-primary:active, .btn-secondary:active { transform: scale(.98); }

.search-results {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  margin-top: 4px;
}
.search-item {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  font: inherit;
}
.search-item:hover, .search-item:focus {
  border-color: var(--accent);
  background: #eff6ff;
}
.search-item b { display: block; }
.search-item small { color: var(--muted); }

.selected-card {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #dbeafe;
  border: 1px solid #93c5fd;
}
.selected-card strong { display: block; font-family: var(--font-display); }
.selected-card span { color: var(--muted); font-size: .92rem; }

.period-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.period-form .check {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.period-form .btn-secondary { grid-column: 1 / -1; }

.report-bar {
  display: grid;
  gap: 12px;
}
.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.totals div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}
.totals span {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.totals b {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.tx-list { display: grid; gap: 10px; }
.tx-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.tx-card.cancelled { opacity: .62; }
.tx-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tx-card time { color: var(--muted); font-size: .85rem; }
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-refuel { background: #dbeafe; color: #1e40af; }
.badge-refill { background: #e0e7ff; color: #3730a3; }
.badge-adjustment { background: #e8eef5; color: #334155; }
.badge-cancel_refuel,
.badge-cancel_refill { background: #fee2e2; color: #991b1b; }
.badge-reversed { background: #fef3c7; color: #92400e; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tx-card.tx-cancel { border-color: rgba(153, 27, 27, 0.28); background: #fff7f7; }
.tx-card.tx-has-cancel { opacity: .9; background: #fffbeb; }
.status-line { color: #92400e; font-weight: 600; }
.tx-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}
.tx-main strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.tx-meta {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: .9rem;
}
.cancel-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}
.cancel-note {
  margin: 8px 0 0;
  color: var(--err);
  font-size: .86rem;
}
.empty { color: var(--muted); margin: 8px 0; }

.simple-list { display: grid; gap: 8px; }
.simple-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.simple-item strong { display: block; font-family: var(--font-display); }
.simple-item span { color: var(--muted); font-size: .9rem; }

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(720px, 100%);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 8px 10px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: rgba(8, 18, 36, .94);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,.08);
  z-index: 40;
}
.bottom-nav a {
  display: grid;
  place-items: center;
  gap: 2px;
  text-decoration: none;
  color: rgba(232,240,251,.62);
  font-size: .68rem;
  font-weight: 600;
  border-radius: 12px;
  padding: 6px 2px;
}
.bottom-nav a.active {
  color: #bfdbfe;
  background: rgba(59,130,246,.18);
}
.nav-ico {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: currentColor;
  opacity: .85;
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
}
.nav-refuel .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M4 20V8l4-4h6l4 4v12'/><path d='M8 20v-6h6v6'/><path d='M18 10h1a2 2 0 0 1 2 2v5a2 2 0 1 0 4 0V9l-3-3'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M4 20V8l4-4h6l4 4v12'/><path d='M8 20v-6h6v6'/><path d='M18 10h1a2 2 0 0 1 2 2v5a2 2 0 1 0 4 0V9l-3-3'/></svg>");
}
.nav-voice .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z'/><path d='M5 11a7 7 0 0 0 14 0'/><path d='M12 18v3'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z'/><path d='M5 11a7 7 0 0 0 14 0'/><path d='M12 18v3'/></svg>");
}
.nav-refill .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M7 7h10v14H7z'/><path d='M9 7V4h6v3'/><path d='M12 11v6'/><path d='M9 14h6'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M7 7h10v14H7z'/><path d='M9 7V4h6v3'/><path d='M12 11v6'/><path d='M9 14h6'/></svg>");
}
.nav-journal .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M6 4h12v16H6z'/><path d='M9 8h6M9 12h6M9 16h4'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M6 4h12v16H6z'/><path d='M9 8h6M9 12h6M9 16h4'/></svg>");
}
.nav-service .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><circle cx='12' cy='12' r='3'/><path d='M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6l1.4 1.4M17 17l1.4 1.4M5.6 18.4l1.4-1.4M17 7l1.4-1.4'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><circle cx='12' cy='12' r='3'/><path d='M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6l1.4 1.4M17 17l1.4 1.4M5.6 18.4l1.4-1.4M17 7l1.4-1.4'/></svg>");
}

/* Голосовая заправка — чат */
body.voice-page .tank-strip { display: none; }
body.voice-page .content { padding: 0; }
.voice-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
}
.voice-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: #f5f9ff;
}
.voice-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.voice-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .88rem;
}
.voice-clear {
  min-height: 42px;
  padding: 0 12px;
  font-size: .85rem;
  flex-shrink: 0;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  max-height: calc(100vh - 320px);
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(59,130,246,.08), transparent 60%),
    #eef4fb;
}
.chat-bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 1rem;
  white-space: normal;
}
.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(145deg, #60a5fa, #1d4ed8);
  color: #f8fbff;
  border-bottom-right-radius: 6px;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.chat-status {
  align-self: center;
  color: var(--muted);
  font-size: .85rem;
  font-style: italic;
}
.chat-input-bar {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: #fff;
}
.chat-input-bar textarea {
  width: 100%;
  min-height: 48px;
  max-height: 140px;
  resize: none;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px;
  font: inherit;
  font-size: 1.02rem;
}
.mic-btn, .send-btn {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
}
.mic-btn {
  width: 52px;
  background: #13284a;
  color: #bfdbfe;
  position: relative;
}
.mic-btn::before {
  content: "";
  position: absolute;
  inset: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z'/><path d='M5 11a7 7 0 0 0 14 0'/><path d='M12 18v3'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z'/><path d='M5 11a7 7 0 0 0 14 0'/><path d='M12 18v3'/></svg>") center / contain no-repeat;
}
.mic-btn.recording {
  background: #991b1b;
  color: #fee2e2;
  animation: pulseMic 1s infinite;
}
@keyframes pulseMic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.send-btn {
  padding: 0 14px;
  background: linear-gradient(145deg, #60a5fa, #1d4ed8);
  color: #f8fbff;
}

@media (min-width: 720px) {
  .app-shell { padding-top: 20px; }
  .period-form { grid-template-columns: 1fr 1fr auto auto; align-items: end; }
  .period-form .check { grid-column: auto; }
  .period-form .btn-secondary { grid-column: auto; }
  .report-bar {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .voice-shell { min-height: calc(100vh - 160px); }
  .chat-messages { max-height: calc(100vh - 280px); }
}
