/* ==========================================================================
   Gapboard — the phone layout
   Matches "Gapboard Mobile" in the design project: today first, one day at a
   time, a Move sheet in place of dragging, and the radar as a pull-up drawer.
   Tokens are shared with app.css; only the shapes differ.
   ========================================================================== */

/*
 * The phone's page scrolls as a page: the header is pinned to the top, the
 * bottom bar is fixed, and the day between them is the document's own
 * content. (Scrolling the day inside a fixed-height shell instead stopped
 * the week tab scrolling at all on a real iPhone.)
 */
.m-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
}

/* --- header ------------------------------------------------------------- */

/* Pinned: the brand row and the mode toggle stay put while the day scrolls. */
.m-top {
  position: sticky; top: 0; z-index: 12;
  background: var(--bg);
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  display: flex; flex-direction: column; gap: 12px;
}
/* the day's own parts sit in a column with room between them */
.m-week { display: flex; flex-direction: column; gap: 10px; }
.m-top__row { display: flex; align-items: center; gap: 10px; }
.m-brand { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.m-brand__title {
  font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-brand__sub {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-help, .m-hist, .m-settings {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: var(--r-pill);
  background: var(--card); font-size: 15px; font-weight: 800; color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  display: flex; align-items: center; justify-content: center;
}
.m-hist, .m-settings { color: var(--muted); }
.m-hist:disabled { opacity: .38; box-shadow: none; cursor: default; }
.icon--hist { width: 17px; height: 17px; }

.m-modes {
  display: flex; align-items: center; gap: 4px;
  background: var(--pill); border-radius: var(--r-pill); padding: 4px;
}
.m-modes .modes__thumb { top: 4px; bottom: 4px; }
.m-modes button {
  flex: 1; border: 0; background: none; color: var(--muted);
  font-size: 14px; font-weight: 700; padding: 9px 0;
  border-radius: var(--r-pill); text-align: center;
}
.m-modes button[aria-pressed="true"] { color: var(--on-ink); }

/* --- the middle --------------------------------------------------------- */

.m-main {
  flex: 1;
  padding: 0 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
  /* clears the fixed bottom bar; --stretch is the give past the end of the
     page while it is being pulled, in the app (ui/overscroll.js) */
  padding-bottom: calc(168px + var(--stretch, 0px));
}

/* --- day strip ---------------------------------------------------------- */

.m-daystrip {
  display: flex; gap: 7px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 -18px; padding: 2px 18px 4px;
  scroll-snap-type: x proximity;
}
.m-daystrip::-webkit-scrollbar { display: none; }
.m-daychip {
  flex: none; width: 52px; border: 0; scroll-snap-align: center;
  background: var(--card); border-radius: 11px; padding: 8px 0 7px;
  text-align: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  display: flex; flex-direction: column; gap: 1px;
}
.m-daychip__name { font-size: 12px; font-weight: 800; color: var(--muted); }
.m-daychip__num { font-size: 15px; font-weight: 800; color: var(--ink); }
.m-daychip__bar {
  display: block; height: 3px; border-radius: var(--r-pill);
  background: var(--dash); margin: 5px 8px 0; overflow: hidden;
}
.m-daychip__bar i { display: block; height: 100%; background: var(--muted-2); border-radius: var(--r-pill); }
.m-daychip.is-on { background: var(--ink); width: 60px; }
.m-daychip { transition: background .2s, color .2s, box-shadow .2s, transform .12s; }
.m-daychip:active { transform: scale(.96); }
.m-daychip.is-on .m-daychip__name { color: color-mix(in srgb, var(--on-ink) 70%, transparent); }
.m-daychip.is-on .m-daychip__num { color: var(--on-ink); }
.m-daychip.is-on .m-daychip__bar { background: color-mix(in srgb, var(--on-ink) 25%, transparent); }
.m-daychip.is-on .m-daychip__bar i { background: #8B79E8; }
.m-daychip.is-past:not(.is-on) { opacity: .55; }

/* --- day summary -------------------------------------------------------- */

.m-daysum {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px;
  display: flex; flex-direction: column; gap: 8px;
}
.m-daysum__line { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); }
.m-daysum__add { margin-left: auto; align-self: center; width: 26px; height: 26px; border-radius: 8px; background: var(--card); }
.m-daysum__line b { color: var(--ink); font-weight: 800; }
.m-daysum__spacer { flex: 1; }
.m-daysum__meet { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.m-daysum__meet .btn { padding: 4px 12px; }
.m-daysum .strip .seg.mtg { background: var(--mtg-solid); }

/* --- cards on a day ----------------------------------------------------- */

.m-cards { display: flex; flex-direction: column; gap: 10px; }
/* A held finger lifts a card: no callout, no text selection on the way. */
.m-cards .card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* On a phone, and in the app on any shape, nothing is text to select or a
   link to preview — only what you can type into. */
@media (max-width: 720px) {
  body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
}
html.is-native body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.is-native input, html.is-native textarea, html.is-native [contenteditable] { -webkit-user-select: text; user-select: text; }
.drag-ghost {
  z-index: 60; pointer-events: none; opacity: .95; transform: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28); transition: none; animation: none;
}
.m-daychip.is-over { background: var(--accent-soft) !important; outline: 2px solid var(--accent); outline-offset: -2px; }
.m-cards .drop-slot { min-height: 40px; }
.m-cards .card {
  height: auto !important;
  border-left-width: 6px; border-radius: 12px; padding: 13px 14px; gap: 8px;
  box-shadow: var(--shadow-raised);
}
.m-cards .card__title { font-size: 15px; -webkit-line-clamp: 3; }
.m-cards .card--spurt { border-left-width: 8px; }

.meta--has-action { align-items: center; }
.meta__action { margin-left: auto; }
.m-move {
  border: 0; background: none; padding: 2px 0 2px 8px;
  font-size: 12.5px; font-weight: 800; color: var(--ink);
}

.m-empty { font-size: 13.5px; color: var(--muted); padding: 6px 2px; }
.m-hint { font-size: 12.5px; color: var(--muted-2); }
.m-dayfoot { font-size: 13px; color: var(--muted-2); padding-top: 2px; }
.m-dayfoot.is-done { color: var(--ok); font-weight: 700; }
.m-dayfoot.is-over {
  background: var(--warn-soft); color: var(--warn-ink);
  border-radius: 9px; padding: 9px 11px; font-weight: 800;
}

/* --- habit suggestion --------------------------------------------------- */

.m-suggest {
  border: 1px dashed var(--accent-line); background: var(--surface-2);
  border-radius: 12px; padding: 13px 14px;
  display: flex; align-items: center; gap: 10px;
}
.m-suggest__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.m-suggest__lead { font-size: 12.5px; color: var(--muted); }
.m-suggest__title { font-size: 16px; font-weight: 800; color: var(--accent-ink); }
.m-suggest .btn--soft { padding: 9px 14px; font-size: 13.5px; font-weight: 800; }

/* --- Just today --------------------------------------------------------- */

.m-today { display: flex; flex-direction: column; gap: 14px; }
.m-now {
  background: var(--card); border-left: 8px solid var(--area, var(--none));
  border-radius: 14px; padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-raised);
  transition: transform .2s ease, opacity .2s ease;
}
.m-now.is-leaving { transform: translateX(40px); opacity: 0; }
.m-now__label { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.m-now__title { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; text-wrap: pretty; }
.m-now__meta { align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.m-now__acts { display: flex; gap: 9px; margin-top: 2px; }
.m-now__acts .btn { padding: 14px 16px; font-size: 15px; }
.m-now__done { flex: 1; }
.m-now__edit { display: flex; gap: 14px; }
.m-now--empty { border-left-color: var(--none); }
.m-now--empty p { font-size: 14px; color: var(--muted); }

.m-next { display: flex; flex-direction: column; gap: 9px; }
.m-next h3 { font-size: 15px; font-weight: 800; }
.m-next .card { border-left-width: 6px; border-radius: 12px; padding: 13px 14px; }

/* --- gap picker --------------------------------------------------------- */

.m-gap {
  background: var(--surface-2); border-radius: 14px; padding: 15px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.m-gap__head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.m-gap__head h3 { font-size: 16px; font-weight: 800; }
.m-gap__head span { font-size: 12.5px; color: var(--muted); }
.m-gap__btns { display: flex; gap: 8px; }
.m-gap__btns button {
  flex: 1; border: 0; background: var(--card); border-radius: 11px; padding: 13px 0;
  text-align: center; font-size: 14px; font-weight: 800;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.m-gap__btns button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.m-gap__list { display: flex; flex-direction: column; gap: 8px; }
.m-cand {
  width: 100%; text-align: left; background: var(--card);
  border: 1px solid var(--line-soft); border-left: 5px solid var(--area, var(--none));
  border-radius: 11px; padding: 11px 12px; box-shadow: var(--shadow-card);
}
.m-cand--habit { border-style: dashed; border-left-style: solid; }
.m-cand__main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.m-cand__title { display: flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 800; }
.m-cand__title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-cand__src { font-size: 12.5px; color: var(--muted-2); }

/* --- bottom bar --------------------------------------------------------- */

.m-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 11px;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, .06);
}
.m-add { display: flex; align-items: stretch; position: relative; }
.m-add__field {
  flex: 1; min-width: 0; border: 0; background: var(--surface);
  border-radius: 12px 0 0 12px; padding: 12px 14px; font-size: 16px; color: var(--ink);
}
.m-add__field::placeholder { font-size: 13.5px; color: var(--faint); }
.m-add__field:focus { outline: none; }
.m-add:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.m-add__go {
  border: 0; background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 800; padding: 12px 18px;
}
.m-add__caret {
  border: 0; background: var(--accent); color: var(--on-accent);
  padding: 12px 13px; border-radius: 0 12px 12px 0;
  border-left: 1px solid rgba(255, 255, 255, .25);
  display: flex; align-items: center;
}
/* The bar is at the bottom of the screen, so its menu opens upward. */
.m-add .addmenu {
  top: auto; bottom: calc(100% + 8px); left: 0; right: 0; min-width: 0;
  box-shadow: 0 -10px 30px rgba(31, 36, 48, .22);
}
.m-qadd {
  width: 100%; border: 1px dashed var(--accent-line); border-radius: 12px; background: none;
  padding: 12px 0; text-align: center; font-size: 14.5px; font-weight: 800; color: var(--accent-ink);
}
.m-qadd .upbadge { margin-left: 6px; }
.m-radarbar {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: var(--pill); border-radius: 12px; padding: 11px 14px;
}
.m-radarbar__dot { width: 11px; height: 11px; border-radius: 3px; background: var(--accent); flex: none; }
.m-radarbar__label { flex: 1; text-align: left; font-size: 14px; font-weight: 800; }
.m-radarbar .tag--count { background: var(--card); }
.m-radarbar__caret { font-size: 13px; color: var(--muted); }

/* --- sheets and the drawer ---------------------------------------------- */

.m-sheetwrap { position: fixed; inset: 0; z-index: 30; }
.m-scrim { position: absolute; inset: 0; background: var(--scrim-strong); animation: fade-in .2s ease-out backwards; }
@keyframes m-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
/* The bar is the signal; the zone around it is the target you can actually hit. */
.m-grabzone {
  align-self: stretch; flex: none;
  border: 0; background: none; padding: 8px 0 10px; margin: -12px 0 0;
  display: flex; align-items: center; justify-content: center;
  min-height: 32px; cursor: grab; touch-action: none;
}
.m-grabzone:active { cursor: grabbing; }
.m-grab {
  width: 44px; height: 4px; border-radius: var(--r-pill);
  background: var(--line-strong); flex: none; pointer-events: none;
  transition: background .15s, width .15s;
}
.m-grabzone:active .m-grab, .m-grabzone:focus-visible .m-grab {
  background: var(--muted-2); width: 56px;
}

.m-sheet, .m-drawer {
  position: absolute; left: 0; right: 0; bottom: 0;
  transition: transform .16s ease-out;
  will-change: transform;
  animation: m-sheet-up .28s cubic-bezier(.2, .8, .2, 1) backwards;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, .25);
  max-height: 92dvh; overflow: auto;
}
.m-drawer { top: 96px; gap: 12px; }
/* While a finger is on it, the sheet tracks the finger rather than easing. */
.m-sheet.is-dragging, .m-drawer.is-dragging { transition: none; }
.m-scrim { transition: opacity .16s ease-out; }

.m-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; }
.m-sheet__head { display: flex; flex-direction: column; gap: 4px; }
.m-sheet__title { font-size: 18px; font-weight: 800; line-height: 1.25; text-wrap: pretty; }
.m-sheet__meta { font-size: 12.5px; color: var(--muted-2); }
.m-group { display: flex; flex-direction: column; gap: 8px; }
.m-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.m-chip {
  border: 0; background: var(--pill); border-radius: var(--r-pill);
  padding: 11px 18px; font-size: 14px; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.m-chip { transition: background .18s, color .18s, transform .12s; }
.m-chip:active { transform: scale(.96); }
.m-chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.m-sheet__acts {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line-faint); padding-top: 14px;
}
.m-sheet__acts .btn { padding: 14px 20px; font-size: 15px; }
.m-grow { flex: 1; }

.m-drawer__head { display: flex; align-items: center; gap: 8px; }
/* The switch itself sits on the head's centre line, as on the rail; its name hangs below. */
.m-drawer__head .alltasks { margin-top: 15px; }
.m-drawer__title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.m-drawer__head h2 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.m-fits { white-space: nowrap; }
.m-drawer__count { font-size: 12.5px; color: var(--muted-2); }
.m-fits {
  border: 0; background: var(--pill); border-radius: var(--r-pill);
  padding: 7px 13px; font-size: 12.5px; font-weight: 700; color: var(--ink);
}
.m-drawer__body { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.m-drawer__foot { font-size: 12.5px; color: var(--muted-2); text-wrap: pretty; }
.m-rsec { display: flex; flex-direction: column; gap: 10px; }
.m-rsec__head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: none; padding: 0; text-align: left;
}
.m-rsec__label { flex: 1; font-size: 14px; font-weight: 800; line-height: 1.25; }
.m-chips--folded { margin-top: 2px; }
.m-chips--folded .m-chip { padding: 9px 15px; font-size: 13px; }

/* a radar card and its one-tap action */
.card--split { display: flex; flex-direction: row; align-items: center; gap: 12px; border-radius: 12px; }
.card--split .card__content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.m-totoday {
  flex: none; border: 0; background: var(--accent); color: var(--on-accent);
  border-radius: 11px; padding: 10px 14px; font-size: 13.5px; font-weight: 800; white-space: nowrap;
}
