/* ============================================================================
   Diving Journals — design system v2: "Depth & Surface"
   Single source of truth for the app's visual layer.
   Loaded after bootstrap.min.css + fonts.css, overrides Bootstrap's look.
   Fonts (self-hosted): Montserrat (display), Roboto (body).
   ----------------------------------------------------------------------------
   Subject grounding (commercial diving): the UI reads like dive instruments —
   a water-column depth gradient, sonar accents, tabular instrument figures
   for depths/times/pressures, and a glowing "under water" live status.

   TWO THEMES, keyed off <html data-bs-theme="dark|light">:
     dark  — "Глубина":     night ops, low ambient light.
     light — "Поверхность": bright deck sunlight, maximum legibility.
   Every component below is theme-agnostic and consumes only --c-* tokens.

   LAYOUT SHELL (tablet-first, 90% of users are tablets):
     ≥768px  — fixed left navigation rail (--rail-w), content beside it.
     ≥1200px — the rail expands into a full sidebar with labels.
     <768px  — compact sticky topbar with a collapsible menu.
   ========================================================================== */

/* ── Shared geometry & type (theme-independent) ───────────────────────── */
:root {
  --f-display: 'Montserrat', system-ui, sans-serif;
  --f-body:    'Roboto', system-ui, sans-serif;

  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 16px;

  --rail-w: 88px;
}
@media (min-width: 1200px) {
  :root { --rail-w: 232px; }
}

/* ── Theme: dark — "Глубина" (default) ────────────────────────────────── */
:root,
[data-bs-theme="dark"] {
  color-scheme: dark;

  /* depth column: surfaces from surface light to the abyss */
  --c-abyss:    #081320;
  --c-deep:     #0a1622;
  --c-panel:    #0f1f2e;
  --c-panel-2:  #14283a;
  --c-panel-3:  #1b344a;
  --c-line:     #21384e;
  --c-line-2:   #2c4a66;

  --c-foam:     #e6eef6;   /* primary text */
  --c-mist:     #a9c0d4;   /* secondary text */
  --c-muted:    #6e8aa3;   /* tertiary / labels */

  /* accent: dive light / sonar */
  --c-cyan:        #38bdf8;
  --c-cyan-bright: #6fd4ff;
  --c-cyan-deep:   #1b87c4;
  --c-cyan-glow:   rgba(56, 189, 248, .35);
  --c-cyan-soft:   rgba(56, 189, 248, .12);
  --c-on-accent:   #042331;

  /* status / semantic */
  --c-underwater:      #22d3ee;
  --c-on-underwater:   #04222a;
  --c-live-soft:       rgba(34, 211, 238, .08);
  --c-live-softer:     rgba(34, 211, 238, .14);
  --c-prep:       #94a9bf;
  --c-prep-bg:    rgba(148, 169, 191, .12);
  --c-prep-line:  rgba(148, 169, 191, .32);
  --c-paused:     #f6b545;
  --c-done:       #34d39e;
  --c-on-done:    #03251b;
  --c-danger:     #fb7185;
  --c-danger-bg:  rgba(251, 113, 133, .12);
  --c-danger-line: rgba(251, 113, 133, .45);
  --c-success:    #34d39e;
  --c-success-bg: rgba(52, 211, 158, .12);
  --c-success-line: rgba(52, 211, 158, .4);
  --c-warning:    #f6b545;
  --c-warning-bg: rgba(246, 181, 69, .12);
  --c-warning-line: rgba(246, 181, 69, .4);
  --c-info:       #38bdf8;
  --c-info-bg:    rgba(56, 189, 248, .12);

  --shadow:    0 2px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, .5);

  --body-bg:
    radial-gradient(1200px 520px at 50% -120px, rgba(56,189,248,.06), transparent 70%),
    linear-gradient(180deg, var(--c-deep) 0%, var(--c-abyss) 100%);
  --rail-bg: linear-gradient(180deg, var(--c-panel) 0%, var(--c-deep) 100%);
  --card-grad: linear-gradient(160deg, var(--c-panel) 0%, var(--c-deep) 100%);
  --header-grad: linear-gradient(135deg, var(--c-panel-2) 0%, var(--c-panel) 60%, var(--c-deep) 100%);
  --logo-filter: brightness(0) invert(1) drop-shadow(0 0 6px var(--c-cyan-glow));
  --scroll-thumb: var(--c-line-2);
  --scroll-thumb-hover: #3a5d7e;

  /* Bootstrap bridge */
  --bs-body-bg: var(--c-deep);
  --bs-body-color: var(--c-foam);
  --bs-border-color: var(--c-line);
  --bs-emphasis-color: var(--c-foam);
  --bs-secondary-color: var(--c-mist);
  --bs-tertiary-color: var(--c-muted);
  --bs-link-color: var(--c-cyan);
  --bs-link-hover-color: var(--c-cyan-bright);
  --bs-card-bg: var(--c-panel);
  --bs-card-cap-bg: var(--c-panel-2);
  --bs-modal-bg: var(--c-panel);
  --bs-modal-border-color: var(--c-line-2);
  --bs-dropdown-bg: var(--c-panel-2);
  --bs-dropdown-link-hover-bg: var(--c-panel-3);
  --bs-secondary-bg: var(--c-panel-2);

  /* ── Legacy --dc-* tokens (templates still reference these inline) ── */
  --dc-navy:       #cfe3f5;              /* heading/label ink on dark */
  --dc-navy-mid:   var(--c-panel-2);
  --dc-blue:       var(--c-cyan);
  --dc-blue-hover: var(--c-cyan-bright);
  --dc-blue-light: var(--c-cyan-soft);
  --dc-accent:     var(--c-cyan);
  --dc-text:       var(--c-foam);
  --dc-gray:       var(--c-panel);
  --dc-border:     var(--c-line);
}

/* ── Theme: light — "Поверхность" ─────────────────────────────────────── */
[data-bs-theme="light"] {
  color-scheme: light;

  /* sea-glass paper: cool, not cream */
  --c-abyss:    #dfe9f1;
  --c-deep:     #eef4f9;
  --c-panel:    #ffffff;
  --c-panel-2:  #f1f6fa;
  --c-panel-3:  #e3edf5;
  --c-line:     #d8e3ec;
  --c-line-2:   #bfd2e0;

  --c-foam:     #10293c;   /* ink */
  --c-mist:     #3f5d75;
  --c-muted:    #6b8296;

  /* accent deepened for AA contrast on white */
  --c-cyan:        #0173b2;
  --c-cyan-bright: #015d92;   /* hover darkens in daylight */
  --c-cyan-deep:   #0a4a73;
  --c-cyan-glow:   rgba(2, 132, 199, .28);
  --c-cyan-soft:   rgba(2, 132, 199, .10);
  --c-on-accent:   #ffffff;

  --c-underwater:      #0e7490;
  --c-on-underwater:   #ffffff;
  --c-live-soft:       rgba(14, 116, 144, .07);
  --c-live-softer:     rgba(14, 116, 144, .13);
  --c-prep:       #5d7288;
  --c-prep-bg:    rgba(93, 114, 136, .10);
  --c-prep-line:  rgba(93, 114, 136, .35);
  --c-paused:     #b45309;
  --c-done:       #067647;
  --c-on-done:    #ffffff;
  --c-danger:     #d92d20;
  --c-danger-bg:  rgba(217, 45, 32, .08);
  --c-danger-line: rgba(217, 45, 32, .4);
  --c-success:    #067647;
  --c-success-bg: rgba(6, 118, 71, .09);
  --c-success-line: rgba(6, 118, 71, .35);
  --c-warning:    #b45309;
  --c-warning-bg: rgba(180, 83, 9, .09);
  --c-warning-line: rgba(180, 83, 9, .35);
  --c-info:       #0173b2;
  --c-info-bg:    rgba(2, 132, 199, .08);

  --shadow:    0 1px 3px rgba(16, 41, 60, .07), 0 2px 12px rgba(16, 41, 60, .05);
  --shadow-lg: 0 12px 32px rgba(16, 41, 60, .16);

  --body-bg:
    radial-gradient(1200px 520px at 50% -120px, rgba(2,132,199,.07), transparent 70%),
    linear-gradient(180deg, #f4f8fb 0%, var(--c-abyss) 100%);
  --rail-bg: linear-gradient(180deg, #ffffff 0%, #f3f8fb 100%);
  --card-grad: linear-gradient(160deg, #ffffff 0%, #f6fafc 100%);
  --header-grad: linear-gradient(135deg, #ffffff 0%, #f4f9fc 60%, #ebf3f9 100%);
  --logo-filter: brightness(0) opacity(.82);   /* ink silhouette on light */
  --scroll-thumb: var(--c-line-2);
  --scroll-thumb-hover: #9fb8ca;

  /* Bootstrap bridge */
  --bs-body-bg: var(--c-deep);
  --bs-body-color: var(--c-foam);
  --bs-border-color: var(--c-line);
  --bs-emphasis-color: var(--c-foam);
  --bs-secondary-color: var(--c-mist);
  --bs-tertiary-color: var(--c-muted);
  --bs-link-color: var(--c-cyan);
  --bs-link-hover-color: var(--c-cyan-bright);
  --bs-card-bg: var(--c-panel);
  --bs-card-cap-bg: var(--c-panel-2);
  --bs-modal-bg: var(--c-panel);
  --bs-modal-border-color: var(--c-line-2);
  --bs-dropdown-bg: var(--c-panel);
  --bs-dropdown-link-hover-bg: var(--c-panel-2);
  --bs-secondary-bg: var(--c-panel-2);

  --dc-navy:       #10293c;   /* ink on light */
  --dc-navy-mid:   var(--c-panel-2);
  --dc-blue:       var(--c-cyan);
  --dc-blue-hover: var(--c-cyan-bright);
  --dc-blue-light: var(--c-cyan-soft);
  --dc-accent:     var(--c-cyan);
  --dc-text:       var(--c-foam);
  --dc-gray:       var(--c-panel);
  --dc-border:     var(--c-line);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
body {
  font-family: var(--f-body);
  font-weight: 400;
  color: var(--c-foam);
  background: var(--body-bg);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--f-display); color: var(--c-foam); }

a { color: var(--c-cyan); text-decoration: none; }
a:hover { color: var(--c-cyan-bright); }

hr { border-color: var(--c-line); opacity: 1; }

::selection { background: var(--c-cyan-glow); color: var(--c-foam); }

/* Instrument figures: depths, times, pressures read like a dive computer */
.tnum, .stat-value, .stat-mini-value, td.num, .table .num, .live-timer {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: .01em;
}

/* Custom scrollbar — quiet */
* { scrollbar-color: var(--scroll-thumb) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: content-box; }

/* ── Accessibility ────────────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 2000;
  background: var(--c-panel); color: var(--c-foam);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
  border: 1px solid var(--c-line-2);
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--c-cyan); outline-offset: 2px; border-radius: 2px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: none; }

/* Cross-document view transitions (Chrome/Android): soft page fades */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }

/* ══════════════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════════════ */

/* ── Navigation rail (≥768px) ─────────────────────────────────────────── */
.rail {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--rail-w);
  z-index: 1030;
  display: flex;
  flex-direction: column;
  background: var(--rail-bg);
  border-right: 1px solid var(--c-line);
  padding-top: max(.5rem, env(safe-area-inset-top));
  padding-left: env(safe-area-inset-left);
}
/* depth-gauge ticks down the rail's right edge — the instrument signature */
.rail::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0; width: 26px;
  background-image: repeating-linear-gradient(180deg, var(--c-line-2) 0 1px, transparent 1px 14px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000);
          mask-image: linear-gradient(90deg, transparent, #000);
  opacity: .35;
  pointer-events: none;
}

.rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .6rem .4rem .8rem;
  color: var(--c-foam);
  text-align: center;
}
.rail-brand:hover { color: var(--c-foam); }
.rail-brand img { height: 34px; filter: var(--logo-filter); }
.rail-brand__name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .58rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-mist);
  line-height: 1.25;
}

.rail-cta {
  margin: 0 auto .85rem;
  width: 52px; height: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: var(--radius);
  font-size: 1.5rem;
  line-height: 1;
}
.rail-cta .rail-cta__label { display: none; }

.rail-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .3rem .5rem .5rem;
}
.rail-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .32rem;
  min-height: 58px;
  padding: .5rem .15rem;
  border-radius: var(--radius);
  color: var(--c-mist);
  font-family: var(--f-display);
  font-weight: 600;
  font-size: .58rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.15;
  transition: color .15s, background .15s;
  position: relative;
}
.rail-link svg { width: 22px; height: 22px; flex-shrink: 0; }
.rail-link:hover { color: var(--c-foam); background: var(--c-panel-3); }
.rail-link.active {
  color: var(--c-cyan);
  background: var(--c-cyan-soft);
}
/* lit sonar tick on the active item's left edge */
.rail-link.active::before {
  content: "";
  position: absolute;
  left: -.5rem; top: 50%;
  height: 22px; width: 3px;
  transform: translateY(-50%);
  background: var(--c-cyan);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--c-cyan-glow);
}

.rail-foot {
  border-top: 1px solid var(--c-line);
  padding: .6rem .5rem calc(.6rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
}
.rail-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  max-width: 100%;
}
.rail-user__avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--c-panel-3);
  border: 1px solid var(--c-line-2);
  color: var(--c-mist);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rail-user__name {
  display: none;
  color: var(--c-muted);
  font-size: .78rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.rail-user { text-decoration: none; border-radius: var(--radius-sm); padding: .15rem; }
a.rail-user:hover .rail-user__name,
a.rail-user.active .rail-user__name { color: var(--c-foam); }
a.rail-user:hover .rail-user__avatar { border-color: var(--c-mist); }
a.rail-user.active .rail-user__avatar { border-color: var(--c-cyan); color: var(--c-cyan); background: var(--c-cyan-soft); }
.rail-foot .lang-switch { display: flex; gap: .25rem; }
.rail-foot form { margin: 0; }

/* Expanded sidebar ≥1200px: rows with labels */
@media (min-width: 1200px) {
  .rail-brand { flex-direction: row; justify-content: flex-start; gap: .6rem; padding: .8rem 1rem; }
  .rail-brand img { height: 30px; }
  .rail-brand__name { font-size: .68rem; text-align: left; }
  .rail-cta {
    margin: 0 .9rem .9rem;
    width: auto; height: auto;
    min-height: 48px;
    padding: .55rem 1rem;
    font-size: .8rem;
  }
  .rail-cta .rail-cta__plus { font-size: 1.15rem; margin-right: .5rem; }
  .rail-cta .rail-cta__label { display: inline; }
  .rail-nav { padding: .3rem .75rem .5rem; }
  .rail-link {
    flex-direction: row;
    justify-content: flex-start;
    gap: .75rem;
    min-height: 46px;
    padding: .55rem .85rem;
    font-size: .76rem;
    letter-spacing: .04em;
    text-align: left;
  }
  .rail-link svg { width: 20px; height: 20px; }
  .rail-link.active::before { left: -.75rem; }
  .rail-foot { flex-direction: row; flex-wrap: wrap; justify-content: space-between; padding-left: .9rem; padding-right: .9rem; }
  .rail-user { flex-direction: row; gap: .5rem; min-width: 0; flex: 1 1 100%; }
  .rail-user__avatar { width: 30px; height: 30px; font-size: .7rem; }
  .rail-user__name { display: block; }
}

/* Icon-only utility buttons in the rail / topbar */
.btn-icon {
  background: none;
  border: 1px solid var(--c-line-2);
  color: var(--c-mist);
  width: 38px; height: 38px;
  min-height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  flex-shrink: 0;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { color: var(--c-foam); border-color: var(--c-cyan-deep); background: var(--c-panel-3); }
.btn-icon--danger:hover { color: var(--c-danger); border-color: var(--c-danger); background: var(--c-danger-bg); }

/* theme toggle: show the icon of the theme you would switch TO */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
[data-bs-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-bs-theme="light"] .theme-toggle .icon-moon { display: inline; }
[data-bs-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-bs-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Mobile topbar (<768px) ───────────────────────────────────────────── */
.m-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--rail-bg);
  border-bottom: 1px solid var(--c-line);
  box-shadow: var(--shadow);
  padding-top: max(.45rem, env(safe-area-inset-top));
  padding-bottom: .45rem;
}
.m-topbar__bar { display: flex; align-items: center; gap: .6rem; }
/* the collapsible menu must never outgrow the screen — scroll inside */
.m-topbar #navMenu { max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain; }
.m-topbar__brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .03em;
  color: var(--c-foam);
  min-width: 0;
}
.m-topbar__brand:hover { color: var(--c-foam); }
.m-topbar__brand img { height: 30px; filter: var(--logo-filter); }
.m-topbar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-topbar__toggler {
  margin-left: auto;
  background: none;
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius-sm);
  color: var(--c-mist);
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.m-topbar__toggler svg { width: 20px; height: 20px; }
.m-menu {
  border-top: 1px solid var(--c-line);
  margin-top: .45rem;
  padding: .6rem .25rem .4rem;
}
.m-menu .rail-link {
  flex-direction: row;
  justify-content: flex-start;
  gap: .8rem;
  min-height: 48px;
  padding: .6rem .8rem;
  font-size: .8rem;
  text-align: left;
}
.m-menu .rail-link.active::before { left: 0; }
.m-menu__foot {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--c-line);
  margin-top: .6rem;
  padding: .7rem .5rem 0;
}
.m-menu__user { color: var(--c-muted); font-size: .82rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.m-menu__user { text-decoration: none; }
a.m-menu__user:hover { color: var(--c-foam); }

/* ── Main content area ────────────────────────────────────────────────── */
.app-main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-right: env(safe-area-inset-right);
}
@media (min-width: 768px) {
  .app-main { padding-left: calc(var(--rail-w) + env(safe-area-inset-left)); }
  .m-topbar { display: none; }
}
@media (max-width: 767.98px) {
  .rail { display: none; }
}
/* content containers go fluid — a rail already constrains the line length */
.app-main .container {
  max-width: 1380px;
  width: 100%;
  padding-left: clamp(1rem, 2.5vw, 2.25rem);
  padding-right: clamp(1rem, 2.5vw, 2.25rem);
  margin-left: auto;
  margin-right: auto;
}
.app-content { flex: 1 1 auto; }

/* ── Page header strip — depth-gauge signature ────────────────────────── */
.page-header {
  position: relative;
  background: var(--header-grad);
  color: var(--c-foam);
  padding: 1.5rem 0 1.3rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--c-line);
  overflow: hidden;
}
/* faint depth-gauge ticks down the right edge */
.page-header::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0; width: 64px;
  background-image: repeating-linear-gradient(180deg, var(--c-line-2) 0 1px, transparent 1px 14px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000);
          mask-image: linear-gradient(90deg, transparent, #000);
  opacity: .5;
  pointer-events: none;
}
/* a lit waterline along the bottom */
.page-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-cyan) 35%, var(--c-cyan-bright) 50%, var(--c-cyan) 65%, transparent);
  opacity: .55;
}
.page-header h1 {
  font-size: clamp(1.3rem, 2.2vw, 1.55rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: .02em;
  overflow-wrap: anywhere;
}
.page-header .subtitle {
  font-size: .78rem;
  color: var(--c-cyan);
  margin-top: .3rem;
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  min-height: 44px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all .18s ease;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--c-cyan-soft); }
.btn-sm { min-height: 38px; font-size: .74rem; }

.btn-primary {
  background: var(--c-cyan);
  border-color: var(--c-cyan);
  color: var(--c-on-accent);
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--c-cyan-bright) !important;
  border-color: var(--c-cyan-bright) !important;
  color: var(--c-on-accent) !important;
  box-shadow: 0 0 16px var(--c-cyan-glow);
}
/* navy → "panel" surface button */
.btn-navy, .btn-secondary {
  background: var(--c-panel-2);
  border: 1px solid var(--c-line-2);
  color: var(--c-foam);
}
.btn-navy:hover, .btn-secondary:hover {
  background: var(--c-panel-3);
  border-color: var(--c-cyan-deep);
  color: var(--c-foam);
}
.btn-outline-navy, .btn-outline-secondary {
  border: 1px solid var(--c-line-2);
  color: var(--c-mist);
  background: transparent;
}
.btn-outline-navy:hover, .btn-outline-secondary:hover {
  background: var(--c-panel-2);
  border-color: var(--c-line-2);
  color: var(--c-foam);
}
.btn-outline-blue, .btn-outline-primary {
  border: 1px solid var(--c-cyan-deep);
  color: var(--c-cyan);
  background: transparent;
}
.btn-outline-blue:hover, .btn-outline-primary:hover {
  background: var(--c-cyan-soft);
  border-color: var(--c-cyan);
  color: var(--c-cyan-bright);
}
/* ghost button that sits on the page-header strip (theme-aware) */
.btn-outline-light, .btn-header-ghost {
  border: 1px solid var(--c-line-2);
  color: var(--c-mist);
  background: transparent;
}
.btn-outline-light:hover, .btn-header-ghost:hover {
  background: var(--c-panel-2);
  border-color: var(--c-cyan-deep);
  color: var(--c-foam);
}
.btn-danger {
  background: transparent;
  border: 1px solid var(--c-danger-line);
  color: var(--c-danger);
}
.btn-danger:hover { background: var(--c-danger-bg); border-color: var(--c-danger); color: var(--c-danger); }
.btn-success { background: var(--c-done); border-color: var(--c-done); color: var(--c-on-done); }
.btn-success:hover { background: var(--c-done); border-color: var(--c-done); color: var(--c-on-done); filter: brightness(1.1); }
.btn-logout {
  border: 1px solid var(--c-line-2);
  color: var(--c-mist);
  min-height: 34px; font-size: .74rem;
  font-family: var(--f-display); font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  background: transparent;
}
.btn-logout:hover { border-color: var(--c-danger); color: var(--c-danger); }

/* soft amber call-to-action (checklists block the start) */
.btn-warn-soft {
  background: var(--c-warning-bg);
  border: 1px solid var(--c-warning-line);
  color: var(--c-paused);
}
.btn-warn-soft:hover {
  background: var(--c-warning-bg);
  border-color: var(--c-paused);
  color: var(--c-paused);
  filter: brightness(1.05);
}
/* soft green confirm button (close event, etc.) */
.btn-ok-soft { background: var(--c-success-bg); border: 1px solid var(--c-success-line); color: var(--c-done); }
.btn-ok-soft:hover { background: var(--c-success-bg); border-color: var(--c-done); color: var(--c-done); filter: brightness(1.08); }

/* icon trash button (list pages) */
.btn-trash {
  color: var(--c-muted); opacity: .65; padding: .45rem .5rem;
  border-radius: var(--radius-sm); transition: all .15s;
  display: inline-flex; align-items: center; background: none; border: none;
  min-width: 40px; min-height: 40px; justify-content: center;
}
.btn-trash:hover { color: var(--c-danger); opacity: 1; background: var(--c-danger-bg); }
.btn-trash-sm {
  color: var(--c-muted); opacity: .6; padding: .35rem .45rem;
  border-radius: var(--radius-sm); transition: all .15s;
  display: inline-flex; align-items: center; background: none; border: none; flex-shrink: 0;
  min-width: 36px; min-height: 36px; justify-content: center;
}
.btn-trash-sm:hover { color: var(--c-danger); opacity: 1; background: var(--c-danger-bg); }

/* ── Cards & surfaces ─────────────────────────────────────────────────── */
.card {
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--c-foam);
}
.card-header, .card-footer { background: transparent; border-color: var(--c-line); }
.card-header-navy {
  background: var(--c-panel-2);
  color: var(--c-foam);
  padding: .9rem 1.25rem;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--c-line);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  /* the ::before tick is a flex item; keep content hugging it even when a
     template adds justify-content-between */
  justify-content: flex-start !important;
}
.card-header-navy::before {
  content: "";
  width: 3px; height: 1em;
  margin-right: .6rem;
  flex-shrink: 0;
  background: var(--c-cyan);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--c-cyan-glow);
}
/* trailing counters / actions inside a header dock to the right edge */
.card-header-navy > small:last-child,
.card-header-navy > .float-end { margin-left: auto; }

/* ── Empty states — an invitation to act, not a dead end ──────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--c-muted);
}
.empty-state__icon {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 1rem;
  opacity: .85;
}
.empty-state__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--c-mist);
  margin-bottom: .35rem;
}
.empty-state p { max-width: 420px; margin-left: auto; margin-right: auto; }
.empty-state .btn { margin-top: .75rem; }

/* ── Tables — dense instrument readout ────────────────────────────────── */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--c-foam);
  --bs-table-border-color: var(--c-line);
  --bs-table-striped-bg: var(--c-panel-2);
  --bs-table-striped-color: var(--c-foam);
  --bs-table-hover-bg: var(--c-cyan-soft);
  --bs-table-hover-color: var(--c-foam);
  color: var(--c-foam);
  border-color: var(--c-line);
}
.table th {
  font-family: var(--f-display);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--c-cyan);
  background: var(--c-panel-2);
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--c-line) !important;
  white-space: nowrap;
}
/* long tables: keep the header readable while scrolling */
.table thead th { position: sticky; top: 0; z-index: 2; }
.table td {
  padding: .8rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--c-line);
  border-top: none;
  font-size: .9rem;
  color: var(--c-foam);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover > * { background: var(--c-cyan-soft); }
/* the live-dive row glows faintly, like a lit channel */
.table-active-row > * { background: var(--c-live-soft) !important; box-shadow: inset 3px 0 0 var(--c-underwater); }
.table-active-row:hover > * { background: var(--c-live-softer) !important; }
.table-responsive { border-radius: var(--radius); }
/* long free text in cells must never blow the layout */
.cell-clip {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Status badges — instrument indicators ────────────────────────────── */
.badge-underwater, .badge-preparation, .badge-done, .badge-paused {
  font-family: var(--f-display);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .36em .8em;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: .45em;
  line-height: 1;
}
.badge-underwater::before, .badge-preparation::before,
.badge-done::before, .badge-paused::before {
  content: "";
  width: .5em; height: .5em;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-underwater {
  color: var(--c-on-underwater);
  background: var(--c-underwater);
  box-shadow: 0 0 0 1px var(--c-cyan-glow), 0 0 14px var(--c-cyan-glow);
  animation: uw-pulse 2s ease-in-out infinite;
}
.badge-underwater::before { background: var(--c-on-underwater); }
.badge-preparation {
  color: var(--c-prep);
  background: var(--c-prep-bg);
  border: 1px solid var(--c-prep-line);
}
.badge-done {
  color: var(--c-done);
  background: var(--c-success-bg);
  border: 1px solid var(--c-success-line);
}
.badge-paused {
  color: var(--c-paused);
  background: var(--c-warning-bg);
  border: 1px solid var(--c-warning-line);
}
@keyframes uw-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--c-cyan-glow), 0 0 12px var(--c-cyan-glow); }
  50%      { box-shadow: 0 0 0 1px var(--c-cyan-glow), 0 0 24px var(--c-cyan-glow); }
}

/* generic bootstrap badges, recolored */
.badge.bg-secondary { background: var(--c-panel-3) !important; color: var(--c-mist); }
.badge.bg-success   { background: var(--c-success-bg) !important; color: var(--c-done); }
.badge.bg-warning   { background: var(--c-warning-bg) !important; color: var(--c-paused); }
.badge.bg-danger    { background: var(--c-danger-bg) !important; color: var(--c-danger); }
.badge.bg-info      { background: var(--c-info-bg) !important; color: var(--c-cyan); }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  min-height: 48px;
  font-size: .95rem;
  background-color: var(--c-panel-2);
  color: var(--c-foam);
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius-sm);
}
.form-control::placeholder { color: var(--c-muted); opacity: 1; }
.form-control:focus, .form-select:focus {
  background-color: var(--c-panel-2);
  color: var(--c-foam);
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 3px var(--c-cyan-soft);
}
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23629ec4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 16px 12px;
  padding-right: 2.25rem;
}
.form-control:disabled, .form-select:disabled { background-color: var(--c-panel); color: var(--c-muted); }
.form-label, label {
  font-family: var(--f-display);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--c-mist);
}
.form-text, .text-muted { color: var(--c-muted) !important; }
.form-check-input {
  background-color: var(--c-panel-2);
  border-color: var(--c-line-2);
}
.form-check-input:checked {
  background-color: var(--c-cyan);
  border-color: var(--c-cyan);
}
.form-check-input:focus { border-color: var(--c-cyan); box-shadow: 0 0 0 3px var(--c-cyan-soft); }
.input-group-text {
  background: var(--c-panel-2);
  border: 1px solid var(--c-line-2);
  color: var(--c-mist);
}
.invalid-feedback, .errorlist, .text-danger { color: var(--c-danger) !important; }
.errorlist { list-style: none; padding: 0; margin: .25rem 0 0; font-size: .8rem; }
.was-validated .form-control:invalid, .form-control.is-invalid { border-color: var(--c-danger); }

/* native pickers follow the theme */
::-webkit-calendar-picker-indicator { filter: none; }
[data-bs-theme="dark"] ::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.7); }

/* ── Date fields: site-format text entry + calendar button (app.js) ───── */
.date-field { position: relative; }
.date-field > .form-control { padding-right: 2.6rem; font-variant-numeric: tabular-nums; }
.date-field > .form-control::placeholder { font-size: .9em; letter-spacing: -.01em; }
.date-field__btn {
  position: absolute; top: 0; right: 0; bottom: 0; width: 2.6rem;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--c-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.date-field__btn:hover, .date-field__btn:focus-visible { color: var(--c-cyan); background: var(--c-cyan-soft); }
.date-field__btn:disabled { color: var(--c-line-2); background: transparent; }
/* native input stays rendered (showPicker needs it) under the button, invisible */
.date-field > .date-field__native {
  position: absolute; right: 0; bottom: 0; width: 2.6rem; height: 100%; min-height: 0;
  padding: 0; border: 0; opacity: 0; pointer-events: none;
}

/* ── Pagination ───────────────────────────────────────────────────────── */
.page-link {
  color: var(--c-mist);
  background: var(--c-panel);
  border-color: var(--c-line);
  border-radius: var(--radius-sm) !important;
  font-family: var(--f-display);
  font-size: .8rem;
  font-weight: 600;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.page-link:hover { color: var(--c-cyan-bright); background: var(--c-panel-2); border-color: var(--c-cyan-deep); }
.page-item.active .page-link {
  background: var(--c-cyan);
  border-color: var(--c-cyan);
  color: var(--c-on-accent);
  box-shadow: 0 0 12px var(--c-cyan-glow);
}
.page-item.disabled .page-link { color: var(--c-muted); background: transparent; border-color: var(--c-line); }
.pagination { gap: .3rem; }

/* ── Alerts / messages ────────────────────────────────────────────────── */
.alert {
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius);
  background: var(--c-panel-2);
  color: var(--c-foam);
}
.alert-success { background: var(--c-success-bg); border-color: var(--c-success-line); color: var(--c-done); }
.alert-info    { background: var(--c-info-bg);    border-color: var(--c-cyan-deep);    color: var(--c-cyan); }
.alert-warning { background: var(--c-warning-bg); border-color: var(--c-warning-line); color: var(--c-paused); }
.alert-danger, .alert-error { background: var(--c-danger-bg); border-color: var(--c-danger-line); color: var(--c-danger); }

/* status banners (dive detail) */
.alert-live   { background: var(--c-live-soft);  border: 1px solid var(--c-underwater); color: var(--c-foam); }
.alert-paused { background: var(--c-warning-bg); border: 1px solid var(--c-warning-line); color: var(--c-foam); }

/* ── Modals ───────────────────────────────────────────────────────────── */
.modal-content {
  background: var(--c-panel);
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--c-foam);
}
.modal-header { background: var(--c-panel-2); border-color: var(--c-line); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal-footer { border-color: var(--c-line); }
.modal-title { font-family: var(--f-display); color: var(--c-foam); font-size: 1rem; font-weight: 700; letter-spacing: .02em; }
.btn-close, .btn-close-white { opacity: .7; }
.btn-close:hover, .btn-close-white:hover { opacity: 1; }
[data-bs-theme="dark"] .btn-close, [data-bs-theme="dark"] .btn-close-white { filter: invert(1) grayscale(1) brightness(1.6); }
[data-bs-theme="light"] .btn-close, [data-bs-theme="light"] .btn-close-white { filter: none; }
.modal-backdrop.show { opacity: .6; }

/* ── Dropdowns (bootstrap) ───────────────────────────────────────────── */
.dropdown-menu {
  background: var(--c-panel);
  border: 1px solid var(--c-line-2);
  box-shadow: var(--shadow-lg);
}
.dropdown-item { color: var(--c-mist); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--c-panel-3); color: var(--c-foam); }
.dropdown-divider { border-color: var(--c-line); }

/* ── Tom Select ───────────────────────────────────────────────────────── */
.ts-wrapper .ts-control {
  background: var(--c-panel-2);
  border: 1px solid var(--c-line-2);
  color: var(--c-foam);
  border-radius: var(--radius-sm);
  min-height: 48px;
  font-size: .95rem;
  display: flex;
  align-items: center;
}
.ts-wrapper.focus .ts-control { border-color: var(--c-cyan); box-shadow: 0 0 0 3px var(--c-cyan-soft); }
.ts-control input { color: var(--c-foam) !important; }
.ts-control input::placeholder { color: var(--c-muted) !important; }
.ts-dropdown {
  background: var(--c-panel);
  border: 1px solid var(--c-line-2);
  color: var(--c-foam);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
}
.ts-dropdown .option { color: var(--c-mist); padding: .55rem 1rem; }
.ts-dropdown .option:hover, .ts-dropdown .active { background: var(--c-cyan-soft); color: var(--c-foam); }
.ts-dropdown .option.selected { background: var(--c-cyan); color: var(--c-on-accent); }
.ts-dropdown .create:hover { background: var(--c-cyan-soft); }
.ts-control .item { color: var(--c-foam); }

/* ── Language switcher ────────────────────────────────────────────────── */
.lang-btn {
  background: none;
  border: 1px solid var(--c-line-2);
  color: var(--c-muted);
  font-family: var(--f-display);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .2em .55em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  min-height: 30px;
  min-width: 34px;
}
.lang-btn.active { border-color: var(--c-cyan); color: var(--c-cyan); background: var(--c-cyan-soft); }
.lang-btn:hover { color: var(--c-foam); border-color: var(--c-line-2); }

/* ── Sortable table headers ───────────────────────────────────────────── */
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; }
.sort-link:hover { color: var(--c-cyan-bright); }
.sort-indicator { font-size: .75em; opacity: .35; }
.sort-indicator.active { opacity: 1; color: var(--c-cyan); }

/* ── Floating action button (mobile) ──────────────────────────────────── */
@media (max-width: 767.98px) {
  .fab-bottom {
    position: fixed;
    bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + .75rem));
    right: 1.5rem; z-index: 1000;
    width: 58px; height: 58px; border-radius: 50%;
    font-size: 1.7rem; font-weight: 300;
    background: var(--c-cyan); color: var(--c-on-accent); border: none;
    box-shadow: 0 6px 22px var(--c-cyan-glow);
    display: inline-flex; align-items: center; justify-content: center;
  }
  .fab-bottom:hover { color: var(--c-on-accent); background: var(--c-cyan-bright); }
  body { padding-bottom: 5.5rem; }
}

/* ── Utilities (theme-aware remaps of bootstrap helpers) ──────────────── */
.text-blue { color: var(--c-cyan) !important; }
.text-navy { color: var(--c-foam) !important; }
.text-mist { color: var(--c-mist) !important; }
.text-warning { color: var(--c-paused) !important; }
.bg-panel { background: var(--c-panel) !important; }
.min-w-0 { min-width: 0 !important; }
.hairline { border-color: var(--c-line) !important; }
.border-warning { border-color: var(--c-warning-line) !important; }

/* htmx: dim the swap target while a request is in flight */
.htmx-request #stats-results, #stats-results.htmx-request { opacity: .45; transition: opacity .2s; }

/* ── Accessibility: respect reduced motion ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .badge-underwater { animation: none; }
  * { transition: none !important; animation-duration: .01ms !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   PAGE-LEVEL COMPONENTS
   ══════════════════════════════════════════════════════════════════════ */

/* ── Home dashboard ───────────────────────────────────────────────────── */
.home-card {
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 1.9rem 1.7rem;
  background: var(--card-grad);
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  position: relative;
  overflow: hidden;
  color: var(--c-foam);
}
.home-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.home-card--active { border-color: var(--c-line-2); }
.home-card--active::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--c-cyan);
  box-shadow: 0 0 12px var(--c-cyan-glow);
  opacity: 0; transition: opacity .2s;
}
.home-card--active:hover { border-color: var(--c-cyan-deep); }
.home-card--active:hover::before { opacity: 1; }
.home-card--wip { opacity: .62; }
.home-card--wip:hover { opacity: .85; }
.home-card__icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--c-cyan-soft);
  color: var(--c-cyan);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .9rem;
}
.home-card__icon svg { width: 26px; height: 26px; }
.home-card__title {
  font-family: var(--f-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-foam);
  margin-bottom: .5rem;
}
.home-card__desc { font-size: .875rem; color: var(--c-mist); margin-bottom: 0; line-height: 1.5; }
.home-card__arrow {
  position: absolute; right: 1.5rem; bottom: 1.4rem;
  font-size: 1.3rem; color: var(--c-cyan); font-weight: 700;
  transition: transform .2s;
}
.home-card--active:hover .home-card__arrow { transform: translateX(4px); }
.home-card__badge {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--c-panel-3); color: var(--c-mist);
  font-family: var(--f-display);
  font-size: .65rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: .25em .65em; border-radius: 999px;
  border: 1px solid var(--c-line-2);
}

/* ── Dive journal: operations board ───────────────────────────────────── */
/* Live / preparing dives surface as big touch-first cards above the archive */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.ops-card {
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--card-grad);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  position: relative;
  overflow: hidden;
}
.ops-card--live { border-color: var(--c-underwater); }
.ops-card--live::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--c-underwater) 30%, var(--c-underwater) 70%, transparent);
  animation: uw-pulse-line 2s ease-in-out infinite;
}
@keyframes uw-pulse-line { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.ops-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.ops-card__who { min-width: 0; }
.ops-card__diver {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--c-foam);
  overflow-wrap: anywhere;
}
.ops-card__diver:hover { color: var(--c-cyan); }
.ops-card__site {
  color: var(--c-muted);
  font-size: .82rem;
  margin-top: .1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.ops-card__timer, .ops-card__timer.live-timer {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--c-foam);
  line-height: 1.1;
  font-family: var(--f-display);
}
.ops-card__timer .ms { font-size: .8rem; opacity: .55; }
.ops-card__meta { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; font-size: .82rem; color: var(--c-muted); }
.ops-card__actions { display: flex; flex-direction: column; gap: .5rem; margin-top: auto; }
.ops-card__actions .btn { min-height: 48px; }
.ops-card__hint { font-size: .78rem; color: var(--c-paused); text-align: center; }
/* страхующий на карточке активного спуска */
.ops-card__backup {
  display: flex; flex-direction: column; gap: .5rem;
  border-top: 1px dashed var(--c-line-2); padding-top: .65rem;
}
.ops-card__backup.is-live {
  border-top: 2px solid var(--c-underwater);
}
.ops-card__backup-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; }
.ops-card__backup-label {
  font-family: var(--f-display); font-size: .7rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted);
}
.ops-card__backup-name { font-weight: 600; color: var(--c-foam); }
.ops-card__backup-state { margin-left: auto; font-size: .85rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.ops-card__backup.is-live .ops-card__backup-state { color: var(--c-foam); font-weight: 700; font-family: var(--f-display); }
.ops-card__backup-state .ms { font-size: .7em; opacity: .55; }
.ops-card__backup .btn { min-height: 44px; }
@media (prefers-reduced-motion: reduce) { .ops-card--live::before { animation: none; } }

.ops-section-title {
  font-family: var(--f-display);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .8rem;
}
.ops-section-title::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--c-line); }
.ops-section-title .count { color: var(--c-cyan); }

.chip-link {
  font-family: var(--f-display);
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}
.chip-link--ok { color: var(--c-done); }
.chip-link--warn { color: var(--c-paused); }
.chip-link--warn:hover { color: var(--c-paused); filter: brightness(1.15); }
.live-timer { letter-spacing: .03em; font-size: .95rem; }
.live-timer .ms { font-size: .75rem; opacity: .6; }
.event-dot { font-size: 1rem; line-height: 1; }
.event-dot-active { color: var(--c-danger); }
.event-dot-done { color: var(--c-done); }

/* ── Shared status pills (used across detail pages) ───────────────────── */
.tag-required, .tag-done, .tag-partial, .tag-notstarted {
  font-family: var(--f-display);
  font-size: .65rem; font-weight: 700;
  letter-spacing: .04em;
  padding: .25em .6em; border-radius: 999px;
  display: inline-block; line-height: 1;
}
.tag-required, .tag-partial { background: var(--c-warning-bg); color: var(--c-paused); border: 1px solid var(--c-warning-line); }
.tag-done                   { background: var(--c-success-bg); color: var(--c-done);   border: 1px solid var(--c-success-line); }
.tag-notstarted             { background: var(--c-panel-3);    color: var(--c-muted);  border: 1px solid var(--c-line-2); }

/* dark progress track + accent fill */
.progress { background-color: var(--c-panel-3); height: .5rem; }
.progress-bar.bg-primary { background-color: var(--c-cyan) !important; }
.progress-bar.bg-success { background-color: var(--c-done) !important; }

/* ── Dive detail ─────────────────────────────────────────────────────── */
.phase-table td:first-child { font-family: var(--f-display); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-mist); width: 40%; }
.phase-table td:last-child { font-size: .95rem; }
.phase-total td { border-top: 2px solid var(--c-line-2) !important; font-weight: 700; }
.info-label { font-family: var(--f-display); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--c-cyan); margin-bottom: .15rem; }
.info-value { font-size: .95rem; color: var(--c-foam); overflow-wrap: anywhere; }
.info-value.empty { color: var(--c-muted); font-style: italic; }
.equip-table th, .pause-table th { font-family: var(--f-display); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--c-cyan); background: var(--c-panel-2); padding: .75rem 1rem; }
.equip-table td, .pause-table td { padding: .75rem 1rem; font-size: .9rem; vertical-align: middle; border-bottom: 1px solid var(--c-line); }
.equip-table td:first-child { font-family: var(--f-display); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-mist); }
.section-title { font-family: var(--f-display); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-cyan); border-bottom: 2px solid var(--c-line-2); padding-bottom: .4rem; margin-bottom: 1rem; }
.pause-row td { background: var(--c-panel-2); }
.pause-active td { background: var(--c-warning-bg); }
.event-row-active { background: var(--c-live-soft) !important; margin: 0 -.75rem; padding-left: .75rem; padding-right: .75rem; }

/* ── Checklist run detail ────────────────────────────────────────────── */
.item-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--c-line); }
.item-row:last-child { border-bottom: none; }
.item-row .item-text { flex-grow: 1; font-size: .95rem; min-width: 0; overflow-wrap: anywhere; }
.item-row .item-text.done { text-decoration: line-through; color: var(--c-muted); }
.btn-check-toggle {
  background: none; border: 2px solid var(--c-line-2); border-radius: var(--radius-sm);
  width: 34px; height: 34px; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; color: var(--c-foam);
}
.btn-check-toggle.is-done { background: var(--c-done); border-color: var(--c-done); color: var(--c-on-done); }
.btn-check-toggle:hover:not(.is-done) { border-color: var(--c-done); }
.meta-row { display: flex; gap: .4rem; align-items: baseline; }
.meta-label { font-family: var(--f-display); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); min-width: 90px; }
.meta-value { font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }

/* ── Statistics (also used by the htmx results fragment) ──────────────── */
.stat-value { font-family: var(--f-display); font-size: 2rem; font-weight: 700; color: var(--c-foam); line-height: 1; margin-bottom: .35rem; }
.stat-label { font-family: var(--f-display); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }
.stat-mini-value { font-family: var(--f-display); font-size: 1.1rem; font-weight: 700; color: var(--c-foam); }
.stat-mini-label { font-size: .65rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }

/* ── Nav tabs (checklist filters) — segmented chips ──────────────────── */
.nav-tabs { border-bottom: 0; gap: .4rem; flex-wrap: wrap; }
.nav-tabs .nav-link {
  font-family: var(--f-display); font-size: .76rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--c-mist); background: var(--c-panel);
  border: 1px solid var(--c-line-2); border-radius: 999px;
  padding: .5rem 1.05rem; min-height: 40px;
  display: inline-flex; align-items: center;
  transition: background .15s, color .15s, border-color .15s;
  margin-bottom: 0;
}
.nav-tabs .nav-link:hover { background: var(--c-panel-3); color: var(--c-foam); border-color: var(--c-line-2); }
.nav-tabs .nav-link.active {
  background: var(--c-cyan); color: var(--c-on-accent);
  border-color: var(--c-cyan);
  box-shadow: 0 0 10px var(--c-cyan-glow);
}

/* ── Checklist badges & item rows ────────────────────────────────────── */
.badge-blocks, .badge-complete, .badge-partial, .badge-empty {
  font-family: var(--f-display); font-size: .7rem; font-weight: 700;
  letter-spacing: .04em; padding: .25em .6em; border-radius: 999px;
  display: inline-block; line-height: 1;
}
.badge-blocks, .badge-partial { background: var(--c-warning-bg); color: var(--c-paused); border: 1px solid var(--c-warning-line); }
.badge-complete { background: var(--c-success-bg); color: var(--c-done); border: 1px solid var(--c-success-line); }
.badge-empty { background: var(--c-panel-3); color: var(--c-muted); border: 1px solid var(--c-line-2); }
.item-num { font-size: .8rem; color: var(--c-muted); font-family: var(--f-display); font-weight: 700; min-width: 1.4rem; text-align: right; flex-shrink: 0; }

/* ── Signature: pad, standalone signing page, signed preview ───────────
   The pad is drawn by app.js on a <canvas>; ink colour is read from
   --c-foam so the drawing follows the active theme. Both themes below. */

.signature-box {
  position: relative;
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius);
  background: var(--c-panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* dotted baseline the diver signs on — painted over the canvas */
.signature-box::after {
  content: "";
  position: absolute;
  left: 6%; right: 6%; bottom: 22%;
  border-bottom: 2px dotted var(--c-line-2);
  pointer-events: none;
}
.signature-pad, .stylus-pad {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  max-height: 46vh;
  background: transparent;
  touch-action: none;
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 575.98px) {
  .signature-pad, .stylus-pad { aspect-ratio: 2 / 1; }
}

/* ── Standalone signing page (no rail, no topbar) ─────────────────────── */
body.sign-body {
  min-height: 100vh;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
}
.sign-page {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sign-back { min-height: 1.75rem; }
.sign-back__link {
  font-family: var(--f-display); font-size: .8rem; font-weight: 600;
  letter-spacing: .04em; color: var(--c-muted); text-decoration: none;
}
.sign-back__link:hover { color: var(--c-cyan); }

.sign-context { text-align: center; }
.sign-context__checklist {
  font-family: var(--f-display); font-size: .78rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--c-cyan);
}
.sign-context__dive { font-size: .82rem; color: var(--c-muted); margin-top: .2rem; }

.sign-who { text-align: center; padding: .5rem 0 .25rem; }
.sign-who__label {
  font-family: var(--f-display); font-size: .68rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--c-muted);
  margin-bottom: .35rem;
}
.sign-name {
  font-family: var(--f-display);
  font-size: clamp(1.6rem, 5.2vw, 2.75rem);
  font-weight: 700; line-height: 1.12; color: var(--c-foam);
  overflow-wrap: anywhere;
}
.sign-position {
  font-size: .9rem; color: var(--c-mist); margin-top: .3rem;
}

.sign-items {
  list-style: none; margin: 0; padding: .35rem 0;
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  columns: 1;
}
@media (min-width: 700px) { .sign-items { columns: 2; column-gap: 2rem; } }
.sign-item {
  display: flex; gap: .5rem; align-items: baseline;
  padding: .2rem 0; font-size: .85rem; color: var(--c-mist);
  break-inside: avoid;
}
.sign-item__mark { color: var(--c-muted); font-weight: 700; width: 1rem; flex-shrink: 0; }
.sign-item.is-done .sign-item__mark { color: var(--c-done); }
.sign-item__text { min-width: 0; overflow-wrap: anywhere; }

.sign-caption {
  text-align: center;
  font-family: var(--f-display); font-size: 1rem; font-weight: 700;
  color: var(--c-foam); margin-top: .25rem;
}

.sign-form { display: flex; flex-direction: column; gap: .85rem; }
.sign-actions { display: flex; gap: .75rem; }
.sign-actions .btn { flex: 1 1 0; min-height: 56px; }

.sign-error {
  background: var(--c-danger-bg);
  border: 1px solid var(--c-danger-line);
  border-radius: var(--radius);
  color: var(--c-danger);
  font-size: .88rem;
  padding: .65rem .9rem;
}

.sign-blocked {
  text-align: center;
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius);
  background: var(--c-panel);
  padding: 2rem 1.25rem;
}
.sign-blocked__title {
  font-family: var(--f-display); font-size: .78rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--c-paused);
  margin-bottom: .6rem;
}
.sign-blocked__text { color: var(--c-mist); margin-bottom: 1.25rem; }

.sign-pick {
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius);
  background: var(--c-panel);
  padding: 1.5rem 1.25rem;
}

/* ── PIN-код (ключ простой ЭП): поле на экране подписи и экран задания ── */
.pin-input {
  font-family: var(--f-display);
  font-size: 1.6rem; letter-spacing: .5em; text-align: center;
  max-width: 16rem; margin: 0 auto;
}
.sign-pin { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; }
.sign-pin .form-label { margin: 0; color: var(--c-mist); font-weight: 600; }
.sign-pin__forgot { font-size: .8rem; color: var(--c-muted); }
.sign-pin__forgot:hover { color: var(--c-cyan); }

.pin-explain {
  color: var(--c-mist); font-size: .92rem; text-align: center;
  max-width: 36rem; margin: 0 auto;
}
.pin-explain p { margin-bottom: .5rem; }
.pin-explain__warn { color: var(--c-warning); }
.pin-form {
  display: flex; flex-direction: column; gap: 1rem;
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius);
  background: var(--c-panel);
  padding: 1.5rem 1.25rem;
}
.pin-form__field { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pin-form .btn { min-height: 56px; }
.pin-form__after { margin: 0; font-size: .82rem; color: var(--c-muted); text-align: center; }

.pep-notice {
  background: var(--c-info-bg);
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius);
  color: var(--c-foam);
  font-size: .88rem;
  padding: .65rem .9rem;
}
.pep-facts { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.pep-facts .info-label { display: inline; margin-right: .35rem; }
.pep-log summary { cursor: pointer; font-size: .85rem; color: var(--c-muted); }
.pep-log__list { list-style: none; margin: 0; padding: 0 1.5rem .75rem; font-size: .82rem; }
.pep-log__list li { display: flex; flex-wrap: wrap; gap: .25rem .75rem; padding: .25rem 0; border-bottom: 1px solid var(--c-line); }
.pep-log__list li:last-child { border-bottom: 0; }
.pep-log__when { color: var(--c-muted); font-variant-numeric: tabular-nums; }
.pep-log__what { color: var(--c-foam); flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.pep-log__who { color: var(--c-mist); }
.sig-slot__auth { color: var(--c-muted); }

/* ── Signed state on the run detail page ─────────────────────────────── */
.sign-banner {
  background: var(--c-success-bg);
  border: 1px solid var(--c-success-line);
  border-radius: var(--radius);
  color: var(--c-done);
  font-family: var(--f-display); font-weight: 700; font-size: .9rem;
  padding: .8rem 1rem;
}
/* ── Блок «Подписи» на странице заполнения: строка на подписанта ─────── */
.sign-banner__who { font-weight: 400; margin-left: .35rem; }
.sign-banner__next {
  margin-top: .35rem; font-family: var(--f-body); font-weight: 600;
  color: var(--c-foam);
}
.sig-slot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  padding: .9rem 0;
}
.sig-slot + .sig-slot { border-top: 1px solid var(--c-line); }
.sig-slot__num {
  flex: 0 0 2.25rem; height: 2.25rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-weight: 700;
  border: 2px solid var(--c-line-2); color: var(--c-muted);
}
.sig-slot.is-next .sig-slot__num { border-color: var(--c-cyan); color: var(--c-cyan); }
.sig-slot.is-signed .sig-slot__num { border-color: var(--c-done); background: var(--c-success-bg); color: var(--c-done); }
.sig-slot__body { flex: 1 1 12rem; min-width: 0; }
.sig-slot__role {
  font-family: var(--f-display); font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted);
}
.sig-slot__name {
  font-family: var(--f-display); font-size: 1.1rem; font-weight: 700;
  color: var(--c-foam); overflow-wrap: anywhere;
}
.sig-slot__state { font-size: .85rem; color: var(--c-paused); }
.sig-slot__state.is-signed { color: var(--c-done); }
.sig-slot__sig {
  width: 150px; max-width: 40%; color: var(--c-foam);
  border-bottom: 1px solid var(--c-line-2);
}
.sig-slot__sig svg { width: 100%; height: auto; display: block; }
.sig-slot__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
/* подпись руководителя за инструктаж в форме нового спуска — подписано */
.briefing-signed {
  background: var(--c-success-bg);
  border: 1px solid var(--c-success-line);
  border-radius: var(--radius);
  padding: 0 1rem;
}
.briefing-signed .sig-slot__actions { margin-left: auto; }
@media (max-width: 575.98px) {
  .sig-slot__actions, .sig-slot__actions .btn-lg { width: 100%; }
}

/* статус подписей в таблице чек-листов спуска */
.sig-status { font-size: .8rem; color: var(--c-muted); white-space: nowrap; }
.sig-status.is-signed { color: var(--c-done); }
.sig-status__mark { display: inline-block; width: 1rem; font-weight: 700; }
.sig-status__role { font-weight: 700; margin-right: .2rem; }

.sig-preview {
  width: 100%; max-width: 260px;
  border: 1px solid var(--c-line-2);
  border-radius: var(--radius-sm);
  background: var(--c-panel-2);
  padding: .5rem .75rem;
  color: var(--c-foam);
}
.sig-preview svg { display: block; width: 100%; height: auto; }
.sig-preview__name {
  font-family: var(--f-display); font-weight: 700; font-size: 1rem;
  color: var(--c-foam); margin-top: .55rem;
}
.sig-preview__caption { font-size: .85rem; color: var(--c-mist); margin-top: .15rem; }
.sig-preview__meta { font-size: .78rem; color: var(--c-muted); margin-top: .25rem; }

.item-locked-note {
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--c-line);
  font-size: .78rem; color: var(--c-muted);
  background: var(--c-panel-2);
}
.item-row.is-locked { opacity: .75; }

/* ── Stylus test page (stylus_test.html) ─────────────────────────────── */
.stylus-verdict {
  flex: 1 1 280px; font-size: .9rem; line-height: 1.35; padding: .5rem .75rem;
  border-radius: var(--radius-sm); color: var(--c-mist);
  background: var(--c-panel-2); border: 1px solid var(--c-line-2);
}
.stylus-verdict.is-ok { color: var(--c-done); background: var(--c-success-bg); border-color: var(--c-success-line); }
.stylus-verdict.is-warn { color: var(--c-paused); background: var(--c-warning-bg); border-color: var(--c-warning-line); }
.stylus-readout { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem 1.25rem; margin: 0; }
.stylus-readout dt {
  font-family: var(--f-display); font-size: .7rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted);
}
.stylus-readout dd { margin: .1rem 0 0; font-family: var(--f-display); font-size: 1.15rem; font-weight: 700; color: var(--c-foam); }
.stylus-ua { margin-top: 1rem; font-size: .75rem; color: var(--c-muted); overflow-wrap: anywhere; }

/* ── Numpad (own digit pad for touch input on [data-numpad]; app.js) ─── */
body.numpad-open { overflow: hidden; }
.numpad { position: fixed; inset: 0; z-index: 1080; display: flex; align-items: flex-end; justify-content: center; }
.numpad[hidden] { display: none; }
.numpad__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.numpad__sheet {
  position: relative; width: 100%; max-width: 440px;
  background: var(--c-panel); color: var(--c-foam);
  border: 1px solid var(--c-line-2); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .35);
}
@media (min-width: 768px) {
  .numpad { align-items: center; }
  .numpad__sheet { border-bottom: 1px solid var(--c-line-2); border-radius: var(--radius); }
}
.numpad__head { display: flex; align-items: baseline; gap: .6rem; padding-right: 2.5rem; min-height: 1.5rem; }
.numpad__title {
  font-family: var(--f-display); font-size: .8rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--c-mist);
}
.numpad__range { font-size: .8rem; color: var(--c-muted); }
.numpad__x {
  position: absolute; top: .5rem; right: .5rem; width: 44px; height: 44px;
  background: none; border: 0; border-radius: 999px; color: var(--c-muted); font-size: 1.6rem; line-height: 1;
}
.numpad__x:hover { color: var(--c-foam); background: var(--c-panel-3); }
.numpad__display {
  margin: .6rem 0 .2rem; padding: .5rem .9rem; text-align: right;
  font-family: var(--f-display); font-size: 2.2rem; font-weight: 700; line-height: 1.2;
  background: var(--c-panel-2); border: 1px solid var(--c-line-2); border-radius: var(--radius-sm);
  min-height: 3.6rem; overflow-wrap: anywhere;
}
.numpad__display.is-empty { color: var(--c-muted); font-weight: 500; }
.numpad__error { min-height: 1.3rem; font-size: .85rem; color: var(--c-danger); text-align: right; }
.numpad__keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .3rem; }
.numpad__key {
  min-height: 58px; border-radius: var(--radius-sm);
  font-family: var(--f-display); font-size: 1.45rem; font-weight: 600;
  color: var(--c-foam); background: var(--c-panel-2); border: 1px solid var(--c-line-2);
  touch-action: manipulation; user-select: none;
}
.numpad__key:active { background: var(--c-panel-3); }
.numpad__key--fn { font-size: 1.05rem; color: var(--c-mist); }
.numpad__key--done { font-size: 1.05rem; background: var(--c-cyan); border-color: var(--c-cyan); color: var(--c-on-accent); }
.numpad__key.is-off { visibility: hidden; }
input.is-numpad-target { border-color: var(--c-cyan); box-shadow: 0 0 0 3px var(--c-cyan-soft); }

/* ── Dive conditions column (dive_create): label left, fixed-width input right ── */
.cond-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.cond-row .form-label { margin-bottom: 0; min-width: 0; }
.cond-row__input { flex: 0 0 92px; width: 92px; }

/* ── Prefill hint (temperatures from the previous dive on the same site) ── */
.prefill-hint {
  margin-top: .5rem; padding: .6rem .75rem; font-size: .82rem; line-height: 1.35;
  color: var(--c-mist); background: var(--c-panel-2);
  border: 1px dashed var(--c-line-2); border-radius: var(--radius-sm);
}
.prefill-hint__date { font-weight: 700; color: var(--c-foam); white-space: nowrap; }
.prefill-hint__values { color: var(--c-foam); }

/* ── Chip checkboxes (multi-select from a short dictionary, e.g. bottom types) ── */
.chip-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.chip-group legend { float: none; width: auto; padding: 0; }
.chip-group__items { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-check {
  position: relative; display: inline-flex; align-items: center; margin: 0; cursor: pointer;
  min-height: 40px; padding: .4rem .85rem;
  font-family: inherit; font-size: .9rem; font-weight: 500; letter-spacing: normal; text-transform: none;
  color: var(--c-mist); background: var(--c-panel-2);
  border: 1px solid var(--c-line-2); border-radius: 999px;
  transition: background .15s, color .15s, border-color .15s;
  user-select: none;
}
.chip-check:hover { border-color: var(--c-cyan); color: var(--c-foam); }
.chip-check .chip-check__input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip-check:has(.chip-check__input:checked) {
  background: var(--c-cyan); border-color: var(--c-cyan); color: var(--c-on-accent);
}
.chip-check:has(.chip-check__input:focus-visible) { outline: 2px solid var(--c-cyan); outline-offset: 2px; }

/* ── Attached documents (diver card, checklist run items) ───────────── */
.item-row .item-body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.item-row .item-body .item-text { flex-grow: 0; }
.item-docs { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.doc-chip {
  display: inline-flex; align-items: center; gap: .3rem; max-width: 100%;
  font-size: .8rem; line-height: 1.2; color: var(--c-foam);
  background: var(--c-panel-2); border: 1px solid var(--c-line-2);
  border-radius: 999px; padding: .25rem .35rem .25rem .6rem;
}
a.doc-chip { padding-right: .6rem; text-decoration: none; }
.doc-chip a { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; color: inherit; text-decoration: none; }
.doc-chip a:hover, a.doc-chip:hover { color: var(--c-cyan); }
.doc-chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem; }
.doc-chip__remove {
  background: none; border: none; color: var(--c-muted); font-size: 1rem; line-height: 1;
  min-width: 28px; min-height: 28px; border-radius: 999px; cursor: pointer;
}
.doc-chip__remove:hover { color: var(--c-danger); background: var(--c-danger-bg); }
.doc-upload { display: inline-flex; align-items: center; gap: .35rem; margin: 0; cursor: pointer; }
.doc-upload:focus-within { outline: 2px solid var(--c-cyan); outline-offset: 2px; }
.doc-icon { color: var(--c-muted); flex-shrink: 0; display: inline-flex; }
.doc-meta { font-size: .78rem; color: var(--c-muted); overflow-wrap: anywhere; }
.btn-check-toggle.is-blocked { border-style: dashed; border-color: var(--c-warning-line); cursor: not-allowed; }
.btn-check-toggle.is-blocked:hover { border-color: var(--c-paused); }
.tag-expired {
  font-family: var(--f-display); font-size: .65rem; font-weight: 700; letter-spacing: .04em;
  padding: .25em .6em; border-radius: 999px; display: inline-block; line-height: 1;
  background: var(--c-danger-bg); color: var(--c-danger); border: 1px solid var(--c-danger-line);
}
/* template editor: per-item "document required" switch */
.doc-flag {
  display: inline-flex; align-items: center; gap: .3rem; flex-shrink: 0;
  font-family: var(--f-display); font-size: .7rem; font-weight: 700; letter-spacing: .03em;
  color: var(--c-muted); background: none; border: 1px dashed var(--c-line-2);
  border-radius: 999px; padding: .3rem .65rem; min-height: 32px; cursor: pointer;
  transition: all .15s;
}
.doc-flag:hover { color: var(--c-foam); border-color: var(--c-cyan); }
.doc-flag.is-on { color: var(--c-paused); background: var(--c-warning-bg); border: 1px solid var(--c-warning-line); }
@media (max-width: 575.98px) { .doc-flag__label { display: none; } }
/* drag-and-drop zones ([data-doc-drop], wired in app.js) */
[data-doc-drop] { transition: background .15s, outline-color .15s; outline: 2px dashed transparent; outline-offset: -4px; }
[data-doc-drop].is-dragover { outline-color: var(--c-cyan); background: var(--c-panel-2); }
[data-doc-drop].is-uploading { opacity: .6; pointer-events: none; }
.doc-drop-hint { font-size: .78rem; color: var(--c-muted); }
.doc-picker {
  display: flex; align-items: center; gap: .5rem; margin: 0; cursor: pointer;
  min-height: 48px; padding: .375rem .75rem;
  /* это <label> — сбрасываем глобальный стиль подписей полей (капс, display-шрифт) */
  font-family: inherit; font-size: .95rem; font-weight: 400; letter-spacing: normal; text-transform: none;
  background: var(--c-panel-2); color: var(--c-muted);
  border: 1px dashed var(--c-line-2); border-radius: var(--radius-sm);
  transition: border-color .15s, color .15s;
}
.doc-picker:hover, .doc-picker:focus-within { border-color: var(--c-cyan); color: var(--c-foam); }
.doc-picker.has-file { border-style: solid; color: var(--c-foam); }
.doc-picker__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-picker__hint { font-size: inherit; color: inherit; }
.doc-picker.has-file .doc-picker__hint { display: none; }
.doc-picker__formats { font-size: .75rem; color: var(--c-muted); margin-top: .3rem; }
@media (hover: none), (max-width: 767.98px) { .doc-drop-hint { display: none; } }
.sign-item__docs { display: block; font-size: .8em; color: var(--c-muted); margin-top: .15rem; }
.btn-check-toggle.is-locked { cursor: default; opacity: .85; }
.btn-check-toggle.is-locked:hover:not(.is-done) { border-color: var(--c-line-2); }

/* ══════════════════════════════════════════════════════════════════════
   DECOMPRESSION TABLES — sticky controls (table pick + depth/time search)
   ══════════════════════════════════════════════════════════════════════ */
.deco-controls {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--body-bg);
  padding-block: 1rem;
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--c-line);
}
@media (max-width: 767.98px) {
  .deco-controls { top: 72px; }
}
/* the app-wide sticky <thead> (app.css .table rule) would otherwise fight
   the sticky controls bar above for the same top offset */
#decoTableContainer .deco-table thead th { position: static; }
