/* Harbor Blue Soft */
:root {
  --background: #faf9f6;
  --surface: #fffefd;
  --recessed: #fffdf8;
  --text: #22262d;
  --muted: #565555;
  --accent: #164fa0;
  --menu-hover: #d2dff3;
  --accent-hover: #113c78;
  --on-accent: #fffefa;
  --line: #e7e0d5;
  --control: #827c76;
  --header: #182a42;
  --header-raised: #263e5c;
  --header-text: #f8fbff;
  --header-accent: #a7cdff;
  --header-control: #839dbb;
  --focus: #245fab;
  --header-focus: #b3d6ff;
  --track: #ede7de;
  --bar-neutral: #555e6a;
  --bar-stale: #6b7179;
  --bar-warning: #965600;
  --bar-high: #892229;
  --shadow: #251a110b;
  --dialog-backdrop: #10182099;
  --badge-claude-text: #74472e;
  --badge-claude-bg: #f6e9dc;
  --badge-codex-text: #274f77;
  --badge-codex-bg: #e8eff8;
  --badge-signed-in-text: #26563c;
  --badge-signed-in-bg: #e5f1e8;
  --badge-signed-out-bg: #f0f0ef;
  --stale-label-text: #79410d;
  --stale-label-bg: #f7ead7;
  --danger: #a53f35;
  --danger-hover: #7b2a22;
  --on-danger: #fff7f5;
  --error: #952d2a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #191817;
    --surface: #23211f;
    --recessed: #2b2723;
    --text: #f5efe7;
    --muted: #c5bbb0;
    --accent: #9ec8ff;
    --menu-hover: #3a4a5e;
    --accent-hover: #c1deff;
    --on-accent: #101e30;
    --line: #483f37;
    --control: #a29888;
    --header: #172539;
    --header-raised: #293d57;
    --header-text: #f2f7ff;
    --header-accent: #a7cdff;
    --header-control: #839dbb;
    --focus: #9ec8ff;
    --header-focus: #b3d6ff;
    --track: #443e37;
    --bar-neutral: #a4a9af;
    --bar-stale: #979b9f;
    --bar-warning: #efbd63;
    --bar-high: #e37480;
    --shadow: #100d0a66;
    --badge-claude-text: #f3c1a3;
    --badge-claude-bg: #493126;
    --badge-codex-text: #b9d8fa;
    --badge-codex-bg: #283e58;
    --badge-signed-in-text: #bbdfc5;
    --badge-signed-in-bg: #243b2e;
    --badge-signed-out-bg: #343536;
    --stale-label-text: #f3c988;
    --stale-label-bg: #50391f;
    --danger: #eb8994;
    --danger-hover: #ffafb8;
    --on-danger: #311016;
    --error: #ffabb4;
  }
}

:root {
  color-scheme: light dark;
  font-family: var(--font-sans);
  font-synthesis: none;
  color: var(--text);
  background: var(--background);
  --font-sans: system-ui, sans-serif;
  --font-mono: ui-monospace, monospace;
  --radius-card: 13px;
  --radius-panel: 9px;
  --radius-control: 7px;
  --radius-pill: 20px;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --text-small: .8125rem;
  --text-regular: 1rem;
  --text-value: 1.5rem;
  --text-title: 2rem;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); }
button, input { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, .table-scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.site-header { --focus: var(--header-focus); background: var(--header); color: var(--header-text); }
.header-inner { max-width: 1200px; margin: auto; padding: 0 2rem; min-height: 46px; display: flex; align-items: center; gap: var(--space-5); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; font-size: .9rem; font-weight: 740; color: inherit; white-space: nowrap; text-decoration: none; }
.brand:hover { color: var(--header-text); }
.brand:hover .brand-name { text-decoration: underline; }
.brand-mark { display: block; flex: none; color-scheme: dark; }
.profile-menu { position: relative; margin-left: auto; min-width: 0; }
.profile-menu summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 28px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--header-control);
  border-radius: var(--radius-control);
  color: var(--header-text);
  cursor: pointer;
  font-size: var(--text-small);
  list-style: none;
}
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu summary::after {
  content: '';
  flex: none;
  width: .4em;
  height: .4em;
  border-right: 2px solid;
  border-bottom: 2px solid;
  transform: translateY(-.1em) rotate(45deg);
}
.profile-menu[open] summary::after { transform: translateY(.1em) rotate(225deg); }
.profile-menu summary:hover, .profile-menu[open] summary { background: var(--header-raised); }
.profile-menu:has(a[aria-current]) summary { box-shadow: inset 0 -2px var(--header-accent); }
.profile-actions {
  --focus: var(--accent);
  position: absolute;
  z-index: 1;
  inset: calc(100% + var(--space-2)) 0 auto auto;
  width: min(11rem, calc(100vw - 2rem));
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control);
  border-radius: var(--radius-panel);
  box-shadow: 0 2px 8px var(--shadow);
}
.profile-actions :is(a, button) {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-control);
  text-align: start;
  text-decoration: none;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--text-small);
}
/* Menu items share one hover/focus style; the doubled class outranks the global button:hover. */
.profile-actions.profile-actions :is(a, button):is(:hover, :focus-visible) { background: var(--menu-hover); color: var(--accent); }
.profile-actions a[aria-current] { color: var(--accent); font-weight: 650; text-decoration: underline; }
.profile-actions :is(a, button):focus-visible { outline-offset: -2px; }
main { max-width: 1200px; margin: auto; padding: 2.6rem 2rem 4rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 3.8vw, 3rem); line-height: 1.08; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; }
.account-head :is(h2, h3) { font-size: .96rem; font-weight: 650; letter-spacing: normal; overflow-wrap: anywhere; }
p { line-height: 1.6; color: var(--muted); }
h1 + p { margin-top: .65rem; }
.page-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 1.75rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: 0 2px 4px var(--shadow); margin-bottom: 1rem; }
.member, .section, .login-card, .empty { padding: 1.3rem 1.5rem; }
.member-heading, .account-head, .last-send { display: flex; align-items: center; gap: .55rem; }
.member-heading { justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.member-heading a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.member-heading a:hover { text-decoration: underline; }
.member-heading a span { color: var(--accent); margin-left: .15rem; }
.last-send { font-size: .8rem; flex-wrap: wrap; }
.status, .provider { border-radius: var(--radius-control); display: inline-block; padding: .22rem .48rem; background: var(--recessed); color: var(--muted); font-size: .73rem; font-weight: 620; white-space: nowrap; }
.account-badges { display: inline-flex; gap: var(--space-1); }
.status.signed-in { color: var(--badge-signed-in-text); background: var(--badge-signed-in-bg); }
.status.signed-out { background: var(--badge-signed-out-bg); }
.status.stale { background: var(--stale-label-bg); color: var(--stale-label-text); }
.provider.claude { color: var(--badge-claude-text); background: var(--badge-claude-bg); }
.provider.codex { color: var(--badge-codex-text); background: var(--badge-codex-bg); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 0 0 1rem; }
/* This week leads the person totals; today and month are secondary. */
.metrics > .metric:not(:first-child) .token-count { font-size: var(--text-regular); }
@media (max-width: 720px) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .metrics > .metric:first-child .token-count { font-size: var(--text-value); }
}
.metric { border-radius: var(--radius-panel); padding: .8rem 1rem; background: var(--recessed); }
dt { color: var(--muted); font-size: .8rem; font-weight: 650; }
dd { margin: 0; }
.token-count { font-size: clamp(1.15rem, 2.6vw, 1.75rem); font-weight: 730; letter-spacing: -.035em; overflow-wrap: anywhere; margin: .15rem 0; font-variant-numeric: tabular-nums; }
.token-count small { color: var(--muted); font-size: .82rem; letter-spacing: 0; font-weight: 520; }
.cost { font-size: .95rem; font-variant-numeric: tabular-nums; }
.account + .account { margin-top: .7rem; }
.account { border: 1px solid var(--line); border-radius: var(--radius-panel); padding: .8rem 1rem; }
.limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem 1.1rem; margin: .7rem 0 0; }
.limit-session { grid-column: 1; }
.limit-weekly { grid-column: 2; }
.limit-model { grid-column: 3; }
@media (max-width: 560px) {
  .limits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .limits > .limit { grid-column: auto; }
  .limits > .limit:only-child { grid-column: 1 / -1; }
}
@media (max-width: 340px) {
  .limits { grid-template-columns: minmax(0, 1fr); }
}
.limit :is(dt, .reset) { overflow-wrap: anywhere; }
.limit strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.limit dd { display: grid; grid-template-columns: minmax(2.6rem, auto) 1fr; align-items: center; column-gap: .35rem; padding-top: .25rem; }
.reset { grid-column: 1 / -1; font-size: .73rem; color: var(--muted); margin-top: .24rem; }
meter {
  appearance: none;
  display: block;
  width: 100%;
  height: .42rem;
  border: 0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--track);
  --fill: var(--bar-neutral);
}
meter.high { --fill: var(--bar-high); }
meter.warning { --fill: var(--bar-warning); }
meter::-webkit-meter-inner-element { display: block; height: 100%; }
meter::-webkit-meter-bar { inset: 0; height: 100%; background: var(--track); border: 0; border-radius: var(--radius-pill); }
meter::-webkit-meter-optimum-value { background: var(--fill); border-radius: var(--radius-pill); }
meter::-moz-meter-bar { background: var(--fill); border-radius: var(--radius-pill); }
.data-stale :is(.token-count, .cost, .amount, .limit strong, .weekly-card strong) { color: var(--muted); }
.data-stale meter { --fill: var(--bar-stale); }
.section h2 { margin-bottom: .65rem; }
.section p + a { display: inline-block; margin-top: .7rem; }
.muted { color: var(--muted); }
button, .button { display: inline-block; border: 1px solid transparent; border-radius: var(--radius-control); padding: .59rem .85rem; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 660; font-size: .87rem; line-height: 1.3; cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { background: var(--accent-hover); color: var(--on-accent); }
.secondary { background: var(--surface); border-color: var(--control); color: var(--accent); }
.danger { background: var(--danger); color: var(--on-danger); margin-top: 1rem; }
.danger:hover { background: var(--danger-hover); color: var(--on-danger); }
.delete-link, .error { color: var(--error); }
.back { display: inline-block; margin-bottom: 1rem; }
.table-scroll { position: relative; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .88rem; }
th { color: var(--muted); font-weight: 660; background: var(--recessed); }
td, th { padding: .68rem .75rem; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
.connection-dialog {
  width: min(42rem, calc(100% - var(--space-5)));
  max-height: calc(100% - var(--space-5));
  padding: clamp(var(--space-3), 4vw, var(--space-5));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--control);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
}
.connection-dialog::backdrop { background: var(--dialog-backdrop); }
.connection-dialog > .connection-panel { margin: 0; padding: 0; border: 0; box-shadow: none; }
.connection-form { display: grid; gap: var(--space-4); }
.connection-field { display: grid; gap: var(--space-2); }
.connection-field label { font-size: .88rem; font-weight: 620; }
.connection-actions, .connection-result-heading { display: flex; align-items: center; gap: var(--space-2); }
.connection-actions { flex-wrap: wrap; justify-content: flex-end; }
.connection-result-heading { justify-content: space-between; margin-bottom: var(--space-2); }
.connection-result-heading h2 { margin: 0; }
input { background: var(--surface); color: var(--text); min-width: 0; border: 1px solid var(--control); border-radius: var(--radius-control); padding: .53rem .7rem; }
.credentials { display: grid; gap: var(--space-2); margin: var(--space-3) 0 var(--space-4); }
.credentials dd { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--space-2); margin-top: var(--space-1); }
.credentials dd > code { padding: var(--space-2); }
.connection-prompt { border-top: 1px solid var(--line); padding-top: var(--space-4); }
code { padding: .13em .3em; background: var(--recessed); border-radius: var(--radius-control); overflow-wrap: anywhere; }
.setup-steps { margin: 0 0 1.2rem; padding-left: 1.4rem; line-height: 1.7; }
label[for="agent-prompt"] { display: block; margin: .9rem 0 .4rem; font-size: .88rem; font-weight: 620; }
#agent-prompt { display: block; width: 100%; resize: vertical; padding: .7rem; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--recessed); color: inherit; font: .88rem/1.55 var(--font-mono); }
.copy-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); color: var(--muted); font-size: .88rem; }
.credentials .copy-actions { max-width: 10rem; }
#agent-prompt + .copy-actions { margin-top: var(--space-2); }
button[hidden] { display: none; }
.sign-in { display: grid; min-height: 72vh; place-items: center; }
.login-card { max-width: 540px; padding: clamp(1.5rem, 5vw, 2.8rem); }
.login-card p { margin-bottom: 1.2rem; }
@media (max-width: 720px) {
  .header-inner { padding: .375rem .8rem; gap: var(--space-2); }
  .brand { white-space: normal; overflow-wrap: anywhere; }
  main { padding: 1.65rem .8rem 3rem; }
  .page-heading, .member-heading { align-items: flex-start; flex-direction: column; }
  .member, .section, .empty { padding: .9rem; }
  .account { padding: .6rem; }
  .account-head { flex-wrap: wrap; }
}

main:has(.team-heading) { max-width: 1120px; }
.team-heading { margin-bottom: var(--space-5); }
.team-heading h1 { font-size: var(--text-title); }
.team-member { container-type: inline-size; padding-bottom: var(--space-3); box-shadow: none; }
.team-member .member-heading { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.team-member:has(.member-heading:last-child) { padding-bottom: var(--space-4); }
.team-member .member-heading:last-child { margin-bottom: 0; }
.team-member .member-heading a { display: inline-block; min-height: 24px; }
.team-member :is(.provider, .last-send, .reset, dt, .token-count small) { font-size: var(--text-small); }
.overview-summary {
  display: grid;
  grid-template-columns: minmax(13.75rem, 1.2fr) minmax(0, 2.4fr) minmax(10.5rem, .9fr);
  /* DOM order is week, today/month, cards (reading order, mobile); desktop shows today/month at the right edge. */
  grid-template-areas: "week cards periods";
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.overview-summary dl { margin: 0; }
/* Columns sit side by side without separators; horizontal separators appear once they stack. */
.overview-week { grid-area: week; }
.weekly-cards {
  grid-area: cards;
  align-content: start;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}
.overview-other-periods { grid-area: periods; justify-self: end; text-align: right; }
.overview-other-periods .metric { justify-items: end; }

.team-member .member-heading:not(:last-child) { padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); margin-bottom: var(--space-3); }
.overview-summary :is(dt, .cost) { overflow-wrap: anywhere; }
.overview-week .metric { background: none; border: 0; padding: 0; }
.overview-week .token-count { font-size: var(--text-value); }
.overview-other-periods { display: grid; gap: var(--space-2); }
.overview-other-periods .metric { background: none; padding: 0; }
.overview-other-periods .token-count { font-size: var(--text-regular); margin: 0; }
.overview-other-periods .cost { font-size: var(--text-small); }
@container (max-width: 46rem) {
  /* Week left, today/month right; account cards on their own row below. */
  .overview-summary { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "week periods" "cards cards"; align-items: start; gap: var(--space-3); }
  .weekly-cards { padding-top: var(--space-3); border-top: 1px solid var(--line); }
}
@container (max-width: 17rem) {
  .overview-week .token-count { font-size: clamp(var(--text-regular), 8cqi, var(--text-value)); }
}
@container (max-width: 15rem) {
  /* Too narrow for two columns: stack, all left-aligned. */
  .overview-summary { grid-template-columns: minmax(0, 1fr); grid-template-areas: "week" "periods" "cards"; }
  .overview-other-periods { justify-self: stretch; text-align: left; }
}
.weekly-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-width: min(9rem, 100%);
  max-width: 100%;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  font-size: var(--text-small);
}
.weekly-card .provider { justify-self: start; white-space: normal; overflow-wrap: anywhere; }
.weekly-card strong { font-size: var(--text-regular); font-variant-numeric: tabular-nums; text-align: right; }
.weekly-card .warning { color: var(--bar-warning); }
.weekly-card .high { color: var(--bar-high); }
.weekly-card .reset { margin: 0; overflow-wrap: anywhere; }
.overview-account-details .account {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  margin: 0;
  padding: var(--space-3) 0;
}
.overview-account-details .account:last-child { padding-bottom: var(--space-1); }
.overview-account-details .account-head { flex-flow: column nowrap; align-items: flex-start; gap: var(--space-1); }
.overview-account-details .account-head h3 { max-width: 100%; }
@media (min-width: 900px) {
  .overview-account-details .account {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr);
    align-items: start;
    gap: var(--space-4);
  }
  .overview-account-details .limits { margin: 0; }
}
@container (max-width: 14rem) {
  .overview-account-details .limits { grid-template-columns: minmax(0, 1fr); }
  .overview-account-details .limits > .limit { grid-column: auto; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
