:root {
  --paper: #efe4d0;
  --paper-soft: #f8f0df;
  --ink: #232323;
  --muted: #6f665c;
  --line: #d8c6a9;
  --red: #b64232;
  --blue: #1f3f4a;
  --green: #476b55;
  --gold: #aa7b35;
  --shadow: 0 14px 42px rgba(40, 30, 18, 0.18);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #1f2a2e;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 12%, rgba(182, 66, 50, 0.08), transparent 26rem),
    linear-gradient(90deg, rgba(55, 43, 32, 0.16) 0 1px, transparent 1px 100%),
    linear-gradient(var(--paper), var(--paper-soft));
  background-size: auto, 18px 18px, auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  position: relative;
  background: rgba(248, 240, 223, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
  overflow: hidden;
}

.login-card::before,
.passport-hero::before,
.stamp-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px dashed rgba(35, 35, 35, 0.2);
  pointer-events: none;
}

.airmail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--blue);
  border: 2px solid var(--blue);
  padding: 5px 10px;
  transform: rotate(-2deg);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.login-card h1,
.passport-hero h1 {
  margin: 20px 0 8px;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2.5rem, 13vw, 4.6rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-card p {
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}

.field span,
.field label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.8);
  color: var(--ink);
  padding: 12px;
  border-radius: 8px;
  outline: none;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.primary,
.secondary,
.ghost,
.icon-btn {
  border: 0;
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary {
  background: var(--ink);
  color: #fff8e8;
}

.secondary {
  color: var(--ink);
  background: #ead8b6;
  border: 1px solid #cdb792;
}

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

.icon-btn {
  width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 252, 244, 0.72);
  border: 1px solid var(--line);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(239, 228, 208, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(60, 48, 33, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  transform: rotate(-7deg);
  color: var(--red);
  font-weight: 950;
  font-family: Impact, "Arial Black", sans-serif;
  background: var(--paper-soft);
}

.brand-title {
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.content {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.passport-hero {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  background:
    linear-gradient(105deg, rgba(248, 240, 223, 0.95), rgba(232, 215, 184, 0.78)),
    repeating-linear-gradient(0deg, rgba(35, 35, 35, 0.04), rgba(35, 35, 35, 0.04) 1px, transparent 1px, transparent 8px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid;
  align-items: end;
}

.passport-hero::after {
  content: "FIRST CLASS";
  position: absolute;
  right: 22px;
  top: 26px;
  transform: rotate(6deg);
  border: 3px solid var(--ink);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 950;
  opacity: 0.72;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.hero-copy p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 600;
}

.hero-stamps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: end;
}

.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 3px solid currentColor;
  color: var(--red);
  padding: 8px 12px;
  font-weight: 950;
  text-transform: uppercase;
  background: rgba(255, 252, 244, 0.54);
}

.stamp:nth-child(2n) {
  color: var(--blue);
  transform: rotate(3deg);
}

.stamp:nth-child(3n) {
  color: var(--green);
  transform: rotate(-4deg);
  border-radius: 50%;
  aspect-ratio: 1;
}

.stats-grid,
.cards-grid,
.two-col {
  display: grid;
  gap: 12px;
}

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

.stat,
.panel,
.day-card,
.place-card,
.doc-card,
.check-card,
.stamp-card {
  background: rgba(255, 252, 244, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(55, 43, 32, 0.08);
}

.stat {
  padding: 14px;
}

.stat strong {
  display: block;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
  letter-spacing: 0;
}

.stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.section-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.tabs {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(31, 42, 46, 0.94);
  backdrop-filter: blur(18px);
}

.tab {
  min-width: 0;
  border: 0;
  color: rgba(255, 248, 232, 0.74);
  background: transparent;
  border-radius: 8px;
  padding: 8px 4px;
  display: grid;
  gap: 3px;
  justify-items: center;
  font-size: 0.68rem;
  font-weight: 800;
}

.tab.active {
  color: #fff8e8;
  background: rgba(255, 248, 232, 0.12);
}

.tab svg,
.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.day-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.day-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.day-title strong {
  display: block;
  font-size: 1rem;
}

.day-title span,
.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.day-badge {
  flex: 0 0 auto;
  color: var(--red);
  border: 2px solid var(--red);
  padding: 6px 8px;
  font-weight: 950;
  transform: rotate(3deg);
  align-self: flex-start;
}

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

.time-block {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  border-top: 1px solid rgba(216, 198, 169, 0.78);
  padding-top: 10px;
}

.time {
  color: var(--blue);
  font-weight: 950;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.filters {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 4px;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.68);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 800;
  font-size: 0.82rem;
}

.chip.active {
  background: var(--ink);
  color: #fff8e8;
  border-color: var(--ink);
}

.doc-card,
.place-card,
.check-card,
.panel {
  padding: 14px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ead8b6;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
}

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

.passport-mode {
  background: #f7edda;
  border: 3px solid var(--ink);
  padding: 16px;
  box-shadow: var(--shadow);
}

.passport-mode h2 {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2rem, 10vw, 4rem);
  line-height: 0.9;
  text-transform: uppercase;
  letter-spacing: 0;
}

.translation-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.translation {
  border: 1px solid var(--line);
  padding: 12px;
  background: rgba(255, 252, 244, 0.66);
}

.translation strong {
  display: block;
  color: var(--red);
  margin-bottom: 6px;
}

.map-list {
  display: grid;
  gap: 8px;
}

.map-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.62);
  border-radius: 8px;
}

.pin {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff8e8;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  font-weight: 950;
}

.pin span {
  transform: rotate(45deg);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(31, 42, 46, 0.45);
  display: none;
  align-items: flex-end;
}

.drawer.open {
  display: flex;
}

.sheet {
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  background: var(--paper-soft);
  border-radius: 18px 18px 0 0;
  padding: 18px;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.24);
}

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

.sheet h2 {
  margin: 0;
}

.status-line {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 10px;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 60;
  background: var(--ink);
  color: #fff8e8;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(140%);
  transition: transform 0.25s ease;
}

.toast.show {
  transform: translateY(0);
}

.empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.list-reset {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.check-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px;
  background: rgba(255, 252, 244, 0.64);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-item input {
  width: 20px;
  height: 20px;
}

.stamp-card {
  position: relative;
  padding: 18px;
  min-height: 130px;
  overflow: hidden;
}

.stamp-card strong {
  display: block;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 2.2rem;
  line-height: 0.95;
  letter-spacing: 0;
}

@media (min-width: 760px) {
  .app {
    padding-bottom: 0;
  }

  .content {
    padding: 24px;
  }

  .hero-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }

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

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

  .two-col {
    grid-template-columns: 1fr 1fr;
  }

  .tabs {
    top: 78px;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 32px));
    border-radius: 14px;
    padding: 8px;
    box-shadow: var(--shadow);
  }

  .content {
    padding-top: 88px;
  }

  .sheet {
    width: min(560px, calc(100% - 32px));
    margin: 0 auto 16px;
    border-radius: 18px;
  }

  .drawer {
    align-items: center;
  }

  .toast {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: min(360px, calc(100% - 48px));
  }
}
