:root {
  --bg: #0d1f26;
  --bg-card: #14303a;
  --bg-card-2: #1b3d49;
  --line: #24505f;
  --text: #eaf4f7;
  --muted: #93b3bd;
  --accent: #35c39a;
  --accent-dark: #1f8f70;
  --warn: #f2b134;
  --danger: #e8695f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- layout ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0b1a20;
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

/* Three columns keep the logo optically centred no matter what sits beside it. */
.topbar-inner {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
  padding: 4px 8px;
}
.topbar-side { display: flex; align-items: center; }
.topbar-side-right { justify-content: flex-end; }

.brand {
  justify-self: center;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  white-space: nowrap;
}

.back {
  color: var(--text);
  text-decoration: none;
  font-size: 2.3rem;
  line-height: 1;
  width: 52px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 4px;
}

/* Menu toggle: the checkbox stays focusable for keyboards but invisible. */
.navtoggle { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hamburger {
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 12px 11px;
  cursor: pointer;
  border-radius: 10px;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.navtoggle:focus-visible + .topbar-inner .hamburger { outline: 2px solid var(--accent); }
.navtoggle:checked + .topbar-inner .hamburger { background: #17323d; }

.navpanel {
  display: none;
  border-top: 1px solid var(--line);
  /* On a short screen (landscape) the menu scrolls instead of pushing the page away. */
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.navtoggle:checked ~ .navpanel { display: block; }
.navpanel-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 14px 14px;
}
.navpanel .navlink {
  display: block;
  padding: 14px 2px;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.navpanel .navlink:active { color: var(--accent); }
.navpanel .btn { margin-top: 12px; }
.navrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
}
.navrow-user { border-bottom: 0; }
.navrow .muted { overflow-wrap: anywhere; }

.langswitch { display: flex; gap: 4px; align-items: center; }
.lang {
  color: var(--muted);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.lang.is-active { color: #062018; background: var(--accent); border-color: var(--accent-dark); }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 14px 48px;
}

h1 { font-size: 1.4rem; margin: 4px 0 10px; }
h2 { font-size: 1.05rem; margin: 26px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pagehead h1 { margin-bottom: 2px; }
.pagehead p { margin: 0 0 14px; }
.muted { color: var(--muted); font-size: .87rem; }
.center { text-align: center; }
a { color: var(--accent); }

/* ---------- cards & forms ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 0 14px;
}

.form { display: flex; flex-direction: column; gap: 6px; }
.form label, .weighform label { font-size: .85rem; color: var(--muted); }
.form input + label { margin-top: 8px; }

input {
  width: 100%;
  padding: 13px 12px;
  font-size: 1.05rem;
  color: var(--text);
  background: #0e2530;
  border: 1px solid var(--line);
  border-radius: 12px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin-top: 10px;
  font-size: 1.02rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: #062018; }
.btn-primary:active { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-danger-ghost { background: transparent; border-color: #5c2f2c; color: var(--danger); margin-top: 26px; }
.btn-over { background: #5c2f2c; border-color: var(--danger); color: #ffd9d4; }
.btn-finish { background: transparent; border-color: var(--accent-dark); color: var(--accent); margin-top: 22px; }
.btn-sub { display: block; font-size: .76rem; font-weight: 400; opacity: .85; }

select {
  width: 100%;
  padding: 13px 12px;
  font-size: 1.05rem;
  color: var(--text);
  background: #0e2530;
  border: 1px solid var(--line);
  border-radius: 12px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

textarea {
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
  background: #0e2530;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint-top { margin: 0 0 10px; }

.weighform { padding-bottom: 8px; }
.weighrow { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.weighrow input { font-size: 1.5rem; font-weight: 700; text-align: center; }
.weighrow .btn { width: auto; margin: 0; white-space: nowrap; }
.hint { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }

/* ---------- flash & alert ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.flash {
  padding: 11px 13px;
  border-radius: 12px;
  font-size: .92rem;
  border: 1px solid;
}
.flash-success { background: #12362c; border-color: #1f6b53; color: #b9f0dc; }
.flash-warning { background: #3b3016; border-color: #7a6320; color: #f6dfa8; }
.flash-error   { background: #3a1f1d; border-color: #7a3a34; color: #f6c9c4; }

.alert {
  background: #3b3016;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.alert-head { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.alert p { margin: 4px 0 10px; font-size: .93rem; }
.alert-label { color: #f6dfa8; font-size: .85rem !important; margin-bottom: 6px !important; }
.alert .btn-ghost { border-color: #7a6320; }

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: #14303a;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
.chip-sub { display: block; font-size: .74rem; font-weight: 400; color: var(--muted); }

/* ---------- stats ---------- */
.stats { display: flex; gap: 8px; margin-bottom: 16px; }
.stat {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.stat-num { display: block; font-size: 1.15rem; font-weight: 700; }
.stat-lbl { display: block; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.records { display: flex; flex-direction: column; gap: 10px; }
.record { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.record strong { font-size: 1.15rem; margin-left: auto; }
.record .muted:last-child { flex-basis: 100%; text-align: right; }

.tag {
  display: inline-block;
  background: #12362c;
  border: 1px solid #1f6b53;
  color: #b9f0dc;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: .72rem;
}
.tag-done { background: #1b3d49; border-color: var(--line); color: var(--muted); }
.tag-kind { background: #16323d; border-color: #2d5f73; color: #cfe6ee; }

/* ---------- overweight net ---------- */
.over-flag { color: #ffb4ab; font-weight: 700; }

.alert-over { background: #3a1f1d; border-color: var(--danger); }
.alert-over .alert-head { color: #ffd9d4; }

.netcard.is-over { border-color: var(--danger); background: #33201f; }
.netcard.is-over .netcard-weight { color: #ffb4ab; }
.bar.bar-over span { background: var(--danger); }
.gauge.is-over { border-color: var(--danger); background: #33201f; }
.gauge.is-over .gauge-num { color: #ffb4ab; }

/* ---------- nets ---------- */
.netgrid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 420px) { .netgrid { grid-template-columns: 1fr 1fr; } }

.netcard {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  text-decoration: none;
  color: var(--text);
}
.netcard:active { background: var(--bg-card-2); }
.netcard-top { display: flex; justify-content: space-between; align-items: baseline; }
.netcard-title { font-weight: 600; font-size: .95rem; }
.netcard-weight { font-weight: 700; }
.netcard-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 6px; }

.bar { height: 8px; background: #0b1f27; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-lg { height: 14px; }
.gauge-top { display: flex; justify-content: space-between; align-items: baseline; }
.gauge-num { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.gauge-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-top: 10px; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.rowlink {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  text-decoration: none;
  color: var(--text);
}
.rowlink-main { display: flex; flex-direction: column; }
.rowlink-side { text-align: right; font-weight: 700; }

/* ---------- user management ---------- */
.usercard { margin-bottom: 0; }
.usercard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.usercard p { margin: 4px 0 10px; }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input { font-size: .95rem; }
.inline-form .btn { width: auto; margin: 0; white-space: nowrap; font-size: .9rem; padding: 12px; }
.userows { display: flex; flex-wrap: wrap; gap: 8px; }
.userows form { flex: 1 1 45%; }
.userows .btn { margin-top: 10px; font-size: .9rem; padding: 12px 10px; }
.checkrow { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .95rem; }
.checkrow input { width: auto; }
code { background: #0e2530; border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: .85em; }

.fishrow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
}
.fish-main { display: flex; flex-direction: column; gap: 2px; margin-right: auto; min-width: 0; }
.fish-w { font-size: 1.1rem; font-weight: 700; }
.fish-note { font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.iconbtn {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 9px;
  width: 34px;
  height: 34px;
  font-size: .9rem;
  cursor: pointer;
}
