/* The Switchy panel, matched to the SwiftUI source (PanelView, SwitchTileGrid,
   StatusStripView, PanelFooterView, CodesListView, UsageAccountCard, Theme).
   The black style: the panel is always dark, a solid #121212 ground with
   neutral grey cards. 1pt in the app = 1px here. */

.sw {
  --p: 255 255 255;               /* Color.primary as a fill (always dark) */
  --text: rgb(255 255 255 / 0.85);
  --sec: rgb(255 255 255 / 0.55);
  --ter: rgb(255 255 255 / 0.25);
  --acc: #0a84ff;
  --blue: #2f7bff;                /* Color.switchyBlue */
  --amber: #f5b13d;               /* Color.switchyAmber: anything in progress */
  --green: #32d74b; --orange: #ff9f0a; --red: #ff453a;
  --ground: #121212;              /* Color.panelGround */
  --card: rgb(var(--p) / 0.055);  /* PanelStyle.cardFill */
  --card-hover: rgb(var(--p) / 0.085);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 13px; line-height: 1.2; color: var(--text);
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-align: left;
}
:where(.sw) button { border: 0; background: none; padding: 0; cursor: default; font: inherit; color: inherit; text-align: inherit; }
.sw svg { flex: none; }
.sw .mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; }
.sw .tnum { font-variant-numeric: tabular-nums; }

/* ---------- Window: PanelMetrics width 360, radius 22, hairline edge ---------- */
.sw-panel {
  width: 360px;
  border-radius: 22px;
  background: var(--ground);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.09),
    0 10px 36px rgb(0 0 0 / 0.32),
    0 0.5px 3px rgb(0 0 0 / 0.18);
  overflow: hidden;
  transform-origin: 50% 0;
}

/* ---------- Tab picker: segmented, radius 14 track, radius 11 thumb ---------- */
.sw-tabs {
  position: relative; display: flex; gap: 2px;
  margin: 12px 12px 0; padding: 3px; border-radius: 14px;
  background: rgb(var(--p) / 0.06);
}
.sw-tabs__hl {
  position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 10px) / 3); border-radius: 11px;
  background: rgb(var(--p) / 0.12);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.sw-tab {
  position: relative; flex: 1; padding: 6px 0; border-radius: 11px;
  font-size: 13px; font-weight: 500; text-align: center; color: var(--sec);
  transition: color 0.22s, transform 0.2s;
}
.sw-tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.sw-tab:active { transform: scale(0.97); opacity: 0.82; }

.sw-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sw-body[hidden] { display: none; }

/* ---------- Status strip: radius 18 cards, no tint, no glowing dots ---------- */
.sw-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sw-card {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  padding: 12px 14px; border-radius: 18px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color 0.22s, box-shadow 0.22s;
}
.sw-card:hover { background: var(--card-hover); }
.sw-card[aria-expanded="true"] { background: rgb(var(--p) / 0.085); box-shadow: inset 0 0 0 1px rgb(var(--p) / 0.14); }
.sw-card__row { display: flex; align-items: center; gap: 7px; }
.sw-card__title { font-size: 12.5px; font-weight: 500; color: var(--sec); flex: 1; }
.sw-card[aria-expanded="true"] .sw-card__title { font-weight: 600; color: var(--text); }
.sw-card__chev { width: 9px; height: 9px; color: var(--sec); transition: transform 0.22s; }
.sw-card[aria-expanded="true"] .sw-card__chev { transform: rotate(180deg); }
.sw-card__l1 { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-card__l2 { font-size: 12.5px; color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sec); flex: none; transition: background-color 0.3s; }
.sw-dot[data-c="green"] { background: var(--green); }
.sw-dot[data-c="orange"] { background: var(--amber); }
.sw-dot[data-c="red"] { background: var(--red); }

.sw-detail { border-radius: 18px; background: var(--card); overflow: hidden; }
.sw-detail[hidden] { display: none; }
.sw-detail--net { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.sw-detail--net > span { font-size: 12px; font-weight: 500; color: var(--sec); margin-right: auto; }
.sw-seg { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: rgb(var(--p) / 0.06); }
.sw-seg button { font-size: 12px; padding: 4px 9px; border-radius: 8px; color: var(--sec); }
.sw-seg button[aria-pressed="true"] { font-weight: 600; color: var(--text); background: rgb(var(--p) / 0.12); }
.sw-iconbtn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--sec); }
.sw-iconbtn:hover { background: rgb(var(--p) / 0.1); color: var(--text); }
.sw-iconbtn svg { width: 13px; height: 13px; }

.sw-detail--dev { padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.sw-sechead { height: 30px; padding: 0 4px 0 8px; display: flex; align-items: center; gap: 2px; }
.sw-sechead > span { font-size: 11px; font-weight: 600; letter-spacing: 0.8px; color: var(--sec); margin-right: auto; }
.sw-row { height: 34px; padding: 0 4px 0 8px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.sw-row__name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.sw-row__meta { font-size: 11.5px; color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sw-row__time { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--sec); padding-right: 4px; }
.sw-row:has(.sw-tag[data-c="orange"]) .sw-row__time { color: var(--amber); }
.sw-tag {
  width: 46px; height: 18px; border-radius: 6px; flex: none;
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.3px;
}
.sw-tag[data-c="green"] { color: var(--green); background: color-mix(in srgb, var(--green) 16%, transparent); }
.sw-tag[data-c="orange"] { color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.sw-tag[data-c="red"] { color: var(--red); background: color-mix(in srgb, var(--red) 16%, transparent); }

/* Theme.swift PillToggleStyle */
.sw-pilltoggle { width: 30px; height: 18px; border-radius: 999px; background: var(--acc); position: relative; margin: 0 4px; }
.sw-pilltoggle::after {
  content: ""; position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff linear-gradient(var(--acc), var(--acc)) center / 1.5px 6px no-repeat;
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.2);
}

/* ---------- Tile grid: 54 tall, radius 16; on shows in the blue circle only ---------- */
.sw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sw-tile {
  height: 54px; padding: 0 11px; border-radius: 16px;
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: var(--card);
  transition: background-color 0.22s, transform 0.2s, opacity 0.2s;
}
.sw-tile:hover { background: var(--card-hover); }
.sw-tile:active { transform: scale(0.97); opacity: 0.82; }
.sw-tile[aria-pressed="true"] { background: rgb(var(--p) / 0.1); }
.sw-tile[aria-pressed="true"]:hover { background: rgb(var(--p) / 0.13); }
.sw-tile__icon {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: rgb(var(--p) / 0.1); color: rgb(var(--p) / 0.8);
  transition: background-color 0.22s, color 0.22s;
}
.sw-tile__icon svg { width: 16px; height: 16px; }
.sw-tile[aria-pressed="true"] .sw-tile__icon { background: var(--acc); color: #fff; }
.sw-tile__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sw-tile__title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-tile__sub { font-size: 11.5px; color: var(--sec); font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; gap: 3px; }
.sw-tile__sub svg { width: 8px; height: 8px; }
/* A timed switch mid-countdown (Pomodoro running, timed Keep Awake) reads amber */
.sw-tile__sub.is-counting { color: var(--amber); }


/* ---------- Footer ---------- */
.sw-divider { height: 1px; margin: 0 12px; background: rgb(var(--p) / 0.1); }
.sw-footer { display: flex; align-items: center; padding: 10px 14px 12px; }
.sw-footer__spacer { flex: 1; }
.sw-hoverbtn { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--sec); transition: background-color 0.15s, color 0.15s; }
.sw-hoverbtn:hover { color: var(--text); background: rgb(var(--p) / 0.1); }
.sw-hoverbtn svg { width: 17px; height: 17px; }
.sw-capsule { font-size: 13px; font-weight: 600; padding: 7px 24px; border-radius: 999px; background: rgb(var(--p) / 0.1); transition: background-color 0.15s; }
.sw-capsule:hover { background: rgb(var(--p) / 0.15); }

/* ---------- Codes: radius 16 rows, amber countdown ---------- */
.sw-codes { display: flex; flex-direction: column; gap: 8px; }
.sw-code {
  min-height: 66px; padding: 10px 12px; border-radius: 16px; width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  transition: background-color 0.15s, transform 0.2s;
}
.sw-code:hover { background: var(--card-hover); }
.sw-code:active { transform: scale(0.98); }
/* ServiceIcon.letterIcon: neutral grey, the letter in the label colour */
.sw-svc {
  width: 34px; height: 34px; border-radius: 8.84px; flex: none;
  display: grid; place-items: center;
  background: rgb(var(--p) / 0.1); color: var(--text); font-size: 15px; font-weight: 700;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif;
}
/* ServiceIcon.siteIcon: the site's own logo on white */
.sw-svc--site { background: #fff; }
.sw-svc--site svg { width: 26px; height: 26px; }
.sw-code__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sw-code__l1 { display: flex; align-items: center; gap: 10px; }
.sw-code__name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-code__otp { font-size: 19px; font-weight: 600; white-space: pre; transition: color 0.2s; }
.sw-code.is-expiring .sw-code__otp { color: var(--red); }
.sw-code__copied { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; font-size: 12px; font-weight: 600; color: #fff; background: var(--acc); padding: 4px 10px; border-radius: 999px; }
.sw-code__detail { font-size: 12.5px; color: var(--sec); }
.sw-ring { position: relative; width: 22px; height: 22px; flex: none; }
.sw-ring svg { width: 22px; height: 22px; transform: rotate(-90deg); }
.sw-ring circle { fill: none; stroke-width: 2.5; }
.sw-ring .track { stroke: rgb(var(--p) / 0.12); }
.sw-ring .arc { stroke: var(--amber); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.2s; }
.sw-code.is-expiring .sw-ring .arc { stroke: var(--red); }
.sw-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 8.5px; font-weight: 600; color: var(--sec); font-variant-numeric: tabular-nums; }
.sw-code.is-expiring .sw-ring span { color: var(--red); }

/* ---------- Usage: radius 18 cards; bars blue < 60%, amber 60-84%, red 85%+ ---------- */
.sw-usage { display: flex; flex-direction: column; gap: 8px; }
.sw-acct { padding: 14px; border-radius: 18px; background: var(--card); display: flex; flex-direction: column; gap: 12px; }
.sw-acct__head { display: flex; align-items: center; gap: 10px; }
.sw-mark { width: 30px; height: 30px; border-radius: 8.4px; display: grid; place-items: center; flex: none; }
.sw-mark svg { width: 15px; height: 15px; }
.sw-mark--claude { color: #d97857; background: rgb(217 120 87 / 0.18); }
.sw-mark--codex { color: var(--text); background: rgb(var(--p) / 0.1); }
.sw-acct__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sw-acct__title { font-size: 14px; font-weight: 600; }
.sw-acct__email { font-size: 12px; color: var(--sec); }
.sw-plan { font-size: 11.5px; font-weight: 600; color: var(--sec); padding: 3px 9px; border-radius: 9px; background: rgb(var(--p) / 0.08); }
.sw-bars { display: flex; flex-direction: column; gap: 9px; }
.sw-bar { display: grid; grid-template-columns: 58px 1fr 40px; column-gap: 10px; row-gap: 4px; align-items: center; }
.sw-bar__label { font-size: 12.5px; color: rgb(var(--p) / 0.8); }
.sw-bar__track { height: 7px; border-radius: 999px; background: rgb(var(--p) / 0.1); overflow: hidden; }
.sw-bar__fill { display: block; height: 100%; min-width: 3px; border-radius: 999px; transform-origin: left center; background: var(--blue); }
.sw-bar__fill[data-c="orange"] { background: var(--amber); }
.sw-bar__fill[data-c="red"] { background: var(--red); }
.sw-bar__pct { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sw-bar:has([data-c="orange"]) .sw-bar__pct { color: var(--amber); }
.sw-bar:has([data-c="red"]) .sw-bar__pct { color: var(--red); }
.sw-bar__reset { grid-column: 2 / 4; font-size: 11.5px; color: var(--sec); }
.sw-usage__summary { display: flex; justify-content: flex-end; padding: 2px 4px 0; font-size: 11px; color: var(--ter); }

/* A standalone app surface used outside the hero (the switch cards) */
.sw-surface {
  border-radius: 22px; padding: 12px;
  background: var(--ground);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.09), 0 10px 36px rgb(0 0 0 / 0.22);
}

/* CodesLockedView */
.sw-locked { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 24px; }
.sw-locked[hidden] { display: none; }
.sw-locked__icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgb(var(--p) / 0.07); color: var(--sec); }
.sw-locked__icon svg { width: 22px; height: 22px; }
.sw-locked__title { font-size: 14px; font-weight: 600; }
.sw-locked__btn { margin-top: 4px; font-size: 12px; font-weight: 600; color: #fff !important; background: var(--acc) !important; padding: 6px 18px !important; border-radius: 999px; }
