:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --primary: #e63f51;
  --primary-dark: #cf3041;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* VS Code "Dark+" palette, matching TAGTHAI's other internal tools. */
html.dark {
  --bg: #1e1e1e;
  --surface: #252526;
  --border: #454545;
  --text: #d4d4d4;
  --text-muted: #9d9d9d;
  --text-faint: #858585;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

/* header, shared by login + app pages */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand img {
  height: 2rem;
  width: 2rem;
  border-radius: 0.4rem;
}

.brand-text p {
  margin: 0;
  line-height: 1.25;
}

.brand-text .name {
  font-weight: 700;
  font-size: 0.9rem;
}

.brand-text .sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.email {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}

.avatar {
  height: 1.8rem;
  width: 1.8rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  display: flex;
}

.icon-btn:hover {
  background: var(--border);
}

.icon-btn svg {
  height: 1.1rem;
  width: 1.1rem;
}

.icon-moon {
  display: none;
}

html.dark .icon-sun {
  display: none;
}

html.dark .icon-moon {
  display: block;
}

.link-btn {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .topbar {
    padding: 0.75rem 1rem;
  }
  .brand-text .sub {
    display: none;
  }
  .email {
    display: none;
  }
}

.link-btn:hover {
  background: var(--border);
}

/* main app */

main.page {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
}

.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

@media (max-width: 480px) {
  main.page {
    margin: 1.25rem auto;
    padding: 0 0.75rem;
  }
  .project {
    padding: 1rem 1.1rem;
  }
}

.project h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
  font-weight: 600;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.cluster:first-of-type {
  border-top: none;
}

.cluster-name {
  font-size: 0.9rem;
  min-width: 0;
  word-break: break-word;
}

.status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.status.RUNNING {
  background: #f0fdf4;
  color: #15803d;
}

.status.STOPPING,
.status.PROVISIONING,
.status.RECONCILING {
  background: #fffbeb;
  color: #b45309;
}

.status.ERROR,
.status.NOT_FOUND,
.status.NO_ACCESS {
  background: #fef2f2;
  color: #dc2626;
}

.status.STOPPED {
  background: #f1f5f9;
  color: #475569;
}

html.dark .status.RUNNING {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
}

html.dark .status.STOPPING,
html.dark .status.PROVISIONING,
html.dark .status.RECONCILING {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
}

html.dark .status.ERROR,
html.dark .status.NOT_FOUND,
html.dark .status.NO_ACCESS {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

html.dark .status.STOPPED {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

.node-count {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-left: 0.5rem;
}

.actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.actions button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  color: #fff;
}

.actions button.up {
  background: #16a34a;
}

.actions button.up:hover {
  background: #15803d;
}

.actions button.down {
  background: var(--primary);
}

.actions button.down:hover {
  background: var(--primary-dark);
}

.actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.msg {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
  color: var(--text-muted);
}

/* login page */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1rem;
}

.login-wrap .theme-corner {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.login-card {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border-radius: 1rem;
  padding: 2.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  text-align: center;
}

html.dark .login-card {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.login-card img.logo {
  height: 4rem;
  width: 4rem;
  border-radius: 0.75rem;
  margin: 0 auto 1rem;
  display: block;
}

.login-card h1 {
  font-size: 1.3rem;
  margin: 0 0 0.4rem;
}

.login-card p.sub {
  margin: 0 0 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 2.75rem;
  width: 100%;
  border-radius: 0.6rem;
  background: #1f2937;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid #374151;
}

.google-btn:hover {
  background: #111827;
}

.google-btn svg {
  height: 1.1rem;
  width: 1.1rem;
}
