/* Wavelength app. Mobile first, brand colours from the main site. */
@font-face { font-family: 'Cormorant Garamond'; src: url('/assets/fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('/assets/fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/assets/fonts/dm-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/assets/fonts/dm-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/assets/fonts/dm-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --navy: #0F1E33; --deep: #0A1526; --teal: #2A7F8A; --teal-l: #7FC4CC; --cream: #F7F5F0; --sand: #EDEAE3;
  --ink: #0F1E33; --muted: #5B6878; --line: #E2DED5; --card: #FFFFFF;
  --red: #B4453A; --red-bg: #FBEDEB; --amber: #B7791F; --amber-bg: #FDF4E3; --green: #2E7D5B; --green-bg: #E8F4EE;
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 18px; --tab: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--deep); color: var(--cream); padding: calc(var(--safe-t) + 12px) 18px 14px; display: flex; align-items: center; gap: 12px; }
.top .back { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(247,245,240,.18); background: none; display: grid; place-items: center; cursor: pointer; flex: none; color: var(--cream); text-decoration: none; }
.top h1 { font: 500 26px/1.1 var(--serif); margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .mark { width: 34px; height: 34px; flex: none; }
.top .act { background: none; border: 0; color: var(--teal-l); font-weight: 600; cursor: pointer; padding: 6px 4px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-l); flex: none; }
.sync-dot.off { background: #8796A8; }
.sync-dot.busy { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }

/* Hero on home */
.hero { background: var(--deep); color: var(--cream); padding: 6px 20px 30px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: auto -20% -60% -20%; height: 120%; background: radial-gradient(closest-side, rgba(42,127,138,.35), transparent); pointer-events: none; }
.hero .hi { font: 500 34px/1.05 var(--serif); margin: 6px 0 4px; position: relative; z-index: 1; }
.hero .sub { color: #B9C4D0; margin: 0 0 18px; position: relative; z-index: 1; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; position: relative; z-index: 1; }
.stat { background: rgba(247,245,240,.06); border: 1px solid rgba(247,245,240,.1); border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font: 600 24px/1.1 var(--sans); color: #fff; font-variant-numeric: lining-nums tabular-nums; }
.stat span { font-size: 11px; letter-spacing: .04em; color: #B9C4D0; }

main { max-width: 680px; margin: 0 auto; padding: 18px 16px calc(var(--tab) + var(--safe-b) + 28px); }
main.flush { padding-top: 0; }
.wide main { max-width: 680px; }
h2.sec { font: 500 24px/1.2 var(--serif); margin: 26px 2px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
h2.sec a { font: 600 13px var(--sans); text-decoration: none; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); font-weight: 600; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 12px; }
.card.dark { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.card.dark .muted { color: #B9C4D0; }
.card.teal { background: linear-gradient(135deg, #123049, #1d5f68); color: var(--cream); border: 0; }
.card h3 { font: 600 17px/1.3 var(--sans); margin: 0 0 4px; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; background: var(--navy); color: var(--cream); font-weight: 600; padding: 13px 20px; cursor: pointer; text-decoration: none; min-height: 48px; font-size: 15px; }
.btn.teal { background: var(--teal); color: #fff; }
.btn.light { background: var(--teal-l); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.card.dark .btn.ghost, .card.teal .btn.ghost { color: var(--cream); border-color: rgba(247,245,240,.3); }
.btn.danger { background: var(--red); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.link { background: none; border: 0; color: var(--teal); font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Install button: looks like an app store download */
.get-app { display: flex; align-items: center; gap: 14px; background: #000; color: #fff; border-radius: 16px; padding: 12px 18px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; text-align: left; width: 100%; }
.get-app .ico { width: 44px; height: 44px; border-radius: 11px; background: var(--deep); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(127,196,204,.35); }
.get-app small { display: block; font-size: 11px; opacity: .75; letter-spacing: .03em; }
.get-app b { font-size: 17px; font-weight: 600; }

/* Forms */
.field { margin: 0 0 16px; }
.field > label, .field > .lab { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.field .hint { font-size: 13px; color: var(--muted); margin: -2px 0 8px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 14px; min-height: 48px; font-size: 16px; appearance: none; -webkit-appearance: none; }
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230F1E33' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 36px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42,127,138,.15); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--teal); }
.err { background: var(--red-bg); color: var(--red); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0 0 14px; }
.ok { background: var(--green-bg); color: var(--green); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0 0 14px; }
.warn { background: var(--amber-bg); color: #7a4f10; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 0 0 14px; }

/* Segmented and chips */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font-size: 14px; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; user-select: none; }
.seg input:checked + label { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.seg input:focus-visible + label { outline: 2px solid var(--teal); outline-offset: 2px; }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.types label { border-radius: 14px; padding: 12px; min-height: 56px; line-height: 1.25; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; background: var(--sand); color: var(--navy); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.teal { background: #E3F1F2; color: #1d5f68; }

/* Entry list */
.search { display: flex; gap: 8px; margin: 0 0 12px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -16px 4px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer; }
.filters button[aria-pressed=true] { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.month { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 18px 4px 8px; }
.entry { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin: 0 0 8px; text-decoration: none; color: inherit; }
.entry .thumb { width: 58px; height: 58px; border-radius: 12px; background: var(--deep); flex: none; overflow: hidden; display: grid; place-items: center; color: var(--teal-l); font: 600 13px var(--sans); }
.entry .thumb img { width: 100%; height: 100%; object-fit: cover; }
.entry h3 { margin: 0; font-size: 15px; font-weight: 600; }
.entry p { margin: 2px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { margin: 0 auto 14px; }

/* Progress */
.pw-tabs { display: flex; gap: 8px; margin: 0 0 14px; overflow-x: auto; }
.pw-tabs a { flex: none; text-decoration: none; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-weight: 600; font-size: 14px; }
.pw-tabs a[aria-current] { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.mod { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 12px; border-left: 5px solid var(--line); }
.mod.red { border-left-color: var(--red); } .mod.amber { border-left-color: var(--amber); } .mod.green { border-left-color: var(--green); }
.mod-head { display: flex; align-items: center; gap: 14px; }
.ring { width: 64px; height: 64px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 600 15px var(--sans); }
.mod h3 { margin: 0; font-size: 17px; }
.mod .need { font-size: 14px; margin: 2px 0 0; font-weight: 600; }
.mod.red .need { color: var(--red); } .mod.amber .need { color: var(--amber); } .mod.green .need { color: var(--green); }
.bars { margin-top: 14px; display: grid; gap: 10px; }
.bar-row { font-size: 13px; }
.bar-row .lbl { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 4px; }
.bar { height: 8px; border-radius: 99px; background: var(--sand); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--red); }
.bar.amber i { background: var(--amber); } .bar.green i { background: var(--green); } .bar.over i { background: var(--red); }
.window { font-size: 13px; color: var(--muted); margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.mini { display: grid; gap: 8px; }
.mini .bar-row .lbl b { font-weight: 600; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 4px 2px 14px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--red); }
.legend .a::before { background: var(--amber); } .legend .g::before { background: var(--green); }

/* Entry detail */
.detail dl { display: grid; grid-template-columns: 42% 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 12px; }
.gallery button { padding: 0; border: 0; background: var(--deep); border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: pointer; position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .add { display: grid; place-items: center; color: var(--teal-l); background: var(--navy); font-size: 13px; font-weight: 600; gap: 4px; align-content: center; }
.gallery .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; background: rgba(10,21,38,.8); color: #fff; display: grid; place-items: center; font-size: 15px; }
.signbox { border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.signbox.ok { margin: 0; }

/* Tab bar */
.tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(10,21,38,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid rgba(247,245,240,.08); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #8796A8; text-decoration: none; font-size: 11px; font-weight: 500; }
.tabs a[aria-current] { color: var(--teal-l); }
.tabs .plus { align-self: center; justify-self: center; width: 58px; height: 58px; border-radius: 50%; background: var(--teal); color: #fff; box-shadow: 0 8px 24px rgba(42,127,138,.45); margin-top: -18px; }
.tabs .plus span { display: none; }

/* Sheets and modals */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(10,21,38,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--cream); width: 100%; max-width: 680px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 14px; }
.sheet h2 { font: 500 26px/1.15 var(--serif); margin: 0 0 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--tab) + var(--safe-b) + 14px); transform: translateX(-50%); background: var(--navy); color: var(--cream); padding: 12px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 90vw; animation: up .2s; }

/* Image editor */
.editor { position: fixed; inset: 0; z-index: 60; background: #050b14; color: #fff; display: flex; flex-direction: column; }
.editor .bar-top, .editor .bar-bot { padding: calc(var(--safe-t) + 10px) 14px 10px; display: flex; align-items: center; gap: 10px; }
.editor .bar-bot { padding: 10px 14px calc(var(--safe-b) + 12px); flex-wrap: wrap; justify-content: center; }
.editor .stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.editor canvas { max-width: 100%; max-height: 100%; touch-action: none; }
.editor .sel { position: absolute; border: 2px solid var(--teal-l); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); pointer-events: none; }
.editor .sel.box { box-shadow: none; background: rgba(0,0,0,.6); border-color: #fff; }
.editor .tool { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; padding: 9px 14px; font-size: 14px; cursor: pointer; }
.editor .tool[aria-pressed=true] { background: var(--teal); border-color: var(--teal); }
.editor .tip { font-size: 13px; color: #B9C4D0; text-align: center; padding: 0 16px 6px; width: 100%; margin: 0; }
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; display: grid; place-items: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer button { position: absolute; top: calc(var(--safe-t) + 12px); right: 12px; }

/* Signature */
.sigpad { width: 100%; height: 170px; background: #fff; border: 1px dashed #b9b3a6; border-radius: 14px; touch-action: none; display: block; }

/* Auth screens */
.auth { min-height: 100vh; min-height: 100dvh; background: var(--deep); color: var(--cream); display: flex; flex-direction: column; }
.auth-head { padding: calc(var(--safe-t) + 46px) 26px 30px; text-align: center; position: relative; overflow: hidden; }
.auth-head::after { content: ''; position: absolute; left: -30%; right: -30%; top: 30%; height: 140%; background: radial-gradient(closest-side, rgba(42,127,138,.3), transparent); pointer-events: none; }
.auth-head svg { margin: 0 auto 16px; position: relative; z-index: 1; }
.auth-head .wm { letter-spacing: .42em; font-size: 15px; font-weight: 600; position: relative; z-index: 1; }
.auth-head .tag { letter-spacing: .22em; font-size: 10px; color: #B9C4D0; margin-top: 6px; position: relative; z-index: 1; }
.auth-head h1 { font: 500 38px/1.05 var(--serif); margin: 28px 0 10px; position: relative; z-index: 1; }
.auth-head p { color: #B9C4D0; margin: 0 auto; max-width: 420px; position: relative; z-index: 1; }
.auth-body { flex: 1; background: var(--cream); color: var(--ink); border-radius: 26px 26px 0 0; padding: 26px 20px calc(30px + var(--safe-b)); }
.auth-body .inner { max-width: 440px; margin: 0 auto; }
.features { display: grid; gap: 12px; margin: 0 0 22px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .fi { width: 40px; height: 40px; border-radius: 12px; background: var(--deep); color: var(--teal-l); display: grid; place-items: center; flex: none; }
.feature b { display: block; font-size: 15px; }
.feature span { font-size: 14px; color: var(--muted); }
.pathcard { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 0 0 10px; cursor: pointer; }
.pathcard input { width: 22px; height: 22px; accent-color: var(--teal); margin: 2px 0 0; flex: none; }
.pathcard b { display: block; }
.pathcard span { font-size: 13px; color: var(--muted); }
.decl { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; font-size: 14px; }
.decl ul { padding-left: 18px; margin: 8px 0; }
.decl li { margin: 0 0 8px; }

/* Install guide (iPhone) */
.ios-steps { counter-reset: s; list-style: none; padding: 0; margin: 10px 0 0; }
.ios-steps li { counter-increment: s; display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ios-steps li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--cream); display: grid; place-items: center; font-weight: 600; flex: none; }

/* Desktop: show the app in a phone-width column with the tab bar centred */
@media (min-width: 760px) {
  .tabs { left: 50%; transform: translateX(-50%); width: 680px; border-radius: 22px 22px 0 0; }
  .hero, .top { border-radius: 0; }
  .hero > *, .top > * { max-width: 680px; }
  .hero { padding-left: max(20px, calc(50% - 320px)); padding-right: max(20px, calc(50% - 320px)); }
  .top { padding-left: max(18px, calc(50% - 322px)); padding-right: max(18px, calc(50% - 322px)); }
  .toast { bottom: 100px; }
}
@media (max-width: 370px) { .stats { grid-template-columns: repeat(2, 1fr); } .two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
ol.steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
ol.steps li { margin: 0 0 6px; }
.evmod { border-top: 1px solid var(--line); padding: 10px 0; }
.evmod p { margin: 4px 0 0; }
.evmod .row { align-items: center; gap: 8px; }

/* Supervisor review of encrypted shared images */
.review-imgs { display: grid; gap: 10px; margin-top: 12px; }
.review-img { width: 100%; height: auto; border-radius: 10px; background: #000; display: block; -webkit-touch-callout: none; user-select: none; }
