:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #14213d;
  --muted: #657786;
  --line: #d8e0e6;
  --brand: #0d3b66;
  --brand-2: #2a9d8f;
  --danger: #b42318;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #e8f1f2 0, var(--bg) 280px);
  -webkit-text-size-adjust: 100%;
}

.app {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 18px calc(18px + var(--safe-bottom));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(20, 33, 61, 0.08);
}

.auth {
  min-height: calc(100vh - 36px);
  display: grid;
  align-content: center;
  gap: 24px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  font-size: 20px;
}

.eyebrow {
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted,
.sectionTitle p {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 46px;
  padding: 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  background: #fbfcfd;
}

button,
.button {
  appearance: none;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  min-height: 46px;
  padding: 12px 14px;
  text-align: center;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.filePicker {
  border: 1px dashed #8aa6b8;
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfc;
}

.filePicker input {
  border: 0;
  min-height: auto;
  padding: 8px 0 0;
  background: transparent;
}

.filePicker strong {
  display: block;
  color: var(--brand);
  font-size: 15px;
  padding-top: 10px;
}

.fileActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.fileAction {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
}

.fileAction input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.secondaryAction {
  background: var(--brand-2);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}

.secondary {
  background: var(--brand-2);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 0;
  background: linear-gradient(180deg, #e8f1f2 0, rgba(232, 241, 242, 0.92) 100%);
}

.tab {
  background: #dfe9ee;
  color: var(--brand);
}

.tab.active {
  background: var(--brand);
  color: white;
}

.tabpane {
  display: grid;
  gap: 14px;
}

.sectionTitle {
  display: grid;
  gap: 4px;
}

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.summary span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fbfc;
  display: grid;
  gap: 4px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.actions.single {
  grid-template-columns: 1fr;
}

.install {
  margin-top: 20px;
}

.qr {
  width: min(260px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.steps {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.history {
  display: grid;
  gap: 10px;
}

.receipt {
  display: grid;
  gap: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.receiptActions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.danger {
  background: var(--danger);
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.cameraModal {
  position: fixed;
  inset: 0;
  background: rgba(9, 20, 28, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  z-index: 1000;
}

.cameraModal video {
  width: 100%;
  max-width: 480px;
  max-height: 65vh;
  border-radius: 12px;
  background: #000;
  object-fit: cover;
}

.cameraModal .error {
  color: #ff8a80;
  margin: 0;
}

.cameraControls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

.cameraControls .ghost {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

@media (max-width: 620px) {
  .app {
    padding: 10px 10px calc(16px + var(--safe-bottom));
  }

  .panel {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    margin-top: 8px;
  }

  .grid,
  .summary,
  .actions,
  .receiptActions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 18px;
  }

  .tabs {
    gap: 6px;
  }

  .tab {
    padding-inline: 8px;
  }

  .receiptHeader {
    display: grid;
  }
}
