/* Components: buttons, chips, cards, forms, rows, rings, meters, skeletons, empty states. */

/* buttons: pill, inset highlight + ambient shadow, spring press */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em; height: 42px; padding: 0 18px;
  border-radius: 99px; font-weight: 650; font-size: .92rem; line-height: 1; white-space: nowrap; color: var(--ink);
  border: 1px solid var(--line-2); background: color-mix(in oklch, var(--surface) 70%, transparent);
  transition: transform .45s var(--spring), background .2s, border-color .2s, box-shadow .3s, color .2s;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn:active { transform: scale(.965); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary {
  background: var(--accent); color: var(--on-accent); border-color: transparent;
  box-shadow: 0 1px 0 oklch(1 0 0 / .5) inset, 0 -2px 0 oklch(0 0 0 / .1) inset, 0 10px 24px -12px var(--accent), 0 2px 4px oklch(0 0 0 / .12);
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.good { background: var(--good); color: var(--surface); border-color: transparent; }
.btn.danger { color: var(--crit); }
.btn.danger:hover { border-color: var(--crit); background: var(--crit-bg); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--surface-2); }
.btn.sm { height: 34px; padding: 0 13px; font-size: .84rem; }
.btn.block { width: 100%; }

/* chips + segmented control */
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 99px;
  border: 1px solid var(--line-2); background: color-mix(in oklch, var(--surface) 70%, transparent); color: var(--ink-2);
  font-weight: 600; font-size: .82rem; white-space: nowrap; transition: transform .45s var(--spring), background .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--bg); }
.chip select { appearance: none; border: 0; background: transparent; font: inherit; color: inherit; padding-right: 2px; outline: none; max-width: 160px; }
.chip svg { width: 15px; height: 15px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.seg button { height: 30px; padding: 0 13px; border-radius: 99px; font-weight: 650; font-size: .8rem; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font: 700 .62rem/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.pill.crit { background: var(--crit-bg); color: var(--crit); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.pill.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.cat-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-weight: 650; font-size: .74rem; color: var(--ink-2); background: color-mix(in oklch, var(--c) 16%, transparent); }
.cat-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

/* cards with the top-lit sheen (§4) */
.card {
  position: relative; isolation: isolate; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sh-1); padding: clamp(16px, 1.7vw, 24px); display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; background: var(--sheen); pointer-events: none; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head .h2 { margin-top: 2px; }
.card.click { cursor: pointer; transition: box-shadow .3s, transform .45s var(--spring), border-color .2s; }
.card.click:hover { box-shadow: var(--sh-2); border-color: var(--line-2); }

/* forms */
.field { display: grid; gap: 6px; }
.field > span { font: 600 .66rem/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field .auto { color: var(--accent-text); margin-left: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-width: 0; height: 44px; padding: 0 13px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--ink); font-size: .95rem; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.field textarea { height: auto; min-height: 92px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.pw { position: relative; display: block; }
.pw input { padding-right: 70px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 32px; padding: 0 10px; border-radius: 9px; font: 700 .7rem var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.eye:hover { background: var(--surface-3); color: var(--ink); }
.err { color: var(--crit); font-size: .88rem; font-weight: 550; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 420px) { .grid-2.wrap1 { grid-template-columns: 1fr; } }

/* ---- the chain row: one line, like a strike row in an option chain */
.rows { display: block; }
.row {
  position: relative; display: grid; grid-template-columns: 62px 30px minmax(0, 1fr) auto 62px; align-items: center;
  min-height: var(--row-h); padding: 9px clamp(10px, 1.6vw, 20px); border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background .15s;
}
.row:hover { background: var(--surface-2); }
.row.sel { background: var(--accent-soft); }
.row.sel::after { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.row.flash { animation: flash 1.6s var(--ease); }
.row .d { font: 600 .74rem/1 var(--f-mono); color: var(--muted); white-space: nowrap; overflow: hidden; letter-spacing: -.01em; }
.row .d.late { color: var(--crit); }
.row .d.today { color: var(--accent-text); }
.row .d.soon { color: var(--ink-2); }
.row .d.approx::after { content: "~"; color: var(--faint); }
.chk {
  width: 22px; height: 22px; border-radius: 7px; border: 1.75px solid var(--line-2); display: grid; place-items: center;
  color: transparent; transition: transform .45s var(--spring), background .2s, border-color .2s;
}
.chk svg { width: 14px; height: 14px; }
.chk:hover { border-color: var(--good); }
.chk:active { transform: scale(.85); }
.chk.on { background: var(--good); border-color: var(--good); color: var(--surface); }
/* the whole task text is visible: titles wrap onto as many lines as they need (owner, 14 Oct) */
.row .t { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; padding: 2px 0 2px 10px; min-height: 26px; border-left: 3px solid var(--c, var(--line-2)); }
.row .tt { min-width: 0; font-weight: 520; line-height: 1.35; overflow-wrap: anywhere; }
.row .pp { flex-basis: 100%; order: -1; color: var(--faint); font-size: .74rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag.amt-in { display: none; }
.tag.amt-in.rev { background: var(--good-bg); color: var(--good); }
.tag.amt-in.cost { background: var(--surface-2); color: var(--muted); }
.row .pp::after { content: " ›"; }
/* optional compact mode (More → Appearance): one line per task, the rest on tap */
html[data-rows="compact"] .row { min-height: var(--row-h); height: var(--row-h); padding-block: 0; }
html[data-rows="compact"] .row .t { flex-wrap: nowrap; height: 28px; padding-block: 0; }
html[data-rows="compact"] .row .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-rows="compact"] .row .pp { display: none; }
.row .tag { flex: none; height: 19px; padding: 0 6px; border-radius: 6px; display: inline-flex; align-items: center; font: 700 .6rem/1 var(--f-mono); letter-spacing: .05em; }
.tag.p1 { background: var(--crit-bg); color: var(--crit); }
.tag.doing { background: var(--info-bg); color: var(--info); }
.tag.blocked { background: var(--warn-bg); color: var(--warn); }
.tag.prog { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.row.k-milestone .tt { font-family: var(--f-display); font-weight: 650; letter-spacing: -.01em; }
.row.k-milestone .t::before { content: "◆"; color: var(--accent-text); font-size: .7rem; }
.row.k-macro .tt { font-weight: 640; }
.row .who { padding-left: 8px; }
.row .amt { text-align: right; font: 650 .74rem/1 var(--f-mono); white-space: nowrap; }
.amt.rev { color: var(--good); }
.amt.cost { color: var(--faint); }
/* done side: shaded like in-the-money strikes */
.row.is-done { background: color-mix(in oklch, var(--good-row) 70%, transparent); }
.row.is-done:hover { background: var(--good-row); }
.row.is-done .tt { color: var(--ink-2); }
.row.is-done.k-milestone .tt { color: var(--ink); }

/* rings and meters */
.ring { --p: 0; --size: 132px; position: relative; width: var(--size); height: var(--size); flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .trk { stroke: var(--track); }
.ring .val { stroke: var(--accent); stroke-dasharray: calc(var(--p) * 2.83) 283; transition: stroke-dasharray 1s var(--ease); }
.ring .val.good { stroke: var(--good); }
.ring .mid { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .mid b { font: 650 1.7rem/1 var(--f-display); letter-spacing: -.03em; }
.ring .mid small { display: block; font: 600 .62rem var(--f-mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.meter { height: 8px; border-radius: 8px; background: var(--track); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); min-width: 3px; transition: width .8s var(--ease); }

/* stats */
.stat { display: grid; gap: 4px; min-width: 0; }
.stat b { font: 650 clamp(1.4rem, 1.1rem + 1vw, 2rem)/1 var(--f-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: .8rem; }

/* skeletons */
.sk { border-radius: var(--r-md); background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%) 100% 0 / 200% 100%; animation: shimmer 1.5s linear infinite; }
.sk-row { height: 18px; margin: 14px 20px; border-radius: 8px; }
.sk-card { min-height: 220px; border-radius: var(--r-lg); }
.sk-title { height: 42px; width: min(420px, 70%); }

/* designed empty / error states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: clamp(32px, 7vw, 72px) 20px; border-radius: var(--r-lg); border: 1.5px dashed var(--line-2); color: var(--ink-2); }
.empty-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--surface-2); color: var(--muted); }
.empty-ic svg { width: 24px; height: 24px; }
.empty b { font: 650 1.05rem/1.3 var(--f-display); color: var(--ink); }
.empty p { max-width: 42ch; color: var(--muted); font-size: .9rem; }
.empty.is-error .empty-ic { background: var(--crit-bg); color: var(--crit); }
.empty.slim { padding: 22px 16px; }

/* key-value rows */
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv select { height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 0 10px; max-width: 55%; }

/* feed */
.feed { display: grid; }
.ev { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.ev:last-child { border-bottom: 0; }
.ev b { font-weight: 650; }
.ev .what { color: var(--ink-2); }
.ev small { display: block; color: var(--faint); font: 500 .7rem var(--f-mono); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tmp-pw { font: 700 1.3rem/1.2 var(--f-mono); letter-spacing: .04em; text-align: center; padding: 16px; border-radius: var(--r-md); border: 1.5px dashed var(--line-2); background: var(--surface-2); user-select: all; word-break: break-all; }

/* icons that sit inside text-sized elements */
.pill svg { width: 11px; height: 11px; flex: none; }
.p-parent svg, .kv svg, .cat-pill svg { width: 15px; height: 15px; flex: none; }
