:root {
  --ink: #151713;
  --muted: #6f736b;
  --line: rgba(34, 38, 31, 0.11);
  --paper: rgba(250, 250, 247, 0.78);
  --paper-solid: #fbfbf8;
  --accent: #d5ff47;
  --accent-deep: #9ec414;
  --soft-green: #eff8d1;
  --danger: #a84a3f;
  --shadow: 0 18px 55px rgba(54, 62, 39, 0.09);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: #f2f3ed;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.auth-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(27, 30, 23, .42);
  backdrop-filter: blur(12px);
}

.auth-overlay[hidden] { display: none; }

.auth-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 24px;
  background: var(--paper-solid);
  box-shadow: 0 30px 90px rgba(20, 24, 15, .25);
}

.auth-eyebrow { color: #748052; font-size: 10px; font-weight: 760; letter-spacing: .14em; }
.auth-card h2 { margin-top: 10px; font-size: 26px; }
.auth-card p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-card label { display: block; margin-top: 24px; color: var(--muted); font-size: 11px; font-weight: 700; }
.auth-card input {
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: white;
}
.auth-card input:focus { border-color: var(--accent-deep); box-shadow: 0 0 0 3px rgba(158, 196, 20, .14); }
.auth-card button { width: 100%; margin-top: 16px; padding: 13px; border: 0; border-radius: 12px; background: var(--accent); cursor: pointer; font-weight: 700; }
.auth-error { display: block; min-height: 16px; margin-top: 8px; color: var(--danger); font-size: 11px; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(4px);
  pointer-events: none;
}

.ambient-one {
  top: -280px;
  right: -140px;
  background: radial-gradient(circle, rgba(213, 255, 71, .48), rgba(213, 255, 71, 0) 68%);
}

.ambient-two {
  bottom: -360px;
  left: -190px;
  background: radial-gradient(circle, rgba(186, 214, 173, .34), rgba(186, 214, 173, 0) 68%);
}

.shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 48px;
}

.site-footer {
  padding: 18px 20px 34px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

.topbar,
.section-heading,
.project-summary,
.session-summary,
.turn-header,
.turn-row {
  display: flex;
  align-items: center;
}

.topbar { justify-content: space-between; gap: 32px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: #69705e;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .15em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-deep);
  box-shadow: 0 0 0 5px rgba(158, 196, 20, .12);
}

h1, h2, p { margin: 0; }

h1 {
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: .95;
}

.topbar p {
  margin-top: 15px;
  color: var(--muted);
  font-size: 15px;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 252, .7);
  box-shadow: 0 5px 18px rgba(54, 62, 39, .05);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}

.refresh-button:hover { transform: translateY(-1px); background: white; }
.refresh-button:active { transform: translateY(0); }
.refresh-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.refresh-button.loading svg { animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.metrics {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr 1.1fr;
  gap: 12px;
  margin-top: 40px;
}

.metric-card {
  min-height: 150px;
  padding: 22px;
  border: 1px solid rgba(34, 38, 31, .08);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.metric-card.primary {
  background: var(--accent);
  border-color: rgba(99, 126, 10, .12);
}

.metric-label, .metric-note, .project-number small, .session-number small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 18px;
  font-size: clamp(28px, 3.2vw, 42px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
}

.metric-card .time-value { font-size: clamp(19px, 2vw, 27px); line-height: 1.15; }
.metric-note { margin-top: 6px; }
.metric-card.primary .metric-label, .metric-card.primary .metric-note { color: rgba(21, 23, 19, .62); }

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px 15px;
  color: #626956;
  font-size: 12px;
}

.notice svg { width: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

.project-section { margin-top: 44px; }
.section-heading { justify-content: space-between; margin-bottom: 16px; }
.section-heading h2 { font-size: 22px; letter-spacing: -.03em; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }

.status-pill, .model-pill, .turn-badge, .project-meta-count {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  white-space: nowrap;
}

.status-pill {
  padding: 7px 11px;
  color: #607128;
  background: rgba(213, 255, 71, .32);
  font-size: 11px;
  font-weight: 650;
}

.status-pill.error { color: var(--danger); background: rgba(214, 104, 90, .12); }
.project-list { display: grid; gap: 10px; }

.project-card {
  overflow: hidden;
  border: 1px solid rgba(34, 38, 31, .09);
  border-radius: 22px;
  background: rgba(252, 252, 249, .82);
  box-shadow: 0 9px 30px rgba(54, 62, 39, .055);
  backdrop-filter: blur(16px);
}

.project-summary {
  width: 100%;
  min-height: 96px;
  gap: 18px;
  padding: 18px;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.project-summary:hover { background: rgba(255, 255, 255, .52); }
.project-summary[aria-expanded="true"] .chevron { transform: rotate(90deg); background: var(--accent); }
.project-identity { display: block; min-width: 0; flex: 1 1 auto; }
.project-title { display: block; overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.project-path { display: block; overflow: hidden; margin-top: 7px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.project-number { width: 126px; flex: 0 0 auto; text-align: right; }
.project-number strong { display: block; margin-top: 5px; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.project-meta-count { padding: 6px 9px; color: #62675d; background: #eff0ea; font-size: 11px; }
.session-panel { padding: 12px; border-top: 1px solid var(--line); background: rgba(242, 244, 236, .52); }
.session-panel-header { display: flex; justify-content: space-between; padding: 2px 12px 10px 54px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.session-list { display: grid; gap: 8px; }

.session-card {
  overflow: hidden;
  border: 1px solid rgba(34, 38, 31, .09);
  border-radius: 20px;
  background: rgba(252, 252, 249, .9);
  box-shadow: 0 5px 18px rgba(54, 62, 39, .04);
  backdrop-filter: blur(16px);
}

.session-summary {
  width: 100%;
  gap: 18px;
  min-height: 88px;
  padding: 16px 18px;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.session-summary:hover { background: rgba(255, 255, 255, .52); }

.chevron {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #eceee6;
  transition: transform .2s ease, background .2s ease;
}

.session-summary[aria-expanded="true"] .chevron { transform: rotate(90deg); background: var(--accent); }
.chevron svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.session-identity { display: block; min-width: 0; flex: 1 1 auto; }
.session-name { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { display: flex; min-width: 0; gap: 7px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.separator { color: #b2b5ac; }
.session-number { width: 126px; flex: 0 0 auto; text-align: right; }
.session-number strong { display: block; margin-top: 5px; font-size: 17px; font-variant-numeric: tabular-nums; }
.session-number strong { white-space: nowrap; }
.turn-badge { padding: 6px 9px; color: #62675d; background: #eff0ea; font-size: 11px; }

.turn-panel { border-top: 1px solid var(--line); background: rgba(242, 244, 236, .52); }
.turn-header { justify-content: space-between; padding: 13px 24px 10px 66px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.turn-list { padding: 0 12px 12px; }

.turn-row {
  gap: 24px;
  justify-content: space-between;
  padding: 16px 18px 16px 54px;
  border-radius: 13px;
}

.turn-row + .turn-row { border-top: 1px solid rgba(34, 38, 31, .07); border-radius: 0; }
.turn-row:hover { background: rgba(255, 255, 255, .52); }
.turn-copy { min-width: 0; }
.turn-topline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.model-pill { padding: 3px 7px; color: #626d3f; background: rgba(213, 255, 71, .24); font-size: 9px; font-weight: 700; }
.turn-prompt { margin-top: 7px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.content-detail, .token-detail { display: block; margin-top: 6px; color: #7f8479; font-size: 10px; font-variant-numeric: tabular-nums; }
.token-detail { color: #a0a39c; }
.turn-usage { flex: 0 0 130px; text-align: right; }
.turn-usage strong { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.turn-quota { display: block; margin-top: 6px; color: #7b806f; font-size: 11px; }
.turn-quota.unavailable { color: #a3a69f; }

.empty-state, .error-state {
  padding: 52px 22px;
  border: 1px dashed rgba(34, 38, 31, .18);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, .45);
  text-align: center;
}

.empty-state strong, .error-state strong { display: block; margin-bottom: 6px; color: var(--ink); }
.loading-card { display: grid; gap: 10px; padding: 24px; border-radius: 20px; background: rgba(255,255,255,.5); }
.loading-card span { height: 12px; border-radius: 999px; background: linear-gradient(90deg, #e8eae3, #f8f9f5, #e8eae3); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.loading-card span:nth-child(1) { width: 44%; }
.loading-card span:nth-child(2) { width: 72%; }
.loading-card span:nth-child(3) { width: 29%; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 880px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .session-number { width: 108px; }
  .project-number { width: 108px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1160px); padding-top: 32px; }
  .topbar { align-items: flex-start; }
  .topbar p { max-width: 260px; line-height: 1.5; }
  .refresh-button { width: 40px; height: 40px; justify-content: center; padding: 0; }
  .refresh-button { font-size: 0; }
  .metrics { margin-top: 28px; gap: 8px; }
  .metric-card { min-height: 126px; padding: 17px; border-radius: 17px; }
  .metric-card strong { margin-top: 15px; }
  .notice { align-items: flex-start; line-height: 1.5; }
  .project-summary { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 15px 13px; }
  .project-identity { grid-column: 2 / 4; grid-row: 1; padding-right: 4px; }
  .project-summary .chevron { grid-column: 1; grid-row: 1; }
  .project-number { grid-row: 2; width: auto; text-align: left; }
  .project-summary .credits-number { grid-column: 2; }
  .project-summary .quota-number { grid-column: 3; min-width: 72px; text-align: right; }
  .project-meta-count { display: none; }
  .session-panel { padding: 8px; }
  .session-panel-header { padding-left: 12px; }
  .session-summary { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 15px 13px; }
  .session-identity { grid-column: 2 / 4; grid-row: 1; padding-right: 4px; }
  .chevron { grid-column: 1; grid-row: 1; }
  .session-number { grid-row: 2; width: auto; text-align: left; }
  .credits-number { grid-column: 2; }
  .quota-number { grid-column: 3; min-width: 72px; text-align: right; }
  .turn-badge { display: none; }
  .turn-header { padding-left: 18px; }
  .turn-row { align-items: flex-start; padding: 15px 8px; gap: 12px; }
  .turn-usage { flex-basis: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
