/* ============================================================
   Tokens
   ============================================================ */
:root {
  --navy:      #0d1f3c;
  --navy-2:    #142545;
  --teal:      #2bbfca;
  --teal-dim:  #1fa8b3;
  --teal-bg:   rgba(43,191,202,.12);
  --surface:   #ffffff;
  --surface-2: #f0f4f8;
  --surface-3: #dde6ef;
  --text:      #0d1f3c;
  --text-2:    #3d5a7a;
  --text-3:    #7a9ab8;
  --danger:    #c2410c;
  --danger-bg: #fff1ec;

  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --sh: 0 2px 8px rgba(13,31,60,.08);
  --sh-md: 0 4px 16px rgba(13,31,60,.10);

  --nav-w: 220px;   /* sidenav width desktop */
  --bnav-h: 62px;   /* bottom nav height mobile */
}

/* ============================================================
   Reset — no body scroll
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--navy); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }

/* ============================================================
   Spinner
   ============================================================ */
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--teal); border-radius: 50%; animation: spin .9s linear infinite; }
.spinner--sm { width: 28px; height: 28px; border-width: 2.5px; border-top-color: var(--teal-dim); border-color: var(--surface-3); border-top-color: var(--teal-dim); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ============================================================
   Views — fixed full-screen
   ============================================================ */
.view { position: fixed; inset: 0; display: flex; }

.view--center { align-items: center; justify-content: center; background: linear-gradient(150deg, var(--navy) 0%, #0d3a5c 100%); }

/* ============================================================
   Landing
   ============================================================ */
.landing { text-align: center; padding: 2rem 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; max-width: 380px; width: 100%; }
.landing__logo { width: min(52vw, 180px); filter: brightness(0) invert(1) drop-shadow(0 2px 16px rgba(43,191,202,.4)); margin-bottom: .5rem; }
.landing__tagline { font-size: clamp(2rem, 8vw, 2.75rem); font-weight: 700; color: #fff; letter-spacing: -.02em; }
.landing__sub { font-size: .9rem; color: rgba(255,255,255,.55); margin-bottom: .75rem; }

/* ============================================================
   App shell
   ============================================================ */
.view--app { flex-direction: column; background: var(--surface-2); }

/* ── Sidenav (desktop) ── */
.sidenav {
  display: none;
  width: var(--nav-w);
  flex-shrink: 0;
  flex-direction: column;
  background: var(--navy);
  padding: 1.5rem 0 1rem;
  overflow-y: auto;
  gap: 0;
}
.sidenav__logo-wrap {
  margin: 0 .875rem 1.75rem;
  display: flex; align-items: center;
}
.sidenav__logo {
  height: 40px; width: auto;
  object-fit: contain;
  object-position: left;
  filter: brightness(0) invert(1);
}
.sidenav__links { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidenav__bottom { padding-bottom: .5rem; }
.sidenav__item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.25rem;
  margin: 0 .5rem;
  border-radius: var(--r);
  font-size: .9rem; font-weight: 500;
  color: rgba(255,255,255,.5);
  text-align: left;
  transition: color .15s, background .15s;
}
.sidenav__item:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidenav__item--active { color: var(--teal); background: rgba(43,191,202,.1); }
.sidenav__item:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.sidenav__icon { width: 22px; height: 22px; flex-shrink: 0; }
.sidenav__avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.2); flex-shrink: 0; }

/* ── Content area ── */
.app-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Panels ── */
.panel { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; padding-bottom: var(--bnav-h); }

/* ── Panel header ── */
.panel-header { padding: 1rem 1.5rem; border-bottom: 1px solid rgba(43,191,202,.15); background: linear-gradient(90deg, #0a1e38 0%, #0c2d47 100%); display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 5; }
.panel-header__title { font-size: 1.05rem; font-weight: 700; color: #fff; }
.panel-header__count { font-size: .8rem; color: rgba(255,255,255,.45); margin-left: auto; }

/* ── Bottom nav (mobile) ── */
.bottom-nav {
  flex-shrink: 0;
  height: var(--bnav-h);
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--surface-3);
  box-shadow: 0 -2px 10px rgba(13,31,60,.06);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: .65rem; font-weight: 500;
  transition: color .15s;
}
.bottom-nav__item svg { width: 24px; height: 24px; }
.bottom-nav__item--active { color: var(--teal-dim); }
.bottom-nav__avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface-3); }
.bottom-nav__item--active .bottom-nav__avatar { border-color: var(--teal-dim); }
.bottom-nav__item:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

/* ============================================================
   Logbook topbar (KPIs + Log button)
   ============================================================ */
/* ── Logbook topbar: [Log a dive] [KPIs…] ── */
.logbook-topbar {
  display: flex;
  align-items: stretch;
  gap: .75rem;
}
.logbook-topbar .btn-log-dive {
  flex-shrink: 0;
  align-self: stretch;
  white-space: nowrap;
}
.home-stats {
  flex: 1;
  display: flex;
  gap: .5rem;
  background: linear-gradient(120deg, var(--navy) 0%, #0e3d5e 50%, #166878 100%);
  border-radius: var(--r-lg);
  padding: .65rem .85rem;
  min-width: 0;
}
.home-stat {
  flex: 1;
  background: rgba(255,255,255,.1);
  border-radius: var(--r);
  padding: .5rem .4rem;
  display: flex; flex-direction: column; align-items: center;
  backdrop-filter: blur(4px);
  min-width: 0;
}
.home-stat__val { font-size: 1.1rem; font-weight: 700; color: #fff; line-height: 1; margin-bottom: .12rem; }
.home-stat__unit { font-size: .8rem; }
.home-stat__lbl { font-size: .58rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.5); }

/* ── Mobile: stats below the button, chips collapsed ── */
@media (max-width: 639px) {
  .logbook-topbar { flex-direction: column; align-items: stretch; }
  .logbook-topbar .btn-log-dive { order: -1; }
  .home-stats { order: 0; }
  .logbook-chips-card { display: none; }
  .logbook-chips-card.logbook-chips--open { display: block; }
}

/* ── Filter toggle (mobile only, inside search bar) ── */
.logbook-filter-toggle {
  display: none;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1.5px solid var(--surface-3);
  color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s;
  margin-left: .35rem;
}
.logbook-filter-toggle:hover { border-color: #b0c4d6; }
.logbook-filter-toggle.active { background: var(--teal-bg); border-color: var(--teal-dim); color: var(--teal-dim); }
.logbook-filter-toggle svg { width: 16px; height: 13px; display: block; }
@media (max-width: 639px) {
  .logbook-filter-toggle { display: flex; }
}

/* ============================================================
   Home body
   ============================================================ */
.home-body { background: var(--surface-2); flex: 1; padding: .9rem 1.25rem .5rem; display: flex; flex-direction: column; gap: .75rem; }

/* ============================================================
   Cert finder
   ============================================================ */
.cert-body { flex: 1; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; background: var(--surface-2); overflow-y: auto; }
.cert-intro { font-size: .875rem; color: var(--text-2); }
.cert-form { flex-shrink: 0; }
.cert-search-row { display: flex; gap: .5rem; }
.cert-search-input { flex: 1; }
.cert-search-btn { flex-shrink: 0; }
.cert-searching { display: flex; align-items: center; gap: .6rem; color: var(--text-2); font-size: .9rem; padding: .5rem 0; }
.cert-results { }
.cert-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
@media (min-width: 860px) {
  .cert-results-grid { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
}

/* ─── Diver Card — wide landscape ───────────── */
.diver-card {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,.45), 0 3px 10px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  color: #fff;
  background: linear-gradient(160deg, #041e42 0%, #0a3d7a 28%, #0b6575 58%, #054035 85%, #022018 100%);
}

/* Agency underwater tints */
.diver-card--padi   { background: linear-gradient(155deg, #041e42 0%, #073e9e 30%, #0b6e8a 62%, #034e5e 100%); }
.diver-card--ssi    { background: linear-gradient(155deg, #2a0808 0%, #8b1a1a 30%, #0b5068 65%, #034040 100%); }
.diver-card--sdi    { background: linear-gradient(155deg, #060f2a 0%, #0f2d6e 30%, #0b5870 62%, #034040 100%); }
.diver-card--tdi    { background: linear-gradient(155deg, #060f2a 0%, #0f2d6e 30%, #0b5870 62%, #034040 100%); }
.diver-card--sditdi { background: linear-gradient(155deg, #060f2a 0%, #0f2d6e 30%, #0b5870 62%, #034040 100%); }
.diver-card--cmas   { background: linear-gradient(155deg, #001030 0%, #003087 30%, #0b5e70 62%, #033040 100%); }

/* Underwater caustics + depth haze */
.diver-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% -30%, rgba(80,190,255,.22) 0%, transparent 52%),
    radial-gradient(ellipse at 75% -15%, rgba(120,220,255,.14) 0%, transparent 48%),
    radial-gradient(ellipse at 50% 120%, rgba(0,60,30,.35) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* Inline SVG ocean decorations */
.dc-ocean-deco {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

/* All content above bg */
.dc-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 22px 0;
}

/* Top row: [photo]  [cert title]  [agency logo] */
.dc-top-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.dc-photo-wrap { flex-shrink: 0; }
.dc-photo {
  width: 62px; height: 62px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,.7);
  box-shadow: 0 3px 14px rgba(0,0,0,.45);
}
.dc-photo--placeholder {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 3px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
}
.dc-photo--placeholder svg { width: 34px; height: 34px; opacity: .7; }

.dc-cert-title {
  flex: 1;
  min-width: 0;
  text-align: center;
}
.dc-cert-name {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 4px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.55);
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.dc-name {
  font-size: .95rem;
  font-weight: 600;
  color: rgba(255,255,255,.8);
  margin: 0;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Agency logo — top right, on frosted-white pill */
.dc-logo-wrap {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.88);
  border-radius: 12px;
  padding: 7px 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.dc-logo {
  max-height: 40px;
  max-width: 96px;
  object-fit: contain;
}
.diver-card--padi .dc-logo {
  max-height: 46px;
  max-width: 108px;
}
.dc-logo-text {
  font-size: 1.7rem;
  font-weight: 900;
  color: rgba(255,255,255,.9);
  letter-spacing: -.02em;
  text-shadow: 0 2px 10px rgba(0,0,0,.5);
}

/* Meta row — cert date / number / dob */
.dc-meta-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.18);
  padding: 12px 0;
}
.dc-meta-col { }
.dc-label {
  font-size: .62rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0 0 .2rem;
}
.dc-meta-val {
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.dc-verify {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  color: rgba(150,230,255,.9);
  text-decoration: none;
  padding: 4px 0 8px;
}
.dc-verify:hover { text-decoration: underline; color: #fff; }
.dc-warning { font-size: .78rem; color: #fbbf24; margin: 4px 0 6px; }

/* Remove button (absolute, top-right) */
.dc-remove {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 10;
  background: rgba(0,0,0,.4);
  border: none;
  color: #fff;
  font-size: .8rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .15s;
}
.dc-remove:hover { background: rgba(0,0,0,.65); }

/* Edit button — to the left of remove */
.dc-edit {
  position: absolute;
  top: 12px; right: 48px;
  z-index: 10;
  background: rgba(0,0,0,.4);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .15s;
}
.dc-edit:hover { background: rgba(0,0,0,.65); }
.dc-edit svg { width: 14px; height: 14px; }

/* Form section titles inside modals */
.form-section-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 1.5rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.form-section-title:first-child { margin-top: 0; }

/* Locked (read-only) field state */
.form-input--locked {
  opacity: .55;
  cursor: not-allowed;
  background: rgba(255,255,255,.04) !important;
}

/* Lock notice banner */
.ce-lock-notice {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .82rem;
  color: var(--text-2);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: .65rem .9rem;
  margin-bottom: .75rem;
}
.ce-lock-notice svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }
.ce-lock-notice strong { color: var(--text); font-weight: 600; }

/* Facility autocomplete dropdown */
.facility-ac-wrap { position: relative; }
.facility-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 200;
  background: var(--navy-2, #142545);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  list-style: none;
  margin: 0; padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.facility-dropdown[hidden] { display: none; }
.facility-dropdown li {
  padding: 9px 14px;
  cursor: pointer;
  font-size: .88rem;
  line-height: 1.3;
  color: var(--text, #e2e8f0);
  border-radius: 6px;
  margin: 0 4px;
}
.facility-dropdown li:hover,
.facility-dropdown li[aria-selected="true"] {
  background: rgba(43,191,202,.18);
  color: #fff;
}
.facility-dropdown__name { font-weight: 600; }
.facility-dropdown__loc  { font-size: .78rem; color: rgba(255,255,255,.5); }
.facility-dropdown__empty { padding: 10px 14px; font-size: .85rem; color: rgba(255,255,255,.4); font-style: italic; }
.facility-dropdown__loading { padding: 10px 14px; font-size: .85rem; color: rgba(255,255,255,.4); }

/* 4divers brand footer — white logo centered */
.dc-brand-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 22px 18px;
  margin-top: auto;
}
.dc-brand-logo {
  height: 28px;
  width: auto;
  max-width: 140px;
  filter: brightness(0) invert(1);
  opacity: .75;
}

/* Save/action footer */
.dc-footer { padding: 0 22px 20px; }
.dc-save-btn {
  width: 100%;
  font-weight: 700;
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
}
.dc-save-btn:hover { background: rgba(255,255,255,.28); }
.dc-save-btn--saved { background: rgba(255,255,255,.07); color: rgba(255,255,255,.45); cursor: default; border-color: rgba(255,255,255,.15); }

/* Saved certs shelf uses same grid */
.saved-certs { margin-bottom: 1.5rem; }
.saved-certs__title { font-size: .9rem; font-weight: 700; color: var(--text-2); margin-bottom: .75rem; }
.saved-certs__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 860px) {
  .saved-certs__list { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
}
.saved-certs__divider { border: none; border-top: 1px solid var(--surface-3); margin: 1.5rem 0 1rem; }

/* Confidence badges */
.cert-confidence { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.cert-confidence--high   { background: rgba(34,197,94,.25); color: #86efac; }
.cert-confidence--medium { background: rgba(234,179,8,.2); color: #fde047; }
.cert-confidence--low    { background: rgba(239,68,68,.2); color: #fca5a5; }
.cert-extra { padding: .6rem 1.1rem .85rem; display: flex; flex-direction: column; gap: .35rem; border-top: 1px solid var(--surface-2); }
.cert-detail-row { display: flex; gap: .5rem; font-size: .8rem; }
.cert-detail-key { color: var(--text-3); font-weight: 600; text-transform: uppercase; font-size: .68rem; letter-spacing: .05em; min-width: 72px; flex-shrink: 0; padding-top: .15rem; }
.cert-detail-val { color: var(--text); word-break: break-word; }

.btn-log-dive {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .7rem 1.5rem;
  background: linear-gradient(135deg, var(--teal) 0%, #17a3b8 100%);
  color: #fff; border: none;
  border-radius: var(--r-lg); font-size: .95rem; font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 4px 12px rgba(43,191,202,.35);
  transition: opacity .15s, transform .12s, box-shadow .15s;
}
.btn-log-dive:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(43,191,202,.45); }
.btn-log-dive:active { transform: scale(.98); box-shadow: none; }
.btn-log-dive:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
@media (min-width: 768px) { #btn-log-home { width: auto; min-width: 220px; align-self: center; } }
#home-empty { flex: 1; justify-content: center; }

/* Free bar */
.free-bar { background: var(--surface); border-radius: var(--r); padding: .85rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.free-bar__text { font-size: .875rem; color: var(--text-2); flex: 1; }
.free-bar__upgrade { font-size: .875rem; font-weight: 600; color: var(--teal-dim); text-decoration: none; }
.free-bar__upgrade:hover { text-decoration: underline; }

.section-title { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }

/* ============================================================
   Logbook filters
   ============================================================ */
/* ── Logbook filter wrapper ── */
.logbook-filters { display: flex; flex-direction: column; gap: .6rem; }

/* ── Search card ── */
.logbook-search-card {
  background: var(--surface);
  border: 1.5px solid var(--surface-3);
  border-radius: var(--r-lg);
  padding: .6rem .85rem;
  box-shadow: var(--sh);
  transition: border-color .15s, box-shadow .15s;
}
.logbook-search-card:focus-within {
  border-color: var(--teal);
  box-shadow: var(--sh), 0 0 0 3px rgba(43,191,202,.12);
}
.logbook-search { position: relative; display: flex; align-items: center; }
.logbook-search__icon {
  position: absolute; left: .1rem; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
}
.logbook-search__input {
  width: 100%; box-sizing: border-box;
  padding: .45rem .5rem .45rem 1.85rem;
  background: transparent; border: none;
  font: inherit; font-size: .9rem; color: var(--text);
  -webkit-appearance: none;
}
.logbook-search__input::placeholder { color: var(--text-3); }
.logbook-search__input:focus { outline: none; }
.logbook-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none; width: 14px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2l10 10M12 2L2 12' stroke='%237a9ab8' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  cursor: pointer; opacity: 1;
}

/* ── Chips card ── */
.logbook-chips-card {
  background: var(--surface);
  border: 1.5px solid var(--surface-3);
  border-radius: var(--r-lg);
  padding: .65rem 1rem;
  box-shadow: var(--sh);
}
.logbook-filter-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ── fdd (filter dropdown) trigger ── */
.fdd {
  display: inline-flex; align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--surface-3);
  border-radius: 999px;
  padding: .4rem .55rem .4rem .88rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  font: inherit;
}
.fdd:hover { border-color: #b0c4d6; }
.fdd:focus-visible { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(43,191,202,.12); }
.fdd--open { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(43,191,202,.12); }
.fdd--active { border-color: var(--teal-dim); background: var(--teal-bg); }
.fdd__label { font-size: .78rem; font-weight: 600; color: var(--text-2); letter-spacing: -.01em; }
.fdd__sep { color: var(--text-3); font-size: .78rem; margin: 0 .18rem; }
.fdd__value { font-size: .78rem; color: var(--text); }
.fdd--active .fdd__value { color: var(--teal-dim); font-weight: 600; }
.fdd__chevron { width: 10px; height: 6px; color: var(--text-3); margin-left: .4rem; transition: transform .2s; flex-shrink: 0; }
.fdd--open .fdd__chevron { transform: rotate(180deg); }

/* ── fdd panel ── */
.fdd__panel {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1.5px solid var(--surface-3);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(13,31,60,.14), 0 2px 8px rgba(13,31,60,.08);
  min-width: 220px;
  max-width: 300px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transition: opacity .14s, transform .14s;
  pointer-events: none;
}
.fdd__panel--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fdd__search-wrap {
  position: relative;
  padding: .5rem .6rem;
  border-bottom: 1px solid var(--surface-3);
  flex-shrink: 0;
}
.fdd__search-icon {
  position: absolute; left: 1.05rem; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3); pointer-events: none;
}
.fdd__search {
  width: 100%; padding: .32rem .4rem .32rem 1.75rem;
  border: 1.5px solid var(--surface-3); border-radius: var(--r);
  background: var(--surface-2); font: inherit; font-size: .82rem; color: var(--text);
  box-sizing: border-box;
}
.fdd__search:focus { outline: none; border-color: var(--teal); }
.fdd__search::placeholder { color: var(--text-3); }

.fdd__options {
  flex: 1; overflow-y: auto;
  padding: .25rem 0;
}
.fdd__options::-webkit-scrollbar { width: 4px; }
.fdd__options::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

.fdd__group-header {
  padding: .55rem .9rem .2rem;
  font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3);
}

.fdd__option {
  display: flex; align-items: center; gap: .55rem;
  padding: .42rem .9rem;
  cursor: pointer; font-size: .84rem; color: var(--text);
  transition: background .1s;
}
.fdd__option:hover { background: var(--surface-2); }
.fdd__option--checked { color: var(--teal-dim); }
.fdd__option--checked:hover { background: var(--teal-bg); }

.fdd__checkbox {
  width: 15px; height: 15px; flex-shrink: 0;
  accent-color: var(--teal); cursor: pointer;
  border-radius: 3px;
}
.fdd__option-label { flex: 1; }
.fdd__check { width: 11px; height: 9px; color: var(--teal-dim); flex-shrink: 0; }

.fdd__no-results {
  padding: .9rem; font-size: .84rem; color: var(--text-3); text-align: center;
}

.fdd__panel-footer {
  border-top: 1px solid var(--surface-3);
  padding: .38rem .9rem;
  flex-shrink: 0;
}
.fdd__clear-link {
  font-size: .78rem; font-weight: 600; color: var(--teal-dim);
  background: none; border: none; padding: 0; cursor: pointer;
}
.fdd__clear-link:hover { text-decoration: underline; }

/* ── Clear all filters ── */
.fdd-clear-all {
  font-size: .78rem; font-weight: 600; color: var(--danger);
  background: none; border: none; padding: .38rem .6rem;
  cursor: pointer; border-radius: 999px;
  transition: background .15s;
  white-space: nowrap;
}
.fdd-clear-all:hover { background: var(--danger-bg); }

@media (min-width: 640px) {
  .logbook-filter-row { flex-wrap: nowrap; }
}

/* ============================================================
   Dive list & cards
   ============================================================ */
.dive-list { display: flex; flex-direction: column; gap: .65rem; }

.dive-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem 1rem 1rem;
  display: flex; align-items: center; gap: .85rem;
  box-shadow: var(--sh);
  transition: box-shadow .15s;
}
.dive-card:hover { box-shadow: var(--sh-md); }

/* Number badge */
.dive-num {
  flex-shrink: 0;
  width: 50px;
  background: var(--teal-bg);
  border-radius: var(--r);
  display: flex; flex-direction: column; align-items: center;
  padding: .5rem .25rem .4rem;
  text-align: center;
}
.dive-num__label { font-size: .55rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--teal-dim); line-height: 1; }
.dive-num__n { font-size: 1.4rem; font-weight: 800; color: var(--teal-dim); line-height: 1; }

.dive-card__body { flex: 1; min-width: 0; text-align: left; background: none; border: none; font: inherit; cursor: pointer; padding: 0; }
.dive-card__body:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: var(--r); }
.dive-card__site { font-size: .95rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dive-card__meta { font-size: .78rem; color: var(--text-3); margin: .15rem 0 .5rem; }

.dive-card__badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .71rem; font-weight: 600;
  padding: .18rem .5rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--surface-3);
}
.badge--depth { color: var(--teal-dim); background: var(--teal-bg); border-color: transparent; }
.badge--time  { color: #4a7aa5; background: #e8f0f8; border-color: transparent; }
.badge--check { color: #1a7a3c; background: #e8f9ef; border-color: transparent; }
.badge--buddy { color: var(--text-2); }

.dive-card__stars { margin-top: .4rem; color: #f5a623; font-size: .8rem; letter-spacing: .1em; }

.dive-card__sub { font-size: .8rem; color: var(--text-2); margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dive-card__actions { display: flex; gap: .15rem; flex-shrink: 0; }
.dive-card__edit, .dive-card__del { flex-shrink: 0; padding: .4rem; color: var(--text-3); border-radius: var(--r); transition: color .15s, background .15s; }
.dive-card__edit:hover { color: var(--teal-dim); background: var(--teal-bg); }
.dive-card__del:hover { color: var(--danger); background: var(--danger-bg); }
.dive-card__edit:focus-visible, .dive-card__del:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.dive-card__edit svg, .dive-card__del svg { width: 15px; height: 15px; display: block; }

/* Dive detail (read-only) modal */
.dive-detail__header-actions { display: flex; align-items: center; gap: .25rem; }
.modal__icon-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-3); border-radius: var(--r); transition: color .15s, background .15s; }
.modal__icon-btn:hover { color: var(--teal-dim); background: var(--teal-bg); }
.modal__icon-btn svg { width: 18px; height: 18px; }
.dive-detail__body { display: flex; flex-direction: column; gap: 1.25rem; }
.dive-detail__group-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: .5rem; }
.dive-detail__row { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--surface-2); }
.dive-detail__row:last-child { border-bottom: none; }
.dive-detail__label { font-size: .85rem; color: var(--text-2); flex-shrink: 0; }
.dive-detail__val { font-size: .85rem; font-weight: 600; color: var(--text); text-align: right; word-break: break-word; }
.dive-detail__empty { font-size: .85rem; color: var(--text-3); text-align: center; padding: 1rem; }

/* ============================================================
   State box
   ============================================================ */
.state-box { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 3rem 2rem; gap: .65rem; }
.state-box__emoji { font-size: 2.75rem; line-height: 1; }
.state-box__title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.state-box__text  { font-size: .875rem; color: var(--text-2); line-height: 1.7; max-width: 280px; }

/* ============================================================
   Profile
   ============================================================ */
.profile-body { display: flex; flex-direction: column; padding: 2rem 1.5rem; gap: 2rem; max-width: 560px; }
.profile-identity { display: flex; align-items: center; gap: 1.25rem; }
.profile-identity__text { display: flex; flex-direction: column; gap: .25rem; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid var(--teal); flex-shrink: 0; }
.profile-name  { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.profile-email { font-size: .875rem; color: var(--text-2); }

.settings-section { display: flex; flex-direction: column; gap: 1rem; }
.settings-section__title { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin: 0; }
.settings-section__desc  { font-size: .875rem; color: var(--text-2); margin: -.5rem 0 0; }
.settings-section--account { border-top: 1px solid var(--border, rgba(255,255,255,.08)); padding-top: 2rem; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .7rem 1.5rem; border-radius: var(--r);
  font-size: .9rem; font-weight: 600; cursor: pointer; border: none;
  transition: opacity .15s, background .15s;
}
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn--primary { background: var(--teal-dim); color: #fff; }
.btn--primary:hover { background: var(--teal); }
.btn--ghost { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--surface-3); }
.btn--ghost:hover { background: var(--surface-3); }
.btn--danger { background: var(--danger-bg); color: var(--danger); min-width: 160px; }
.btn--danger:hover { opacity: .85; }

/* ============================================================
   Status
   ============================================================ */
.status { font-size: .85rem; color: var(--text-3); text-align: center; min-height: 1.2em; }
.status.error { color: var(--danger); }

/* ============================================================
   Modal
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-end; }
@media (min-width: 600px) { .modal { align-items: center; justify-content: center; } }

.modal__backdrop { position: absolute; inset: 0; background: rgba(13,31,60,.55); backdrop-filter: blur(2px); animation: fade-in .2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal__sheet {
  position: relative; width: 100%; max-width: 540px; max-height: 92svh;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: slide-up .28s cubic-bezier(.22,1,.36,1);
  padding: 1.25rem 1.25rem 2rem;
}
@media (min-width: 600px) { .modal__sheet { border-radius: var(--r-xl); animation: scale-in .2s ease; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes scale-in { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal__header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .5rem; }
.modal__title  { font-size: 1.1rem; font-weight: 700; }
.modal__close  { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-3); border-radius: var(--r); transition: color .15s, background .15s; }
.modal__close svg { width: 18px; height: 18px; }
.modal__close:hover { color: var(--text); background: var(--surface-2); }
.modal__close:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ============================================================
   Form
   ============================================================ */
.dive-form  { display: flex; flex-direction: column; gap: .8rem; }
.form-row   { display: grid; gap: .65rem; }
.form-row--2 { grid-template-columns: 1fr 1fr; }
.form-row--name { grid-template-columns: 1fr .42fr 1fr; }
.form-row--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 480px) { .form-row--4 { grid-template-columns: repeat(4, 1fr); } }
.form-field { display: flex; flex-direction: column; gap: .3rem; }
.form-label { font-size: .78rem; font-weight: 600; color: var(--text-2); }
.form-field--req .form-label::after { content: ' *'; color: var(--danger); }
.form-input {
  padding: .6rem .75rem; border: 1.5px solid var(--surface-3); border-radius: var(--r);
  font: inherit; font-size: .875rem; color: var(--text); background: var(--surface); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(43,191,202,.15); }
.form-input::placeholder { color: var(--text-3); }
.form-input[type="date"] { color-scheme: light; }
.form-textarea { resize: vertical; min-height: 68px; }

.star-rating { display: flex; gap: .2rem; margin-top: .1rem; }
.star { font-size: 1.6rem; color: var(--surface-3); transition: color .1s; padding: 0 .05rem; line-height: 1; }
.star--active { color: #f5a623; }
.star:hover { transform: scale(1.15); }
.star:focus-visible { outline: 2px solid var(--teal); border-radius: 3px; }

.form-status  { font-size: .85rem; text-align: center; }
.form-actions { display: flex; gap: .65rem; justify-content: flex-end; margin-top: .25rem; }
.form-actions .btn { min-width: 100px; }

/* ============================================================
   Log-a-dive wizard
   ============================================================ */
.dive-wizard { gap: 0; }
.dwz-track { display: flex; flex-direction: column; }
.dive-slide { display: flex; flex-direction: column; gap: .8rem; }
.dive-slide[hidden] { display: none; }
.dive-slide__title { font-size: 1rem; font-weight: 700; color: var(--text); margin: .1rem 0 .2rem; }
.dive-slide__fields { display: flex; flex-direction: column; gap: .8rem; }

/* number + unit suffix */
.dwz-num { position: relative; display: flex; align-items: center; }
.dwz-num .form-input { padding-right: 2.6rem; }
.dwz-suffix { position: absolute; right: .75rem; font-size: .8rem; color: var(--text-3); pointer-events: none; }

/* choice chips (enum + multi) */
.chip-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  padding: .42rem .7rem; border: 1.5px solid var(--surface-3); border-radius: 999px;
  font: inherit; font-size: .82rem; color: var(--text-2); background: var(--surface);
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.chip:hover { border-color: var(--teal-dim); }
.chip--on { border-color: var(--teal-dim); background: var(--teal-bg); color: var(--teal-dim); font-weight: 600; }
.chip:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* per-field star (pin to main slides) */
.form-label { display: flex; align-items: center; gap: .4rem; }
.field-star {
  font-size: 1.05rem; line-height: 1; color: var(--text-3);
  padding: 0 .1rem; cursor: pointer; transition: color .12s, transform .12s;
}
.field-star:hover { transform: scale(1.15); }
.field-star--on { color: #f5a623; }
.field-star:focus-visible { outline: 2px solid var(--teal); border-radius: 3px; }

.dwz-pinned-label, .dwz-hint { font-size: .76rem; color: var(--text-3); margin: .3rem 0 0; }
.dwz-no-buddy {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem 0;
  cursor: pointer; user-select: none;
}
.dwz-no-buddy__check { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; flex-shrink: 0; }
.dwz-no-buddy__label { font-size: .88rem; color: var(--text-2); }
.dwz-pinned-label { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }

/* accordion groups on the "More details" slide */
.dwz-acc { border: 1px solid var(--surface-3); border-radius: var(--r); overflow: hidden; }
.dwz-acc + .dwz-acc { margin-top: .6rem; }
.dwz-acc__head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: .7rem .85rem; font: inherit; font-size: .9rem; font-weight: 600; color: var(--text);
  background: var(--surface-2); cursor: pointer;
}
.dwz-acc__head:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.dwz-acc__chev { transition: transform .18s; color: var(--text-3); }
.dwz-acc__head[aria-expanded="true"] .dwz-acc__chev { transform: rotate(180deg); }
.dwz-acc__body { display: flex; flex-direction: column; gap: .8rem; padding: .85rem; }
.dwz-acc__body[hidden] { display: none; }

/* footer: back | dots | actions */
.dwz-footer {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem;
  margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--surface-2);
}
.dwz-footer__left  { justify-self: start; }
.dwz-footer__right { justify-self: end; display: flex; gap: .5rem; }
.dwz-footer .btn { min-width: 84px; }
.dwz-nav[hidden] { display: none; }
.dwz-dots { display: flex; gap: .4rem; justify-self: center; }
.dwz-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); transition: background .15s, transform .15s; }
.dwz-dot--on { background: var(--teal-dim); transform: scale(1.25); }
.dwz-dot--more { width: 6px; height: 6px; opacity: .6; }

/* Confirmation slide */
.confirm-header {
  display: flex; align-items: center; gap: .85rem;
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal) 25%, transparent);
  border-radius: var(--r); padding: .85rem 1rem; margin-bottom: 1rem;
}
.confirm-header__stamp { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.confirm-header__title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0 0 .2rem; }
.confirm-header__sub { font-size: .8rem; color: var(--text-2); margin: 0; line-height: 1.4; }

/* Current photo preview (edit mode) */
.confirm-current { position: relative; border-radius: var(--r); overflow: hidden; margin-bottom: .75rem; }
.confirm-current__img { width: 100%; max-height: 200px; object-fit: cover; display: block; }
.confirm-current__overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: .5rem; background: linear-gradient(transparent, rgba(0,0,0,.55));
  display: flex; justify-content: flex-end;
}
.confirm-current__replace {
  font-size: .78rem; padding: .3rem .75rem;
  background: rgba(255,255,255,.9); color: var(--text); border-radius: 999px;
  border: none; cursor: pointer; font-weight: 600;
}

/* Drop zone button */
.confirm-drop {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: 1.5rem 1rem; border: 2px dashed var(--surface-3); border-radius: var(--r);
  background: var(--surface-2); text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.confirm-drop:hover { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 5%, var(--surface-2)); }
.confirm-drop--replace { border-style: solid; }
.confirm-drop--ready { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 8%, var(--surface-2)); }
.confirm-drop__icon { font-size: 2.2rem; line-height: 1; }
.confirm-drop__title { font-size: .92rem; font-weight: 700; color: var(--teal); }
.confirm-drop__sub { font-size: .76rem; color: var(--text-3); line-height: 1.4; }
.confirm-drop__file { font-size: .8rem; color: var(--teal); font-weight: 600; word-break: break-all; }

.confirm-ack {
  display: flex; gap: .75rem; align-items: flex-start; margin-top: .75rem;
  padding: .8rem; background: color-mix(in srgb, #f59e0b 10%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
  border-radius: var(--r); cursor: pointer;
}
.confirm-ack__check {
  width: 1.1rem; height: 1.1rem; flex-shrink: 0; margin-top: .1rem;
  accent-color: var(--teal);
}
.confirm-ack__text { font-size: .85rem; line-height: 1.45; color: var(--text); }
@keyframes ack-shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-5px); }
  40%,80% { transform: translateX(5px); }
}
.confirm-ack--shake { animation: ack-shake .45s ease; border-color: #f59e0b; }

/* Confirmation badge on dive cards */
.badge--confirmed { background: color-mix(in srgb, var(--teal) 15%, transparent); color: var(--teal); font-size: .72rem; }

/* Dive detail tabs */
.modal__sheet--tabs { display: flex; flex-direction: column; overflow: hidden; }
.detail-tabs { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--surface-3); }
.detail-tab {
  flex: 1; padding: .65rem .5rem; font-size: .84rem; font-weight: 600;
  color: var(--text-2); background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.detail-tab--on { color: var(--teal); border-bottom-color: var(--teal); }
.detail-tab__panel { display: none; overflow-y: auto; flex: 1; padding: 0 1.25rem 1.5rem; }
.detail-tab__panel--on { display: block; }

/* Confirmation tab content */
.confirm-tab-content { padding-top: 1rem; }
.confirm-tab__img { width: 100%; border-radius: var(--r); display: block; }
.confirm-tab-empty { padding: 2rem 0; text-align: center; color: var(--text-2); font-size: .88rem; line-height: 1.5; }

/* Existing photo preview in confirmation slide */
.confirm-existing { margin-bottom: .75rem; text-align: center; }
.confirm-existing__img { max-width: 100%; max-height: 180px; border-radius: var(--r); object-fit: contain; border: 1px solid var(--surface-3); }
.confirm-existing__label { font-size: .76rem; color: var(--text-3); margin-top: .35rem; }
.confirm-upload--replace { border-style: solid; border-color: var(--surface-3); }

/* Confirmation badge on dive cards */
.badge--confirmed { background: color-mix(in srgb, var(--teal) 15%, transparent); color: var(--teal); font-size: .72rem; }

/* Dive detail tabs */
.modal__sheet--tabs { display: flex; flex-direction: column; overflow: hidden; }
.detail-tabs { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--surface-3); }
.detail-tab {
  flex: 1; padding: .65rem .5rem; font-size: .84rem; font-weight: 600;
  color: var(--text-2); background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.detail-tab--on { color: var(--teal); border-bottom-color: var(--teal); }
.detail-tab__panel { display: none; overflow-y: auto; flex: 1; padding: 0 1.25rem 1.5rem; }
.detail-tab__panel--on { display: block; }

/* Confirmation tab content */
.confirm-tab-content { padding-top: 1rem; }
.confirm-tab__img { width: 100%; border-radius: var(--r); display: block; }
.confirm-tab-empty { padding: 2rem 0; text-align: center; color: var(--text-2); font-size: .88rem; line-height: 1.5; }

@media (max-width: 420px) {
  .dwz-footer { grid-template-columns: 1fr auto; row-gap: .7rem; }
  .dwz-dots { grid-column: 1 / -1; order: -1; }   /* dots span full width on top */
  .dwz-footer__right { flex-wrap: wrap; justify-content: flex-end; }
}

/* ============================================================
   Desktop layout
   ============================================================ */
@media (min-width: 768px) {
  .view--app { flex-direction: row; }
  .sidenav { display: flex; }
  .app-content { flex-direction: row; flex: 1; overflow: hidden; }
  .panel { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .home-body { padding: 1.5rem; max-width: 860px; }
  .dive-list { max-width: 820px; }
  .home-stats { gap: .75rem; }

  .panel-header { padding: 1.25rem 2rem 1rem; }
}

/* ============================================================
   Bubbles
   ============================================================ */
.bubble {
  position: fixed;
  bottom: -60px;
  border-radius: 50%;
  /* glassy sphere: dark base, bright rim, specular highlight */
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(circle at 68% 72%, rgba(43,191,202,0.18) 0%, rgba(43,191,202,0) 60%),
    radial-gradient(circle at 50% 50%, rgba(43,191,202,0.07) 0%, rgba(13,31,60,0.04) 100%);
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow:
    inset -2px -2px 4px rgba(43,191,202,0.25),
    inset  1px  1px 3px rgba(255,255,255,0.35);
  pointer-events: none;
  animation: bubble-rise var(--dur, 9s) ease-in forwards;
  z-index: 0;
}
@keyframes bubble-rise {
  0%   { transform: translateY(0)       translateX(0);                    opacity: 0; }
  8%   { opacity: 0.85; }
  25%  { transform: translateY(-25vh)   translateX(calc(var(--drift)*0.3)); }
  50%  { transform: translateY(-52vh)   translateX(calc(var(--drift)*0.7)); }
  75%  { transform: translateY(-78vh)   translateX(var(--drift)); }
  92%  { opacity: 0.5; }
  100% { transform: translateY(-112vh)  translateX(calc(var(--drift)*1.1)); opacity: 0; }
}


/* Tall modal variant for search (scrollable content) */
.modal__sheet--tall { max-height: 90vh; overflow-y: auto; }
@media (min-width: 600px) { .modal__sheet--tall { max-height: 80vh; } }
.modal__sheet--narrow { max-width: 360px; margin: auto; border-radius: var(--r-xl) !important; text-align: center; }

/* Remove cert confirmation modal */
.remove-cert-icon-wrap { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.remove-cert-icon { width: 56px; height: 56px; }
.remove-cert-title { font-size: 1.15rem; font-weight: 700; color: var(--text); margin: 0 0 .5rem; }
.remove-cert-name  { font-size: .95rem; font-weight: 600; color: var(--teal); margin: 0 0 .75rem; }
.remove-cert-desc  { font-size: .85rem; color: var(--text-2); margin: 0 0 1.75rem; line-height: 1.5; }
.remove-cert-actions { display: flex; gap: .75rem; justify-content: center; }
.complete-profile__desc { font-size: .9rem; color: var(--text-2); margin: 0 0 1.25rem; line-height: 1.5; }
.remove-cert-actions .btn { min-width: 110px; }

/* No-results strip inside modal */
.cert-no-results { text-align: center; padding: 1.5rem 1rem; }
.cert-no-results__text { color: var(--text-2); margin-bottom: 1rem; font-size: .9rem; }
.btn--secondary { background: var(--surface-2); color: var(--text-1); border: 1px solid var(--surface-3); padding: .6rem 1.4rem; border-radius: var(--r); font-weight: 600; font-size: .9rem; cursor: pointer; }
.btn--secondary:hover { background: var(--surface-3); }

/* Cert-results grid inside modal */
#modal-cert-search .cert-results-grid { margin-top: 1rem; }
#modal-cert-search .diver-card { max-width: 100%; }

/* Cert panel action row */
.cert-actions { padding: 1rem 1.25rem .25rem; }
.cert-actions .btn-log-dive { max-width: 100%; }
@media (min-width: 768px) {
  .cert-actions { padding: 1.5rem 2rem .5rem; }
  .cert-actions .btn-log-dive { width: auto; min-width: 220px; }
}

/* Search form footer — always-visible manual add link */
.cert-form-footer { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--surface-3); }
.cert-form-footer__text { font-size: .82rem; color: var(--text-3); }
.cert-form-footer__link { font-size: .82rem; font-weight: 600; color: var(--teal-dim); background: none; border: none; cursor: pointer; padding: 0; }
.cert-form-footer__link:hover { text-decoration: underline; }
.cert-suggestions {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 200;
  background: var(--surface-1, #fff);
  border: 1px solid var(--surface-3, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  margin: 2px 0 0;
  padding: 4px 0;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
}
.cert-suggestions[hidden] { display: none; }
.cert-suggestions__item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1.3;
}
.cert-suggestions__item:hover,
.cert-suggestions__item[aria-selected="true"] {
  background: var(--surface-2, #f3f3f3);
}
.cert-suggestions__name { font-weight: 600; color: var(--text-1, #111); }
.cert-suggestions__desc { color: var(--text-3, #888); font-size: .78rem; margin-top: 1px; }
/* Site autocomplete */
.site-ac__list {
  position: fixed;
  z-index: 9999;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--r);
  box-shadow: var(--sh-md);
  max-height: 260px;
  overflow-y: auto;
}
.site-ac__list[hidden] { display: none; }
.site-ac__item {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .6rem 1rem;
  cursor: pointer;
  outline: none;
}
.site-ac__item:hover,
.site-ac__item:focus { background: var(--teal-bg); }
.site-ac__name { font-size: .92rem; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-ac__local { font-size: .76rem; color: var(--text-3); flex: 1 0 100%; margin-top: -.1rem; order: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-ac__item { flex-wrap: wrap; }
.site-ac__meta { order: 3; }
.site-ac__country { font-size: .78rem; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }

/* Date + time inline row */
.dwz-row { display: flex; gap: .5rem; }
.dwz-row .form-field { flex: 1; }
.dwz-row .dwz-field[data-field="dive_time"] { flex: 0 0 auto; }

/* Time HH:MM split */
.dwz-time-split { display: flex; align-items: center; gap: .35rem; }
.dwz-time-split .form-input { width: 72px; text-align: center; padding-left: .5rem; padding-right: .5rem; }
.dwz-time-sep { font-size: 1.1rem; font-weight: 700; color: var(--text-2); line-height: 1; }

/* Site autocomplete meta (country + distance) */
.site-ac__meta { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.site-ac__dist { font-size: .75rem; color: var(--teal-dim); white-space: nowrap; font-weight: 600; }

/* Invite accept modal */
.invite-avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--teal); margin: 0 auto 1rem; display: block;
}
.invite-from { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: .25rem; }
.invite-tagline { font-size: .95rem; color: var(--text-2); margin-bottom: 1rem; }
.invite-dive {
  background: var(--surface-2); border-radius: var(--r); padding: .75rem 1rem;
  text-align: left; margin: .75rem 0;
}
.invite-dive__label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: .2rem; }
.invite-dive__site  { font-size: .95rem; font-weight: 700; color: var(--text); }
.invite-dive__meta  { font-size: .8rem; color: var(--text-3); margin-top: .1rem; }

/* Missing required field highlight */
.form-field--missing .form-input,
.form-field--missing .chip-group,
.form-field--missing .site-ac .form-input,
.form-field--missing .dwz-time-split .form-input {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(194,65,12,.12);
}
.form-field--missing .form-label { color: var(--danger); }

/* Starred-field highlight animation (fires after promote to experience slide) */
@keyframes field-highlight {
  0%   { background: rgba(43,191,202,.18); border-radius: var(--r); }
  60%  { background: rgba(43,191,202,.10); }
  100% { background: transparent; }
}
.dwz-field--highlight { animation: field-highlight 1.4s ease forwards; }

/* Field label row with help button */
.form-label-row { display: flex; align-items: center; gap: .3rem; margin-bottom: .15rem; }
.form-label-row .form-label { margin: 0; }
.field-help-btn {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--surface-3); font-size: .7rem; font-weight: 700; line-height: 1;
  color: var(--text-3); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .12s, color .12s, background .12s;
}
.field-help-btn:hover { border-color: var(--teal-dim); color: var(--teal-dim); background: var(--teal-bg); }
.field-help-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.field-help-pop {
  font-size: .78rem; color: var(--text-2); line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--surface-3);
  border-radius: var(--r); padding: .55rem .75rem;
  margin-bottom: .25rem;
}
.field-help-pop[hidden] { display: none; }

/* Entry type chips with icons */
.chip-group--entry { gap: .5rem; }
.chip--icon { display: inline-flex; align-items: center; gap: .35rem; padding: .55rem .85rem; }
.chip__icon { flex-shrink: 0; display: flex; align-items: center; }
.chip__img { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; opacity: .75; }
.chip--on .chip__img { opacity: 1; }
.chip--icon.chip--on .chip__icon svg { stroke: var(--teal-dim); }

/* Location field readonly state */
.form-field--auto .form-input {
  background: var(--surface-2); color: var(--text-2);
  border-style: dashed; cursor: default;
}
.form-field--auto .form-label::after { content: ' (auto-filled)'; font-weight: 400; color: var(--text-3); font-size: .7rem; }

/* Accordion optional label */
.dwz-acc__opt { font-weight: 400; font-size: .8em; color: var(--text-3); }

/* Buddy autocomplete */
.buddy-ac { position: relative; }
.buddy-ac__list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  z-index: 200; margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--surface-3);
  border-radius: var(--r); box-shadow: var(--sh-md);
  max-height: 220px; overflow-y: auto;
}
.buddy-ac__list[hidden] { display: none; }
.buddy-ac__item, .buddy-ac__create {
  padding: .6rem 1rem; cursor: pointer; outline: none;
  font-size: .9rem; color: var(--text);
  display: flex; align-items: center; gap: .45rem;
}
.buddy-ac__item:hover, .buddy-ac__item:focus { background: var(--teal-bg); }
.buddy-ac__create { color: var(--teal-dim); font-weight: 600; border-top: 1px solid var(--surface-2); }
.buddy-ac__create:hover, .buddy-ac__create:focus { background: var(--teal-bg); }

/* Create new buddy inline form */
.buddy-create {
  margin-top: .6rem; padding: .85rem; background: var(--surface-2);
  border-radius: var(--r); border: 1px solid var(--surface-3);
}
.buddy-create[hidden] { display: none; }
.buddy-create__title { font-size: .82rem; font-weight: 700; color: var(--text-2); margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .04em; }
.buddy-create__row { display: flex; gap: .5rem; }
.buddy-create__row .form-input { flex: 1; }

/* Invite link panel */
.buddy-invite {
  margin-top: .6rem; padding: .85rem; background: linear-gradient(135deg, rgba(43,191,202,.07), rgba(43,191,202,.03));
  border-radius: var(--r); border: 1px solid rgba(43,191,202,.25);
}
.buddy-invite[hidden] { display: none; }
.buddy-invite__label { font-size: .85rem; color: var(--text-2); margin-bottom: .5rem; }
.buddy-invite__label strong { color: var(--teal-dim); }
.buddy-invite__url-row { display: flex; gap: .4rem; margin-bottom: .6rem; }
.buddy-invite__url { flex: 1; font-size: .78rem; background: var(--surface); }
.buddy-invite__share-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn--share {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .85rem; border-radius: var(--r); font-size: .82rem; font-weight: 600;
  border: 1.5px solid var(--surface-3); color: var(--text-2); background: var(--surface);
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn--share:hover { background: var(--surface-2); border-color: var(--teal-dim); color: var(--teal-dim); }
.buddy-invite__wa { color: #25d366; }
.buddy-invite__wa:hover { border-color: #25d366; color: #25d366; background: rgba(37,211,102,.07); }
.buddy-invite__qr { display: block; width: 160px; height: 160px; margin: .75rem auto .5rem; border-radius: var(--r); }
.buddy-invite__err { font-size: .82rem; color: var(--danger, #e53e3e); margin: .25rem 0 .5rem; text-align: center; }
.buddy-invite__native { color: var(--teal-dim); }

/* Pending dive shares (awaiting approval) */
.pending-shares { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.pending-shares[hidden] { display: none; }
.pending-shares__title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: .25rem 0 .1rem; }
.pending-share {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(43,191,202,.08), rgba(43,191,202,.03));
  border: 1px solid rgba(43,191,202,.28); border-radius: var(--r); padding: .75rem .9rem;
}
.pending-share__info { flex: 1; min-width: 0; }
.pending-share__site { font-size: .95rem; font-weight: 700; color: var(--text); }
.pending-share__meta { font-size: .78rem; color: var(--text-3); margin-top: .15rem; }
.pending-share__actions { display: flex; gap: .4rem; flex-shrink: 0; }
.pending-share__actions .btn { padding: .4rem .8rem; font-size: .82rem; }

/* Buddies page */
/* Buddies panel */
.buddies-body { padding: 1rem 1rem .5rem; display: flex; flex-direction: column; gap: 1rem; }

.buddies-top-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.buddies-top-row .btn-log-dive { flex-shrink: 0; }
.buddies-top-row .buddies-search-wrap { flex: 1; min-width: 160px; }

.buddies-search-wrap { position: relative; }
.buddies-search__icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.buddies-search { width: 100%; padding: .65rem .9rem .65rem 2.4rem; background: var(--surface); border: 1px solid var(--surface-3); border-radius: var(--r); font: inherit; font-size: .9rem; color: var(--text); }
.buddies-search:focus { outline: none; border-color: var(--teal-dim); box-shadow: 0 0 0 3px var(--teal-bg); }

.buddy-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; margin-top: .1rem; }
.buddy-stat { font-size: .72rem; color: var(--text-3); background: var(--surface-2); border-radius: 99px; padding: .15rem .55rem; white-space: nowrap; }
.buddy-stat--total { color: var(--teal-dim); background: var(--teal-bg); }
.buddy-stat--link { cursor: pointer; border: none; font: inherit; transition: opacity .15s; }
.buddy-stat--link:hover { opacity: .72; }

.buddies-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 520px) { .buddies-list { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .buddies-list { grid-template-columns: repeat(4, 1fr); } }

.buddy-card {
  background: var(--surface); border: 1px solid var(--surface-3);
  border-radius: var(--r-lg); padding: 1.25rem 1rem 1rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  box-shadow: var(--sh); text-align: center;
}
.buddy-card__avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-bg) 0%, var(--surface-3) 100%);
  color: var(--teal-dim); font-weight: 700; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--surface-3);
}
.buddy-card__avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.buddy-card__name { font-size: .9rem; font-weight: 700; color: var(--text); line-height: 1.2; word-break: break-word; }
.buddy-card__status {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: .2rem .6rem; border-radius: 99px;
}
.buddy-card__status--on { background: var(--teal-bg); color: var(--teal-dim); }
.buddy-card__status--pending { background: var(--surface-2); color: var(--text-3); }
.buddy-card__share {
  margin-top: .35rem; width: 100%; padding: .45rem .5rem;
  background: var(--surface-2); border: 1px solid var(--surface-3);
  border-radius: var(--r); font-size: .78rem; font-weight: 600; color: var(--text-2);
  transition: background .15s, color .15s;
}
.buddy-card__share:hover { background: var(--teal-bg); color: var(--teal-dim); border-color: var(--teal-dim); }

/* ============================================================
   Plan a Dive
   ============================================================ */
.plan-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  height: calc(100% - 3.5rem);
  overflow-y: auto;
}
.plan-topbar { display: flex; align-items: center; }
.plan-search-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: .5rem .75rem;
}
.plan-search { display: flex; align-items: center; gap: .6rem; }
.plan-search__icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); }
.plan-search__input {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  background: none;
  padding: .5rem 0;
}
.plan-search__input::placeholder { color: var(--text-3); }
.plan-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.plan-chips-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: .65rem .85rem;
}
.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.plan-col { display: flex; flex-direction: column; gap: .5rem; }
.plan-col__title {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 0 .1rem;
}
.plan-col__list { display: flex; flex-direction: column; gap: .5rem; }

/* Site card */
.plan-site-card {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
}
.plan-site-card:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.plan-site-card__name {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-site-card__meta {
  font-size: .73rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.plan-site-card__dist { margin-left: auto; font-size: .7rem; color: var(--text-3); }
.plan-site-card__rating { color: #f5a623; font-size: .72rem; letter-spacing: .08em; }

/* Center card */
.plan-center-card {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  transition: box-shadow .15s, transform .1s;
}
.plan-center-card:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.plan-center-card__name {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-center-card__loc {
  font-size: .73rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-center-card__dist { font-size: .7rem; color: var(--teal-dim); margin-top: .1rem; }

.plan-col-done { font-size: .72rem; color: var(--text-3); text-align: center; padding: .5rem 0 .25rem; }
.plan-loading { display: flex; justify-content: center; padding: 2.5rem 0; }
.plan-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-3);
  font-size: .82rem;
  line-height: 1.5;
}
.plan-geo-prompt {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--text-2);
  font-size: .83rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  align-items: center;
  line-height: 1.5;
}
.plan-geo-prompt__icon { font-size: 1.75rem; }
.plan-geo-prompt__btn {
  padding: .45rem 1.1rem;
  border: 1.5px solid var(--teal-dim);
  border-radius: 999px;
  color: var(--teal-dim);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.plan-geo-prompt__btn:hover { background: var(--teal-bg); }

/* Favorites chip */
.plan-fav-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--surface);
  border: 1.5px solid var(--surface-3);
  border-radius: 999px;
  padding: .35rem .75rem .35rem .55rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.plan-fav-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
.plan-fav-chip:hover { border-color: #f5a623; color: #f5a623; }
.plan-fav-chip--active { border-color: #f5a623; background: rgba(245,166,35,.1); color: #c78a0a; }
.plan-fav-chip--active svg { fill: #f5a623; stroke: #f5a623; }

/* Star button on cards */
.plan-star-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--r);
  color: var(--text-3);
  transition: color .15s, background .15s;
  padding: 0;
}
.plan-star-btn svg { width: 15px; height: 15px; }
.plan-star-btn:hover { color: #f5a623; background: rgba(245,166,35,.1); }
.plan-star-btn--on { color: #f5a623; }
.plan-star-btn--on svg { fill: #f5a623; }

/* Card row layout (name + star) */
.plan-site-card,
.plan-center-card { position: relative; }
.plan-card__top { display: flex; align-items: flex-start; gap: .25rem; }
.plan-card__top .plan-site-card__name,
.plan-card__top .plan-center-card__name { flex: 1; min-width: 0; }

/* Plan detail modal */
.plan-detail-sheet { max-width: 560px; width: 100%; }
.plan-detail-section { margin-bottom: 1rem; }
.plan-detail-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: .3rem;
}
.plan-detail-value { font-size: .88rem; color: var(--text-2); line-height: 1.5; }
.plan-detail-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.plan-detail-tag {
  background: var(--teal-bg);
  color: var(--teal-dim);
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 999px;
}
.plan-detail-rating { color: #f5a623; font-size: .95rem; letter-spacing: .1em; }
.plan-detail-tag--link {
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.plan-detail-tag--link:hover { background: var(--teal-bg); color: var(--teal-dim); }
.plan-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  font-size: .82rem;
  color: var(--text-2);
  margin-bottom: 1rem;
}
.plan-detail-stat { display: flex; flex-direction: column; gap: .1rem; }
.plan-detail-stat b { font-size: .95rem; color: var(--text); }
.plan-detail-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--surface-3);
  color: var(--text-2);
  transition: background .15s, border-color .15s;
}
.plan-detail-link:hover { background: var(--surface-2); }
.plan-detail-link svg { width: 16px; height: 16px; flex-shrink: 0; }
/* Source credit — card + modal */
.plan-card__credit {
  font-size: .68rem;
  color: var(--text-3);
  margin-top: .25rem;
}
.plan-card__source { }
.plan-detail-credit {
  font-size: .75rem;
  color: var(--text-3);
  margin-top: 1.25rem;
  padding-top: .75rem;
  border-top: 1px solid var(--surface-3);
}
.plan-detail-credit a { color: var(--text-3); text-decoration: underline; }
.plan-detail-credit a:hover { color: var(--text-2); }

/* Load More button */
.plan-load-more {
  display: block;
  width: 100%;
  padding: .65rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--surface-3);
  border-radius: var(--r-lg);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-top: .25rem;
}
.plan-load-more:hover { background: var(--surface-2); border-color: var(--teal-dim); color: var(--teal-dim); }

/* Inline nav icons in modal location row */
.plan-detail-loc-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .88rem;
  color: var(--text-2);
}
.plan-nav-icon { display: inline-flex; align-items: center; flex-shrink: 0; }
.plan-nav-icon__img { width: 20px; height: 20px; object-fit: contain; }

.plan-detail-gm-search { color: #4285f4; text-decoration: none; font-size: .85rem; }

.plan-detail-nav-row {
  display: flex;
  gap: .25rem;
  margin-top: .4rem;
}

.modal__header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .3rem;
  flex-shrink: 0;
}
.plan-detail-ext-links { text-align: right; }
.plan-ext-more-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: .2rem;
}
.plan-detail-ext-links-body {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.plan-ext-gm-img { width: 24px; height: 24px; object-fit: contain; display: block; }
.plan-padi-star {
  font-size: .72rem;
  font-weight: 600;
  color: #003087;
  margin-top: .1rem;
  margin-bottom: .4rem;
}
.plan-ext-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .2rem .45rem;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-decoration: none;
  transition: opacity .15s;
  line-height: 1;
}
.plan-ext-link:hover { opacity: .75; }
.plan-ext-link--padi { background: #003087; color: #fff; }
.plan-ext-link--ssi  { background: #e3000f; color: #fff; }
.plan-ext-link--gm   { background: #f1f3f4; padding: .2rem .3rem; border: 1px solid #ddd; }
.plan-detail-gm-search:hover { text-decoration: underline; }
.plan-detail-map-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  font-weight: 600;
  color: #4285f4;
  text-decoration: none;
  border-bottom: 1px solid rgba(66,133,244,.3);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}
.plan-detail-map-link:hover { color: #1a6fc4; border-color: #1a6fc4; }
.plan-detail-map-link svg { width: 15px; height: 15px; flex-shrink: 0; }

@media (max-width: 639px) {
  .plan-body { padding: .85rem 1rem; }
  .plan-grid { grid-template-columns: 1fr; }
}

/* Invite buddy modal */
.invite-buddy__desc { font-size: .88rem; color: var(--text-2); margin: 0 0 1rem; line-height: 1.5; }
.invite-buddy__link-wrap { display: flex; gap: .5rem; margin-bottom: 1rem; }
.invite-buddy__link-input { flex: 1; padding: .6rem .85rem; background: var(--surface-2); border: 1px solid var(--surface-3); border-radius: var(--r); font-size: .8rem; color: var(--text-2); min-width: 0; }
.invite-buddy__copy { flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--surface-3); color: var(--text-2); display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.invite-buddy__copy svg { width: 18px; height: 18px; }
.invite-buddy__copy:hover, .invite-buddy__copy.copied { background: var(--teal-bg); color: var(--teal-dim); border-color: var(--teal-dim); }
.invite-buddy__qr-wrap { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin: .25rem 0 1rem; }
.invite-buddy__qr { width: 160px; height: 160px; border-radius: var(--r); background: var(--surface-2); display: block; }
.invite-buddy__qr-label { font-size: .72rem; color: var(--text-3); }
.invite-buddy__share-row { display: flex; gap: .6rem; }
.invite-buddy__share-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: .75rem .5rem; border-radius: var(--r); font-size: .75rem; font-weight: 600;
  border: 1px solid var(--surface-3); background: var(--surface-2); color: var(--text-2);
  text-decoration: none; transition: background .15s, color .15s, border-color .15s;
}
.invite-buddy__share-btn svg { width: 22px; height: 22px; }
.invite-buddy__share-btn:hover { background: var(--surface-3); color: var(--text); }
.invite-buddy__share-btn--whatsapp { color: #25d366; border-color: rgba(37,211,102,.3); background: rgba(37,211,102,.06); }
.invite-buddy__share-btn--whatsapp:hover { background: rgba(37,211,102,.14); }
.invite-buddy__share-btn--whatsapp svg { width: 22px; height: 22px; }
.invite-buddy__share-btn--sms { color: #3b82f6; border-color: rgba(59,130,246,.3); background: rgba(59,130,246,.06); }
.invite-buddy__share-btn--sms:hover { background: rgba(59,130,246,.14); }

/* ============================================================
   Cert photos — edit modal upload strip
   ============================================================ */
.cert-photos-section { display: flex; flex-direction: column; gap: .6rem; }

.cert-photos-list { display: flex; flex-wrap: wrap; gap: .5rem; }

.cert-photo-thumb {
  position: relative; width: 72px; height: 72px; border-radius: var(--r);
  overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--surface-3); background: var(--surface-2);
  cursor: pointer;
}
.cert-photo-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.cert-photo-thumb__del {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; border: none; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.cert-photo-thumb:hover .cert-photo-thumb__del { opacity: 1; }
.cert-photo-thumb__del:focus { opacity: 1; }

.cert-photo-add {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; border-radius: var(--r);
  border: 1.5px dashed var(--surface-3); background: transparent;
  color: var(--text-2); font-size: .82rem; font-weight: 500;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
  align-self: flex-start;
}
.cert-photo-add svg { width: 16px; height: 16px; flex-shrink: 0; }
.cert-photo-add:hover { border-color: var(--teal-dim); color: var(--teal-dim); background: var(--teal-bg); }

/* ============================================================
   Cert photos — diver card strip
   ============================================================ */
.dc-photos-strip {
  display: flex; gap: .4rem; flex-wrap: wrap;
  padding: 0 16px 14px; margin-top: -2px;
}
.dc-photo-thumb {
  width: 52px; height: 52px; border-radius: 6px; overflow: hidden;
  border: 1.5px solid rgba(255,255,255,.18); flex-shrink: 0;
  cursor: pointer; transition: opacity .15s, border-color .15s;
}
.dc-photo-thumb:hover { opacity: .85; border-color: rgba(255,255,255,.45); }
.dc-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============================================================
   Cert photo lightbox
   ============================================================ */
.cert-photo-lightbox {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 9999;
  padding: env(safe-area-inset-top, 1rem) 1rem env(safe-area-inset-bottom, 1rem);
}
.cert-photo-lightbox__close {
  position: absolute; top: max(env(safe-area-inset-top, 0px), 1rem); right: 1rem;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,.55); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  z-index: 1;
}
.cert-photo-lightbox__close svg { width: 20px; height: 20px; }
.cert-photo-lightbox__img {
  max-width: min(100%, 900px); max-height: calc(100dvh - 120px);
  object-fit: contain; border-radius: var(--r); display: block;
}
.cert-photo-lightbox__nav {
  display: flex; align-items: center; gap: .75rem;
  margin-top: .75rem;
}
.cert-photo-lightbox__prev,
.cert-photo-lightbox__next {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,.55); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.cert-photo-lightbox__prev svg,
.cert-photo-lightbox__next svg { width: 20px; height: 20px; }
.cert-photo-lightbox__prev:disabled,
.cert-photo-lightbox__next:disabled { opacity: .35; cursor: default; }
.cert-photo-lightbox__counter { color: rgba(255,255,255,.7); font-size: .85rem; min-width: 4ch; text-align: center; }

/* cert photos pill button on diver card */
.dc-photos-btn {
  position: absolute; bottom: 14px; left: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .75rem .35rem .6rem;
  border-radius: 99px; border: 1.5px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.35); color: rgba(255,255,255,.9);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dc-photos-btn:hover { background: rgba(0,0,0,.55); border-color: rgba(255,255,255,.6); }
.dc-photos-btn:disabled { opacity: .5; cursor: default; }
.dc-photos-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ============================================================
   Mobile FAB + search toggle
   ============================================================ */

/* Search toggle button — visible only on mobile (hidden on desktop via media query below) */
.panel-search-btn {
  display: none; /* overridden at max-width:767px */
  align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.85);
  transition: background .15s, border-color .15s, color .15s;
}
.panel-search-btn svg { width: 18px; height: 18px; }
.panel-search-btn.search-active {
  background: rgba(43,191,202,.3);
  border-color: var(--teal-dim);
  color: var(--teal-dim);
}

@media (max-width: 767px) {
  /* Show search toggle buttons in panel headers */
  .panel-search-btn { display: flex; }

  /* Fixed FAB: primary create buttons float above the bottom nav */
  .btn-log-dive {
    position: fixed;
    bottom: calc(var(--bnav-h) + 10px);
    left: 1rem;
    right: 1rem;
    width: auto;
    z-index: 50;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
  }

  /* Extra bottom padding so list content scrolls clear of FAB + bottom nav */
  .panel { padding-bottom: calc(var(--bnav-h) + 72px); }

  /* Collapse the topbar containers whose only child is now the fixed button */
  .cert-actions { padding: 0; }
  .plan-topbar  { display: none; }
  /* logbook-topbar keeps home-stats, so only remove button spacing */
  .logbook-topbar { gap: 0; }

  /* Buddies top row: search wrap handled by toggle; row no longer needs padding */
  .cert-actions.buddies-top-row { padding: 0; }

  /* ── Mobile search: collapsed by default, slide in on .search-open ── */
  .logbook-search-card,
  .plan-search-card,
  .buddies-search-wrap {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-height .22s ease, opacity .18s ease;
  }
  .logbook-search-card.search-open,
  .plan-search-card.search-open,
  .buddies-search-wrap.search-open {
    max-height: 80px;
    opacity: 1;
    pointer-events: auto;
  }
}
