/* Coach shell. Graphite surfaces, orange only marks what is current. Derived from prototypes k3 (phone) and d9 B (desktop). */
:root {
  color-scheme: dark;
  --bg: #111315;
  --surface: #1B1E22;
  --soft: #23272C;
  --ink: #ECEEF0;
  --muted: #9AA1A9;
  --faint: #5E656C;
  --line: #262A2F;
  --edge: #3A4047;
  --or: #FF6A2E;
  --E: cubic-bezier(.22, .8, .24, 1);
  --row: 46px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Schibsted Grotesk', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- phone layout (k3) ---------- */
.app {
  max-width: 440px; margin: 0 auto; min-height: 100dvh;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 16px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
}
.cal { display: contents; } /* phone: header, calendar, day, account stack in one column */

.sub { display: flex; align-items: center; justify-content: space-between; min-height: 24px; margin-bottom: 4px; font-size: 14px; font-weight: 500; color: var(--muted); }
.step { display: flex; gap: 2px; margin-right: -8px; }
.step button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); transition: color .2s, background .2s; }
.step button:hover { color: var(--ink); background: var(--soft); }
.step svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.vt { display: flex; align-items: baseline; gap: 18px; position: relative; }
.vt button { font-size: 15px; font-weight: 700; color: var(--faint); padding-bottom: 7px; transition: color .2s; }
.vt button:hover { color: var(--muted); }
.vt button.on { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); margin-right: 4px; }
.uln { position: absolute; left: 0; bottom: 0; width: 0; height: 2.5px; border-radius: 2px; background: var(--or); pointer-events: none; view-transition-name: uln; transition: left .35s var(--E), width .35s var(--E); }
.vt button[data-v="today"] { view-transition-name: tab-today; }
.vt button[data-v="week"] { view-transition-name: tab-week; }
.vt button[data-v="month"] { view-transition-name: tab-month; }

.dw { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding: 0 1px; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); margin: 16px 0 2px; }
.grid { overflow: hidden; height: var(--row); transition: height .45s var(--E); touch-action: pan-y; }
.wrow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding: 0 1px; height: var(--row); align-items: center; transition: transform .45s var(--E), opacity .3s; }
.d { height: 40px; display: grid; place-items: center; border-radius: 11px; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; transition: background .2s, color .2s, box-shadow .2s; }
.grid.month .d.out { color: var(--faint); font-weight: 500; }
.d.sel { box-shadow: inset 0 0 0 1.5px var(--muted); }
.d.today { background: var(--ink); color: var(--bg); box-shadow: none; }
.wrow.cw .d:not(.today):not(.sel) { box-shadow: inset 0 0 0 1.25px var(--edge); }
.d:not(.today):hover { background: var(--soft); }

.day { animation: fade .35s var(--E); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.day .sec { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 0 8px; }
.day h2 { display: none; }
.empty { border: 1px dashed var(--line); border-radius: 18px; padding: 16px; font-size: 15px; font-weight: 600; color: var(--muted); }

.acct { margin-top: auto; padding-top: 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); order: 2; }
.app > main { order: 1; }
.acct form { margin: 0; }
.acct button { color: var(--muted); padding: 10px 0; }
.acct button:hover { color: var(--ink); }
#who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- desktop layout (d9 B) ---------- */
@media (min-width: 1100px) {
  .app {
    max-width: none; display: grid; align-items: start; gap: 16px; padding: 16px;
    grid-template-columns: 330px minmax(0, 1.2fr) minmax(0, 1fr);
  }
  .cal { display: flex; flex-direction: column; background: var(--surface); border-radius: 24px; padding: 22px; position: sticky; top: 16px; min-height: calc(100dvh - 32px); }
  .acct { order: 0; }
  .app > main { order: 0; }
  .vt button.on { font-size: 28px; }
  .day { background: var(--surface); border-radius: 24px; padding: 22px; }
  .day .sec { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
  .day h2 { display: block; margin: 10px 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
  .empty { border: 0; padding: 0; border-radius: 0; font-weight: 500; }
}

/* ---------- view transitions (k3) ---------- */
::view-transition-group(*) { animation-duration: .42s; animation-timing-function: var(--E); }
::view-transition-old(root) { animation: .42s var(--E) both vt-out; }
::view-transition-new(root) { animation: .42s var(--E) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateX(calc(var(--dx, 1) * -48px)); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(calc(var(--dx, 1) * 48px)); } }
html[data-vt="morph"]::view-transition-old(root) { display: none; }
html[data-vt="morph"]::view-transition-new(root) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login > div { width: 100%; max-width: 360px; }
.login img { width: 56px; height: 56px; border-radius: 16px; display: block; }
.login h1 { margin: 22px 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.login p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.login .go { margin-top: 28px; display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 16px; text-decoration: none; transition: opacity .2s; }
.login .go:hover { opacity: .9; }
.login .go svg { width: 18px; height: 18px; }
.login .err { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink); font-size: 14px; }
