/* Portico — Passport Ledger Deck theme */

:root {
  --ink: #20324b;
  --paper: #d8c7a8;
  --paper-light: #e6d9c0;
  --paper-dark: #c9b58f;
  --copper: #b66a3c;
  --copper-dark: #9c5630;
  --moss: #5c6b3c;
  --rust: #9a4a30;
  --indigo: #20324b;
  --card: #f3ead6;
  --line: rgba(32, 50, 75, 0.22);
  --side-pad: 16px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% 0%, #e9dcbf 0%, var(--paper) 55%, var(--paper-dark) 100%);
  font-size: 17px;
  line-height: 1.45;
  overscroll-behavior-y: contain;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  padding-top: calc(var(--safe-t) + 14px);
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 18px);
}

.screen { padding: 0 var(--side-pad); display: none; }
.screen.active { display: block; }

h1.screen-title {
  font-size: 24px;
  margin: 4px 0 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

p.screen-sub {
  margin: 0 0 14px;
  font-style: italic;
  font-size: 15px;
  opacity: 0.75;
}

/* ---------- Ticket header (Passport) ---------- */
.ticket {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 14px 16px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 0 rgba(32, 50, 75, 0.15);
  overflow: hidden;
}
.ticket::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 7px,
    transparent 7px 14px
  );
  opacity: 0.85;
}
.ticket-inner {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ticket-title {
  font-size: 21px;
  font-weight: bold;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.ticket-sub { font-size: 13px; font-style: italic; opacity: 0.7; }
.ticket-stub {
  flex: none;
  border-left: 2px dashed var(--line);
  padding-left: 12px;
  font-size: 12px;
  text-align: center;
  line-height: 1.3;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Tiny counters ---------- */
.counters {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.counter {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.counter b { font-size: 22px; }
.counter span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* ---------- Copper add strip ---------- */
.add-strip {
  display: block;
  width: 100%;
  min-height: 54px;
  border: 1.5px solid var(--copper-dark);
  border-radius: 12px;
  background: linear-gradient(180deg, #c67a48 0%, var(--copper) 100%);
  color: #f6ecd9;
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 3px rgba(32, 50, 75, 0.25);
}
.add-strip:active { transform: translateY(1px); }

/* ---------- Next-Want focus card ---------- */
.focus-card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  padding: 18px 16px 16px;
  overflow: hidden;
}
.focus-card .band {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 10px;
  background: var(--indigo);
}
.focus-card .kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.7;
  margin: 0 0 6px 16px;
}
.focus-card h2 {
  margin: 0 0 4px 16px;
  font-size: 22px;
  line-height: 1.25;
}
.focus-card .meta { margin: 0 0 10px 16px; font-style: italic; font-size: 15px; opacity: 0.8; }
.focus-card .note { margin: 10px 0 0 16px; font-size: 15px; border-top: 1px dashed var(--line); padding-top: 10px; }

/* ---------- Stamp rows ---------- */
.group-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1.5px solid var(--ink);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.group-title small { font-weight: normal; opacity: 0.7; }

.stamp {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 10px;
  padding: 10px 12px 10px 0;
  margin-bottom: 10px;
  min-height: 44px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
}
.stamp .band {
  flex: none;
  width: 8px;
  margin-right: 12px;
}
.stamp .band.want { background: var(--indigo); }
.stamp .band.visited { background: var(--moss); }
.stamp .band.return { background: var(--rust); }
.stamp .stamp-body { flex: 1; min-width: 0; }
.stamp .site { font-weight: bold; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stamp .coll { font-style: italic; font-size: 14px; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stamp .state-word {
  flex: none;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  flex: none;
}
.dot.filled.want { background: var(--indigo); }
.dot.filled.visited { background: var(--moss); }
.dot.filled.return { background: var(--rust); }

/* perforated side notches (half-circles punched at the right edge) */
.stamp::before, .stamp::after {
  content: "";
  position: absolute;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--ink);
  z-index: 2;
  pointer-events: none;
}
.stamp::before { top: -8px; }
.stamp::after { bottom: -8px; }

/* ---------- Actions sheet / row actions ---------- */
.row-actions {
  display: flex;
  gap: 10px;
  padding: 4px 0 12px;
}
.row-actions button {
  flex: 1;
  min-height: 44px;
  font-family: inherit;
  font-size: 15px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.row-actions button.primary { background: var(--ink); color: var(--paper); }
.row-actions button.cycle { background: var(--paper-light); }
.row-actions button.danger { background: #f0ddd2; color: var(--rust); border-color: var(--rust); }

/* ---------- Forms (Log) ---------- */
.panel {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 16px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.field .req { color: var(--copper); }
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--paper-light);
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--copper);
  outline-offset: 1px;
}
.field .err {
  display: none;
  color: var(--rust);
  font-size: 14px;
  margin-top: 4px;
}
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid select, .field.invalid textarea {
  border-color: var(--rust);
  background: #f4e2d8;
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.form-actions button {
  flex: 1;
  min-height: 48px;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  border: 1.5px solid var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-actions .save { background: var(--ink); color: var(--paper); }
.form-actions .cancel { background: transparent; color: var(--ink); }
.form-hint { font-size: 13px; font-style: italic; opacity: 0.7; margin-top: 10px; }

/* ---------- Search (Find) ---------- */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap input {
  width: 100%;
  min-height: 48px;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 10px 40px 10px 14px;
}
.search-wrap input:focus { outline: 2px solid var(--copper); }
.search-clear {
  position: absolute;
  right: 6px; top: 5px;
  min-width: 38px; min-height: 38px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--ink);
  cursor: pointer;
  border-radius: 50%;
}
.result-count { font-size: 14px; font-style: italic; opacity: 0.75; margin: 0 0 10px; }

/* state filter chips on Find */
.chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  min-height: 36px;
  padding: 4px 14px;
  font-family: inherit;
  font-size: 14px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip.on { background: var(--ink); color: var(--paper); }

/* ---------- Empty states ---------- */
.empty {
  text-align: center;
  padding: 42px 12px 34px;
  color: var(--ink);
}
.empty .arc {
  width: 120px; height: 90px;
  margin: 0 auto 14px;
  border: 2.5px solid rgba(32, 50, 75, 0.28);
  border-bottom: none;
  border-radius: 60px 60px 0 0;
  position: relative;
}
.empty .arc::before {
  content: "";
  position: absolute;
  inset: 10px 12px 0;
  border: 1.5px dashed rgba(32, 50, 75, 0.22);
  border-bottom: none;
  border-radius: 50px 50px 0 0;
}
.empty p { margin: 0; font-style: italic; font-size: 16px; opacity: 0.8; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  background: linear-gradient(180deg, #e8dcc2 0%, var(--paper) 100%);
  border-top: 1.5px solid var(--ink);
  padding: 6px 8px calc(6px + var(--safe-b));
  display: flex;
  gap: 6px;
  max-width: 560px;
  margin: 0 auto;
}
.tab {
  flex: 1;
  min-height: 48px;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 10px;
  opacity: 0.65;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.tab .protector {
  width: 26px; height: 26px;
  position: relative;
}
.tab .protector i {
  position: absolute;
  width: 0; height: 0;
  border-style: solid;
}
/* brass corner-protector silhouette: four tiny photo-corner triangles */
.tab .protector i:nth-child(1) { top: 0; left: 0; border-width: 9px 9px 0 0; border-color: var(--copper) transparent transparent transparent; border-top-left-radius: 4px; }
.tab .protector i:nth-child(2) { top: 0; right: 0; border-width: 0 9px 9px 0; border-color: transparent var(--copper) transparent transparent; border-top-right-radius: 4px; }
.tab .protector i:nth-child(3) { bottom: 0; right: 0; border-width: 0 0 9px 9px; border-color: transparent transparent var(--copper) transparent; border-bottom-right-radius: 4px; }
.tab .protector i:nth-child(4) { bottom: 0; left: 0; border-width: 9px 0 0 9px; border-color: transparent transparent transparent var(--copper); border-bottom-left-radius: 4px; }
.tab.active {
  opacity: 1;
  background: rgba(255, 251, 240, 0.55);
  border-color: var(--line);
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(32, 50, 75, 0.22);
}
.tab.active .protector i:nth-child(1) { border-top-color: var(--copper-dark); }
.tab.active .protector i:nth-child(2) { border-right-color: var(--copper-dark); }
.tab.active .protector i:nth-child(3) { border-bottom-color: var(--copper-dark); }
.tab.active .protector i:nth-child(4) { border-left-color: var(--copper-dark); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 14px);
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
  max-width: 88%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
