/* === agent f3: sync status, How data flows, Automations === */
/* State colors only: saved = neutral, waiting = blue, synced = green, needs attention = red. */
:where(.f3-pill, .f3-fs, .f3-list li, .f3-runs li, .f3-states li) { --st: var(--faint); --st-bg: var(--hover); --st-ink: var(--ink-2); }
.st-waiting { --st: var(--blue); --st-bg: rgb(43 108 176 / .1); --st-ink: var(--blue); }
.st-synced { --st: var(--good); --st-bg: var(--good-bg); --st-ink: var(--good); }
.st-attention { --st: var(--bad); --st-bg: var(--bad-bg); --st-ink: var(--bad); }
.st-saved { --st: var(--faint); --st-bg: var(--hover); --st-ink: var(--ink-2); }
.f3-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st); flex: none; display: inline-block; }
.st-waiting > .f3-dot, .f3-pill.st-waiting .f3-dot, .f3-fs.st-waiting .f3-dot { animation: f3-breathe 1.6s ease-in-out infinite; }
@keyframes f3-breathe { 50% { opacity: .35; } }

/* header pill + popover */
.f3-cs { position: relative; display: inline-flex; }
.f3-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); border: 0; background: var(--st-bg); color: var(--st-ink);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform 100ms var(--ease-out, ease-out); }
.f3-pill:active { transform: scale(.97); }
.f3-pill:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.f3-pill.static { cursor: default; }
.f3-n { font-variant-numeric: tabular-nums; font-weight: 700; opacity: .8; }
.f3-pop { position: fixed; z-index: 400; width: min(360px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 16px;
  background: rgb(255 255 255 / .96); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); box-shadow: var(--glass-edge, 0 0 0 1px var(--line)), var(--sh-pop); transform-origin: top left; animation: f3-grow 160ms cubic-bezier(.2, .8, .2, 1); }
@keyframes f3-grow { from { opacity: 0; transform: scale(.96) translateY(-2px); } }
.f3-pop-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.f3-list, .f3-runs { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.f3-list li, .f3-runs li { display: grid; grid-template-columns: 7px 1fr auto; gap: 10px; align-items: start; }
.f3-list li .f3-dot, .f3-runs li .f3-dot { margin-top: 6px; }
.f3-li { min-width: 0; }
.f3-li b { color: var(--st-ink); }
.f3-why { color: var(--ink-2); overflow-wrap: anywhere; }

/* inline field chip */
.f3-fs { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; padding: 0 6px; height: 16px; border-radius: var(--r-pill); background: var(--st-bg); color: var(--st-ink);
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0; vertical-align: 1px; white-space: nowrap; }
.f3-fs .f3-dot { width: 5px; height: 5px; }

/* Settings pages */
.f3-flow, .f3-auto { max-width: 1040px; }
.f3-lede { font-size: var(--fs-md); color: var(--ink-2); max-width: 70ch; margin: 4px 0 16px; line-height: 1.5; }
.f3-card { background: var(--panel); border-radius: var(--r-card, 16px); box-shadow: var(--glass-edge, 0 0 0 1px var(--line)), var(--sh-1); padding: 16px 20px; margin-bottom: 12px; }
.f3-card h3 { margin: 0 0 10px; font-size: var(--fs-lg); letter-spacing: -.01em; }
.f3-two { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.f3-two li { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 12px; font-size: var(--fs-base); }
.f3-two li span { color: var(--ink-2); font-family: var(--mono, ui-monospace, monospace); font-size: var(--fs-sm); }
.f3-states { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.f3-states li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.f3-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 6px; }
.f3-row select { width: auto; max-width: min(340px, 100%); border-radius: var(--r-pill); min-height: 30px; }
.f3-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.f3-check input { width: 15px; min-width: 0; padding: 0; min-height: 0; height: 15px; margin: 0; flex: none; accent-color: var(--sg-blue, var(--blue)); }
.f3-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.f3-table { min-width: 640px; }
.f3-table td { vertical-align: top; }
.f3-dir { display: inline-block; padding: 1px 8px; border-radius: var(--r-pill); font-size: var(--fs-sm); background: var(--hover); color: var(--ink-2); white-space: nowrap; }
.f3-dir.d-both { background: rgb(var(--sg-blue-rgb, 36 61 144) / .1); color: var(--sg-blue, var(--blue)); font-weight: 600; }
.f3-dir.d-out { background: var(--warn-bg); color: var(--warn); }
.f3-dl { display: grid; grid-template-columns: minmax(110px, 170px) 1fr; gap: 6px 14px; margin: 0; }
.f3-dl dt { font-weight: 600; font-size: var(--fs-base); }
.f3-dl dd { margin: 0; color: var(--ink-2); }
.f3-dl.tight { grid-template-columns: 56px 1fr; gap: 4px 10px; margin-bottom: 10px; }
.f3-dl.tight dt { color: var(--muted); font-weight: 500; font-size: var(--fs-sm); }
.f3-dl.tight dd { font-size: var(--fs-base); }
.f3-prot { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.f3-alert { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-ctl, 12px); background: var(--bad-bg); color: var(--bad); font-weight: 600; font-size: var(--fs-base); }

/* automation cards */
.f3-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 12px; }
.f3-grid .f3-card { margin: 0; display: flex; flex-direction: column; }
.f3-am.has-fail { box-shadow: var(--glass-edge, 0 0 0 1px var(--line)), 0 0 0 1.5px var(--bad-line), var(--sh-1); }
.f3-am.is-paused { opacity: .78; }
.f3-am-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.f3-am-h h3 { margin-bottom: 8px; }
.f3-am-f { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.f3-am .f3-runs { margin-top: 10px; }
.f3-on { font-size: var(--fs-sm); font-weight: 600; color: var(--good); }
.f3-on.off { color: var(--muted); }
.f3-switch { position: relative; display: inline-flex; flex: none; width: 38px; height: 22px; cursor: pointer; }
.f3-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.f3-switch span { width: 100%; height: 100%; border-radius: var(--r-pill); background: var(--line-3); transition: background 160ms ease; }
.f3-switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform 220ms cubic-bezier(.3, 1.3, .5, 1); }
.f3-switch input:checked + span { background: var(--good); }
.f3-switch input:checked + span::after { transform: translateX(16px); }
.f3-switch input:focus-visible + span { box-shadow: var(--focus-ring); }

@media (max-width: 640px) {
  .f3-card { padding: 14px 14px; }
  .f3-two li, .f3-states li, .f3-dl { grid-template-columns: 1fr; gap: 2px; }
  .f3-dl dd { margin-bottom: 8px; }
  .f3-dl.tight { grid-template-columns: 56px 1fr; }
  .f3-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .f3-pop { animation: f3-fade 120ms linear; }
  .st-waiting > .f3-dot, .f3-pill.st-waiting .f3-dot, .f3-fs.st-waiting .f3-dot { animation: none; }
  .f3-switch span::after { transition: none; }
}
@keyframes f3-fade { from { opacity: 0; } }
@media (prefers-reduced-transparency: reduce) { .f3-pop { background: #fff; } }
