:root {
  color-scheme: light;
  --bg: #eef3f1;
  --text: #18211f;
  --muted: #73807b;
  --line: #d8e1de;
  --surface: #ffffff;
  --soft: #f7faf8;
  --accent: #16806a;
  --accent-2: #3f7fba;
  --fuel: #36a388;
  --service: #3f7fba;
  --danger: #b5473e;
  --shadow: 0 14px 40px rgba(24, 33, 31, 0.08);
}

body.auth-required .shell {
  display: none;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  min-height: 34px;
  padding: 0 12px;
  background: #edf3f0;
  color: var(--accent);
  box-shadow: none;
}

.passport-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
  color: #f4fbf8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(16, 26, 28, 0.98), rgba(27, 37, 43, 0.96)),
    #101a1c;
  box-shadow: 0 18px 50px rgba(10, 16, 18, 0.22);
}

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

.passport-head h2 {
  margin: 0;
  color: #fff;
  letter-spacing: 0;
}

.passport-head small,
.passport-metric span,
.passport-action span,
.achievement-card span,
.timeline-item small,
.timeline-empty,
.passport-note {
  color: rgba(244, 251, 248, 0.68);
}

.score-ring {
  display: grid;
  place-items: center;
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: conic-gradient(#5ee0bd 0deg, rgba(255, 255, 255, 0.12) 0deg);
  position: relative;
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: #121d20;
}

.score-ring strong,
.score-ring span {
  position: relative;
  z-index: 1;
}

.score-ring strong {
  font-size: 24px;
}

.score-ring span {
  margin-top: 28px;
  font-size: 11px;
  color: rgba(244, 251, 248, 0.62);
  position: absolute;
}

.passport-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.passport-metric,
.passport-action,
.achievement-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.passport-metric strong {
  color: #fff;
  font-size: 14px;
}

.passport-actions,
.achievement-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.achievement-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.achievement-card strong::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #5ee0bd;
  box-shadow: 0 0 16px rgba(94, 224, 189, 0.7);
}

.achievement-card.muted strong::before {
  background: #91a39d;
  box-shadow: none;
}

.vehicle-timeline {
  display: grid;
  gap: 8px;
}

.timeline-title {
  color: #fff;
  font-weight: 700;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: start;
}

.timeline-item > span {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: #5ee0bd;
}

.timeline-item.service > span,
.timeline-item.service_visit > span {
  background: #8bb9ff;
}

.timeline-item.achievement > span {
  background: #f0c66a;
}

.stat {
  display: grid;
  width: 100%;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.action-card {
  display: grid;
  gap: 4px;
  min-height: 72px;
  color: var(--text);
  text-align: left;
  background: var(--soft);
  border: 1px solid var(--line);
  box-shadow: none;
}

.action-card span {
  color: var(--muted);
}

.action-card.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.action-card.active span {
  color: rgba(255, 255, 255, 0.78);
}

.preset-row {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.preset-row button {
  min-height: 36px;
  padding: 0 12px;
  background: #edf3f0;
  color: var(--text);
  box-shadow: none;
}

.drawer,
.report-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: rgba(17, 25, 22, 0.32);
  backdrop-filter: blur(5px);
}

.drawer.hidden,
.report-sheet.hidden {
  display: none;
}

.drawer-panel,
.sheet-panel {
  max-height: 88vh;
  overflow: auto;
  padding: 18px;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 50px rgba(24, 33, 31, 0.18);
  animation: sheetUp 220ms ease both;
}

.drawer-panel {
  width: min(520px, 100%);
  margin-left: auto;
}

.drawer-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.drawer-form {
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.menu-row {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  background: var(--soft);
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  box-shadow: none;
}

.wide-btn {
  width: 100%;
  margin-top: 10px;
}

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

.scan-actions button {
  width: 100%;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-hint {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}

.sheet-panel {
  width: min(720px, 100%);
  margin: 0 auto;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.report-metric,
.tip-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.report-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.report-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.report-records {
  max-height: 360px;
  overflow: auto;
}

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

@media (max-width: 980px) {
  .shell {
    padding: 14px 12px 96px;
  }

  .hero-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 2px;
  }

  .summary-card {
    min-width: 78vw;
    scroll-snap-align: start;
  }

  .cars {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .car-item {
    min-width: 230px;
  }

  .quick-actions {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 6px 0;
    background: rgba(238, 243, 241, 0.92);
    backdrop-filter: blur(8px);
  }

  .action-card {
    min-height: 58px;
    padding: 8px;
  }

  .passport-grid,
  .passport-actions,
  .achievement-strip,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .passport-head {
    align-items: flex-start;
  }
}

@media (max-width: 980px) {
  .shell {
    padding: 14px 12px 96px;
  }

  .hero-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 2px;
  }

  .summary-card {
    min-width: 78vw;
    scroll-snap-align: start;
  }

  .cars {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .car-item {
    min-width: 230px;
  }

  .quick-actions {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 6px 0;
    background: rgba(238, 243, 241, 0.92);
    backdrop-filter: blur(8px);
  }

  .action-card {
    min-height: 58px;
    padding: 8px;
  }

  .passport-grid,
  .passport-actions,
  .achievement-strip,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .passport-head {
    align-items: flex-start;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(238, 243, 241, 0)),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  min-height: 42px;
  border-radius: 7px;
  padding: 0 16px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(22, 128, 106, 0.18);
}

button:active {
  transform: translateY(0) scale(0.99);
}

button:disabled {
  opacity: 0.55;
}

.shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 42px);
}

h2 {
  font-size: 18px;
}

.icon-btn {
  width: 44px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.loading .icon-btn {
  animation: spin 800ms linear infinite;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card,
.band,
.panel,
.workspace,
.chart-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 16px;
  overflow: hidden;
  position: relative;
  animation: rise 420ms ease both;
}

.summary-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -30px auto;
  width: 130px;
  height: 90px;
  background: rgba(54, 163, 136, 0.12);
  transform: rotate(-14deg);
}

.summary-card.accent::after {
  background: rgba(54, 163, 136, 0.16);
}

.summary-card.blue::after {
  background: rgba(63, 127, 186, 0.15);
}

.summary-card span,
.summary-card small,
.stat span,
.stat em {
  color: var(--muted);
}

.summary-card strong {
  font-size: clamp(22px, 4vw, 31px);
  line-height: 1.05;
  z-index: 1;
}

.summary-card small {
  z-index: 1;
}

.band {
  padding: 14px;
  margin-bottom: 16px;
}

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

.grid-form,
.entry-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 120px auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 11px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(22, 128, 106, 0.12);
}

select:disabled {
  background: #f1f5f3;
  color: #9aa4a0;
}

.layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 16px;
  align-items: start;
}

.panel,
.workspace {
  padding: 16px;
}

.report-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.report-bar .eyebrow {
  margin-bottom: 2px;
}

.period-controls {
  display: grid;
  grid-template-columns: 140px 150px 150px;
  gap: 8px;
  align-items: center;
}

.panel {
  position: sticky;
  top: 12px;
}

.cars {
  display: grid;
  gap: 9px;
}

.car-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  background: var(--soft);
  color: var(--text);
  text-align: left;
  border: 1px solid transparent;
  box-shadow: none;
}

.car-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.car-item.active {
  border-color: rgba(22, 128, 106, 0.48);
  background: #e5f4ef;
}

.car-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #d7ebe5;
  color: #11634f;
  font-size: 13px;
  font-weight: 800;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 92px;
  background: var(--soft);
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.stat em {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-style: normal;
}

.pop {
  animation: pop 260ms ease both;
}

.charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  margin-bottom: 14px;
}

.chart-card {
  min-height: 320px;
  padding: 14px;
  box-shadow: none;
}

.chart-card canvas {
  display: block;
  width: 100%;
  height: 250px;
}

.chart-card.compact {
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  width: fit-content;
  background: #edf2ef;
  border-radius: 8px;
}

.tab {
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.tab:hover {
  box-shadow: none;
}

.tab.active {
  background: var(--accent-2);
  color: #fff;
}

.entry-form {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  border-top: 1px solid var(--line);
  padding-top: 14px;
  animation: fade 180ms ease both;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.hidden {
  display: none;
}

.history {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.record {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  animation: fade 220ms ease both;
}

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

.record .fuel {
  color: var(--fuel);
}

.record .service {
  color: var(--service);
}

.empty {
  color: var(--muted);
  padding: 18px 0;
}

.error {
  margin: 12px auto;
  width: min(920px, calc(100% - 24px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff1ef;
  border: 1px solid #f0c8c1;
  color: var(--danger);
}

.reveal {
  animation: rise 360ms ease both;
}

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

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

@media (max-width: 980px) {
  .hero-grid,
  .layout,
  .charts,
  .grid-form,
  .entry-form,
  .stats,
  .period-controls {
    grid-template-columns: 1fr;
  }

  .report-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .panel {
    position: static;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
  }

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

/* Modern app pass */
:root {
  --bg: #f4f7f5;
  --text: #121815;
  --muted: #6f7a75;
  --line: #dfe7e3;
  --surface: #ffffff;
  --soft: #f8fbf9;
  --accent: #12735f;
  --accent-2: #2f6f9f;
  --fuel: #1f987d;
  --service: #2f6f9f;
  --warning: #c26b33;
  --danger: #b8423a;
  --shadow: 0 16px 42px rgba(27, 38, 34, 0.09);
  --press-shadow: 0 8px 18px rgba(18, 115, 95, 0.18);
}

body {
  background:
    linear-gradient(180deg, #ffffff 0, #f4f7f5 250px),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
.car-item,
.stat,
.action-card,
.menu-row {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-weight: 750;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(18, 115, 95, 0.18);
}

button:hover {
  box-shadow: var(--press-shadow);
}

button:active,
.car-item:active,
.stat:active,
.action-card:active,
.menu-row:active {
  transform: translateY(1px) scale(0.99);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: progress;
  opacity: 0.68;
}

.is-busy {
  pointer-events: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

button.is-busy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.shell {
  padding-top: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: 0 -18px 14px;
  padding: 12px 18px;
  background: rgba(244, 247, 245, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(223, 231, 227, 0.78);
}

.topbar h1 {
  font-size: clamp(28px, 6vw, 42px);
}

.icon-btn,
.ghost-btn,
.preset-row button,
.menu-row {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(27, 38, 34, 0.06);
}

.icon-btn {
  display: grid;
  place-items: center;
}

.hero-grid {
  gap: 14px;
}

.summary-card,
.panel,
.workspace,
.chart-card,
.report-metric,
.tip-card {
  border-color: rgba(208, 220, 214, 0.9);
}

.summary-card {
  min-height: 118px;
  background:
    linear-gradient(135deg, rgba(18, 115, 95, 0.1), rgba(255, 255, 255, 0) 54%),
    var(--surface);
}

.summary-card.accent {
  background:
    linear-gradient(135deg, rgba(31, 152, 125, 0.14), rgba(255, 255, 255, 0) 58%),
    var(--surface);
}

.summary-card.blue {
  background:
    linear-gradient(135deg, rgba(47, 111, 159, 0.14), rgba(255, 255, 255, 0) 58%),
    var(--surface);
}

.summary-card::after {
  display: none;
}

.status-bar {
  min-height: 36px;
  display: flex;
  align-items: center;
  margin: -4px 0 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.report-bar,
.entry-form {
  border-color: rgba(223, 231, 227, 0.86);
}

.period-controls select,
.period-controls input,
input,
select {
  background: #fbfdfc;
}

.car-item,
.action-card,
.stat {
  border-radius: 8px;
  background: #fff;
  border-color: var(--line);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.car-item:hover,
.action-card:hover,
.stat:hover {
  box-shadow: 0 12px 28px rgba(27, 38, 34, 0.08);
}

.car-item.active {
  border-color: rgba(18, 115, 95, 0.55);
  background: #eef8f4;
  box-shadow: 0 12px 26px rgba(18, 115, 95, 0.12);
}

.car-badge {
  background: linear-gradient(135deg, #d9f0e9, #dceaf5);
}

.action-card.active {
  background:
    linear-gradient(135deg, #12735f, #2f6f9f);
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(18, 115, 95, 0.22);
}

.stats {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.stat strong {
  font-size: clamp(18px, 2.4vw, 24px);
}

.chart-card {
  background: #fff;
}

.entry-form {
  margin-top: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.drawer,
.report-sheet {
  background: rgba(18, 24, 21, 0.42);
}

.drawer-panel,
.sheet-panel {
  border-radius: 18px 18px 0 0;
}

.menu-row {
  min-height: 48px;
}

.file-hint {
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 40;
  width: min(420px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 12px 14px;
  border-radius: 8px;
  background: #12211c;
  color: #fff;
  box-shadow: 0 18px 42px rgba(18, 24, 21, 0.22);
  animation: toastIn 180ms ease both;
}

.toast.error {
  background: #8f2f29;
}

.toast.hidden {
  display: none;
}

.auth-overlay,
.scan-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 24, 21, 0.46);
  backdrop-filter: blur(8px);
}

.auth-overlay.hidden,
.scan-modal.hidden {
  display: none;
}

.auth-panel,
.scan-panel {
  width: min(460px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(18, 24, 21, 0.24);
}

.auth-panel p:not(.eyebrow) {
  margin: 12px 0 18px;
  color: var(--muted);
}

.auth-actions {
  display: grid;
  gap: 10px;
}

.telegram-login-slot {
  display: grid;
  min-height: 42px;
  place-items: center;
  margin-top: 12px;
}

.telegram-login-link {
  display: inline-flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  border-radius: 8px;
  background: #16806a;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.telegram-secondary-btn {
  width: 100%;
  min-height: 44px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.telegram-login-help,
.auth-note {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.auth-note {
  margin: 12px 0 0;
}

.telegram-login-link.hidden {
  display: none;
}

.scan-form {
  display: grid;
  gap: 10px;
}

.catalog-preview {
  align-self: stretch;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 115, 95, 0.08), rgba(47, 111, 159, 0.08)),
    #fff;
}

.catalog-preview strong {
  color: var(--text);
  font-size: 14px;
}

.catalog-preview span {
  color: var(--muted);
  font-size: 12px;
}

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

.stack-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.stack-item small {
  color: var(--muted);
}

.trust-badge {
  width: fit-content;
  padding: 5px 8px;
  color: #17362f;
  border: 1px solid rgba(22, 128, 106, 0.2);
  border-radius: 8px;
  background: rgba(94, 224, 189, 0.18);
  font-size: 12px;
  font-weight: 700;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 980px) {
  .topbar {
    margin: 0 -12px 12px;
    padding: 10px 12px;
  }

  .hero-grid {
    gap: 10px;
  }

  .summary-card {
    min-width: 82vw;
  }

  .panel,
  .workspace,
  .chart-card {
    padding: 14px;
  }

  .status-bar {
    margin-top: 0;
  }

  .quick-actions {
    top: 61px;
    margin-inline: -2px;
    padding: 8px 0;
    background: rgba(244, 247, 245, 0.92);
  }

  .action-card {
    min-height: 64px;
  }

  .stats {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
  }

  .stat {
    min-width: 68vw;
    scroll-snap-align: start;
  }

  .entry-form {
    padding: 14px;
  }

  .drawer-panel,
  .sheet-panel {
    max-height: 92vh;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .shell {
    width: 100%;
    max-width: 100vw;
    padding-inline: 10px;
  }

  .hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .summary-card {
    min-width: 0;
  }

  .layout,
  .panel,
  .workspace {
    min-width: 0;
    width: 100%;
  }

  .panel {
    padding: 12px;
  }

  .cars {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    max-width: 100%;
  }

  .car-item {
    grid-template-columns: 38px minmax(0, 1fr);
    min-width: 0;
    max-width: 100%;
    width: 100%;
    padding-inline: 10px;
  }

  .car-badge {
    width: 38px;
    height: 38px;
  }

  .car-copy {
    min-width: 0;
  }

  .car-copy strong,
  .car-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .passport-head {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .score-ring {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
  }

  .quick-actions {
    grid-template-columns: repeat(3, minmax(96px, 1fr));
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .report-records,
  .history,
  .record {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .auth-overlay {
    align-items: stretch;
    padding: 14px;
  }

  .auth-panel {
    align-self: center;
    width: 100%;
    padding: 20px;
  }
}
