/* GBSC Membership — design system
   Navy frame, signal yellow for "you are here / act now", chart-contour texture.
   Brand colours sampled from the club logo: blue #1c3e95, yellow #fdf100. */
:root {
  --brand-blue: #1c3e95;
  --brand-yellow: #fdf100;
  --navy-950: #081233;
  --navy-900: #0b1840;
  --navy-800: #0f1f4d;
  --navy-700: #14275e;
  --sea-500: #3a64d8;
  --yellow-ink: #3d3a00;

  --bg: #f2f4f9;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --text: #0f1a33;
  --muted: #5b6780;
  --faint: #8a94ab;
  --border: #e2e7f1;
  --border-strong: #cdd5e5;
  --accent: #1c3e95;
  --accent-soft: #e8eefb;
  --ok: #157a3c;   --ok-soft: #e3f5ea;
  --warn: #9a5a00; --warn-soft: #fdf1dc;
  --bad: #b3261e;  --bad-soft: #fde8e6;
  --violet: #5b2a86; --violet-soft: #f1e8fa;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 26, 51, .06), 0 1px 1px rgba(15, 26, 51, .04);
  --shadow-md: 0 6px 20px -6px rgba(15, 26, 51, .16), 0 2px 6px rgba(15, 26, 51, .06);
  --shadow-lg: 0 24px 60px -12px rgba(8, 18, 51, .35);
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* Depth contours, as on a sea chart of the bay */
  --contours: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600' fill='none' stroke='%23ffffff' stroke-width='1.2'%3E%3Cpath d='M-20 420c80-60 160-40 230-90s100-150 200-160 160 60 210 40' opacity='.5'/%3E%3Cpath d='M-20 460c90-50 170-30 250-80s120-150 210-150 150 60 180 50' opacity='.4'/%3E%3Cpath d='M-20 500c100-40 190-20 270-70s130-140 220-140 120 50 150 50' opacity='.32'/%3E%3Cpath d='M-20 540c110-30 200-10 290-60s140-120 230-120 90 40 120 40' opacity='.24'/%3E%3Cpath d='M-20 580c120-20 210 0 300-40s150-100 240-100 70 30 100 30' opacity='.18'/%3E%3Cellipse cx='470' cy='130' rx='70' ry='42' opacity='.35'/%3E%3Cellipse cx='470' cy='130' rx='110' ry='70' opacity='.25'/%3E%3Cellipse cx='470' cy='130' rx='150' ry='100' opacity='.16'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070e24; --surface: #0e1733; --surface-2: #131e40; --text: #e7ecf7; --muted: #9ca8c4; --faint: #6e7a98;
    --border: #1f2b52; --border-strong: #2c3a68; --accent: #9db4f5; --accent-soft: #18265a;
    --ok: #6fd391; --ok-soft: #0f2d1d; --warn: #f2b860; --warn-soft: #33240b; --bad: #f4908a; --bad-soft: #3a1513;
    --violet: #dcc6f6; --violet-soft: #2e1f45;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 8px 24px -8px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font-body); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0; }
[hidden] { display: none !important; }
h1, h2, h3 { letter-spacing: -.01em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.eyebrow { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.msg { min-height: 1.4em; color: var(--muted); padding: 0 16px; }
.msg.error { color: var(--bad); }
.ti { font-size: 1.15em; line-height: 1; vertical-align: -.15em; }

/* ───────── Controls ───────── */
label { display: block; font-weight: 600; margin-bottom: 4px; }
input, select, button, textarea { font: inherit; }
input, select { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sea-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sea-500) 22%, transparent); }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border: 0; border-radius: var(--radius);
  background: var(--brand-blue); color: #fff; font-weight: 600; cursor: pointer; transition: background .15s, transform .1s, box-shadow .15s; }
button:hover { background: var(--navy-700); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--brand-yellow); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
button.link { background: none; color: var(--accent); padding: 0 4px; font-weight: 600; }
button.link:hover { background: none; text-decoration: underline; }
button.secondary, a.button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); }
button.secondary:hover, a.button.secondary:hover { background: var(--surface-2); }
a.button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius); background: var(--brand-blue); color: #fff;
  text-decoration: none; white-space: nowrap; font-weight: 600; transition: background .15s; }
a.button:hover { background: var(--navy-700); }
a.button.ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.28); }
a.button.ghost:hover { background: rgba(255,255,255,.2); }
.icon-btn { width: 36px; height: 36px; padding: 0; border-radius: 9px; background: transparent; color: inherit; }
.icon-btn:hover { background: rgba(127,140,170,.16); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); text-transform: capitalize; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.pending { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.lapsed, .pill.suspended { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); }
.chip.t-family { background: var(--violet-soft); color: var(--violet); }
.chip.t-junior, .chip.t-cadet { background: var(--ok-soft); color: var(--ok); }
.chip.t-crew { background: var(--warn-soft); color: var(--warn); }
.chip.t-senior, .chip.t-honorary, .chip.t-life { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  font-size: .75rem; font-weight: 800; letter-spacing: .02em; background: var(--accent-soft); color: var(--accent); }
.avatar.sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar.h1 { background: #e8eefb; color: #1c3e95; } .avatar.h2 { background: #fff8b8; color: #4a4500; }
.avatar.h3 { background: #e3f5ea; color: #157a3c; } .avatar.h4 { background: #f1e8fa; color: #5b2a86; }
.avatar.h5 { background: #fde8dc; color: #9a3d12; } .avatar.h6 { background: #dff3f6; color: #0f6170; }
@media (prefers-color-scheme: dark) {
  .avatar.h1 { background: #1b2c66; color: #c9d7ff; } .avatar.h2 { background: #3b3810; color: #fff59a; }
  .avatar.h3 { background: #12361f; color: #a6e8bd; } .avatar.h4 { background: #2e1f45; color: #e2cffa; }
  .avatar.h5 { background: #3d1f10; color: #ffc4a3; } .avatar.h6 { background: #0f3138; color: #a8e6ef; }
}

/* ───────── Sign-in ───────── */
body:has(#loginScreen:not([hidden])), body:has(#noAccess:not([hidden])) {
  min-height: 100vh; background: var(--navy-900) var(--contours) center / 900px repeat;
  background-image: var(--contours), radial-gradient(1200px 600px at 80% -10%, #1c3e95 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #14275e 0%, transparent 60%);
  background-size: 700px, auto, auto; }
.login { position: relative; max-width: 400px; margin: 12vh auto 0; padding: 32px 30px 26px; background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-lg); overflow: hidden; }
.login::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--brand-blue) 0 70%, var(--brand-yellow) 70%); }
.login-logo { display: block; border-radius: 14px; margin-bottom: 18px; box-shadow: var(--shadow-md); }
.login .eyebrow { color: var(--accent); }
.login h1 { margin: 2px 0 6px; font: 600 2rem/1.1 var(--font-display); }
.login > .muted { margin: 0 0 20px; }
.login input { width: 100%; margin-bottom: 12px; }
.login form button { width: 100%; padding: 11px; }
@media (max-width: 460px) { .login { margin: 6vh 16px 0; padding: 26px 20px 20px; } }

/* ───────── App shell ───────── */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px 14px; overflow-y: auto;
  background: var(--navy-900); color: #fff; background-image: var(--contours); background-size: 520px; background-position: -120px calc(100% + 140px);
  background-repeat: no-repeat; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: #fff; text-decoration: none; }
.brand img { border-radius: 10px; background: #fff; box-shadow: 0 0 0 3px rgba(253,241,0,.9); }
.brand b { display: block; font: 600 1.15rem/1.1 var(--font-display); letter-spacing: .02em; }
.brand small { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.6); }
#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 14px 10px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.42); }
#nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: rgba(255,255,255,.74);
  text-decoration: none; font-weight: 600; font-size: .93rem; transition: background .15s, color .15s; }
#nav a .ti { font-size: 1.2rem; opacity: .85; }
#nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
#nav a.on { background: rgba(255,255,255,.11); color: #fff; }
#nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand-yellow); }
#nav a.on .ti { color: var(--brand-yellow); opacity: 1; }
#nav a .count { margin-left: auto; }
.count { display: inline-block; min-width: 1.5em; padding: 1px 6px; border-radius: 999px; background: var(--brand-yellow); color: var(--navy-900);
  font-size: .72rem; font-weight: 800; text-align: center; }
.sidebar .who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08); }
.sidebar .avatar { background: var(--brand-yellow); color: var(--navy-900); }
.who-text { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
#whoEmail { font-weight: 700; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#whoRole { font-size: .74rem; color: rgba(255,255,255,.55); text-transform: capitalize; }
.sidebar .icon-btn { color: rgba(255,255,255,.7); }
.sidebar .icon-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border); }
.page-title { min-width: 0; }
.page-title .eyebrow:empty { display: none; }
.page-title h1 { margin: 0; font: 600 1.55rem/1.15 var(--font-display); }
.nav-toggle { display: none; }
.nemo-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px 9px 14px; border-radius: 999px;
  background: var(--brand-yellow); color: var(--navy-900); font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 4px 14px -4px rgba(180,170,0,.6), inset 0 -2px 0 rgba(0,0,0,.08); }
.nemo-pill .ti { font-size: 1.25rem; transition: transform .6s var(--ease); }
.nemo-pill:hover { background: #fff64d; }
.nemo-pill:hover .ti { transform: rotate(160deg); }
.nemo-pill[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--navy-900), 0 0 0 5px var(--brand-yellow); }

.view { padding: 24px 28px 40px; max-width: 1280px; width: 100%; animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view > h2 { margin: 0 0 6px; font: 600 1.35rem/1.2 var(--font-display); }
.view > h2 + p.muted { margin-top: 0; max-width: 760px; }
.toast:not(:empty) { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px; border-radius: 12px; background: var(--navy-900); color: #fff; box-shadow: var(--shadow-lg); animation: rise .25s var(--ease); }
.toast.error:not(:empty) { background: var(--bad); color: #fff; }

.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(8,18,51,.45); }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 272px; transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .nav-toggle { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 40px; padding: 8px 13px 8px 10px; border: 0; border-radius: 10px;
    background: #1c3e95; color: #fff; font: 700 .9rem/1 var(--font-body); cursor: pointer; }
  .nav-toggle:active { transform: scale(.97); }
  .page-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .page-title h1 { font-size: 1.25rem; }
  .view { padding: 16px 16px 32px; }
  .nemo-pill { padding: 8px 14px 8px 11px; }
}
@media (max-width: 420px) { .nemo-pill { font-size: 0; gap: 0; padding: 9px; } .nemo-pill .ti { font-size: 1.3rem; } }

/* ───────── Overview ───────── */
.hero { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 18px; padding: 28px 30px;
  border-radius: var(--radius-lg); color: #fff; overflow: hidden;
  background: var(--navy-800) var(--contours) right -80px top -160px / 640px no-repeat; box-shadow: var(--shadow-md); }
.hero::after { content: ""; position: absolute; right: 0; bottom: 0; width: 120px; height: 5px; background: var(--brand-yellow); }
.hero .eyebrow { color: var(--brand-yellow); }
.hero h2 { margin: 4px 0 6px; font: 600 clamp(1.6rem, 3vw, 2.2rem)/1.1 var(--font-display); }
.hero-sub { margin: 0; color: rgba(255,255,255,.75); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-actions a.button:not(.ghost) { background: var(--brand-yellow); color: var(--navy-900); }
.hero-actions a.button:not(.ghost):hover { background: #fff64d; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 18px 0; }
.stat { position: relative; display: block; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s; overflow: hidden; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.15rem; }
.stat.tone-warn .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat.tone-bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.stat.tone-signal .stat-icon { background: var(--brand-yellow); color: var(--navy-900); }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-value { margin-top: 6px; font: 600 1.9rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 6px; font-size: .8rem; color: var(--muted); }
@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat-icon { width: 28px; height: 28px; right: 10px; top: 10px; font-size: .95rem; }
  .stat-value { font-size: 1.45rem; }
  .hero { padding: 22px 20px; }
}
.stat-sub .up { color: var(--ok); font-weight: 700; } .stat-sub .down { color: var(--bad); font-weight: 700; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 960px) { .ov-grid { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 1rem; }
.card-head a { font-size: .85rem; font-weight: 600; text-decoration: none; }
.type-bars { display: grid; gap: 10px; }
.type-bar { display: grid; grid-template-columns: 140px minmax(0, 1fr) 44px; align-items: center; gap: 12px; font-size: .88rem; color: inherit; text-decoration: none; }
.type-bar:hover .tb-name { color: var(--accent); }
.tb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-track { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.tb-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-blue), var(--sea-500)); transform-origin: left; animation: grow .7s var(--ease); }
.tb-fill.monthly { background: var(--brand-yellow); }
@keyframes grow { from { transform: scaleX(0); } }
.tb-num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; margin-top: 14px; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--brand-blue); }
.legend i.monthly { background: var(--brand-yellow); }
@media (max-width: 520px) { .type-bar { grid-template-columns: 100px minmax(0, 1fr) 36px; } }
ul.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.todo a { display: flex; align-items: center; gap: 12px; padding: 10px; margin: 0 -10px; border-radius: 10px; color: inherit; text-decoration: none; }
.todo a:hover { background: var(--surface-2); }
.todo .ti { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.todo .tone-warn .ti { background: var(--warn-soft); color: var(--warn); }
.todo .tone-bad .ti { background: var(--bad-soft); color: var(--bad); }
.todo .tone-ok .ti { background: var(--ok-soft); color: var(--ok); }
.todo b { display: block; font-size: .92rem; }
.todo small { color: var(--muted); }
.todo .go { margin-left: auto; color: var(--faint); width: auto; height: auto; background: none; }

/* Skeleton loading */
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-row td { padding: 14px 12px !important; }
.skel-row .skel { height: 12px; }

/* ───────── Lists and tables ───────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.search { position: relative; flex: 1 1 280px; }
.search .ti { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { width: 100%; padding-left: 38px; }
.toolbar input[type=search] { flex: 1 1 260px; }
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.table-card table.grid { border: 0; background: transparent; }
.grid th, .grid td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid th { position: sticky; top: 0; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface-2); }
.grid tbody tr { transition: background .12s; }
.grid tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 14px; color: var(--muted); font-size: .9rem; }
.pager button { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); padding: 7px 12px; }
.pager button:hover:not(:disabled) { background: var(--surface-2); }
.person { display: flex; align-items: center; gap: 11px; }
.person-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.person-sub { font-size: .78rem; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* Admin-only controls */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: inline-flex !important; }

/* ───────── Forms ───────── */
.form { max-width: 920px; }
.form fieldset { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 16px 20px 18px; margin: 0 0 16px; box-shadow: var(--shadow-sm); }
.form legend { font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; margin-bottom: 8px; }
.form label { font-weight: 600; font-size: .86rem; display: flex; flex-direction: column; gap: 5px; color: var(--muted); }
.form label.wide { grid-column: 1 / -1; }
.form label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.form label.check { align-self: end; padding-bottom: 8px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { width: 100%; color: var(--text); }
.form textarea, .chat-form textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-blue); width: 17px; height: 17px; }
.form input:disabled { opacity: .6; }
.radios { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 10px; }
.sub { border-top: 1px dashed var(--border-strong); margin-top: 8px; padding-top: 10px; }
.hint { color: var(--muted); font-size: .86rem; margin: 2px 0 8px; }
.warn { border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; background: var(--warn-soft); }
.warn ul { margin: 6px 0; padding-left: 20px; }
.warn p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.actions { display: flex; gap: 10px; align-items: center; }
.form .msg { padding: 8px 0 0; }

/* Boat park */
.park-area h3 { margin: 22px 0 10px; font-size: 1rem; }
.spaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.space { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .85rem; box-shadow: var(--shadow-sm); }
.space b { display: block; color: var(--accent); }
.space.free { color: var(--faint); border-style: dashed; background: transparent; box-shadow: none; }
.space.free b { color: var(--faint); }
button.space { display: block; width: 100%; text-align: left; color: var(--text); font-weight: 500; cursor: pointer; transition: border-color .12s, transform .12s; }
button.space:hover:not(:disabled) { background: var(--surface); border-color: var(--sea-500); transform: translateY(-1px); }
button.space.free:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
button.space.free:hover:not(:disabled)::after { content: " + assign"; font-size: .75rem; font-weight: 700; }
button.space:disabled { cursor: default; }
.space span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space.owing { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.park-hint { margin-top: -6px; }
.park-assign { margin-bottom: 16px; max-width: 720px; }
.park-assign input[type=search] { width: 100%; }
.assign-form p { margin: 6px 0; }
.assign-form .actions { margin-top: 8px; }
.give-place { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.give-place .fields label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.row-actions select { max-width: 220px; padding: 5px 8px; }
/* Wide tables scroll inside their card, never the whole panel */
dialog.panel { overflow-x: hidden; }
.panel-sec { overflow-x: auto; }
.panel-sec .row-actions { white-space: normal; flex-wrap: wrap; align-items: center; min-width: 120px; }

/* New boat: owner picker */
ul.pick { list-style: none; margin: 4px 0 8px; padding: 0; max-width: 640px; }
ul.pick li { padding: 3px 0; }
ul.pick button.link { text-align: left; padding: 2px 0; }
table.grid.compact { width: auto; min-width: 320px; margin: 6px 0; }
table.grid.compact td, table.grid.compact th { padding: 6px 10px; }

/* ───────── Side panels (member, boat, Nemo) ───────── */
button.cell-link { color: var(--text); padding: 0; text-align: left; font-weight: 700; background: none; }
button.cell-link:hover { color: var(--accent); text-decoration: none; background: none; }
td > button.cell-link.mono { color: var(--muted); }
dialog.panel { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(680px, 100vw); padding: 0; border: 0;
  background: var(--bg); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.panel[open] { animation: slide .3s var(--ease); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog.panel::backdrop { background: rgba(8, 18, 51, .45); backdrop-filter: blur(2px); }
.panel-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 22px 22px 20px; color: #fff; background: var(--navy-800) var(--contours) right -60px top -220px / 520px no-repeat; }
.panel-head::after { content: ""; position: absolute; left: 0; bottom: 0; width: 90px; height: 4px; background: var(--brand-yellow); }
.panel-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.panel-head h2 { margin: 0; font: 600 1.45rem/1.15 var(--font-display); }
.panel-head p { margin: 4px 0 0; color: rgba(255,255,255,.72); }
.panel-head .muted { color: rgba(255,255,255,.72); }
.panel-head button.link { color: #fff; font-size: 1.25rem; line-height: 1; padding: 8px; border-radius: 10px; }
.panel-head button.link:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.panel-head .avatar { box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.panel-body { padding: 6px 20px 28px; display: grid; gap: 12px; }
.panel-body > :first-child { margin-top: 14px; }
.panel-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow-sm); }
.panel-sec h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px;
  font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.panel-sec h3 .sec-edit { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); }
.panel-sec h3 .sec-edit:hover { text-decoration: none; filter: brightness(.97); }
.panel-sec p { margin: 4px 0; }
.panel-sec table.grid.compact { width: 100%; min-width: 0; border: 0; }
.panel-sec .grid td { white-space: normal; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 11px; font-size: .82rem; font-weight: 600; }
.notes { white-space: pre-wrap; }
@media (max-width: 560px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dt { margin-top: 8px; } .panel-body { padding: 4px 12px 24px; } }

/* Social sign-in */
.oauth { display: grid; gap: 8px; margin-bottom: 4px; }
.oauth-btn { width: 100%; padding: 11px 14px; font-weight: 600; }
.oauth-btn.google { background: #fff; color: #1f1f1f; border: 1px solid #c9ced8; }
.oauth-btn.google:hover { background: #f6f7f9; }
.oauth-btn.apple { background: #000; color: #fff; }
.oauth .or { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; color: var(--muted); font-size: .82rem; }
.oauth .or::before, .oauth .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Editing inside panels */
.panel-form { max-width: none; }
.panel-form .fields { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.panel-form .actions { margin-top: 6px; }
.row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; white-space: nowrap; }
.row-actions button.link { font-size: .85rem; padding: 0 2px; }
.add-owner { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.add-owner label { font-weight: 600; font-size: .9rem; }
.add-owner input[type=search] { width: 100%; margin-top: 4px; }
.add-owner label.inline { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0; }

/* ───────── Nemo ───────── */
.chat-log { display: flex; flex-direction: column; gap: 12px; min-height: 240px; overflow-y: auto; padding: 16px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; box-shadow: var(--shadow-sm); }
.bubble p { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble p:last-child { margin-bottom: 0; }
.bubble.user { align-self: flex-end; background: var(--brand-blue); color: #fff; border-bottom-right-radius: 5px; }
.bubble.assistant { position: relative; align-self: flex-start; margin-left: 36px; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.bubble.assistant::before { content: "\ea79"; font-family: "tabler-icons"; position: absolute; left: -36px; bottom: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px; background: var(--brand-yellow); color: var(--navy-900); }
.bubble.note { font-style: italic; color: var(--muted); box-shadow: none; background: transparent; border-style: dashed; }
.bubble.note::before, .bubble.error::before { display: none; }
.bubble.error { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.chat-status { align-self: flex-start; margin-left: 36px; color: var(--muted); font-size: .88rem; display: inline-flex; align-items: center; gap: 8px; }
.chat-status::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand-blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; border-radius: 14px; padding: 11px 14px; }
.chat-form button { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.nemo-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 10px; border-radius: 50%; vertical-align: -6px;
  background: var(--brand-yellow); color: var(--navy-900); font-size: 1.2rem; }
dialog.panel.nemo { position: fixed; inset: 0 0 0 auto; z-index: 50; width: min(480px, 100vw); display: flex; flex-direction: column; }
dialog.panel.nemo:not([open]) { display: none; }
@media (min-width: 901px) {
  dialog.panel.nemo { top: var(--topbar-h, 0px); height: auto; max-height: none; box-shadow: -12px 0 32px -12px rgba(8,18,51,.35); }
}
.close-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700;
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.close-btn:hover { background: rgba(255,255,255,.26); }
.nemo .panel-head { flex: none; }
.nemo .panel-head p { font-size: .82rem; }
.nemo-head-actions { display: flex; gap: 2px; align-items: center; }
.nemo-head-actions #chatNew { font-size: .85rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.12); }
.nemo .chat-log { flex: 1; min-height: 0; }
.nemo .chat-form { flex: none; padding: 12px 14px 16px; border-top: 1px solid var(--border); background: var(--surface); }
@media (max-width: 640px) { .bubble { max-width: 92%; } }

/* Proposer + seconder pickers */
.proposer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin: 6px 0 8px; }
.picker { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.picker-label { font-weight: 600; font-size: .86rem; color: var(--muted); }
.picker input[type=search] { width: 100%; }
.picked { display: flex; align-items: center; gap: 8px; }
.picked:empty { display: none; }
.picked b { font-weight: 700; }
.picker ul.pick { margin: 0; }
.proposers .actions { margin-top: 4px; }

/* Applications */
.app-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin: 0 0 12px; max-width: 860px; box-shadow: var(--shadow-sm); }
.app-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.app-head .cell-link { font-size: 1.05rem; }
.app-dupes { color: var(--warn); margin: 6px 0; }
.app-actions { margin-top: 12px; flex-wrap: wrap; }
.app-actions input { flex: 1; min-width: 200px; }

/* Standing: resignation + arrears */
.standing-note { background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 0; }
.standing-bad { color: var(--bad); font-weight: 700; }
.standing-flash { background: var(--ok-soft); border-left: 3px solid var(--ok); padding: 8px 12px; border-radius: 0; }
.standing-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 8px 0 4px; }
.inline-action { margin: 4px 0; }
.inline-action > button.link { padding-left: 0; text-align: left; }
.inline-action .panel-form { margin-top: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
#view-arrears h3 { margin: 26px 0 10px; }

/* Members list badges */
.name-cell { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.flags { display: inline-flex; gap: 4px; margin-left: 2px; }
.flag { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-size: .95rem; cursor: default; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.6; white-space: nowrap; cursor: default; }
.badge-boat, .flag-boat { background: var(--accent-soft); color: var(--accent); }
.badge-family, .flag-family { background: var(--violet-soft); color: var(--violet); }
.badge-arrears, .flag-arrears { background: var(--bad-soft); color: var(--bad); }

/* Reports */
.inline-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); }
.report { max-width: 940px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 26px 24px; box-shadow: var(--shadow-sm); }
.report:empty { display: none; }
.report h2 { margin: 18px 0 4px; font: 600 1.4rem/1.2 var(--font-display); }
.report h3 { margin: 22px 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.report table.grid { border-radius: 10px; }
.report.report-wide { max-width: none; }
.clubhouse-cols { columns: 3; column-gap: 32px; column-rule: 1px solid var(--border); margin-top: 14px; }
.ch-letter { break-after: avoid; margin: 12px 0 4px; padding-bottom: 2px; border-bottom: 2px solid var(--accent); font: 600 1.05rem/1.2 var(--font-display); color: var(--accent); }
.ch-letter:first-child { margin-top: 0; }
.ch-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3px 0; border-bottom: 1px dotted var(--border); break-inside: avoid; font-size: .9rem; }
.ch-name { min-width: 0; overflow-wrap: anywhere; }
.ch-type { flex: none; color: var(--muted); font-size: .76rem; white-space: nowrap; }
@media (max-width: 1000px) { .clubhouse-cols { columns: 2; } }
@media (max-width: 600px) { .clubhouse-cols { columns: 1; } }
@media print {
  .clubhouse-cols { columns: 3; column-gap: 8mm; column-rule: .5pt solid #bbb; }
  .ch-letter { color: #000; border-bottom-color: #000; font-size: 11pt; margin: 6pt 0 2pt; }
  .ch-row { font-size: 9pt; padding: 1pt 0; border-bottom-color: #ccc; }
  .ch-type { color: #444; font-size: 8pt; }
  .sidebar, .topbar, .no-print, #appMsg, .nemo-pill, dialog, .scrim { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  .view { animation: none; padding: 0; }
  .report { border: 0; box-shadow: none; padding: 0; }
  .report table.grid { border: 0; }
  .report table.grid td, .report table.grid th { padding: 2px 6px; font-size: 10pt; position: static; }
}
.rate-input { width: 7em; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
