/* Management Hub – pool-hall palette.
   Deep water for structure, aqua for life, lane-rope red only for things that need someone now. */
:root {
  --deep: #0e2a3b;        /* deep end: header, hero */
  --deep-2: #163a50;
  --water: #1f6f8b;       /* primary actions, links */
  --water-dark: #185a71;
  --aqua: #5cc8d7;        /* highlights on dark */
  --tile: #f3f7f8;        /* page background, cool poolside tile */
  --paper: #ffffff;
  --text: #13232e;
  --muted: #55707f;
  --line: #d7e3e8;
  --rope: #e5484d;        /* urgent / flagged only */
  --amber: #c27a12;       /* high priority / waiting on you */
  --ok: #17845a;

  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

  --r-lg: 14px;
  --r-sm: 8px;
  font-family: var(--body);
  color: var(--text);
  background: var(--tile);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--water); }
h1, h2, h3 { font-family: var(--display); font-stretch: 90%; line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.2rem; font-weight: 700; }
code { font-size: .92em; background: #e8f0f3; padding: .05em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }

/* ---------- Lane rope: the signature stripe ---------- */
.lane-rope {
  height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--rope) 0 18px, #fff 18px 30px, var(--aqua) 30px 48px, #fff 48px 60px,
    var(--water) 60px 78px, #fff 78px 90px);
}

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem; background: var(--deep); color: #fff;
}
.topbar .brand {
  font-family: var(--display); font-weight: 800; font-stretch: 80%; font-size: 1.2rem;
  color: #fff; text-decoration: none; margin-right: auto; letter-spacing: .01em;
}
.topbar .brand span { color: var(--aqua); font-weight: 600; }
.topbar .who { font-size: .9rem; color: #b9d3dc; }
.topbar .btn.secondary { background: transparent; color: #fff; border-color: #3d6075; }
.topbar .btn.secondary:hover { background: var(--deep-2); }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }

.shell { display: flex; min-height: calc(100vh - 56px); }
.sidenav {
  width: 220px; flex-shrink: 0; padding: 1.25rem .75rem;
  background: var(--paper); border-right: 1px solid var(--line);
}
.sidenav a {
  display: block; padding: .6rem .85rem; margin-bottom: 2px; border-radius: var(--r-sm);
  color: var(--text); text-decoration: none; font-weight: 700;
}
.sidenav a:hover { background: var(--tile); }
.sidenav a.active { background: var(--deep); color: #fff; }
.sidenav .section { margin: 1.25rem .85rem .35rem; font-size: .85rem; color: var(--muted); }
main { flex: 1; min-width: 0; padding: 1.75rem; }
/* content keeps a readable width; the dashboard hero runs edge to edge */
main > * { max-width: 1180px; }
main > .dash-hero, main > #dashBody { max-width: none; }

@media (max-width: 760px) {
  .menu-btn { display: block; }
  .topbar .who { display: none; }
  .sidenav { position: fixed; top: 56px; bottom: 0; left: 0; z-index: 9; transform: translateX(-100%); transition: transform .2s; }
  .sidenav.open { transform: none; box-shadow: 4px 0 24px rgba(14, 42, 59, .18); }
  main { padding: 1rem; }
}

/* ---------- Components ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

label { display: block; font-weight: 700; margin: .8rem 0 .3rem; font-size: .95rem; }
input, select, textarea {
  width: 100%; padding: .7rem .8rem; font: inherit; color: var(--text);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--water); box-shadow: 0 0 0 3px rgba(92, 200, 215, .35); }
textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1.15rem; border-radius: var(--r-sm); border: 1.5px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--water); color: #fff;
}
.btn:hover { background: var(--water-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.btn.secondary:hover { background: var(--tile); }
.btn.danger { background: var(--rope); }
.btn.small { padding: .35rem .7rem; font-size: .9rem; }
.btn.block { width: 100%; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .85rem; color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #e8f0f3; color: var(--muted); }
.badge.urgent { background: #fde4e4; color: #b4232a; }
.badge.high { background: #fcefd6; color: #8a560b; }
.badge.ok { background: #dcf3e8; color: var(--ok); }

.alert { padding: .8rem 1rem; border-radius: var(--r-sm); margin: .75rem 0; }
.alert.error { background: #fde4e4; color: #8f1d22; }
.alert.info { background: #e3f4f7; color: var(--deep); }

#toast {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--deep); color: #fff; padding: .75rem 1.15rem; border-radius: var(--r-sm);
  box-shadow: 0 8px 24px rgba(14, 42, 59, .25); z-index: 50; max-width: 90vw;
}
#toast.error { background: var(--rope); }

/* ---------- Sign-in ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: linear-gradient(180deg, var(--deep) 0 42%, var(--tile) 42%);
}
.auth-card { width: 100%; max-width: 410px; padding: 0; overflow: hidden; box-shadow: 0 18px 48px rgba(14, 42, 59, .22); }
.auth-card .auth-body { padding: 1.75rem; }
.auth-card h1 { font-size: 2rem; font-stretch: 80%; font-weight: 800; margin-bottom: .15rem; }
.auth-card .sub { color: var(--muted); margin: 0 0 .75rem; }
.auth-card .foot { text-align: center; font-size: .9rem; color: var(--muted); margin: 1rem 0 0; }

.placeholder { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* ---------- Dashboard ---------- */
.dash-hero {
  margin: -1.75rem -1.75rem 1.5rem; padding: 1.75rem 1.75rem 0;
  background: var(--deep); color: #fff;
}
.dash-hero-inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.5rem; }
.clock {
  font-family: var(--display); font-stretch: 62%; font-weight: 800;
  font-size: clamp(4.5rem, 12vw, 8rem); line-height: .85; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.clock .colon { color: var(--aqua); }
.hero-when { margin-top: .6rem; color: #b9d3dc; font-size: 1.05rem; }
.hero-when strong { color: #fff; }
.hero-right { max-width: 420px; }
.hero-right h1 { font-size: 1.6rem; color: #fff; margin-bottom: .25rem; }
.hero-right p { color: #b9d3dc; margin: 0 0 1rem; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.hero-actions .btn { background: var(--aqua); color: var(--deep); }
.hero-actions .btn:hover { background: #82d8e3; }
.hero-actions .btn.secondary { background: transparent; color: #fff; border-color: #3d6075; }
.hero-actions .btn.secondary:hover { background: var(--deep-2); }
.dash-hero .lane-rope { margin: 0 -1.75rem; }

.pulse { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.pulse a { text-decoration: none; color: inherit; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.1rem; height: 100%; }
.stat b { display: block; font-family: var(--display); font-stretch: 75%; font-weight: 800; font-size: 2.4rem; line-height: 1; }
.stat span { color: var(--muted); font-size: .95rem; }
.stat.hot { border-color: var(--rope); }
.stat.hot b { color: var(--rope); }
.stat.warm b { color: var(--amber); }
@media (max-width: 760px) {
  .pulse { grid-template-columns: repeat(2, 1fr); }
  .dash-hero { margin: -1rem -1rem 1.25rem; padding: 1.25rem 1rem 0; }
  .dash-hero .lane-rope { margin: 0 -1rem; }
}

.dash-cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 1.25rem; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem .25rem; }
.panel-head a { font-weight: 700; font-size: .95rem; text-decoration: none; }
.panel-body { padding: .5rem 1.25rem 1.25rem; }

/* latest handover */
.handover-latest { border-left: 6px solid var(--water); }
.handover-latest.unread { border-left-color: var(--amber); }
.handover-meta { color: var(--muted); margin-bottom: .6rem; }
.handover-summary { font-size: 1.05rem; margin: 0 0 1rem; white-space: pre-line; }
.empty { padding: 1.25rem; border: 1.5px dashed var(--line); border-radius: var(--r-sm); color: var(--muted); }
.empty p { margin: 0 0 .75rem; }

/* needs attention */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 0; border-top: 1px solid var(--line); }
.attn li:first-child { border-top: 0; }
.attn .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: .45rem; background: var(--amber); }
.attn .dot.flag, .attn .dot.urgent { background: var(--rope); }
.attn .t { font-weight: 700; }
.attn .m { color: var(--muted); font-size: .9rem; }
.all-clear { display: flex; gap: .75rem; align-items: center; color: var(--ok); font-weight: 700; padding: .5rem 0; }

/* the club, by area */
.club { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.area {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem .85rem; border-radius: var(--r-sm); background: var(--tile);
  text-decoration: none; color: var(--text); font-weight: 700;
}
.area em { font-style: normal; font-family: var(--display); font-stretch: 75%; font-weight: 800; font-size: 1.3rem; color: var(--muted); }
.area.has { background: #e3f4f7; }
.area.has em { color: var(--water); }
.area.busy { background: #fdecec; }
.area.busy em { color: var(--rope); }

/* who's on */
.crew { display: flex; flex-wrap: wrap; gap: .5rem; }
.crew span { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem .3rem .3rem; background: var(--tile); border-radius: 999px; font-weight: 700; font-size: .95rem; }
.crew i { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: .8rem; background: var(--deep); color: #fff; }
.crew i.admin { background: var(--water); }

@media (prefers-reduced-motion: no-preference) {
  .clock .colon { animation: blink 2s steps(1) infinite; }
  @keyframes blink { 50% { opacity: .35; } }
}

/* polish */
.btn { white-space: nowrap; }
.topbar .brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attn .t a { color: var(--text); text-decoration: none; }
.attn .t a:hover { color: var(--water); text-decoration: underline; }
@media (max-width: 760px) {
  .topbar { padding: .6rem .9rem; gap: .6rem; }
  .topbar .brand { font-size: 1.05rem; }
  .topbar .brand span { display: none; }
}

/* ---------- Step 2: handovers ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: .2rem; }
.crumb { margin: 0 0 .5rem; }
.crumb a { font-weight: 700; text-decoration: none; }
.crumb a::before { content: "‹ "; }

.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin-bottom: 1.25rem; }
.tabs a { padding: .6rem 1rem; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--deep); border-bottom-color: var(--water); }

.ho-list { display: flex; flex-direction: column; gap: .75rem; }
.ho-item {
  display: flex; gap: 1.1rem; align-items: flex-start; padding: 1rem 1.15rem;
  background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--r-lg);
  color: var(--text); text-decoration: none;
}
.ho-item:hover { border-color: var(--water); }
.ho-item.unread { border-left-color: var(--amber); }
.ho-date { flex: none; width: 3.6rem; text-align: center; }
.ho-date b { display: block; font-family: var(--display); font-stretch: 70%; font-weight: 800; font-size: 2.2rem; line-height: 1; color: var(--deep); }
.ho-date span { display: block; font-size: .85rem; line-height: 1.25; color: var(--muted); }
.ho-main { min-width: 0; flex: 1; }
.ho-title { font-weight: 700; }
.ho-snippet { margin: .2rem 0 .5rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ho-tags { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .9rem; }

.ack-bar {
  display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 1rem 1.25rem; margin-bottom: 1.25rem; border-radius: var(--r-lg);
  background: #fcefd6; border: 1.5px solid #f0c97a; color: #5b3a06;
}

.ho-body section + section { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.ho-body h3 { font-size: 1rem; font-stretch: 100%; color: var(--muted); margin-bottom: .3rem; }
.ho-body p { margin: 0; white-space: pre-line; }
.ho-body .ntk h3 { color: var(--deep); }

.actions { list-style: none; margin: 0; padding: 0; }
.action { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem 0; border-top: 1px solid var(--line); }
.action:first-child { border-top: 0; }
.tick input { width: 1.35rem; height: 1.35rem; margin: .15rem 0 0; accent-color: var(--ok); cursor: pointer; }
.action-main { flex: 1; min-width: 0; }
.action-text { font-weight: 700; }
.action.done .action-text { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.action-meta { display: flex; gap: .4rem .75rem; flex-wrap: wrap; align-items: center; font-size: .88rem; color: var(--muted); margin-top: .2rem; }
.action-meta a { font-weight: 700; }

.add-action { margin-top: .75rem; }
.add-action summary { cursor: pointer; font-weight: 700; color: var(--water); padding: .35rem 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.three { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .75rem; }
.three label, .two label { margin-top: 0; }
@media (max-width: 560px) { .three { grid-template-columns: 1fr 1fr; } .three > :first-child { grid-column: 1 / -1; } }

.readers { list-style: none; margin: 0; padding: 0; }
.readers li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.readers li:first-child { border-top: 0; }

.ho-form { max-width: 860px; }
.ho-form .panel-body > label:first-child { margin-top: 0; }
.action-row { display: grid; grid-template-columns: 1fr 11rem 8rem auto; gap: .5rem; margin-bottom: .6rem; align-items: center; }
@media (max-width: 700px) {
  .action-row { grid-template-columns: 1fr 1fr auto; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
  .action-row .desc { grid-column: 1 / -1; }
}
.form-foot {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  padding: .9rem 0; background: linear-gradient(transparent, var(--tile) 30%);
}

/* ---------- Step 3: maintenance ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.filters select { width: auto; min-width: 12rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { font: inherit; font-weight: 700; padding: .45rem .95rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }

.pill { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pill.open { background: #e3f4f7; color: var(--water-dark); }
.pill.in_progress { background: #fcefd6; color: #8a560b; }
.pill.resolved { background: #dcf3e8; color: var(--ok); }

.issue-list { display: flex; flex-direction: column; gap: .6rem; }
.issue {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; align-items: start; padding: .9rem 1.1rem;
  background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--water); border-radius: var(--r-lg);
  color: var(--text); text-decoration: none;
}
.issue:hover { border-color: var(--water); }
.issue.flagged { border-left-color: var(--rope); }
.issue.resolved { border-left-color: var(--ok); opacity: .8; }
.issue-area { font-family: var(--display); font-stretch: 80%; font-weight: 800; color: var(--deep); padding-top: .1rem; }
.issue-title { font-weight: 700; font-size: 1.05rem; }
.issue-meta { display: flex; gap: .4rem .7rem; flex-wrap: wrap; align-items: center; margin-top: .3rem; font-size: .88rem; color: var(--muted); }
.flag-mark { color: var(--rope); margin-right: .35rem; }
@media (max-width: 600px) { .issue { grid-template-columns: 1fr; gap: .2rem; } .issue-area { font-size: .9rem; } }

.flag-bar {
  display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 1rem 1.25rem; margin-bottom: 1.25rem; border-radius: var(--r-lg);
  background: #fde4e4; border: 1.5px solid #f3a5a8; color: #7d1a1f;
}

/* Open → In Progress → Resolved */
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 .9rem; padding: 0; }
.steps li { position: relative; }
.steps button {
  width: 100%; font: inherit; font-weight: 700; padding: .8rem .5rem; cursor: pointer;
  background: var(--tile); color: var(--muted); border: 1.5px solid var(--line); border-left-width: 0;
}
.steps li:first-child button { border-left-width: 1.5px; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.steps li:last-child button { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.steps button:hover:not(:disabled) { background: #e3f4f7; color: var(--deep); }
.steps li.past button { background: #e3f4f7; color: var(--water-dark); }
.steps li.now button { background: var(--deep); border-color: var(--deep); color: #fff; cursor: default; }

.timeline { list-style: none; margin: 0 0 1rem; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1rem .4rem; }
.timeline li::before { content: ""; position: absolute; left: -1.55rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--line); border: 2px solid var(--paper); }
.timeline li.tl-note::before { background: var(--water); }
.timeline li.tl-flag::before { background: var(--rope); }
.timeline li.tl-status::before { background: var(--amber); }
.timeline li.tl-resolved::before { background: var(--ok); }
.timeline p { margin: .2rem 0 0; white-space: pre-line; }
.timeline time { display: block; font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.comment-form label { margin-top: 0; }

fieldset { border: 0; margin: 0 0 .25rem; padding: 0; }
legend { font-weight: 700; margin: .8rem 0 .4rem; padding: 0; }
.area-pick legend { margin-top: 0; }
.area-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.area-pick legend { grid-column: 1 / -1; }
@media (max-width: 640px) { .area-pick { grid-template-columns: repeat(2, 1fr); } }
.area-pick label, .seg label { margin: 0; cursor: pointer; }
.area-pick label, .seg label { position: relative; }
.area-pick input, .seg input { position: absolute; inset: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.area-pick span {
  display: block; text-align: center; padding: .8rem .5rem; border-radius: var(--r-sm);
  background: var(--tile); border: 1.5px solid var(--line); font-weight: 700;
}
.area-pick input:checked + span { background: var(--deep); border-color: var(--deep); color: #fff; }
.area-pick input:focus-visible + span, .seg input:focus-visible + span { outline: 3px solid var(--aqua); outline-offset: 2px; }
.seg { display: flex; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg span { display: block; padding: .6rem 1.1rem; border: 1.5px solid var(--line); margin-left: -1.5px; background: var(--paper); font-weight: 700; }
.seg label:nth-of-type(1) span { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.seg label:last-of-type span { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.seg input:checked + span { background: var(--water); border-color: var(--water); color: #fff; position: relative; }
.seg .p-high input:checked + span { background: var(--amber); border-color: var(--amber); }
.seg .p-urgent input:checked + span { background: var(--rope); border-color: var(--rope); }
.flag-panel { border-color: #f3a5a8; }
.check { display: flex; gap: .75rem; align-items: flex-start; font-weight: 400; margin: 0; cursor: pointer; }
.check input { width: 1.3rem; height: 1.3rem; margin-top: .15rem; accent-color: var(--rope); flex: none; }

/* ---------- Step 4: history and search ---------- */
.search-bar {
  display: grid; grid-template-columns: 2fr repeat(5, minmax(0, 1fr)); gap: .75rem; align-items: end;
  padding: 1rem 1.15rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.search-bar label { margin-top: 0; font-size: .9rem; }
.search-bar .search-q input { font-size: 1.05rem; }
@media (max-width: 1100px) { .search-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); } .search-bar .search-q { grid-column: 1 / -1; } }
@media (max-width: 560px) { .search-bar { grid-template-columns: 1fr 1fr; } }
.quick-dates { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: .75rem 0 1rem; }
.quick-dates .chip { padding: .3rem .75rem; font-size: .9rem; }
.result-count { color: var(--muted); font-weight: 700; margin: 0 0 .6rem; }
mark { background: #c9eef3; color: inherit; border-radius: 3px; padding: 0 .1em; }

.activity { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.activity .day { padding: .6rem 1.15rem; background: var(--tile); font-weight: 700; color: var(--deep); border-top: 1px solid var(--line); }
.activity .day:first-child { border-top: 0; }
.activity .act { display: grid; grid-template-columns: 3.5rem 1fr; gap: .75rem; padding: .6rem 1.15rem; border-top: 1px solid var(--line); }
.activity .act time { color: var(--muted); font-variant-numeric: tabular-nums; }
.activity .act-delete b + * { color: var(--rope); }
.activity a { font-weight: 700; }

/* ---------- Dropdowns: one consistent look everywhere ---------- */
input:not([type=checkbox]):not([type=radio]), select { height: 2.9rem; line-height: 1.2; }
select {
  -webkit-appearance: none; appearance: none;
  padding-right: 2.6rem; cursor: pointer; text-overflow: ellipsis;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231f6f8b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .95rem center; background-size: 12px 8px;
}
select:hover { border-color: #b9cdd5; }
select:disabled { cursor: default; background-color: var(--tile); opacity: .75; }
select::-ms-expand { display: none; }
table.list select { min-height: 2.4rem; padding-top: .35rem; padding-bottom: .35rem; }

/* ---------- Dashboard number tiles: hover / focus ---------- */
.pulse a { display: block; border-radius: var(--r-lg); outline-offset: 3px; }
.stat { position: relative; overflow: hidden; }
.stat b { transform-origin: left bottom; }
/* a lane-rope strip that slides in along the bottom */
.stat::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: repeating-linear-gradient(90deg, var(--water) 0 14px, #fff 14px 20px, var(--aqua) 20px 34px, #fff 34px 40px);
  transform: scaleX(0); transform-origin: left;
}
.stat.hot::after { background: repeating-linear-gradient(90deg, var(--rope) 0 14px, #fff 14px 20px, #f3a5a8 20px 34px, #fff 34px 40px); }
.stat.warm::after { background: repeating-linear-gradient(90deg, var(--amber) 0 14px, #fff 14px 20px, #f0c97a 20px 34px, #fff 34px 40px); }
.stat span::after { content: "›"; display: inline-block; margin-left: .35em; opacity: 0; transform: translateX(-4px); }

.pulse a:hover .stat, .pulse a:focus-visible .stat {
  border-color: var(--water); transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(14, 42, 59, .14);
}
.pulse a:hover .stat.hot, .pulse a:focus-visible .stat.hot { border-color: var(--rope); box-shadow: 0 12px 28px rgba(229, 72, 77, .18); }
.pulse a:hover .stat::after, .pulse a:focus-visible .stat::after { transform: scaleX(1); }
.pulse a:hover .stat b, .pulse a:focus-visible .stat b { transform: scale(1.08); }
.pulse a:hover .stat span, .pulse a:focus-visible .stat span { color: var(--deep); }
.pulse a:hover .stat span::after, .pulse a:focus-visible .stat span::after { opacity: 1; transform: none; }
.pulse a:active .stat { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(14, 42, 59, .12); }

@media (prefers-reduced-motion: no-preference) {
  .stat { transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s, border-color .22s; }
  .stat::after { transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
  .stat b { transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
  .stat span, .stat span::after { transition: color .2s, opacity .2s, transform .22s; }
}

/* =====================================================================
   Motion – one family of easing, small distances, nothing on a loop.
   Colour changes always apply; movement only when the device allows it.
   ===================================================================== */
:root { --ease: cubic-bezier(.2, .8, .2, 1); }

/* Buttons: lift on hover, press in on click */
.btn:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(14, 42, 59, .16); }
.btn.secondary:hover:not(:disabled) { border-color: #b9cdd5; box-shadow: 0 4px 12px rgba(14, 42, 59, .08); }
.btn.danger:hover:not(:disabled) { background: #c93a3f; box-shadow: 0 6px 16px rgba(229, 72, 77, .28); }

/* Sidebar: a small nudge right and a marker on the left */
.sidenav a { position: relative; }
.sidenav a::before {
  content: ""; position: absolute; left: 0; top: 25%; bottom: 25%; width: 3px; border-radius: 3px;
  background: var(--aqua); transform: scaleY(0);
}
.sidenav a:hover:not(.active)::before { transform: scaleY(1); }

/* List cards (handovers, maintenance, history): lift and a sliding chevron */
.ho-item, .issue { position: relative; }
.ho-item::after, .issue::after {
  content: "›"; position: absolute; right: 1.1rem; top: 50%; font-size: 1.6rem; line-height: 1;
  color: var(--water); opacity: 0; transform: translate(-6px, -50%);
}
.ho-item:hover, .issue:hover, .ho-item:focus-visible, .issue:focus-visible { box-shadow: 0 10px 24px rgba(14, 42, 59, .1); }
.ho-item:hover::after, .issue:hover::after, .ho-item:focus-visible::after, .issue:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.issue.flagged:hover { border-color: var(--rope); }
.issue.flagged:hover::after { color: var(--rope); }

/* Dashboard: club area tiles and attention rows */
.area:hover, .area:focus-visible { box-shadow: 0 6px 16px rgba(14, 42, 59, .1); }
.area.has:hover { background: #d2eef3; }
.area.busy:hover { background: #fbdcdc; }
.attn li { border-radius: var(--r-sm); }

/* Tabs: underline grows from the middle */
.tabs a { position: relative; border-bottom-color: transparent !important; }
.tabs a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--water); transform: scaleX(0);
}
.tabs a:hover { color: var(--deep); }
.tabs a:hover::after { transform: scaleX(.4); background: var(--line); }
.tabs a.active::after { transform: scaleX(1); background: var(--water); }

/* Chips and pickers */
.chip:hover:not([aria-pressed="true"]) { border-color: var(--water); color: var(--deep); }
.area-pick span, .seg span { transition: background-color .18s, border-color .18s, color .18s; }
.area-pick label:hover input:not(:checked) + span { border-color: var(--water); background: #e3f4f7; }
.seg label:hover input:not(:checked) + span { background: var(--tile); }

/* Panel header links: underline draws in */
.panel-head a, .crumb a { background: linear-gradient(currentColor, currentColor) no-repeat left bottom / 0 2px; padding-bottom: 1px; }
.panel-head a:hover, .crumb a:hover { background-size: 100% 2px; }

/* Crew avatars */
.crew span { transition: background-color .18s; }
.crew span:hover { background: #e3f4f7; }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform .18s var(--ease), box-shadow .18s, background-color .18s, border-color .18s; }
  .btn:hover:not(:disabled) { transform: translateY(-2px); }
  .btn:active:not(:disabled) { transform: translateY(0) scale(.97); box-shadow: none; transition-duration: .06s; }

  .sidenav a { transition: background-color .18s, color .18s, padding-left .2s var(--ease); }
  .sidenav a:hover:not(.active) { padding-left: 1.1rem; }
  .sidenav a::before { transition: transform .2s var(--ease); }

  .ho-item, .issue { transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
  .ho-item:hover, .issue:hover, .ho-item:focus-visible, .issue:focus-visible { transform: translateY(-2px); }
  .ho-item::after, .issue::after { transition: opacity .2s, transform .25s var(--ease); }

  .area { transition: transform .2s var(--ease), box-shadow .2s, background-color .2s; }
  .area:hover, .area:focus-visible { transform: translateY(-2px); }
  .area em { display: inline-block; transition: transform .2s var(--ease); }
  .area:hover em { transform: scale(1.15); }
  .attn li { transition: background-color .18s, transform .2s var(--ease); }
  .attn li:hover { background: var(--tile); transform: translateX(4px); }

  .tabs a { transition: color .18s; }
  .tabs a::after { transition: transform .25s var(--ease), background-color .2s; }

  .chip { transition: background-color .18s, border-color .18s, color .18s, transform .15s var(--ease); }
  .chip:active { transform: scale(.95); }
  .area-pick span, .seg span { transition: background-color .18s, border-color .18s, color .18s, transform .15s var(--ease); }
  .area-pick label:active span, .seg label:active span { transform: scale(.96); }
  .area-pick input:checked + span { animation: pick .28s var(--ease); }

  .steps button { transition: background-color .2s, color .2s, border-color .2s; }

  .panel-head a, .crumb a { transition: background-size .25s var(--ease); }

  /* Ticking an action off */
  .tick input:checked { animation: pop .3s var(--ease); }
  .action { transition: background-color .3s; }
  .action-text { transition: color .3s; }

  /* Toasts slide up into view */
  #toast:not(.hidden) { animation: toast-in .32s var(--ease); }

  /* Ack and flag banners settle in when the page opens */
  .ack-bar, .flag-bar { animation: settle .45s var(--ease) both; }

  @keyframes pick { 0% { transform: scale(.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
  @keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
  @keyframes settle { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
}

/* ---------- Home-screen app on iPhone: keep clear of the notch and home bar ---------- */
.topbar {
  padding-top: calc(.7rem + env(safe-area-inset-top));
  padding-left: calc(1.25rem + env(safe-area-inset-left));
  padding-right: calc(1.25rem + env(safe-area-inset-right));
}
.auth-page { padding-top: max(1rem, env(safe-area-inset-top)); padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
.form-foot { padding-bottom: calc(.9rem + env(safe-area-inset-bottom)); }
#toast { bottom: calc(1rem + env(safe-area-inset-bottom)); }
@media (max-width: 760px) {
  .topbar {
    padding-top: calc(.6rem + env(safe-area-inset-top));
    padding-left: calc(.9rem + env(safe-area-inset-left));
    padding-right: calc(.9rem + env(safe-area-inset-right));
  }
  .sidenav { top: calc(56px + env(safe-area-inset-top)); padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
  main { padding-left: calc(1rem + env(safe-area-inset-left)); padding-right: calc(1rem + env(safe-area-inset-right)); padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

/* Dashboard hero: greeting sits beside the clock rather than at the far edge */
.dash-hero-inner { justify-content: flex-start; align-items: center; gap: 1.5rem 3rem; }
.hero-right { padding-left: 3rem; border-left: 1px solid #2f5468; max-width: 34rem; }
@media (max-width: 760px) {
  .hero-right { padding-left: 0; border-left: 0; }
}
