/* Slipway: styled after bridgemarina.com (marina blue, burgee red, Crimson Text over Montserrat). */

:root {
  --brand: #0054a2;        /* Bridge Marina blue */
  --accent: #bc072c;       /* burgee red */
  --on-brand: #fff;
  --brand-2: color-mix(in srgb, var(--brand) 82%, #3d9bff);   /* brighter nav blue */
  --brand-deep: color-mix(in srgb, var(--brand) 70%, #001a33);

  --bg: #f2f5f9;
  --tint: #e5edf5;         /* the site's pale-blue footer */
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --text: #2b333b;
  --text-2: #56616c;
  --text-3: #87929c;
  --border: #dfe6ee;
  --border-strong: #c3cfdb;
  --shadow: 0 1px 2px rgba(16, 40, 70, .06), 0 2px 10px rgba(16, 40, 70, .05);
  --shadow-up: 0 10px 30px rgba(16, 40, 70, .16);

  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-tight: "Crimson Text", Georgia, "Times New Roman", serif;
  --font-display: var(--font-tight);
  --ease: cubic-bezier(.2, .7, .2, 1);

  --danger: #c8402e;
  --danger-bg: #fbeceb;
  --success: #2f7d5b;
  --success-bg: #e8f4ed;
  --info: #255f85;
  --info-bg: #e7f0f6;
  --warning-bg: #fdf3e3;

  --radius: 8px;
  --radius-sm: 5px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0a1420; --tint: #0f1e2e; --surface: #101d2b; --surface-2: #162636; --text: #e6edf3; --text-2: #a5b3c1; --text-3: #758595; --border: #213244; --border-strong: #31465c; --danger-bg: #3a1a20; --success-bg: #14301f; --info-bg: #152a3e; --warning-bg: #352a17; --shadow: none; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0a1420; --tint: #0f1e2e; --surface: #101d2b; --surface-2: #162636; --text: #e6edf3; --text-2: #a5b3c1; --text-3: #758595; --border: #213244; --border-strong: #31465c; --danger-bg: #3a1a20; --success-bg: #14301f; --info-bg: #152a3e; --warning-bg: #352a17; --shadow: none; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; }
p { margin: 0; }
a { color: var(--info); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { flex: none; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-family: var(--font); font-weight: 600; letter-spacing: .02em; color: var(--text-3); }

/* Facts shown side by side; the gap does the separating. */
.meta { display: inline-flex; flex-wrap: wrap; column-gap: 12px; row-gap: 0; }
.meta > span { white-space: nowrap; }

/* Slip marker: the painted number on a dock piling, with the job's status as a strip along the bottom. */
.slip {
  position: relative; display: inline-grid; place-items: center; flex: none;
  min-width: 46px; height: 46px; padding: 0 6px 4px; border-radius: 6px;
  background: var(--brand); color: #fff; overflow: hidden;
  font-family: var(--font); font-weight: 700; font-size: 15px; line-height: 1; letter-spacing: 0;
}
.slip > span { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--c, transparent); }
.slip.sm { min-width: 34px; height: 26px; padding: 0 5px 3px; font-size: 12px; border-radius: 4px; }
.slip.sm::after { height: 3px; }
.slip.lg { min-width: 64px; height: 64px; font-size: 21px; border-radius: 8px; padding-bottom: 6px; }
.slip.lg::after { height: 7px; }
:root[data-theme="dark"] .slip { background: #1d4673; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .slip { background: #1d4673; } }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s var(--ease), filter .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .12); }
.btn-primary:hover { background: var(--accent); filter: brightness(.92); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-dark { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-dark:hover { background: var(--brand); filter: brightness(1.1); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success); filter: brightness(.95); }
.btn-danger { color: var(--danger); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(127, 127, 127, .14); }
.icon-btn svg { width: 22px; height: 22px; }

.link-btn { display: block; margin: 14px auto 0; border: 0; background: none; color: var(--info); cursor: pointer; font-size: 14px; }

input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
textarea { min-height: 84px; resize: vertical; }
input, select, textarea { transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 22%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--brand); flex: none; }
input[type="color"] { width: 52px; padding: 3px; cursor: pointer; }

.field { display: block; margin-top: 14px; }
.field > span { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-error { min-height: 18px; margin-top: 10px; color: var(--danger); font-size: 13px; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }

/* ---------- auth ---------- */

.auth-screen {
  position: relative; overflow: hidden;
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px 120px;
  background: linear-gradient(180deg, var(--brand-deep) 0%, var(--brand) 62%, var(--brand-2) 100%);
}
.auth-screen::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--accent); }
.auth-waves {
  position: absolute; left: 0; right: 0; bottom: 0; height: 140px; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 80' preserveAspectRatio='none'%3E%3Cpath d='M0 40c90-24 180-24 270 0s180 24 270 0 180-24 180-24V80H0z' fill='%23ffffff' fill-opacity='.08'/%3E%3C/svg%3E") repeat-x 0 30px / 720px 80px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 80' preserveAspectRatio='none'%3E%3Cpath d='M0 50c90 18 180 18 270 0s180-18 270 0 180 18 180 18V80H0z' fill='%23ffffff' fill-opacity='.1'/%3E%3C/svg%3E") repeat-x 0 60px / 900px 80px;
  animation: tide 40s linear infinite;
}
.auth-card { position: relative; width: min(410px, 100%); padding: 30px 26px; border-radius: 6px; background: var(--surface); box-shadow: 0 24px 60px rgba(0, 20, 50, .35); border-top: 4px solid var(--accent); animation: rise .5s var(--ease) both; }
.auth-card h1 { font-family: var(--font-display); font-size: 32px; margin-bottom: 4px; }
.auth-card .btn-block { margin-top: 18px; min-height: 46px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }

.brand-mark { width: 40px; height: 40px; border-radius: 4px; background: var(--brand); display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-size: 24px; font-weight: 700; flex: none; box-shadow: inset 0 -5px 0 var(--accent); }
.brand-logo { max-height: 44px; max-width: 170px; object-fit: contain; display: block; }
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.05; color: var(--brand); }
.brand-sub { font-size: 11.5px; font-weight: 500; color: var(--text-3); }
:root[data-theme="dark"] .brand-name { color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-name { color: var(--text); } }

/* ---------- shell: red top strip, white masthead, blue nav (like bridgemarina.com) ---------- */

.shell { display: flex; flex-direction: column; min-height: 100%; }

.utility { background: var(--accent); color: #fff; font-size: 13px; font-weight: 500; }
.utility-inner { display: flex; align-items: center; gap: 16px; max-width: 1240px; min-height: 36px; margin: 0 auto; padding: 0 24px; }
.utility-inner p { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.utility-notice { font-weight: 600; }
.utility-notice > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utility-notice svg { width: 16px; height: 16px; animation: ring-bell 2.4s var(--ease) 1 .6s; transform-origin: 50% 10%; }
.utility-place { opacity: .92; }
.utility-x { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 2px; border: 0; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; opacity: .8; }
.utility-x:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.utility-x svg { width: 15px; height: 15px; }
.utility-side { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.utility-side a { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 600; }
.utility-side svg { width: 15px; height: 15px; }
.wx { display: inline-flex; align-items: center; gap: 6px; }
.wx b { font-weight: 700; }
.wx-wind { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; opacity: .9; }
.wx.windy .wx-wind { font-weight: 700; opacity: 1; }

.masthead {
  display: flex; align-items: center; gap: 24px;
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 14px 24px;
}
.shell > .masthead { max-width: none; padding-left: max(24px, calc((100% - 1192px) / 2)); padding-right: max(24px, calc((100% - 1192px) / 2)); background: var(--surface); }
.masthead-brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.search-trigger {
  flex: 1; max-width: 420px; margin-left: auto; display: flex; align-items: center; gap: 10px;
  min-height: 42px; padding: 0 8px 0 14px; border: 1px solid var(--border-strong); border-radius: 22px;
  background: var(--surface-2); color: var(--text-3); font-size: 14px; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search-trigger:hover { border-color: var(--brand-2); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 14%, transparent); }
.search-trigger .search-icon svg { width: 18px; height: 18px; display: block; }
.search-hint { flex: 1; }
kbd { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--text-2); font: 600 11px var(--font); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 24px; color: var(--text); line-height: 1.25; transition: background-color .15s; }
.sidebar-user b { font-size: 14px; }
.sidebar-user:hover { background: var(--surface-2); }

.mainnav {
  position: sticky; top: 0; z-index: 25;
  background: var(--brand-2); color: #fff;
  box-shadow: 0 2px 0 var(--brand-deep), 0 6px 18px rgba(0, 30, 70, .12);
}
.mainnav-inner { display: flex; align-items: stretch; gap: 2px; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 14px;
  color: rgba(255, 255, 255, .88); font-weight: 700; font-size: 14.5px; white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.nav-item svg { width: 18px; height: 18px; opacity: .85; }
.nav-item::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: #fff; transform: scaleX(0); transition: transform .25s var(--ease);
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-item:hover::after { transform: scaleX(.5); }
.nav-item.active { color: #fff; background: rgba(0, 0, 0, .12); }
.nav-item.active::after { transform: scaleX(1); background: var(--accent); }
.mainnav-new { margin: auto 0 auto auto; min-height: 34px; }
.count { margin-left: 2px; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.nav-item .count { box-shadow: 0 0 0 2px var(--brand-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; width: 100%; max-width: 1240px; margin: 0 auto; }
.appbar {
  display: flex; align-items: center; gap: 8px;
  min-height: 64px; padding: 22px 24px 4px;
}
.appbar-title { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 34px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar-logo { display: none; }
.appbar-actions { display: flex; align-items: center; gap: 6px; }
.appbar-search { display: none; }
.phone-notice { display: none; }
.banner { margin: 8px 24px 0; padding: 10px 14px; background: var(--warning-bg); border-radius: var(--radius-sm); font-size: 13px; }
.page { flex: 1; width: 100%; max-width: 1240px; padding: 16px 24px 48px; }
.page.wide { max-width: none; }
.page.narrow { max-width: 808px; }
.tabbar { display: none; }
.action-bar { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 8px; padding: 10px 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
.action-bar .btn { flex: 1; min-height: 46px; font-size: 15px; }

/* ---------- dashboard header: the one big moment ---------- */

.hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: center;
  margin-bottom: 18px; padding: 28px 30px 58px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand) 55%, var(--brand-2));
  color: #fff; box-shadow: var(--shadow-up);
}
.hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); z-index: 1; }
.hero-title { font-family: var(--font-display); font-size: 40px; line-height: 1.05; }
.hero-sub { display: flex; flex-wrap: wrap; column-gap: 18px; margin-top: 8px; font-size: 14px; color: rgba(255, 255, 255, .85); }
.hero-sub [data-weather]:empty { display: none; }
.hero-stats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }
.hero-stat {
  display: flex; flex-direction: column; min-width: 120px; padding: 10px 16px 11px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 6px; background: rgba(255, 255, 255, .08);
  color: #fff; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background-color .2s, transform .2s var(--ease), border-color .2s;
}
a.hero-stat:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); transform: translateY(-2px); }
.hero-stat b { font-family: var(--font-display); font-size: 34px; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.hero-stat span { margin-top: 3px; font-size: 12.5px; font-weight: 500; color: rgba(255, 255, 255, .82); }
.hero-stat.alert { background: var(--accent); border-color: var(--accent); }
.hero-ring { position: relative; width: 128px; height: 128px; grid-row: 1; grid-column: 2; }
.hero-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hero-ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: rgba(255, 255, 255, .16); }
.ring-fg { stroke: #fff; stroke-linecap: round; }
.hero-ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 0 20px; }
.hero-ring-text b { font-family: var(--font-display); font-size: 32px; line-height: 1; }
.hero-ring-text span { font-size: 10.5px; line-height: 1.25; color: rgba(255, 255, 255, .8); margin-top: 3px; }
.hero-waves { position: absolute; left: 0; bottom: -1px; width: 200%; height: 48px; z-index: -1; animation: drift 22s linear infinite; }
.hero-waves .w1 { fill: rgba(255, 255, 255, .07); }
.hero-waves .w2 { fill: rgba(255, 255, 255, .1); animation: bob 7s ease-in-out infinite; }

/* ---------- content ---------- */

.section { margin-top: 24px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 10px; }
.section-head h2 { font-family: var(--font-display); font-size: 24px; color: var(--text); }
.section-head h2::after { content: ""; display: block; width: 28px; height: 3px; margin-top: 3px; border-radius: 2px; background: var(--accent); }
.section-head .spacer + * { font-size: 13px; }
.section-label { font-size: 14px; font-weight: 600; color: var(--text-2); margin: 0 0 8px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-body { padding: 16px; }
.panel + .panel { margin-top: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { display: block; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); transition: transform .2s var(--ease), border-color .2s; }
.stat:hover { border-color: var(--border-strong); }
.stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.greeting { font-family: var(--font-display); font-size: 30px; font-weight: 700; margin-bottom: 12px; }

/* Dashboard status gauge: one bar showing how open work is split across statuses. */
.gauge-wrap { padding: 16px 18px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.gauge-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 12px; }
.gauge-total { font-family: var(--font-display); font-size: 52px; font-weight: 700; line-height: .9; }
.gauge-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 15px; }
.gauge-side a { color: var(--text-2); }
.gauge-side b { color: var(--text); font-family: var(--font-display); font-size: 22px; }
.gauge-side a.overdue b { color: var(--danger); }
.gauge { display: flex; gap: 3px; height: 14px; border-radius: 7px; overflow: hidden; }
.gauge > span { background: var(--c); min-width: 8px; transform-origin: left; }
.gauge .gauge-empty { flex: 1; background: var(--border); }
.gauge-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 14px; }
.gauge-legend a { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.gauge-legend b { color: var(--text); }

.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }

/* list rows */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px;
  border-top: 1px solid var(--border); color: var(--text); cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.row:first-child { border-top: 0; }
a.row:hover, .row.clickable:hover { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--brand-2); }
a.row .chev { transition: transform .2s var(--ease); }
a.row:hover .chev { transform: translateX(3px); color: var(--brand-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; overflow: hidden; }
.row-title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 14px; color: var(--text-2); overflow: hidden; margin-top: 1px; }
.row-sub .meta { flex-wrap: nowrap; overflow: hidden; }
.job-row { min-height: 70px; }
.row-end { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.row-end .chev { width: 18px; height: 18px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.list > .empty { border: 0; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--text-3)); flex: none; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--c, #888) 14%, transparent); color: color-mix(in srgb, var(--c, #888) 80%, var(--text)); white-space: nowrap; }
.flag { padding: 0 6px; border-radius: 4px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; }
.overdue { color: var(--danger); font-weight: 600; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.who { display: inline-flex; align-items: center; gap: 7px; }

.progress { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width .45s var(--ease); transform-origin: left; }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-height: 140px; }
.board-col.drop { outline: 2px dashed var(--info); }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; font-size: 13px; font-weight: 650; }
.board-col-head .n { margin-left: auto; color: var(--text-3); font-weight: 500; }
.card { display: block; margin-top: 6px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); cursor: grab; box-shadow: var(--shadow); transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; }
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-up); }
.card-top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.card-title { font-weight: 600; margin: 3px 0 2px; }
.card-sub { font-size: 12.5px; color: var(--text-2); }
.card .progress { margin-top: 8px; height: 4px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-height: 38px; }
.toolbar .search-input { flex: 1; min-width: 160px; max-width: 280px; }
.segmented { display: inline-flex; padding: 2px; border-radius: 5px; background: var(--tint); }
.segmented button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 4px; transition: background-color .15s, color .15s; background: none; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-2); background: var(--tint); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

/* pipeline chart */
.pipeline th { vertical-align: bottom; }
.pl-step { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; }
.pl-cell { min-width: 150px; }
.pl-swatch { display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 2px; background: var(--c); }
.pl-meter { display: block; color: var(--text); }
.pl-bar { display: block; height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.pl-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-2); transform-origin: left; }
.pl-meter.full .pl-bar > i { background: var(--success); }
.pl-label { display: flex; gap: 8px; margin-top: 4px; font-size: 13px; font-weight: 600; }
.pl-meter.none .pl-label { color: var(--text-3); font-weight: 500; }
.pl-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 9px; border-radius: 6px; background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pl-chip .dot { background: var(--c); }
.pl-chip:hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
.pl-who { font-weight: 500; color: var(--text-2); }
.pl-boat { display: flex; align-items: center; gap: 10px; color: var(--text); }
.pl-boat > span:last-child { display: flex; flex-direction: column; }
.pl-step { font-family: var(--font); font-weight: 700; }
.pipeline th { font-size: 14px; color: var(--text); }

/* steps on a job */
.stepper { display: flex; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.step { flex: 1; min-width: 92px; display: block; padding: 7px 9px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12px; border-top: 3px solid var(--c); }
.step b { display: block; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.current { background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: inset 0 0 0 1px var(--c); }

/* ---------- job page ---------- */

.panel-title { font-family: var(--font-display); font-size: 24px; }
.job-progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.job-progress .progress { flex: 1; height: 8px; }

/* Each checklist in a job is its own collapsible section, marked with the checklist's color. */
.checklist { overflow: hidden; border-top: 4px solid var(--c); transition: box-shadow .2s; }
.checklist.complete .checklist-title b::after { content: ""; display: inline-block; width: 18px; height: 18px; margin-left: 8px; vertical-align: -2px; border-radius: 50%; background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 13px no-repeat; }
.checklist-head {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px;
  border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.checklist-head .progress { width: 90px; flex: none; }
.checklist-head .progress > i { background: var(--c); }
.checklist-head .chev { width: 20px; height: 20px; color: var(--text-3); transition: transform .25s var(--ease); }
.checklist-head:hover { background: var(--surface-2); }
.checklist.collapsed .chev { transform: rotate(-90deg); }
.checklist.collapsed .checklist-body { display: none; }
.checklist-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.checklist-title b { font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.checklist-body { border-top: 1px solid var(--border); }

/* Picking checklists for a new job */
.template-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.chip { min-height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 17px; background: var(--surface); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.chip:hover { border-color: var(--brand-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 6px; background: var(--surface); cursor: pointer; transition: background-color .15s, border-color .15s, transform .15s var(--ease); }
.pick:active { transform: scale(.985); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-box { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--border-strong); border-radius: 5px; font-family: var(--font); font-size: 13px; transition: background-color .15s, border-color .15s; font-weight: 700; color: #fff; flex: none; }
.pick.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.pick.on .pick-box { background: var(--c); border-color: var(--c); }
.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick b { display: block; font-size: 15px; }

.faces { display: inline-flex; }
.faces .avatar { box-shadow: 0 0 0 2px var(--surface); }
.faces .avatar + .avatar { margin-left: -7px; }
.row-progress { height: 4px; margin-top: 7px; max-width: 260px; }

.job-head { padding: 16px; }
.job-head h2 { font-family: var(--font-display); font-size: 32px; line-height: 1.05; }
.job-title { display: flex; align-items: center; gap: 14px; }
.job-meta { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin-top: 14px; font-size: 14px; }
.job-meta dt { color: var(--text-2); }
.job-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.instructions { margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 6px 6px 0; white-space: pre-wrap; font-size: 14px; }
.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.notice.danger { background: var(--danger-bg); }
.notice.info { background: var(--info-bg); }
.notice.success { background: var(--success-bg); }

.form-progress { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.form-progress b { font-family: var(--font-display); font-size: 24px; }
.form-progress .progress { flex: 1; }
.q { padding: 14px 16px; border-top: 1px solid var(--border); }
.q:first-child { border-top: 0; }
.q-label { font-weight: 600; margin-bottom: 8px; }
.q-help { font-size: 13px; color: var(--text-2); margin: -4px 0 8px; }
.req { color: var(--danger); margin-left: 2px; }
.q.missing { background: var(--danger-bg); }
.q-section { padding: 18px 16px 6px; border-top: 1px solid var(--border); background: var(--surface-2); }
.q-section h3 { font-family: var(--font-display); font-size: 21px; color: var(--brand); }
:root[data-theme="dark"] .q-section h3 { color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .q-section h3 { color: var(--text); } }
.task { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; border-top: 1px solid var(--border); cursor: pointer; transition: background-color .2s; }
.task:hover { background: var(--surface-2); }
.task:first-child { border-top: 0; }
.task input { width: 24px; height: 24px; accent-color: var(--success); }
.task-text { background: linear-gradient(currentColor, currentColor) 0 55% / 0 1px no-repeat; transition: color .25s, background-size .35s var(--ease); }
.task.done .task-text { color: var(--text-3); background-size: 100% 1px; }
.task .by { margin-left: auto; font-size: 12px; color: var(--text-3); }
.options label { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.yesno { display: flex; gap: 8px; }
.yesno .btn { min-width: 88px; }
.yesno .btn.yes { background: var(--success); border-color: var(--success); color: #fff; }
.yesno .btn.no { background: var(--danger); border-color: var(--danger); color: #fff; }
.sig canvas { display: block; width: 100%; height: 170px; border: 1px dashed var(--border-strong); border-radius: 8px; background: #fff; touch-action: none; }
.sig img { display: block; max-width: 100%; height: 110px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface-2); cursor: pointer; border: 0; padding: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.video { background: #1e2a33; color: #fff; display: grid; place-items: center; }
.thumb.video svg { width: 30px; height: 30px; }
.thumb .thumb-label { position: absolute; left: 5px; bottom: 5px; padding: 0 5px; border-radius: 4px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; }
.media-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.parts td.num, .parts th.num { text-align: right; font-variant-numeric: tabular-nums; }
.parts-add { display: grid; grid-template-columns: 1fr 70px 90px auto; gap: 6px; padding: 10px 16px 14px; }

.log-item { display: flex; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 14px; }
.log-item:first-child { border-top: 0; }
.log-meta { font-size: 12px; color: var(--text-3); }
.note-form { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.mention { font-weight: 650; color: var(--accent); }
.job-link { text-decoration: underline; cursor: pointer; color: inherit; font-weight: 600; }

.sms-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 12px 16px 16px; }
.sms-item { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; }
.sms-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.sms-item b { display: block; margin-bottom: 2px; font-size: 14px; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 380px; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; max-width: 80%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-meta { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.msg.mine .msg-meta { text-align: right; }
.msg-body { padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .msg-body { background: var(--brand); border-color: var(--brand); color: #fff; }
.msg.mine .mention { color: #ffd59a; }
.msg.ping .msg-body { border-color: var(--accent); }
.chat-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px 0; }

/* schedule */
.day-label { margin: 22px 0 8px; font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-2); }
.day-label.today { color: var(--accent); }
.day-label:first-child { margin-top: 0; }

/* settings */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { position: sticky; top: 66px; }
.settings-nav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; font-size: 14px; }
.settings-nav a:hover { background: var(--surface); color: var(--text); }
.settings-nav a { transition: background-color .15s, color .15s; }
.settings-nav a.active { background: var(--surface); color: var(--brand); border: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.settings h2 { font-family: var(--font-display); font-size: 30px; }
.settings .lead { color: var(--text-2); margin: 4px 0 16px; font-size: 14px; }
.save-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.edit-row { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.edit-row:first-child { border-top: 0; }
.logo-preview { width: 180px; height: 80px; display: grid; place-items: center; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); }
.logo-preview img { max-width: 160px; max-height: 64px; object-fit: contain; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); }
.toggle-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--border); cursor: pointer; }
.toggle-row input { margin-top: 2px; }
.toggle-row b { display: block; font-weight: 600; }
.toggle-row span span { font-size: 13px; color: var(--text-2); }
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.choice-card b { display: block; }
.choice-card span span { font-size: 13px; color: var(--text-2); }

/* form builder */
.type-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 18px; }
.type-item { padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 8px; background: var(--surface); cursor: pointer; }
.type-item.on { border-color: var(--brand); border-left-color: var(--c); box-shadow: inset 0 0 0 1px var(--brand); }
.type-item b { display: block; font-size: 14px; }
.type-new { display: grid; place-items: center; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--text-2); cursor: pointer; min-height: 56px; font-weight: 600; font-size: 14px; background: none; }
.fb-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin-top: 8px; }
.fb-item.is-section { background: var(--surface-2); border-left: 3px solid var(--brand); }
.fb-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fb-top select { width: 170px; flex: none; }
.fb-top input.fb-label { flex: 1; min-width: 150px; }
.fb-tools { display: flex; gap: 2px; align-items: center; margin-left: auto; }
.fb-tools .icon-btn { width: 34px; height: 34px; }
.fb-tools .icon-btn svg { width: 18px; height: 18px; }
.fb-extra { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.fb-extra > * { flex: 1; min-width: 180px; }
.fb-add { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 8px; }
.req-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.req-toggle input { width: 17px; height: 17px; }

/* ---------- dialog & toast ---------- */

.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(4, 22, 44, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .18s ease both; }
.overlay.top { align-items: start; padding-top: 12vh; }
.dialog { width: min(440px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px; border-radius: 8px; background: var(--surface); box-shadow: 0 24px 60px rgba(0, 20, 50, .3); border-top: 4px solid var(--brand-2); animation: pop .22s var(--ease) both; }
.dialog h3 { font-family: var(--font-display); font-size: 26px; margin-bottom: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog .option-list { margin-top: 8px; }
.dialog .option-list button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 0 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; font-size: 15px; }
.dialog .option-list button:hover { background: var(--surface-2); }
.dialog .option-list button.current { font-weight: 700; }
.viewer { width: min(900px, 100%); background: #000; padding: 0; color: #fff; text-align: center; border-top: 0; }
.viewer img, .viewer video { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; }
.viewer-bar { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; padding: 12px; background: #111; font-size: 13px; }
.viewer-loading { padding: 60px 20px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 200; transform: translate(-50%, 160%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 6px; background: var(--brand-deep); color: #fff; border-left: 4px solid var(--accent);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-up); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .35s var(--ease), opacity .25s ease, visibility .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* ---------- quick search ---------- */

.search-dialog { width: min(600px, 100%); padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--border); }
.search-field svg { width: 20px; height: 20px; color: var(--text-3); }
.search-field input { border: 0; box-shadow: none; padding: 12px 0; font-size: 17px; background: transparent; }
.search-field input:focus { box-shadow: none; }
.search-results { overflow-y: auto; padding: 6px 0 10px; }
.sr-group { padding: 10px 16px 4px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.sr { display: flex; align-items: center; gap: 12px; padding: 8px 16px; color: var(--text); }
.sr.sel, .sr:hover { background: var(--tint); box-shadow: inset 3px 0 0 var(--brand-2); }
.sr-icon { display: grid; place-items: center; width: 34px; flex: none; color: var(--text-2); }
.sr-icon svg { width: 20px; height: 20px; }
.sr-main { min-width: 0; display: flex; flex-direction: column; }
.sr-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-main > span { font-size: 12.5px; color: var(--text-2); overflow: hidden; white-space: nowrap; }

/* ---------- motion ---------- */
/* One orchestrated entrance when a page opens; everything else answers a tap. */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes ring-fill { from { stroke-dasharray: 0 100; } }
@keyframes drift { to { transform: translateX(-50%); } }
@keyframes tide { to { background-position: 720px 30px, -900px 60px; } }
@keyframes bob { 50% { transform: translateY(4px); } }
@keyframes ring-bell { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-12deg); } 50% { transform: rotate(0); } }
@keyframes tick { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent), var(--shadow); } 100% { box-shadow: 0 0 0 14px transparent, var(--shadow); } }
@keyframes open-body { from { opacity: 0; transform: translateY(-6px); } }

.page.enter > * { animation: rise .45s var(--ease) both; }
.page.enter > :nth-child(2) { animation-delay: .06s; }
.page.enter > :nth-child(3) { animation-delay: .12s; }
.page.enter > :nth-child(n+4) { animation-delay: .18s; }
.page.enter .columns > div > .section, .page.enter .list > .row { animation: rise .4s var(--ease) both; }
.page.enter .list > .row:nth-child(2) { animation-delay: .04s; }
.page.enter .list > .row:nth-child(3) { animation-delay: .08s; }
.page.enter .list > .row:nth-child(4) { animation-delay: .12s; }
.page.enter .list > .row:nth-child(n+5) { animation-delay: .16s; }
.page.enter .progress > i, .page.enter .pl-bar > i, .page.enter .gauge > span { animation: grow .8s var(--ease) .2s both; }
.page.enter .ring-fg { animation: ring-fill 1.1s var(--ease) .25s both; }
.page.enter .hero-stat { animation: rise .5s var(--ease) both; }
.page.enter .hero-stat:nth-child(2) { animation-delay: .07s; }
.page.enter .hero-stat:nth-child(3) { animation-delay: .14s; }
.page.enter .hero-stat:nth-child(n+4) { animation-delay: .21s; }
.task.just input { animation: tick .35s var(--ease); }
.checklist.just-done { animation: flash .9s ease-out; }
.checklist.opening .checklist-body { animation: open-body .28s var(--ease); }
.utility, .mainnav { animation: fade .3s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .hero-waves, .auth-waves { animation: none !important; }
}

/* ---------- phone ---------- */

@media (max-width: 900px) {
  .utility, .masthead, .mainnav { display: none; }
  .appbar {
    position: sticky; top: 0; z-index: 20;
    min-height: calc(56px + var(--safe-t)); padding: var(--safe-t) 4px 0 12px;
    background: var(--brand); color: var(--on-brand); border-bottom: 3px solid var(--accent);
  }
  .appbar-title { font-size: 26px; color: #fff; }
  .appbar-search { display: inline-grid; }
  .phone-notice:not([hidden]) { display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 14px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; }
  .phone-notice svg { width: 16px; height: 16px; flex: none; }
  .phone-notice > span { flex: 1; min-width: 0; }
  .phone-notice .utility-x { margin-left: auto; }
  .main { max-width: none; }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 20px 18px 46px; margin-bottom: 14px; }
  .hero-title { font-size: 30px; }
  .hero-ring { display: none; }
  .hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
  .hero-stat { min-width: 0; padding: 9px 12px; }
  .hero-stat b { font-size: 28px; }
  .hero-sub { font-size: 13px; }
  .appbar-logo { display: block; }
  .appbar-logo .brand-logo { max-height: 28px; max-width: 80px; background: #fff; border-radius: 4px; padding: 2px 4px; }
  .appbar.has-back .appbar-logo { display: none; }
  .appbar .btn { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
  .banner { margin: 8px 12px 0; padding: 10px 14px; }
  .page { padding: 14px 12px calc(84px + var(--safe-b)); }
  .page.has-actions { padding-bottom: calc(150px + var(--safe-b)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
    padding: 4px 0 calc(4px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--border);
  }
  .tab { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; color: var(--text-3); font-size: 11px; font-weight: 600; }
  .tab svg { width: 24px; height: 24px; }
  .tab { transition: color .2s; }
  .tab svg { transition: transform .25s var(--ease); }
  .tab.active { color: var(--brand); }
  .tab.active svg { transform: translateY(-1px) scale(1.08); }
  .tab.active::before { content: ""; position: absolute; top: -5px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); animation: grow .3s var(--ease); }
  :root[data-theme="dark"] .tab.active { color: var(--text); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab.active { color: var(--text); } }
  .tab .count { position: absolute; top: 1px; left: calc(50% + 6px); margin: 0; }
  .shell.no-tabs .tabbar { display: none; }
  .shell.no-tabs .page { padding-bottom: calc(24px + var(--safe-b)); }
  .shell.no-tabs .page.has-actions { padding-bottom: calc(96px + var(--safe-b)); }
  .action-bar { position: fixed; left: 0; right: 0; bottom: calc(60px + var(--safe-b)); padding: 10px 12px; }
  .shell.no-tabs .action-bar { bottom: 0; padding-bottom: calc(10px + var(--safe-b)); }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .field-row, .field-row.three, .choice-cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .board { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { display: none; }
  .chat { height: calc(100vh - 160px - var(--safe-b)); border-radius: 0; margin: -14px -12px 0; border-left: 0; border-right: 0; }
  .msg { max-width: 92%; }
  .hide-phone { display: none; }
  .row-end .status { display: none; } /* the slip marker's strip already shows status */
  .job-meta { grid-template-columns: 96px 1fr; }
  .parts-add { grid-template-columns: 1fr 60px 80px; }
  .parts-add .btn { grid-column: 1 / -1; }
  .overlay { align-items: end; padding: 0; }
  .dialog { width: 100%; border-radius: 12px 12px 0 0; padding-bottom: calc(20px + var(--safe-b)); animation: sheet .3s var(--ease) both; }
  .overlay.top { align-items: start; padding: calc(8px + var(--safe-t)) 8px 0; }
  .overlay.top .dialog { border-radius: 10px; animation: pop .22s var(--ease) both; max-height: 80vh; }
  .viewer { border-radius: 0; }
  .toolbar .search-input { max-width: none; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
  .toast { bottom: calc(76px + var(--safe-b)); }
  .shell.no-tabs .toast, .page.has-actions ~ .toast { bottom: calc(84px + var(--safe-b)); }
}

@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }

@media print {
  .utility, .masthead, .mainnav, .appbar, .tabbar, .action-bar, .banner, .phone-notice { display: none !important; }
}
