/* The menu bar and Perch's panel, drawn the way the app draws them: a 344 pt popover, cards of
   radius 16 at 4.5% ink with a hairline, system type at small sizes, rounded monospaced figures.
   Values carry over from the app's design notes. */

.menubar, .panel, .toast {
  --p-bg: rgb(246 246 247 / 0.9);
  --p-ink: #1d1d1f;
  --p-ink2: rgb(60 60 67 / 0.64);
  --p-ink3: rgb(60 60 67 / 0.34);
  --p-card: rgb(0 0 0 / 0.045);
  --p-hair: rgb(0 0 0 / 0.07);
  --p-pill: #fff;
  --codex: var(--p-ink);
}
@media (prefers-color-scheme: dark) {
  .menubar, .panel, .toast {
    --p-bg: rgb(40 42 45 / 0.9);
    --p-ink: #f5f5f7;
    --p-ink2: rgb(235 235 245 / 0.62);
    --p-ink3: rgb(235 235 245 / 0.32);
    --p-card: rgb(255 255 255 / 0.06);
    --p-hair: rgb(255 255 255 / 0.08);
    --p-pill: rgb(255 255 255 / 0.16);
  }
}

/* --- menu bar ------------------------------------------------------------ */
.menubar {
  width: 100%; height: 30px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  font: 500 13px/1 var(--font); color: var(--p-ink);
  background: var(--p-bg); border: 1px solid var(--p-hair); border-radius: 10px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
.mb-left, .mb-right { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.mb-left b { font-weight: 700; }
.mb-ico { width: 16px; height: 16px; fill: currentColor; }
.mb-date { padding: 3px 6px; border-radius: 5px; background: var(--p-ink); color: var(--p-bg); font-weight: 650; font-size: 12px; }
.mb-ring { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 5px; background: rgb(127 127 127 / 0.18); font: 600 12px/1 var(--font-round); font-variant-numeric: tabular-nums; color: var(--orange); }
.mb-ring svg { width: 16px; height: 16px; }
.mb-ring .trk { stroke-width: 5; }
.mb-ring .arc { stroke-width: 5; }

/* --- the panel ----------------------------------------------------------- */
.panel {
  position: relative; width: min(344px, 100%); padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 10px;
  font: 12px/1.35 var(--font); color: var(--p-ink); text-align: left;
  background: var(--p-bg); border: 1px solid var(--p-hair); border-radius: 18px;
  -webkit-backdrop-filter: blur(30px) saturate(1.5); backdrop-filter: blur(30px) saturate(1.5);
  box-shadow: var(--shadow);
}
.panel small { display: block; font-size: 11px; color: var(--p-ink2); }
.panel b { font-weight: 600; }
.cap { font-size: 11px; font-weight: 600; color: var(--p-ink2); display: flex; gap: 6px; }
.cap em { font-style: normal; font-weight: 500; color: var(--p-ink3); margin-left: auto; }
.orange { color: var(--orange) !important; }

/* Tabs: one capsule track, each tab its glyph and name, the chosen one on a raised pill. */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px; border-radius: 999px; background: var(--p-card); box-shadow: inset 0 0 0 0.5px var(--p-hair); }
.tabs span { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 0; border-radius: 999px; font-weight: 500; color: var(--p-ink2); }
.tabs svg { width: 13px; height: 13px; fill: currentColor; }
.tabs .on { background: var(--p-pill); color: var(--p-ink); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12), inset 0 0 0 0.5px var(--p-hair); }
.seg { display: flex; padding: 2px; border-radius: 999px; background: var(--p-card); box-shadow: inset 0 0 0 0.5px var(--p-hair); }
.seg span { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 4px 0; border-radius: 999px; color: var(--p-ink2); font-weight: 500; }
.seg .on { background: var(--p-pill); color: var(--p-ink); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.1); }
.seg-sm span { padding: 3px 0; font-size: 11px; }

.card { border-radius: 16px; background: var(--p-card); box-shadow: inset 0 0 0 0.5px var(--p-hair); padding: 11px 14px; }
.kicker { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; color: var(--p-ink2); margin: 4px 2px -8px; }
.greet { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0 2px; }
.row-card { display: flex; align-items: center; gap: 12px; }
.row-card > div:nth-child(2) { flex: 1; min-width: 0; }
.row-card b { font-size: 13px; }
.row-card em { font-style: normal; font-weight: 500; color: var(--p-ink2); margin-left: 4px; }
.fig { font: 600 22px/1 var(--font-round); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.fig i { font-style: normal; font-size: 55%; color: var(--p-ink2); margin-left: 1px; }
.fig.orange i { color: inherit; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini { padding: 10px 12px; }
.mini svg { width: 15px; height: 15px; fill: var(--p-ink2); margin-bottom: 6px; }
.mini b { display: block; font-size: 12px; }
.pfoot { display: flex; gap: 10px; font-size: 11px; color: var(--p-ink3); padding: 2px 2px 0; }
.pfoot .opt { margin-left: auto; color: var(--p-ink2); }
.links { display: flex; justify-content: space-between; padding: 0 4px; color: var(--accent); font-weight: 500; }
kbd { font: 500 10px var(--font); color: var(--p-ink3); margin-left: 4px; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: var(--p-ink3); }
.dot.claude { background: var(--claude); }
.dot.codex { background: var(--codex); }
.dot.green { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.dot.orange { background: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 22%, transparent); }

/* Rings show what's left: full at a window's start, clockwise from twelve, round caps. */
.rings svg { width: 46px; height: 46px; }
.rings.sm svg { width: 38px; height: 38px; }
circle { fill: none; }
.trk { stroke: var(--p-ink, currentColor); stroke-opacity: 0.1; stroke-width: 3.6; }
.arc { stroke-width: 3.6; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.arc.claude { stroke: var(--claude); }
.arc.codex { stroke: var(--codex); }
.arc.warn { stroke: var(--orange); }

/* Bars: capsules on a track of their own colour at 14%. JS sets --v (0-100) from data-v. */
.meter { display: block; position: relative; height: 6px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, currentColor 14%, transparent); }
.meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 60) * 1%); border-radius: inherit; background: currentColor; transform-origin: left; }
.meter.claude { color: var(--claude); }
.meter.codex { color: var(--codex); }
.meter.blue { color: var(--blue); }
.meter.green { color: var(--green); }
.meter.purple { color: var(--purple); }

/* --- AI Usage ------------------------------------------------------------ */
.usage { display: flex; flex-direction: column; gap: 10px; }
.totals { display: grid; grid-template-columns: auto 1fr auto auto; align-items: baseline; gap: 6px; }
.totals small { margin-right: 10px; }
.split { display: flex; gap: 3px; }
.split .meter { flex: var(--v, 50) 1 0; height: 7px; }
.split .meter::after { width: 100%; }
.models { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.models li { display: flex; align-items: center; }
.models span { margin-left: auto; font: 600 12px var(--font-round); font-variant-numeric: tabular-nums; color: var(--p-ink2); }
.toast {
  position: absolute; top: -18px; right: max(-28px, calc(50% - 250px)); width: 270px;
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px;
  font: 12px/1.3 var(--font); color: var(--p-ink); text-align: left;
  background: var(--p-bg); border: 1px solid var(--p-hair); border-radius: 18px;
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); box-shadow: var(--shadow);
}
.toast img { border-radius: 22%; flex: none; }
.toast div { flex: 1; }
.toast b { display: block; font-weight: 600; }
.toast small { color: var(--p-ink2); font-size: 12px; }
.toast > span { font-size: 11px; color: var(--p-ink3); }

/* --- Sound ---------------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 2px; padding-top: 9px; padding-bottom: 9px; }
.list .cap { margin-bottom: 4px; }
.list > span { display: flex; align-items: center; gap: 9px; min-height: 30px; padding: 0 8px; margin: 0 -8px; border-radius: 10px; }
.outputs > span::after { content: ""; margin-left: auto; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--p-ink3); transition: background 0.25s, box-shadow 0.25s; }
.outputs small { margin-left: 8px; }
.outputs .opt-b, [data-step="1"] .outputs .opt-a { background: color-mix(in srgb, var(--accent) 14%, transparent); }
[data-step="1"] .outputs .opt-b { background: none; }
.outputs .opt-b::after, [data-step="1"] .outputs .opt-a::after { background: var(--accent); box-shadow: inset 0 0 0 4px var(--p-bg); }
[data-step="1"] .outputs .opt-b::after { background: none; box-shadow: inset 0 0 0 1.5px var(--p-ink3); }
.outputs > span { transition: background 0.3s var(--ease); }
.app { display: inline-block; flex: none; width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(160deg, #ff7a6b, #e8445a); }
.app.a2 { background: linear-gradient(160deg, #63d471, #23a64f); }
.app.a3 { background: linear-gradient(160deg, #6fb7ff, #2f6fe0); }
.app.a4 { background: linear-gradient(160deg, #ffd56b, #f0a020); }
.app.a5 { background: linear-gradient(160deg, #b18cff, #7650e0); }
.app.a6 { background: linear-gradient(160deg, #5fd6cf, #1d8f8a); }
.apps .vol { flex: 1; color: var(--p-ink); max-width: 130px; margin-left: auto; }
.apps .vol.muted { color: var(--p-ink3); }
.apps em { font: 600 10px/1 var(--font); font-style: normal; padding: 4px 6px; border-radius: 6px; color: var(--p-ink3); box-shadow: inset 0 0 0 1px var(--p-hair); }
.apps em.eq-on { color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.eq .cap em { color: var(--accent); }
.bands { position: relative; display: grid; grid-template-columns: repeat(10, 1fr); height: 96px; margin: 10px 0 6px; }
.bands::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--p-hair); }
.bands i { position: relative; justify-self: center; width: 4px; border-radius: 4px; background: var(--p-hair); }
.bands i::after {
  content: ""; position: absolute; left: 50%; width: 14px; height: 14px; margin: 0 0 -7px -7px;
  bottom: calc(50% + var(--v, 0) * 3.6%); border-radius: 50%;
  background: var(--p-pill); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25), inset 0 0 0 0.5px var(--p-hair);
}
.hz { display: flex; justify-content: space-between; font-size: 10px; color: var(--p-ink3); font-variant-numeric: tabular-nums; }

/* --- Network: data-step 1 online, 2 down, 3 (or none) on the hotspot ------ */
.banners { display: grid; }
.banner { grid-area: 1 / 1; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--green) 12%, transparent); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease); }
.banner b { font-size: 13px; }
.banner.net-down { background: color-mix(in srgb, var(--orange) 14%, transparent); }
.banner.net-ok, .banner.net-down { opacity: 0; transform: translateY(-4px); }
[data-step="1"] .net-ok, [data-step="2"] .net-down { opacity: 1; transform: none; }
[data-step="1"] .net-hot, [data-step="2"] .net-hot { opacity: 0; transform: translateY(4px); }
.spark svg { width: 100%; height: 70px; margin: 8px 0 4px; overflow: visible; }
.spark .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 100; transition: stroke-dashoffset 1.6s var(--ease); }
.axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--p-ink3); }
.meters { display: grid; gap: 9px; }
.meters span { display: grid; grid-template-columns: 56px 1fr 34px; align-items: center; gap: 8px; }
.meters em { font: 600 11px var(--font-round); font-style: normal; text-align: right; color: var(--p-ink2); font-variant-numeric: tabular-nums; }

/* --- Calendar page ------------------------------------------------------ */
.subhead { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; text-align: center; }
.subhead b { font-size: 13px; }
.back { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--p-card); font-size: 18px; line-height: 1; color: var(--p-ink2); }
.month { padding: 0 4px; }
.dow, .days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.dow span { font-size: 10px; font-weight: 600; color: var(--p-ink3); padding-bottom: 4px; }
.days { min-height: 150px; }
.days span { height: 25px; display: grid; place-items: center; font: 500 12px var(--font-round); font-variant-numeric: tabular-nums; }
.days .out { color: var(--p-ink3); }
.days .today { position: relative; color: #fff; font-weight: 700; }
.days .today::before { content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: var(--red); z-index: -1; }
.days .has::after { content: ""; position: absolute; transform: translateY(10px); width: 3px; height: 3px; border-radius: 50%; background: var(--p-ink3); }
.days span { position: relative; z-index: 0; }
.agenda { display: grid; gap: 6px; }
.agenda .cap { margin-top: 4px; }
.ev { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--p-card); position: relative; }
.ev::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--c, var(--blue)); }
.ev time { font: 500 11px var(--font); color: var(--p-ink2); font-variant-numeric: tabular-nums; }
.ev.c1 { --c: var(--blue); } .ev.c2 { --c: var(--purple); } .ev.c3 { --c: var(--green); } .ev.c4 { --c: var(--orange); }
.join { font: 600 11px/1 var(--font); font-style: normal; color: #fff; background: var(--green); padding: 4px 9px; border-radius: 999px; }

/* --- motion: mocks wait at their start until scrolled into view (.is-in) -- */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .arc { transition: stroke-dasharray 1.2s var(--ease); }
  .mock:not(.is-in) .arc { stroke-dasharray: 0 100; }
  .meter::after { transition: transform 1s 0.15s var(--ease); }
  .mock:not(.is-in) .meter::after { transform: scaleX(0); }
  .bands i::after { transition: bottom 0.9s var(--ease); }
  .bands i:nth-child(2)::after { transition-delay: 0.04s; } .bands i:nth-child(3)::after { transition-delay: 0.08s; }
  .bands i:nth-child(4)::after { transition-delay: 0.12s; } .bands i:nth-child(5)::after { transition-delay: 0.16s; }
  .bands i:nth-child(6)::after { transition-delay: 0.2s; } .bands i:nth-child(7)::after { transition-delay: 0.24s; }
  .bands i:nth-child(8)::after { transition-delay: 0.28s; } .bands i:nth-child(9)::after { transition-delay: 0.32s; }
  .bands i:nth-child(10)::after { transition-delay: 0.36s; }
  .mock:not(.is-in) .bands i::after { bottom: 50%; }
  .mock:not(.is-in) .spark .line { stroke-dashoffset: 100; }
  .toast { transition: opacity 0.5s 1.4s var(--ease), transform 0.6s 1.4s var(--ease); }
  .stage:not(.is-in) .toast { opacity: 0; transform: translateX(24px) scale(0.98); }
}

@media (max-width: 860px) {
  .menubar .mb-left span, .menubar .mb-clock { display: none; }
  .stage:has(.toast) { padding-top: 52px; }
  .toast { right: 50%; transform: translateX(50%); top: 0; }
}
@media (max-width: 860px) and (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .stage:not(.is-in) .toast { transform: translateX(50%) translateY(-10px); }
}
