:root {
  --bg: #0d1117; --bg2: #121823; --card: #161d2b; --card2: #1c2536; --line: #263043; --text: #e6edf3; --muted: #8b98ad;
  --accent: #5ea1ff; --accent-bg: #15294a; --good: #3ecf8e; --good-bg: #123a2b; --warn: #f2b441; --warn-bg: #3d2f0f; --bad: #ff6b6b; --bad-bg: #44181c; --violet: #a78bfa;
  --r: 16px; --gap: 12px; --tabs: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
.tab, a.btn, a.reason, a.tile { text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 4px 10px; }
small, .muted { color: var(--muted); }
small { font-size: 13px; }

#app { max-width: 1100px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 66px) 16px calc(var(--tabs) + env(safe-area-inset-bottom) + 24px); }

/* top bar and tabs */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: rgba(13, 17, 23, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 1100px; margin: 0 auto; height: 52px; padding: 0 16px; display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .01em; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.chip-good { background: var(--good-bg); color: var(--good); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-accent { background: var(--accent-bg); color: var(--accent); }
.chip-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); user-select: all; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; display: inline-block; }
.dot-working, .dot-good { background: var(--good); }
.dot-working { animation: pulse 1.4s ease-in-out infinite; }
.dot-paused, .dot-warn { background: var(--warn); }
.dot-problem, .dot-bad, .dot-stopped { background: var(--bad); }
.dot-info { background: var(--muted); }
.dot-ok { background: var(--good); }
@keyframes pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(62, 207, 142, .5); } 50% { opacity: .55; box-shadow: 0 0 0 5px rgba(62, 207, 142, 0); } }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(13, 17, 23, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs-in { max-width: 600px; margin: 0 auto; height: var(--tabs); display: flex; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; position: relative; text-align: center; }
.tab .ico { font-size: 22px; line-height: 1; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* generic pieces */
.stack > * + * { margin-top: var(--gap); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.grid { display: grid; gap: var(--gap); }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 600; background: var(--card2); border: 1px solid var(--line); text-align: center; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #06111f; border-color: transparent; }
.btn-good { background: var(--good); color: #04180f; border-color: transparent; }
.btn-danger { background: var(--bad-bg); color: var(--bad); border-color: #6b2630; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--good); transition: width .4s ease; }
.bar-warn > i { background: var(--warn); }
.bar-bad > i { background: var(--bad); }
.bar-accent > i { background: var(--accent); }
.bar-ticks::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 24.5%, var(--bg) 24.5%, var(--bg) 25.5%, transparent 25.5%, transparent 49.5%, var(--bg) 49.5%, var(--bg) 50.5%, transparent 50.5%, transparent 74.5%, var(--bg) 74.5%, var(--bg) 75.5%, transparent 75.5%); }
.indet > i { width: 40% !important; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

/* home: hero */
.hero { display: flex; gap: 16px; align-items: center; border-width: 1px; }
.hero-calm { background: linear-gradient(135deg, #12301f, var(--card)); border-color: #1f5a3c; }
.hero-attention { background: linear-gradient(135deg, #3a2c0c, var(--card)); border-color: #6b5214; }
.hero-alarm { background: linear-gradient(135deg, #471a1e, var(--card)); border-color: #7a2a31; }
.orb { width: 52px; height: 52px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.hero-calm .orb { background: var(--good-bg); box-shadow: 0 0 0 6px rgba(62, 207, 142, .12); }
.hero-attention .orb { background: var(--warn-bg); box-shadow: 0 0 0 6px rgba(242, 180, 65, .14); animation: breathe 2.4s ease-in-out infinite; }
.hero-alarm .orb { background: var(--bad-bg); box-shadow: 0 0 0 6px rgba(255, 107, 107, .16); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); } }
.hero h1 { font-size: 22px; line-height: 1.2; }
.hero p { color: var(--muted); margin-top: 2px; }
.reasons { margin-top: 10px; display: grid; gap: 6px; }
.reason { color: var(--text); display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: rgba(255, 255, 255, .05); border-radius: 12px; font-size: 15px; }
.reason span:nth-child(2) { flex: 1; }
.chev { color: var(--muted); }

/* home: stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.stats .mode { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stats .mode .seg { flex: 1.2; min-width: 190px; margin: 0; }
.stats .mode .seg .btn { min-height: 40px; }
.stats .mode .head { flex: 1; min-width: 120px; }
.stat .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat .value { font-size: 22px; font-weight: 700; margin: 4px 0 8px; letter-spacing: -.01em; }
.stat .value small { font-size: 14px; font-weight: 500; }
.stat .cap { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.stat { padding: 12px 14px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(3, 1fr); } .stats .mode { grid-column: auto; display: block; } .stats .mode .seg { margin-top: 6px; min-width: 0; } .stat .value { font-size: 26px; } }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.seg .btn { min-height: 44px; white-space: nowrap; padding: 0 8px; }
.seg .on { background: var(--accent-bg); color: var(--accent); border-color: #2c4f86; }
.seg .on-sleep { background: #2a2250; color: var(--violet); border-color: #473a86; }

/* home: crew */
.crew { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 8px 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 124px; transition: transform .12s ease, border-color .12s ease; }
.tile:active { transform: scale(.97); }
.tile:hover { border-color: #35435c; }
.tile .face { font-size: 32px; line-height: 1; width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--card2); }
.tile-business .face { background: var(--accent-bg); }
.tile-staff .face { background: #2a2250; }
.tile .nm { font-weight: 600; font-size: 14px; line-height: 1.15; overflow-wrap: anywhere; }
.tile .st { font-size: 12px; color: var(--muted); line-height: 1.2; }
.tile .dot { position: absolute; top: 10px; right: 10px; }
.tile .need { position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.tile-working { border-color: #1f5a3c; }
.tile-paused { border-color: #6b5214; }
.tile-problem, .tile-stopped { border-color: #7a2a31; }
.tile-paused .face, .tile-stopped .face { filter: grayscale(.6); }

/* home: businesses, activity */
.biz { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
.bizcard { text-align: left; display: block; width: 100%; }
.bizcard .name { font-weight: 700; font-size: 17px; }
.bizcard .meta { margin: 8px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.bizcard .nums { margin-top: 8px; display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.feed { display: grid; gap: 0; padding: 4px 0; }
.item { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 10px 16px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .dot { margin-top: 7px; }
.item .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item .who { font-size: 12px; color: var(--muted); }
.item time { font-size: 12px; color: var(--muted); white-space: nowrap; margin-top: 2px; }

/* inbox */
.q { border-left: 4px solid var(--line); }
.q-high { border-left-color: var(--bad); }
.q-mid { border-left-color: var(--warn); }
.q-low { border-left-color: var(--good); }
.q h3 { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.q .meta { margin: 6px 0 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.q pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; max-height: 9.5em; overflow: hidden; }
.q pre.open { max-height: none; }
.q .actions { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.q .options { display: grid; gap: 8px; }
.q input[type=text], .field { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--bg2); color: var(--text); border: 1px solid var(--line); font: inherit; }
.q .typed { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
details.more summary { cursor: pointer; padding: 12px 4px; color: var(--muted); }
code.cmd { display: block; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg2); padding: 8px 10px; border-radius: 10px; overflow-wrap: anywhere; margin-top: 6px; }

/* agent sheet */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); animation: fade .15s ease; }
.sheet { position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; top: calc(env(safe-area-inset-top) + 28px); background: var(--bg); border-radius: 22px 22px 0 0; border: 1px solid var(--line); border-bottom: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(env(safe-area-inset-bottom) + 28px); animation: rise .22s ease; }
.sheet-head { position: sticky; top: 0; background: var(--bg); padding: 14px 0 10px; display: flex; align-items: center; gap: 12px; z-index: 1; }
.sheet-head .face { font-size: 30px; width: 52px; height: 52px; border-radius: 16px; background: var(--card2); display: flex; align-items: center; justify-content: center; flex: none; }
.sheet-head h1 { font-size: 21px; line-height: 1.15; }
.back { min-height: 44px; padding: 0 14px; border-radius: 22px; background: var(--card2); font-size: 15px; font-weight: 600; flex: none; }
.close { width: 44px; height: 44px; border-radius: 50%; background: var(--card2); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.kv .card { padding: 12px 14px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-weight: 700; font-size: 17px; margin-top: 2px; }
.task { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* what a business does: squares */
.work .sq-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 18px 4px 8px; }
.work .sq-title strong { font-size: 15px; }
.work .sq-more { display: block; margin: 8px 4px 0; }
.work { container-type: inline-size; }
.squares { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }          /* two to a row at every width: wide enough that names and odds are never cut */
.squares-stats { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }
.sq { position: relative; aspect-ratio: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line); }
.sq .sq-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 6px; font-size: 11px; color: var(--muted); }
.sq .lg { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-weight: 600; }
.sq .dy { white-space: nowrap; flex: none; }
.sq .pick, .sq .pin-title { font-weight: 700; font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.sq .pin-title { font-weight: 600; font-size: 14px; -webkit-line-clamp: 4; }
.sq .vs { font-size: 12px; color: var(--muted); line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sq .mult { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--accent); margin-top: auto; line-height: 1.1; }
.sq .pay { font-size: 12px; color: var(--muted); line-height: 1.35; }
.sq .pay b { color: var(--text); }
.sq .pay .when { display: flex; flex-direction: column; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); color: var(--accent); }
.sq .pay .when span { font-size: 11px; opacity: .85; }
.sq .pay .when b { color: var(--accent); }
.sq .pay .when-due, .sq .pay .when-due b { color: var(--warn); }
.sq .res { font-size: 15px; font-weight: 700; }
.sq-stat { aspect-ratio: 1; align-items: center; justify-content: center; text-align: center; padding: 8px 4px; gap: 2px; }
.sq-stat .v { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.sq-stat .k { font-size: 11px; color: var(--muted); line-height: 1.2; }
.days { display: grid; gap: 6px; }
.day-row { display: grid; grid-template-columns: minmax(84px, 1.1fr) minmax(64px, .8fr) minmax(84px, 1fr) minmax(80px, 1fr); gap: 4px 10px; align-items: baseline; padding: 9px 12px; border-radius: 10px; background: var(--card); font-size: 14px; }
.day-row .dd small { color: var(--muted); }
.day-row .da { font-weight: 700; }
.day-row .da.good { color: var(--good); }
.day-row .da.bad { color: var(--bad); }
.day-row .dm, .day-row .db { color: var(--muted); font-size: 13px; }
@media (max-width: 420px) { .day-row { grid-template-columns: 1fr 1fr; } }
.prop-game { margin: 14px 4px 6px; font-weight: 700; font-size: 14px; }
.prop-game small { font-weight: 400; color: var(--muted); }
.prop-rows { display: grid; gap: 6px; }
.prop-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 12px; border-radius: 10px; background: var(--card); font-size: 14px; border-left: 3px solid transparent; }
.prop-row .pp { min-width: 0; overflow-wrap: anywhere; }
.prop-row .po { font-weight: 700; color: var(--accent); }
.prop-row .pm { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.prop-row .pr { grid-column: 1 / -1; font-size: 13px; font-weight: 600; }
.prop-row .pr.good { color: var(--good); }
.prop-row .pr.bad { color: var(--bad); }
.prop-row .po.good { color: var(--good); }
.prop-row .po.bad { color: var(--bad); }
.prop-row .pr .chip { font-size: 11px; padding: 1px 8px; }
.other-costs { margin-top: 4px; }
.prop-row.won { border-left-color: var(--good); }
.prop-row.lost { border-left-color: var(--bad); }
.strat h3 { margin: 0; font-size: 16px; }
.strat h3 small { color: var(--muted); font-weight: 500; }
.strat-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.strat-h .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.strat-s { font-size: 13px; margin: 4px 0 10px; overflow-wrap: anywhere; }
.strat-stopped { opacity: .8; }
.minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.mini { display: flex; flex-direction: column; gap: 1px; padding: 8px 6px; border-radius: 10px; background: var(--card2); text-align: center; min-width: 0; }
.mini b { font-size: 15px; overflow-wrap: anywhere; }
.mini span { font-size: 11px; color: var(--muted); line-height: 1.2; }
.mini.good b { color: var(--good); }
.mini.bad b { color: var(--bad); }
.prog { margin: 8px 0; }
.prog-l { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.prog-l b { color: var(--text); font-weight: 600; white-space: nowrap; }
.strat-v { font-size: 14px; font-weight: 600; margin-top: 10px; }
.strat-v.good { color: var(--good); }
.strat-v.bad { color: var(--bad); }
.kvs { display: grid; gap: 6px; margin-bottom: 10px; }
.kv { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 13px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; }
.checks { display: grid; gap: 6px; }
.checks-t { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.check { display: grid; grid-template-columns: 18px 1fr; gap: 6px; font-size: 13px; line-height: 1.35; }
.check.ok > span:first-child { color: var(--good); }
.check.no > span:first-child { color: var(--bad); }
@media (max-width: 360px) { .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sq-stat.good .v { color: var(--good); }
.sq-stat.bad .v { color: var(--bad); }
.sq-tap { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; }
.sq-tap:active { transform: scale(.98); }
.sq .sq-go { color: var(--accent); font-weight: 600; }
.when-card { display: grid; gap: 6px; }
.when-card .when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--accent); }
.when-card .when b { font-size: 17px; }
.when-card .when-due { color: var(--warn); }
.sq-wait { border-style: dashed; border-color: #6b5214; }
.sq-win { border-color: var(--good); background: linear-gradient(160deg, rgba(62, 207, 142, .24), var(--card) 62%); }
.sq-lose { border-color: var(--bad); background: linear-gradient(160deg, rgba(255, 107, 107, .24), var(--card) 62%); }
.sq-win .mult, .sq-lose .mult { color: var(--muted); font-size: 20px; }
.sq-win .res { color: var(--good); }
.sq-lose .res { color: var(--bad); }
.sq-live { border-color: #1f5a3c; }
.sq-live .pin-title { -webkit-line-clamp: 3; }
.sq .pin-title ~ .pay { margin-top: auto; }
.sq-live .vs { margin-bottom: 2px; }
@container (min-width: 440px) {                                                                  /* a wide sheet (tablet, laptop): the same squares, with room for bigger type */
  .sq { padding: 16px 18px; gap: 5px; }
  .sq .sq-top { font-size: 13px; }
  .sq .pick, .sq .pin-title { font-size: 19px; }
  .sq .vs { font-size: 14px; }
  .sq .mult { font-size: 34px; }
  .sq-win .mult, .sq-lose .mult { font-size: 25px; }
  .sq .pay { font-size: 14px; }
  .sq .res { font-size: 18px; }
  .sq-stat { padding: 8px; }
  .sq-stat .v { font-size: 24px; }
  .sq-stat .k { font-size: 12px; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* ideas */
.idea { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; text-align: left; border-left: 4px solid var(--line); }
.idea-good { border-left-color: var(--good); }
.idea-warn { border-left-color: var(--warn); }
.idea-bad { border-left-color: var(--bad); }
.idea .score { min-width: 60px; height: 60px; border-radius: 16px; background: var(--card2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; line-height: 1; color: var(--muted); }
.idea .score small { font-size: 10px; font-weight: 600; margin-top: 3px; }
.score.good { background: var(--good-bg); color: var(--good); }
.score.warn { background: var(--warn-bg); color: var(--warn); }
.score.bad { background: var(--bad-bg); color: var(--bad); }
.idea .ttl { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.idea .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.idea .why { font-size: 13px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scorecard .big { font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.scorecard .big small { font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.big.good { color: var(--good); }
.big.warn { color: var(--warn); }
.big.bad { color: var(--bad); }
.scorebar { position: relative; margin: 14px 0 8px; }
.scorebar .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); }
.dim-note { font-size: 14px; margin-top: 6px; line-height: 1.4; overflow-wrap: anywhere; }
.sum { padding-top: 10px; border-top: 1px solid var(--line); font-weight: 600; }
.ev { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.ev:first-child { border-top: 0; padding-top: 0; }
.ev:last-child { padding-bottom: 0; }
.quote { margin-top: 4px; font-size: 13px; color: var(--muted); font-style: italic; }
ul.plain { margin: 6px 0 0; padding-left: 20px; }
ul.plain li { margin-top: 4px; overflow-wrap: anywhere; }
.field.area { padding: 12px 14px; line-height: 1.4; resize: vertical; min-height: 120px; }

/* modal, toast */
.modal { position: fixed; z-index: 41; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); max-width: 520px; margin: 0 auto; background: var(--card); border: 1px solid #35435c; border-radius: 22px; padding: 18px; animation: rise .18s ease; display: grid; gap: 12px; }
.modal h3 { font-size: 19px; }
.modal .btns { display: grid; gap: 8px; }
.modal .err { color: var(--bad); font-size: 14px; min-height: 1em; }
.scrim-modal { z-index: 40; }
#toast { position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(var(--tabs) + env(safe-area-inset-bottom) + 12px); display: grid; gap: 8px; pointer-events: none; justify-items: center; }
.toast { background: #202a3d; border: 1px solid #35435c; padding: 11px 16px; border-radius: 14px; max-width: 520px; font-size: 15px; animation: rise .18s ease; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.toast-ok { border-color: #1f5a3c; }
.toast-bad { border-color: #7a2a31; }

.offline { background: var(--bad-bg); color: var(--bad); border: 1px solid #6b2630; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.skeleton { height: 110px; border-radius: var(--r); background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (min-width: 900px) {
  :root { --tabs: 0px; }
  #app { padding-bottom: 40px; }
  .tabs { top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: 440px; background: none; border: 0; backdrop-filter: none; padding: 0; z-index: 25; }
  .tabs-in { height: 52px; max-width: none; }
  .tab { flex-direction: row; gap: 8px; font-size: 14px; }
  .tab .ico { font-size: 17px; }
  .tab[aria-current="page"]::before { top: auto; bottom: 0; width: 24px; height: 3px; border-radius: 3px 3px 0 0; }
  .badge { position: static; margin-left: 2px; }
  .brand { width: 140px; }
  #toast { bottom: 24px; }
  .sheet { left: auto; width: 520px; top: 0; border-radius: 0; border: 0; border-left: 1px solid var(--line); animation: slidein .2s ease; padding-top: env(safe-area-inset-top); }
  @keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* done for you (auto-approve rules) */
.ap { display: grid; gap: 10px; margin: 12px 0; }
.ap .ap-rule { padding: 6px 0; border-top: 1px solid var(--line); }
.ap .muted { color: var(--muted); font-size: 13px; }

/* lessons and skills */
.lesson { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; }
.lesson .body { flex: 1; min-width: 0; }
.lesson .ttl { font-weight: 600; margin-bottom: 4px; }
.lesson .why { color: var(--muted); font-size: 13px; margin-top: 4px; }
.lesson-flag { border-left: 4px solid var(--bad); }
.modal .field + .field, .modal .field + .err { margin-top: 8px; }
.note { white-space: pre-wrap; word-break: break-word; margin: 0 0 10px; line-height: 1.45; }
.note-h { margin: 14px 0 4px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* an agent's switches */
.switch { flex: none; width: 52px; height: 30px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); position: relative; padding: 0; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { background: var(--good-bg); border-color: var(--good); }
.switch.on .knob { transform: translateX(22px); background: var(--good); }
.switch[disabled] { opacity: .5; }
.switch-row { align-items: flex-start; gap: 14px; }

/* Rok's run rules: each run as a chip, under the strategy's verdict */
.runs-box { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line, rgba(127,127,127,.2)); }
.run-chips { flex-wrap: wrap; gap: 6px; }
