/* R7.7 W6: the focus tidy (Choose your focus). Tokens only (design-system.css --ob3-*); no hex. Paper and Graphite come from the
   themed roles. Boards: FocusTidyPhone, FocusTidyMaxPhone, FocusTidyDonePhone (476 x 752). Every tap is at least 44 px; the
   Focus / Later toggle is two 72 x 44 buttons; a pill never grows. Amber for the limit, never red. */

/* While the tidy is open every other child of the canvas steps aside (CSS, so a late re-show cannot show through). */
body[data-obgt-open] .obds-canvas-body > *:not(#r77-slot-tidy) { display: none !important; }
body[data-obgt-open] .obds-page-title { display: none; }
#r77-slot-tidy[hidden] { display: none; }
@media (max-width: 599px) { body[data-obgt-open] .obds-topbar { display: none; } }
body[data-obgt-open] .obds-canvas { overflow-x: clip; }
@media (max-width: 999px) { body[data-obgt-open] .obds-canvas-body { padding: 0; } }

#r77-slot-tidy { --obgt-gutter: 14px; --obgt-muted: color-mix(in srgb, var(--ob3-muted) 80%, var(--ob3-ink)); color: var(--ob3-ink); font-family: var(--ob3-font-sans); min-width: 0; }
.obgt { display: flex; flex-direction: column; min-width: 0; min-height: calc(100dvh - var(--ob-shell-dock-h, 0px)); max-width: 640px; margin-inline: auto; padding-bottom: 0; }
.obgt *, .obgt *::before, .obgt *::after { box-sizing: border-box; }
.obgt :where(p, h1, h2, ul) { margin: 0; padding: 0; }
.obgt :where(ul) { list-style: none; }
.obgt :where(button) { font-family: inherit; color: inherit; }
.obgt button:focus-visible { outline: var(--ob3-focus-ring); outline-offset: var(--ob3-focus-offset); }

/* ---- header bar ---- */
.obgt-bar { display: flex; align-items: center; gap: var(--ob3-space-1); min-height: 56px; padding: 0 var(--ob3-space-1); background: var(--ob3-paper); }
.obgt-icon { width: 44px; min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: var(--ob3-radius-full); cursor: pointer; flex: none; }
.obgt-icon:hover { background: var(--ob3-sunk); }
.obgt-bartxt { flex: 1 1 auto; min-width: 0; }
.obgt-bartitle { font-size: 20px; line-height: 24px; font-weight: var(--ob3-weight-bold); letter-spacing: var(--ob3-tracking-title); }
.obgt-barsub { font-size: var(--ob3-text-meta); line-height: var(--ob3-leading-meta); color: var(--obgt-muted); }

/* ---- notes ---- */
.obgt-note { margin: var(--ob3-space-2) var(--obgt-gutter) 0; padding: var(--ob3-space-3) var(--ob3-space-4); border-radius: var(--ob3-radius-control); font-size: var(--ob3-text-body-sm); line-height: var(--ob3-leading-body-sm); }
.obgt-note.is-amber { background: var(--ob3-attention-tint); color: var(--ob3-attention); }
.obgt-note.is-muted { background: var(--ob3-sunk); color: var(--obgt-muted); }
.obgt-note.is-good { background: var(--ob3-good-tint); color: var(--ob3-good); }

/* ---- the Saarthi card ---- */
.obgt-card { display: flex; align-items: flex-start; gap: var(--ob3-space-3); margin: var(--ob3-space-3) var(--obgt-gutter) 0; padding: var(--ob3-space-3) var(--ob3-space-4); border-radius: var(--ob3-radius-sheet); background: var(--ob3-saarthi-tint); min-width: 0; }
.obgt-orb { width: 26px; height: 26px; border-radius: var(--ob3-radius-full); background: var(--ob3-orb); flex: none; margin-top: 2px; }
.obgt-cardtxt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.obgt-cardlabel { font-size: var(--ob3-text-meta); line-height: var(--ob3-leading-meta); font-weight: var(--ob3-weight-bold); color: var(--ob3-saarthi); }
.obgt-lead { font-family: var(--ob3-font-serif); font-size: var(--ob3-text-saarthi); line-height: var(--ob3-leading-saarthi); font-weight: var(--ob3-weight-medium); color: var(--ob3-ink); overflow-wrap: anywhere; }

/* ---- the count line and the limit message ---- */
.obgt-count { margin: var(--ob3-space-4) var(--obgt-gutter) var(--ob3-space-2); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--ob3-space-2); font-size: var(--ob3-text-meta); line-height: var(--ob3-leading-meta); color: var(--obgt-muted); }
.obgt-count strong { font-size: var(--ob3-text-body-sm); color: var(--ob3-ink); font-weight: var(--ob3-weight-bold); }
.obgt-max { display: flex; align-items: flex-start; gap: var(--ob3-space-2); margin: 0 var(--obgt-gutter) var(--ob3-space-3); padding: var(--ob3-space-3) var(--ob3-space-3); border-radius: var(--ob3-radius-control); background: var(--ob3-attention-tint); color: var(--ob3-attention); font-size: var(--ob3-text-body-sm); line-height: var(--ob3-leading-body-sm); }
.obgt-max svg { flex: none; margin-top: 1px; }

/* ---- the rows ---- */
.obgt-list { display: flex; flex-direction: column; gap: var(--ob3-space-3); padding: 0 var(--obgt-gutter) var(--ob3-space-5); }
.obgt-row { display: flex; align-items: center; gap: var(--ob3-space-3); min-width: 0; padding: var(--ob3-space-3) var(--ob3-space-2) var(--ob3-space-3) var(--ob3-space-4); background: var(--ob3-surface); border: 1px solid var(--ob3-line); border-radius: var(--ob3-radius-card); }
.obgt-rowtxt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.obgt-rowt { font-size: var(--ob3-text-card-title); line-height: 20px; font-weight: var(--ob3-weight-semibold); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.obgt-rowr { font-size: var(--ob3-text-meta); line-height: var(--ob3-leading-meta); color: var(--obgt-muted); overflow-wrap: anywhere; }
.obgt-toggle { flex: none; display: inline-flex; gap: 0; padding: 4px; border-radius: var(--ob3-radius-full); background: var(--ob3-sunk); }
.obgt-seg { width: 72px; min-width: 72px; max-width: 72px; height: 44px; border: 0; border-radius: var(--ob3-radius-full); background: transparent; color: var(--obgt-muted); font-size: var(--ob3-text-body-sm); font-weight: var(--ob3-weight-bold); cursor: pointer; white-space: nowrap; }
.obgt-seg.is-on { background: var(--ob3-accent); color: var(--ob3-on-accent); }
.obgt-seg.is-on[data-k^="l:"] { background: var(--ob3-surface); color: var(--ob3-ink); box-shadow: 0 1px 3px var(--ob3-shadow); }
.obgt-seg.is-blocked { opacity: 0.45; cursor: not-allowed; }

/* ---- the footer: Save and Not now ---- */
.obgt-foot { position: sticky; bottom: var(--ob-shell-dock-h, 0px); z-index: 3; display: flex; gap: var(--ob3-space-2); margin-top: auto; padding: var(--ob3-space-3) var(--obgt-gutter); background: var(--ob3-paper); border-top: 1px solid var(--ob3-line); }
.obgt-main { flex: 1 1 0; min-width: 0; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 var(--ob3-space-2); border-radius: var(--ob3-radius-full); border: 1px solid var(--ob3-line-strong); background: var(--ob3-surface); color: var(--ob3-ink); font-size: var(--ob3-text-body); font-weight: var(--ob3-weight-bold); white-space: nowrap; overflow: hidden; cursor: pointer; }
.obgt-main.is-filled { background: var(--ob3-accent); border-color: var(--ob3-accent); color: var(--ob3-on-accent); }
.obgt-main:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---- the pill (retry, open goals on the empty state): 184 x 44, never grows ---- */
.obgt-pill { height: 44px; width: 184px; min-width: 184px; max-width: 184px; display: inline-flex; align-items: center; justify-content: center; padding: 0 var(--ob3-space-2); border-radius: var(--ob3-radius-full); border: 1px solid var(--ob3-line-strong); background: var(--ob3-surface); color: var(--ob3-ink); font-size: var(--ob3-text-body); font-weight: var(--ob3-weight-semibold); cursor: pointer; white-space: nowrap; overflow: hidden; }
.obgt-pill.is-filled { background: var(--ob3-accent); border-color: var(--ob3-accent); color: var(--ob3-on-accent); }
.obgt-fail { display: flex; flex-direction: column; align-items: flex-start; gap: var(--ob3-space-3); padding: var(--ob3-space-4) var(--obgt-gutter); }
.obgt-plain { font-size: var(--ob3-text-body-sm); line-height: var(--ob3-leading-body-sm); color: var(--obgt-muted); }

/* ---- loading ---- */
.obgt-skel { display: flex; flex-direction: column; gap: var(--ob3-space-3); padding: var(--ob3-space-4) var(--obgt-gutter); }
.obgt-skel span { display: block; height: 76px; border-radius: var(--ob3-radius-card); background: var(--ob3-sunk); }

/* ---- done ---- */
.obgt-done { display: flex; flex-direction: column; align-items: center; gap: var(--ob3-space-3); padding: var(--ob3-space-6) var(--obgt-gutter) var(--ob3-space-5); text-align: center; }
.obgt-tile { width: 64px; height: 64px; border-radius: var(--ob3-radius-sheet); background: var(--ob3-good-tint); color: var(--ob3-good); display: inline-flex; align-items: center; justify-content: center; }
.obgt-donehead { font-family: var(--ob3-font-serif); font-size: var(--ob3-text-title); line-height: var(--ob3-leading-title); font-weight: var(--ob3-weight-bold); }
.obgt-donesub { max-width: 400px; font-size: var(--ob3-text-body-sm); line-height: var(--ob3-leading-body-sm); color: var(--obgt-muted); }
.obgt-link { align-self: stretch; margin-top: var(--ob3-space-4); display: flex; align-items: center; gap: var(--ob3-space-3); min-height: 64px; padding: var(--ob3-space-3) var(--ob3-space-4); border: 1px solid var(--ob3-line); border-radius: var(--ob3-radius-card); background: var(--ob3-surface); text-align: left; cursor: pointer; }
.obgt-linkico { width: 36px; height: 36px; border-radius: var(--ob3-radius-control); background: var(--ob3-accent-tint); color: var(--ob3-accent-text); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.obgt-linktxt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; font-size: var(--ob3-text-meta); line-height: var(--ob3-leading-meta); color: var(--obgt-muted); }
.obgt-linktxt strong { font-size: var(--ob3-text-body); line-height: 20px; color: var(--ob3-ink); font-weight: var(--ob3-weight-bold); }
.obgt-link > svg:last-child { color: var(--obgt-muted); flex: none; }

@media (prefers-reduced-motion: reduce) { .obgt * { transition: none !important; animation: none !important; } }

/* theme.css forces `:root[data-theme] button { background, color, border-color !important }` on every control; these rules outrank it
   (an id in the chain, also !important) for this screen's own controls. Tokens only. */
:root[data-theme] #r77-slot-tidy .obgt-icon { background: transparent !important; color: var(--ob3-ink) !important; border-color: transparent !important; }
:root[data-theme] #r77-slot-tidy .obgt-seg { background: transparent !important; color: var(--obgt-muted) !important; border-color: transparent !important; }
:root[data-theme] #r77-slot-tidy .obgt-seg.is-on { background: var(--ob3-accent) !important; color: var(--ob3-on-accent) !important; border-color: transparent !important; }
:root[data-theme] #r77-slot-tidy .obgt-seg.is-on[data-k^="l:"] { background: var(--ob3-surface) !important; color: var(--ob3-ink) !important; }
:root[data-theme] #r77-slot-tidy .obgt-main,
:root[data-theme] #r77-slot-tidy .obgt-pill { background: var(--ob3-surface) !important; color: var(--ob3-ink) !important; border-color: var(--ob3-line-strong) !important; }
:root[data-theme] #r77-slot-tidy .obgt-main.is-filled,
:root[data-theme] #r77-slot-tidy .obgt-pill.is-filled { background: var(--ob3-accent) !important; color: var(--ob3-on-accent) !important; border-color: var(--ob3-accent) !important; }
:root[data-theme] #r77-slot-tidy .obgt-link { background: var(--ob3-surface) !important; color: var(--ob3-ink) !important; border-color: var(--ob3-line) !important; }
