@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --canvas: #e8eef6;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #5b667a;
  --brand-red: #c81e2b;
  --brand-red-deep: #9f1222;
  --brand-red-soft: rgba(200, 30, 43, 0.11);
  --obsidian: #0f172a;
  --obsidian-hover: #1e293b;
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, 0.13);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.11);

  --glass-surface: linear-gradient(145deg, rgba(255, 255, 255, 0.90) 0%, rgba(248, 251, 255, 0.78) 100%);
  --glass-worksurface: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 252, 255, 0.86) 100%);
  --glass-floating: linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 254, 0.95) 100%);
  --glass-bar-bg: rgba(248, 250, 254, 0.86);
  --glass-border: rgba(255, 255, 255, 0.90);
  --glass-rim: inset 0 1px 0 0 rgba(255, 255, 255, 0.98), inset 0 0 0 1px rgba(255, 255, 255, 0.48);
  --hairline: rgba(15, 23, 42, 0.085);
  --hairline-strong: rgba(15, 23, 42, 0.14);

  --shadow-glass: 0 12px 28px -10px rgba(15, 23, 42, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-floating: 0 22px 48px -10px rgba(15, 23, 42, 0.24), 0 6px 18px -4px rgba(15, 23, 42, 0.09);
  --shadow-btn-primary: 0 8px 20px -4px rgba(200, 30, 43, 0.34), inset 0 1px 0 0 rgba(255, 255, 255, 0.28);

  --radius-xl: 26px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --blur-panel: blur(12px) saturate(150%);
  --blur-floating: blur(14px) saturate(165%);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--canvas);
  background-image:
    radial-gradient(60vw 60vw at 8% 0%, rgba(132, 169, 236, 0.42), transparent 65%),
    radial-gradient(50vw 50vw at 94% 6%, rgba(232, 142, 152, 0.28), transparent 62%),
    linear-gradient(180deg, #eff3f9 0%, #e2e8f2 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.num-tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.glass-panel {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), var(--glass-rim);
  border-radius: var(--radius-lg);
}

.glass-worksurface {
  background: var(--glass-worksurface);
}

.glass-floating {
  background: var(--glass-floating);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: var(--shadow-floating), var(--glass-rim);
}

.glass-bar {
  background: var(--glass-bar-bg);
  -webkit-backdrop-filter: var(--blur-floating);
  backdrop-filter: var(--blur-floating);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-rim);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  width: 100%;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(84px + env(safe-area-inset-bottom, 0px));
}

.content-wrap {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: screen-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes screen-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), var(--glass-rim);
}

.app-topbar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
}

.app-topbar__title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar__title strong {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.15;
  white-space: nowrap;
}

.app-topbar__title span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.app-topbar__utilities {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.connectivity {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.connectivity em {
  font-style: normal;
}

.connectivity.is-offline {
  color: var(--warn);
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px 4px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.sidebar {
  display: none;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.08), var(--glass-rim);
}

.bottom-nav__item {
  appearance: none;
  border: 0;
  background: transparent;
  min-height: 48px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.16s ease, background-color 0.16s ease, transform 0.14s ease;
}

.bottom-nav__item:active {
  transform: scale(0.96);
}

.bottom-nav__item.is-active {
  color: var(--brand-red);
  background: rgba(200, 30, 43, 0.08);
}

.bottom-nav__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav__badge {
  position: absolute;
  top: -5px;
  right: -12px;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--brand-red);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.bottom-nav__label {
  white-space: nowrap;
  line-height: 1.1;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  min-height: 46px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  white-space: nowrap;
  transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn--big {
  min-height: 50px;
  padding: 12px 22px;
  font-size: 15px;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: linear-gradient(180deg, #d92332 0%, #b81926 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: var(--shadow-btn-primary);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #e02837 0%, #a61521 100%);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border-color: rgba(15, 23, 42, 0.11);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.btn--secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.94);
}

.btn--ghost {
  background: rgba(15, 23, 42, 0.05);
  color: var(--ink-secondary);
  border-color: transparent;
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.09);
}

.btn--ghost-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.22);
}

.btn--danger {
  background: linear-gradient(180deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  box-shadow: 0 8px 20px -4px rgba(190, 18, 60, 0.35);
}

.icon-button {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 1px solid rgba(15, 23, 42, 0.09);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.14s ease, background-color 0.15s ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.95);
}

.icon-button:active {
  transform: scale(0.95);
}

.text-button {
  appearance: none;
  border: 0;
  background: transparent;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink-secondary);
}

.text-button--danger {
  color: var(--danger);
}

.text-button--danger:hover:not(:disabled) {
  background: var(--danger-soft);
}

.text-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.home-top-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.hero-card--active {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88) 0%, rgba(240, 246, 255, 0.74) 100%);
  border-color: rgba(255, 255, 255, 0.92);
}

.hero-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.07);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-card__icon--red {
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.hero-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.hero-card__body h2 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 3.5vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.hero-card__body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.hero-card__summary strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
}

.hero-card__actions {
  display: flex;
  padding-top: 2px;
}

.hero-card__actions .btn {
  width: 100%;
}

.driver-panel {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: space-between;
}

.driver-panel__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.panel-heading__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.065);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.panel-heading__icon--red {
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.driver-panel__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.driver-panel__copy strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.driver-panel__copy span {
  font-size: 12.5px;
  color: var(--muted);
}

.driver-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.driver-field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.driver-field input,
.form-field input,
.form-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 13px;
  border: 1px solid rgba(15, 23, 42, 0.13);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.driver-field input:focus,
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(200, 30, 43, 0.14);
}

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

.stat-card {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), var(--glass-rim);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card--accent {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 241, 242, 0.82) 100%);
}

.stat-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-card__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.stat-card__icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.055);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stat-card--accent .stat-card__icon {
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.stat-card__value {
  font-size: clamp(1.3rem, 3.2vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

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

.quick-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.section-title p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.quick-card {
  appearance: none;
  width: 100%;
  min-height: 60px;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.075);
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  transition: transform 0.14s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.quick-card:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 23, 42, 0.14);
}

.quick-card:active {
  transform: scale(0.985);
}

.quick-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-card__icon--red {
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.quick-card__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-card__text strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}

.quick-card__text small {
  font-size: 12.5px;
  color: var(--muted);
}

.quick-card__arrow {
  color: var(--muted);
  flex-shrink: 0;
}

.empty-trip {
  padding: 34px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-trip__icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--brand-red-soft);
  color: var(--brand-red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-trip h2 {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 800;
}

.empty-trip p {
  margin: 0 0 8px;
  max-width: 44ch;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.trip-status {
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  position: relative;
  z-index: 45;
}

.trip-status__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand-red-soft);
  color: var(--brand-red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trip-status__copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trip-status__copy strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-status__copy span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-status__inline-total {
  font-style: normal;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-secondary);
}

.trip-status__total {
  display: none;
  text-align: right;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
  padding-right: 4px;
}

.trip-status__total span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.trip-status__total strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  font-family: var(--font-mono);
}

@media (min-width: 560px) {
  .trip-status__inline-total {
    display: none;
  }

  .trip-status__total {
    display: flex;
  }
}

.trip-status__actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.trip-icon-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.11);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}

.trip-icon-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.trip-icon-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  background: rgba(248, 250, 252, 0.75);
}

.trip-icon-btn--pdf:not(:disabled) {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.15);
  color: var(--ink);
}

.trip-icon-btn--pdf:hover:not(:disabled) {
  background: var(--obsidian);
  border-color: var(--obsidian);
  color: #ffffff;
}

.trip-icon-btn--close:not(:disabled) {
  background: var(--ok-soft);
  border-color: rgba(21, 128, 61, 0.24);
  color: var(--ok);
}

.trip-icon-btn--close:hover:not(:disabled) {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
}

.trip-icon-btn--cancel {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.22);
  color: var(--danger);
}

.trip-icon-btn--cancel:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.trip-workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trip-workspace__left,
.trip-workspace__right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.trip-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.scanner-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.panel-heading__text {
  flex: 1;
  min-width: 0;
}

.panel-heading__text h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.panel-heading__text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.scanner-state {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.scanner-state.is-live {
  color: var(--ok);
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 190px;
  max-height: 280px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, #111827 0%, #1e293b 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.camera-video.is-visible {
  opacity: 1;
}

.camera-placeholder {
  padding: 20px;
  text-align: center;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.camera-placeholder__glyph {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.camera-placeholder strong {
  font-size: 15px;
  font-weight: 700;
}

.camera-placeholder span {
  font-size: 12.5px;
  color: rgba(248, 250, 252, 0.72);
  max-width: 32ch;
}

.scan-frame {
  position: relative;
  width: 66%;
  height: 68%;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 999px rgba(9, 13, 24, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  pointer-events: none;
}

.scan-frame span {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.68);
  padding: 4px 10px;
  border-radius: 8px;
}

.camera-paused {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.76);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px;
  text-align: center;
}

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

.camera-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-button {
  appearance: none;
  min-height: 40px;
  padding: 7px 12px;
  border-radius: 11px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.76);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool-button.is-on {
  background: var(--obsidian);
  color: #ffffff;
}

.status-banner {
  padding: 11px 13px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.status-banner__icon {
  margin-top: 1px;
  flex-shrink: 0;
  color: var(--ink-secondary);
}

.status-banner p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.status-banner--ok {
  background: rgba(5, 150, 105, 0.09);
  border-color: rgba(5, 150, 105, 0.22);
}

.status-banner--ok .status-banner__icon,
.status-banner--ok p {
  color: #065f46;
}

.status-banner--warn {
  background: var(--warn-soft);
  border-color: rgba(217, 119, 6, 0.24);
}

.status-banner--warn .status-banner__icon,
.status-banner--warn p {
  color: #92400e;
}

.status-banner--error {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.24);
}

.status-banner--error .status-banner__icon,
.status-banner--error p {
  color: #991b1b;
}

.paste-qr {
  border-top: 1px solid var(--hairline);
  padding-top: 10px;
}

.paste-qr summary {
  list-style: none;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
}

.paste-qr summary::-webkit-details-marker {
  display: none;
}

.paste-qr__chevron {
  transition: transform 0.16s ease;
}

.paste-qr[open] .paste-qr__chevron {
  transform: rotate(90deg);
}

.paste-qr__body {
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.records-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.records-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
}

.records-title {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  flex: 1 1 210px;
  min-width: 0;
}

.records-title h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.records-title p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.records-header__side {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.records-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.records-clear-btn {
  appearance: none;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.records-clear-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.empty-state {
  padding: 28px 18px;
  border-radius: 16px;
  border: 1px dashed rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.52);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.055);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.empty-state strong {
  font-size: 15px;
  font-weight: 700;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 36ch;
}

.records-list-container {
  width: 100%;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
}

@media (max-width: 679px) {
  .records-table,
  .records-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .records-table thead {
    display: none;
  }

  .records-table tr.record-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto 36px;
    grid-template-areas:
      "num client client action"
      ".   inv    amount amount";
    align-items: center;
    gap: 6px 10px;
    padding: 10px 12px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.09);
  }

  .records-table td {
    padding: 0;
    border: 0;
  }

  .records-table td.row-num {
    grid-area: num;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.06);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
  }

  .records-table td.row-client {
    grid-area: client;
    min-width: 0;
    display: flex;
    align-items: center;
  }

  .records-table td.invoice-value {
    grid-area: inv;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    align-self: center;
    padding-top: 2px;
  }

  .records-table td.money-value {
    grid-area: amount;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    text-align: right;
    white-space: nowrap;
    align-self: center;
    padding-top: 2px;
  }

  .records-table td.row-action {
    grid-area: action;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
  }
}

@media (min-width: 680px) {
  .records-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    padding: 10px 10px;
    border-bottom: 1px solid var(--hairline-strong);
    vertical-align: middle;
  }

  .records-table th.col-amount,
  .records-table td.money-value {
    text-align: right;
  }

  .records-table th.col-num,
  .records-table td.row-num {
    width: 42px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--muted);
  }

  .records-table th.col-action,
  .records-table td.row-action {
    width: 48px;
    text-align: center;
    vertical-align: middle;
  }

  .records-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--hairline);
    vertical-align: middle;
  }

  .records-table td.invoice-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-secondary);
    white-space: nowrap;
  }

  .records-table td.money-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
  }
}

.client-edit-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.client-edit {
  width: 100%;
  height: 34px;
  min-height: 34px;
  padding: 4px 8px;
  margin: 0;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.025);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.client-edit:hover {
  background: rgba(15, 23, 42, 0.05);
}

.client-edit:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(200, 30, 43, 0.12);
}

.record-note {
  font-size: 11.5px;
  color: var(--muted);
}

.muted-dash {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
}

.row-delete {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.03);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  vertical-align: middle;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.row-delete:hover {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.24);
  color: var(--danger);
}

.records-footer {
  padding-top: 12px;
  border-top: 1px solid var(--hairline-strong);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.records-footer__note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.records-footer__total {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  margin-left: auto;
}

.records-footer__total b {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}



.history-panel,
.agenda-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.085);
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.history-item summary {
  list-style: none;
  min-height: 62px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-item__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.history-item__main strong {
  font-size: 14.5px;
  font-weight: 700;
}

.history-item__main span {
  font-size: 12.5px;
  color: var(--muted);
}

.history-item__side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.history-item__total {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
}

.history-item__chevron {
  color: var(--muted);
  transition: transform 0.16s ease;
}

.history-item details[open] .history-item__chevron {
  transform: rotate(90deg);
}

.history-item__detail {
  padding: 0 16px 16px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item__meta {
  padding-top: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.history-table-wrap {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 4px;
  border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}

.history-table td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.history-table td:nth-child(2) {
  word-break: break-word;
}

.history-table td:nth-child(3) {
  white-space: nowrap;
  font-size: 11.5px;
}

.history-table .col-amount {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

.history-item__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.clients-count {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  gap: 14px;
}

.clients-count__symbol {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--ok-soft);
  color: var(--ok);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clients-count__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clients-count__copy strong {
  font-size: 18px;
  font-weight: 800;
}

.clients-count__copy span {
  font-size: 13px;
  color: var(--muted);
}

.agenda-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.privacy-card {
  padding: 14px 16px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.privacy-card__icon {
  color: var(--ink-secondary);
  margin-top: 2px;
  flex-shrink: 0;
}

.privacy-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.44);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: sheet-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal__grabber {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.18);
  margin: 2px auto 2px;
}

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

.modal__titles h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.modal__titles p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.invoice-preview {
  padding: 13px 15px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--hairline-strong);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.invoice-preview__col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-preview__col span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
}

.invoice-preview__col strong {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 800;
}

.invoice-preview__cuit {
  grid-column: span 2;
  font-size: 12px;
  color: var(--ink-secondary);
  padding-top: 6px;
  border-top: 1px solid var(--hairline);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.form-field em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}

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

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 4px;
}

.toast-message {
  position: fixed;
  left: 50%;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  padding: 11px 18px;
  border-radius: 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 28px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

body.modal-open .toast-message {
  bottom: auto;
  top: calc(16px + env(safe-area-inset-top, 0px));
}

@media (min-width: 560px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-card--accent {
    grid-column: span 1;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }

  .modal {
    border-radius: 26px;
    padding: 22px;
  }

  .modal__grabber {
    display: none;
  }
}

@media (min-width: 960px) {
  .bottom-nav {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 20px;
    left: 20px;
    bottom: 20px;
    width: 256px;
    z-index: 35;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 14px;
    border-bottom: 1px solid var(--hairline);
  }

  .sidebar-brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .sidebar-brand__text strong {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.015em;
  }

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

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

  .nav-item {
    appearance: none;
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-secondary);
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .nav-item:hover {
    background: rgba(255, 255, 255, 0.56);
    color: var(--ink);
  }

  .nav-item.is-active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(15, 23, 42, 0.08);
    color: var(--brand-red);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  }

  .nav-item__label {
    flex: 1;
  }

  .nav-count {
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-red);
  }

  .nav-count--muted {
    color: var(--muted);
  }

  .sidebar-foot {
    padding: 12px 10px 2px;
    border-top: 1px solid var(--hairline);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
  }

  .main-content {
    padding: 20px 28px 36px 298px;
  }

  .home-top-grid {
    display: grid;
    grid-template-columns: 7fr 5fr;
    align-items: stretch;
  }

  .hero-card__actions .btn {
    width: auto;
  }

  .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trip-workspace {
    display: grid;
    grid-template-columns: 5fr 7fr;
    align-items: start;
  }

  .toast-message {
    bottom: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
