/* Dark trading-app look (Webull-style): near-black, dense rows, green up / red down. */
:root {
  --bg: #0b0d10;
  --surface: #15181d;
  --surface-2: #1d2128;
  --border: #23272f;
  --text: #eceef1;
  --muted: #8a919c;
  --faint: #5b626d;
  --up: #00c087;
  --up-soft: rgb(0 192 135 / .14);
  --down: #f6465d;
  --down-soft: rgb(246 70 93 / .14);
  --bar: #0f1216;
  --bar-icon: #5b626d;
  --bar-active: #eceef1;
  --nav-h: 72px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; cursor: pointer; }

main {
  max-width: 34rem; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
}
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; font-size: .9rem; padding: 18px 0; margin: 0; }

/* ── Quote header ── */
.quote { padding: 6px 0 4px; }
.quote-label { color: var(--muted); font-size: .85rem; }
.hero { font-size: 2.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.change { font-size: .95rem; font-weight: 600; min-height: 1.4em; }
.change.muted { font-weight: 400; }
.change.up { color: var(--up); }
.change.down { color: var(--down); }
.change .muted { font-weight: 400; }

/* ── Chart ── */
.chart-wrap { position: relative; margin: 10px -16px 0; height: 180px; touch-action: pan-y; }
#chart { display: block; width: 100%; height: 100%; }
.chart-tip {
  position: absolute; top: 0; transform: translateX(-50%);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  font-size: .75rem; padding: 3px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none;
}

.ranges { display: flex; justify-content: space-between; margin: 8px 0 14px; }
.ranges button {
  background: none; border: 0; color: var(--muted); font-weight: 600; font-size: .85rem;
  padding: 6px 12px; border-radius: 6px;
}
.ranges button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 14px;
}
.stat { background: var(--surface); padding: 9px 8px; min-width: 0; }
.stat b { display: block; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }

.trade-btn {
  display: block; width: 100%; border: 0; border-radius: 10px; min-height: 48px;
  background: var(--up); color: #04150f; font-weight: 700; font-size: 1rem;
}
.trade-btn:active { filter: brightness(.9); }

/* ── Sections & rows (watchlist style) ── */
.sect { margin-top: 22px; }
.sect-h {
  display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 700; font-size: 1.05rem; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.sect-sub { color: var(--muted); font-size: .75rem; font-weight: 500; }
.rows { list-style: none; margin: 0; padding: 0; }
.r {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.r .sym { font-weight: 700; letter-spacing: .02em; }
.r .name { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r .l { min-width: 0; }
.r .spark { width: 64px; height: 26px; display: block; }
.r .rt { text-align: right; }
.r .rt .sub { color: var(--muted); font-size: .75rem; }
.box {
  display: inline-block; min-width: 64px; text-align: center; font-weight: 700; font-size: .85rem;
  padding: 6px 8px; border-radius: 6px; color: var(--text); background: var(--surface-2);
}
.box.up { background: var(--up); color: #04150f; }
.box.down { background: var(--down); color: #fff; }
.r img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.act { grid-template-columns: auto 1fr auto; }
.act .badge {
  width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center;
  background: var(--surface-2); font-size: .7rem; font-weight: 700; color: var(--muted);
}
.tag { font-size: .68rem; padding: 1px 6px; border-radius: 4px; margin-left: 6px; font-weight: 600; vertical-align: 1px; }
.tag.rel { background: var(--up-soft); color: var(--up); }
.ib {
  background: none; border: 0; color: var(--faint); width: 32px; height: 32px; border-radius: 6px; padding: 0;
}
.ib:active { color: var(--down); }

/* ── Tackle ── */
.add-row { display: grid; grid-template-columns: 1fr auto 44px; gap: 8px; margin-top: 12px; }
.add-row button { border: 0; border-radius: 8px; background: var(--up); color: #04150f; font-size: 1.4rem; font-weight: 700; }
.pos { grid-template-columns: 1fr auto auto; }
.qty { display: flex; align-items: center; background: var(--surface); border-radius: 8px; }
.qty button { background: none; border: 0; width: 30px; height: 32px; color: var(--muted); font-size: 1.05rem; padding: 0; }
.qty span { min-width: 1.8em; text-align: center; font-weight: 600; }

/* ── Inputs ── */
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px stops iOS zoom-on-focus */
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0;
}
select { width: auto; }
.sheet select { width: 100%; }
input[type="file"] { font-size: 14px; padding: 8px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--up); border-color: var(--up); }
input[type="datetime-local"] { color-scheme: dark; }

/* ── Log sheet ── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 1500; background: rgb(0 0 0 / .6); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1600;
  max-width: 34rem; margin: 0 auto; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 16px);
  display: grid; gap: 12px;
  animation: up .2s ease-out;
}
.sheet[hidden], .sheet-backdrop[hidden] { display: none; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet input, .sheet select, .sheet textarea { background: var(--bg); }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--faint); margin: 0 auto 2px; }
.sheet-h { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 1.1rem; }
.x { background: none; border: 0; color: var(--muted); width: 36px; height: 36px; font-size: 1.1rem; }
.sheet label { display: grid; gap: 4px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.loc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .85rem; }
.chip-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 99px; padding: 8px 14px; font-size: .85rem; font-weight: 600;
}
.sheet .check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--up); }

/* ── Map ── */
#view-map:not([hidden]) { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); }
.map-chip {
  position: absolute; z-index: 450; left: 16px; top: calc(env(safe-area-inset-top) + 14px);
  background: rgb(21 24 29 / .92); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: .85rem; max-width: calc(100% - 90px);
}
.map-chip b { font-size: 1.1rem; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.6); }
.leaflet-container { font: 13px/1.4 -apple-system, system-ui, sans-serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-2); color: var(--text); }
.leaflet-bar a { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.leaflet-control-attribution { background: rgb(11 13 16 / .7) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }

/* ── Bottom tab bar: just the three shaped buttons ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 0 24px env(safe-area-inset-bottom);
  background: var(--bar); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr 1.35fr 1fr; align-items: center;
}
.tab {
  background: none; border: 0; padding: 0; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--bar-icon);
}
.tab svg { display: block; overflow: visible; transition: transform .15s ease, color .15s; }
.tab:active svg { transform: scale(.92); }
.tab-map svg, .tab-tackle svg { width: 40px; height: 34px; }
.tab-fish svg { width: 72px; height: 46px; }   /* the fish is the larger one */

.tab .shape { fill: currentColor; }
.tab .detail { fill: none; stroke: var(--bar); stroke-width: 2.2; stroke-linecap: round; }
.tab .detail.thin { stroke-width: 1.6; }
.tab .handle { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; }
.tab .latch, .tab .eye { fill: var(--bar); }
.tab-fish .detail { stroke-width: 2; opacity: .5; }

.tab[aria-current="page"] { color: var(--bar-active); }
.tab-fish[aria-current="page"] { color: var(--up); }

/* ── Camera-first logging ── */
#open-log { display: flex; align-items: center; justify-content: center; gap: 8px; }
#open-log svg { width: 22px; height: 22px; }
.link-btn {
  display: block; margin: 6px auto 0; background: none; border: 0;
  color: var(--muted); font-size: .85rem; padding: 8px 12px;
}
.shot { position: relative; border-radius: 12px; overflow: hidden; background: var(--bg); }
.shot img { display: block; width: 100%; max-height: 30vh; object-fit: cover; }
.shot-btn { position: absolute; right: 10px; bottom: 10px; background: rgb(11 13 16 / .75); }
.shot.empty-shot { border: 1px dashed var(--border); min-height: 56px; }
.shot.empty-shot .shot-btn { position: static; display: block; margin: 10px auto; }
