:root {
  --bg: #07111f;
  --panel: #0f172a;
  --panel2: #111827;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --soft: #94a3b8;
  --line: #334155;
  --accent: #f97316;
  --blue: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
  --tap: 48px;
  --side-width: 420px;
  --map-phone-height: 48svh;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body { overscroll-behavior: none; }

body[data-layout-mode="balanced"] { --side-width: 420px; }
body[data-layout-mode="half"] { --side-width: min(50vw, 560px); }
body[data-layout-mode="mapwide"] { --side-width: 340px; }
body[data-layout-mode="mapmax"] { --side-width: 260px; }
body[data-phone-map-height="normal"] { --map-phone-height: 48svh; }
body[data-phone-map-height="tall"] { --map-phone-height: 62svh; }
body[data-phone-map-height="max"] { --map-phone-height: 78svh; }

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.topbar {
  padding: 12px 14px;
  background: linear-gradient(90deg, #08111f, #172554);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
}

.topbar .sub {
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px 8px;
  background: rgba(15, 23, 42, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 64px;
  z-index: 18;
}

.tab {
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid #475569;
  background: #1e293b;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 14px;
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  border-color: #fdba74;
  color: #111827;
  font-weight: 800;
}

.view { display: none; }
.view.active { display: block; }

#view-map .content-split {
  display: grid;
  grid-template-columns: minmax(240px, var(--side-width)) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  align-items: stretch;
  background: var(--bg);
}

body[data-layout-mode="stacked"] #view-map .content-split {
  display: flex;
  flex-direction: column;
}

#view-map .side-panel {
  position: relative;
  z-index: 2;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  border-right: 1px solid var(--line);
}

#view-map .map-wrap {
  position: relative;
  z-index: 1;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: #dbeafe;
  height: calc(100svh - 122px);
  min-height: 520px;
}

body[data-layout-mode="stacked"] #view-map .map-wrap {
  height: 62svh;
  min-height: 420px;
  border-left: 0;
  border-top: 1px solid var(--line);
}

#map {
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  background: #dbeafe;
}

.panel {
  padding: 14px;
  max-width: 1100px;
  margin: 0 auto;
}

.side-panel.panel {
  max-width: none;
  margin: 0;
}

.card, details.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  margin: 0 0 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

.card h2, .card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: #fed7aa;
}

.card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 8px 0;
}

.card p, .notes, .route-notes, .api-warning p, .google-ok p {
  overflow-wrap: anywhere;
  word-break: normal;
}

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

.route-card, .place-card, .day-card {
  border-top: 1px solid #263244;
  padding: 12px 0;
}

.route-card:first-child, .place-card:first-child, .day-card:first-child {
  border-top: 0;
}

.kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.title {
  font-weight: 850;
  font-size: 15px;
  margin: 3px 0;
}

.meta, .notes {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 9px;
}

a.btn, button.btn {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 12px;
  padding: 11px 12px;
  border: 1px solid #475569;
  background: #1e293b;
  color: var(--ink);
  font-weight: 750;
  font-size: 14px;
  cursor: pointer;
}

a.btn.primary, button.btn.primary {
  background: #2563eb;
  border-color: #60a5fa;
}

a.btn.map, button.btn.map {
  background: #0f766e;
  border-color: #5eead4;
}

a.btn.warning, button.btn.warning {
  background: #b45309;
  border-color: #fdba74;
}

.filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid #475569;
  background: #111827;
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}

.filter-chip.active {
  background: #0f766e;
  border-color: #5eead4;
  font-weight: 800;
}

.install-box { display: none; }
.install-box.show { display: block; }

.summary {
  cursor: pointer;
  list-style: none;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  color: #fed7aa;
  font-weight: 850;
}

summary::-webkit-details-marker { display: none; }

.summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
}

details:not([open]) .summary::after { content: "▸"; }

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #475569;
  border-radius: 999px;
  padding: 3px 8px;
  color: #dbeafe;
  font-size: 12px;
  margin: 3px 4px 3px 0;
}

.api-warning {
  background: #451a03;
  border: 1px solid #f59e0b;
  color: #ffedd5;
}

.api-warning strong { color: #fff7ed; }

.google-ok {
  background: #052e2b;
  border-color: #14b8a6;
  color: #ccfbf1;
}

.google-ok h2 { color: #99f6e4; }

.gm-style-iw { color: #111827; }

.fallback-marker-dot {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}

.leaflet-popup-content {
  color: #111827;
  font-size: 14px;
  line-height: 1.35;
}

.leaflet-popup-content a {
  color: #2563eb;
  font-weight: 700;
}

.leaflet-tooltip.marker-label {
  background: rgba(15, 23, 42, .88);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  font-weight: 800;
  padding: 3px 7px;
}

.map-label {
  color: #111827;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.25);
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 1px rgba(255,255,255,.9);
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 4px;
}

.text-input, .text-area {
  width: 100%;
  border: 1px solid #475569;
  background: #020617;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 15px;
}

.text-area {
  min-height: 88px;
  resize: vertical;
}

.result-box {
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid #475569;
  background: #020617;
  color: #dbeafe;
  font-size: 14px;
}

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

.phrase-grid > div {
  padding: 10px;
  border: 1px solid #334155;
  background: #020617;
  border-radius: 12px;
}

.phrase-grid span {
  color: var(--muted);
}

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

.choice-list label {
  min-height: 42px;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: #020617;
  cursor: pointer;
}

.packing-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid #263244;
}

.packing-item:first-child {
  border-top: 0;
}

.packing-item input {
  margin-top: 4px;
  transform: scale(1.2);
}

.packing-item span {
  color: var(--muted);
  line-height: 1.35;
}

body.map-fullscreen-active .topbar,
body.map-fullscreen-active .tabs,
body.map-fullscreen-active #view-map .side-panel {
  display: none;
}

body.map-fullscreen-active #view-map .content-split {
  display: block;
}

body.map-fullscreen-active #view-map .map-wrap {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100svh;
  min-height: 0;
  border: 0;
}

body.map-fullscreen-active #map {
  height: 100%;
}

@media (min-width: 760px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .btn-row { grid-template-columns: 1fr 1fr; }
  .phrase-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .topbar { position: sticky; top: 0; z-index: 20; }
  .tabs { top: 61px; }
  #view-map .content-split {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: visible;
  }
  #view-map .map-wrap {
    order: 1;
    height: var(--map-phone-height);
    min-height: 300px;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }
  #view-map .side-panel {
    order: 2;
    max-width: none;
    width: 100%;
    overflow: visible;
    border-right: 0;
  }
  .panel { padding: 12px; }
  .card { border-radius: 14px; padding: 12px; }
  .tab { min-height: 40px; padding: 8px 12px; }
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 18px; }
  .topbar .sub { font-size: 11px; }
  .btn-row { grid-template-columns: 1fr; }
  #view-map .map-wrap { min-height: 280px; }
}


/* HOL-NAPLES-PWA-05 detailed wallet */
.wallet-card h2 {
  margin-bottom: 10px;
}

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

.wallet-card-header > div {
  min-width: 0;
}

.compact-btn {
  min-height: 38px !important;
  width: auto !important;
  padding: 8px 12px !important;
  white-space: nowrap;
}

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

.ticket-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.ticket-card {
  border: 1px solid #334155;
  background: #020617;
  border-radius: 14px;
  padding: 12px;
}

.ticket-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket-card-top h3 {
  margin: 0;
  color: #fed7aa;
  font-size: 15px;
}

.mono-area {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  min-height: 120px;
}

@media (max-width: 640px) {
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .wallet-card-header {
    display: block;
  }

  .compact-btn {
    width: 100% !important;
    margin-top: 8px;
  }

  .ticket-card-top {
    display: block;
  }
}


/* HOL-NAPLES-PWA-06 wallet file vault */
.file-section {
  margin-top: 14px;
  border: 1px dashed #475569;
  border-radius: 14px;
  padding: 11px;
  background: rgba(2, 6, 23, .55);
}

.file-section-title {
  color: #bfdbfe;
  font-weight: 850;
  margin-bottom: 4px;
}

.file-help {
  margin: 4px 0 8px !important;
  font-size: 12px !important;
  color: var(--muted) !important;
}

.file-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.file-picker-btn {
  position: relative;
  overflow: hidden;
}

.file-picker {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

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

.file-empty {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
  background: #020617;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 9px;
  background: #020617;
}

.file-main {
  min-width: 0;
}

.file-main strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.file-main span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.file-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

@media (max-width: 640px) {
  .file-upload-row,
  .file-item {
    grid-template-columns: 1fr;
  }

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