:root {
  color-scheme: light;
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-2: #f1f6ff;
  --text: #202124;
  --muted: #5f6368;
  --blue: #1a73e8;
  --blue-dark: #1558b0;
  --green: #188038;
  --yellow: #fbbc04;
  --red: #d93025;
  --border: #dfe7f5;
  --shadow: 0 22px 60px rgba(26, 115, 232, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  font-family: "Google Sans", Roboto, Arial, sans-serif;
}

:root.dark {
  color-scheme: dark;
  --bg: #0f1726;
  --surface: #162033;
  --surface-2: #1d2b45;
  --text: #eef3fb;
  --muted: #a8b3c7;
  --blue: #8ab4f8;
  --blue-dark: #5f9bf5;
  --green: #81c995;
  --border: #2d3a51;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(26, 115, 232, 0.14), transparent 32rem),
    linear-gradient(180deg, var(--bg), var(--surface-2));
  color: var(--text);
}

.login-page {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(26, 115, 232, 0.14), transparent 28rem),
    linear-gradient(180deg, var(--bg), var(--surface-2));
}

.login-shell { width: min(440px, calc(100% - 32px)); }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 18px;
}

.login-card h1 { margin: 6px 0 8px; font-size: clamp(2rem, 8vw, 3rem); }
.login-copy { margin: 0 0 26px; color: var(--muted); line-height: 1.6; }
.login-form { display: grid; gap: 14px; }
.login-form label { color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.login-form input {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  color: var(--text);
  border-radius: 18px;
  padding: 16px 18px;
  font: inherit;
  outline: none;
}
.login-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent); }
.login-message { min-height: 22px; margin: 2px 0 0; color: var(--muted); }
.login-message.error { color: var(--red); }
.login-message.success { color: var(--green); }
.login-footnote { display: block; margin-top: 20px; color: var(--muted); line-height: 1.5; }

button, a { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; padding-left: 5px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: white;
  background: var(--blue);
  font-weight: 900;
  font-size: 1.45rem;
}
.brand strong { display: block; font-size: 1.15rem; letter-spacing: -0.03em; }
.brand small { display: block; color: var(--muted); font-size: 0.78rem; }

.desktop-nav { display: flex; align-items: center; gap: 5px; }
.desktop-nav a {
  padding: 12px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  transition: 0.18s ease;
}
.desktop-nav a:hover, .desktop-nav a.active { background: var(--surface-2); color: var(--blue); }

.actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .primary-button, .big-blue-button, .refresh-icon-button, .usage-details-button, .status-card.clickable {
  border: 0;
  cursor: pointer;
}
.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}
.primary-button, .big-blue-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  color: white;
  background: #1a73e8;
  border-radius: 999px;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(26, 115, 232, 0.26);
}
.primary-button { padding: 14px 18px; }
.big-blue-button { padding: 18px 28px; font-size: 1rem; }
.primary-button:hover, .big-blue-button:hover { background: #1558b0; transform: translateY(-1px); }
.refresh-icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  color: white;
  background: #1a73e8;
  box-shadow: 0 12px 26px rgba(26, 115, 232, 0.24);
  font-size: 1.45rem;
  line-height: 1;
  transition: transform 0.18s ease, background 0.18s ease;
}
.refresh-icon-button:hover { background: #1558b0; transform: translateY(-1px) rotate(18deg); }
.refresh-icon-button:disabled { opacity: 0.72; cursor: wait; }
.refresh-icon-button.is-spinning span { animation: spin-refresh 0.8s linear infinite; }
@keyframes spin-refresh { to { transform: rotate(360deg); } }
.usage-actions { display: inline-flex; align-items: center; gap: 10px; }
.usage-details-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: #1a73e8;
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  font-weight: 900;
  transition: 0.18s ease;
}
.usage-details-button:hover { color: white; background: #1a73e8; transform: translateY(-1px); }

.menu-wrap { position: relative; }
.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  min-width: 250px;
  display: none;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.dropdown.open { display: grid; }
.dropdown a {
  padding: 13px 14px;
  border-radius: 15px;
  color: var(--muted);
  font-weight: 700;
}
.dropdown a:hover { background: var(--surface-2); color: var(--blue); }

.content { padding-top: 48px; }
.hero {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 28px;
  margin-bottom: 28px;
}
.compact-hero {
  margin-bottom: 20px;
}
.eyebrow, .card-label {
  margin: 0 0 8px;
  color: var(--blue);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.78rem;
}
h1 { max-width: 790px; margin: 0; font-size: clamp(2.3rem, 6vw, 5.8rem); line-height: 0.95; letter-spacing: -0.07em; }
.hero-copy { max-width: 640px; color: var(--muted); font-size: 1.12rem; line-height: 1.65; }

.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.status-card, .panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}
.status-card {
  min-height: 150px;
  padding: 26px;
  text-align: left;
  color: var(--text);
}
.status-card strong { display: block; font-size: clamp(1.8rem, 3vw, 2.75rem); letter-spacing: -0.05em; }
.status-card small { display: block; margin-top: 10px; color: var(--muted); }
.status-card.clickable:hover { outline: 3px solid color-mix(in srgb, var(--blue) 22%, transparent); transform: translateY(-2px); }
.usage-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.usage-head .card-label { margin-bottom: 0; }
.usage-row { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.usage-meta { display: block; margin-top: 6px; color: var(--muted); }
.progress { height: 18px; margin-top: 22px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.progress span { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1a73e8, #8ab4f8); transition: width 0.4s ease; }

.main-view { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr); gap: 20px; }
.panel { padding: 26px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
h2 { margin: 0; font-size: 1.7rem; letter-spacing: -0.04em; }
.live-dot {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 13px; border-radius: 999px;
  color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent);
  font-weight: 900;
}
.live-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px color-mix(in srgb, var(--green) 14%, transparent); }
.activity-list, .commit-list { display: grid; gap: 12px; }
.activity-item, .commit-item {
  display: grid;
  gap: 6px;
  padding: 17px;
  border-radius: 20px;
  background: var(--surface-2);
}
.activity-top, .commit-top { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.badge { padding: 6px 10px; border-radius: 999px; background: #1a73e8; color: white; font-weight: 900; font-size: 0.78rem; }
.item-title { font-weight: 900; }
.item-detail, .meta { color: var(--muted); line-height: 1.45; }
.sha { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--blue); font-weight: 900; }

.details-dialog {
  width: min(620px, calc(100% - 28px));
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.details-dialog::backdrop { background: rgba(15, 23, 38, 0.45); backdrop-filter: blur(4px); }
.details-dialog form { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.dialog-note { margin: 8px 0 20px; color: var(--muted); line-height: 1.55; }
.details-list { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; }
.details-list dt { color: var(--muted); font-weight: 800; }
.details-list dd { margin: 0; font-weight: 900; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .desktop-nav { display: none; }
  .hero, .status-grid, .main-view { grid-template-columns: 1fr; }
  .topbar { border-radius: 28px; align-items: flex-start; }
  .brand small { display: none; }
}

@media (max-width: 560px) {
  .app-shell { width: min(100% - 20px, 1220px); }
  .topbar { flex-wrap: wrap; }
  .actions { width: 100%; justify-content: space-between; }
  .primary-button { flex: 1; }
  .dropdown { left: 0; right: auto; }
  .status-card, .panel { padding: 20px; }
  .details-list { grid-template-columns: 1fr; }
}
