/* =========================================================================
   GreenGrid Design System — Production Edition
   =========================================================================
   Design philosophy:
   - Dark-first, clean, professional developer aesthetic
   - Green-accented (the commit grid IS the product identity)
   - No flashy animations; subtle micro-interactions only
   - Bootstrap 5 used as layout layer; this file owns all visual tokens
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---- CSS Variables ------------------------------------------------------- */

:root {
  /* Core palette */
  --bg:              #0d1512;
  --bg-elevated:     #111a16;
  --surface:         #162018;
  --surface-hover:   #1b2b20;
  --surface-active:  #1f3226;
  --border:          #243228;
  --border-soft:     #1a2620;
  --border-hover:    #2e4038;

  /* Text */
  --text-primary:    #edf3ee;
  --text-secondary:  #a8b9ae;
  --text-muted:      #6b7f74;
  --text-placeholder:#4e6358;

  /* Accent (green) */
  --accent:          #3fd68e;
  --accent-dim:      #2db876;
  --accent-glow:     rgba(63, 214, 142, 0.15);
  --accent-soft:     rgba(63, 214, 142, 0.10);
  --accent-soft-mid: rgba(63, 214, 142, 0.18);
  --accent-border:   rgba(63, 214, 142, 0.28);

  /* Semantic colours */
  --danger:          #e5626a;
  --danger-soft:     rgba(229, 98, 106, 0.12);
  --danger-border:   rgba(229, 98, 106, 0.30);
  --warning:         #e0ac52;
  --warning-soft:    rgba(224, 172, 82, 0.12);
  --success:         var(--accent);

  /* Difficulty colours */
  --easy:   #3fd68e;
  --medium: #e0ac52;
  --hard:   #e5626a;

  /* Typography */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Spacing scale */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px;  --sp-5: 20px;  --sp-6: 24px;
  --sp-7: 28px;  --sp-8: 32px;  --sp-10: 40px;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow-xs:   0 1px 2px rgba(0,0,0,.20);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.24), 0 4px 12px rgba(0,0,0,.14);
  --shadow-card: 0 1px 2px rgba(0,0,0,.24), 0 6px 20px rgba(0,0,0,.16);
  --shadow-hover:0 2px 6px rgba(0,0,0,.28), 0 10px 28px rgba(0,0,0,.22);
  --shadow-glow: 0 0 0 3px var(--accent-soft);

  /* Sidebar */
  --sidebar-w: 232px;

  /* Transitions */
  --t-fast:   0.12s ease;
  --t-normal: 0.18s ease;

  /* Bootstrap overrides */
  --bs-body-bg:         var(--bg);
  --bs-body-color:      var(--text-primary);
  --bs-border-color:    var(--border);
  --bs-primary:         var(--accent);
  --bs-primary-rgb:     63, 214, 142;
  --bs-font-sans-serif: var(--font-body);
}

/* ---- Light theme --------------------------------------------------------- */

html[data-theme="light"] {
  --bg:              #f4f7f5;
  --bg-elevated:     #ffffff;
  --surface:         #ffffff;
  --surface-hover:   #edf3ef;
  --surface-active:  #e4ede8;
  --border:          #d8e4dc;
  --border-soft:     #e4ede8;
  --border-hover:    #bdd4c5;
  --text-primary:    #142018;
  --text-secondary:  #445a4c;
  --text-muted:      #6e887a;
  --text-placeholder:#94a89d;
  --accent-soft:     rgba(27, 152, 88, 0.08);
  --accent-soft-mid: rgba(27, 152, 88, 0.14);
  --accent-border:   rgba(27, 152, 88, 0.24);
  --shadow-card:     0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.07);
  --shadow-hover:    0 2px 6px rgba(0,0,0,.08), 0 8px 22px rgba(0,0,0,.10);
}

/* ---- Reset & Base -------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(63,214,142,0.055), transparent),
    radial-gradient(ellipse 50% 35% at 85% 100%, rgba(63,214,142,0.035), transparent);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6, .display-font {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  line-height: 1.25;
}

p { margin: 0; }
a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-dim); }

img, svg { display: block; }

.mono { font-family: var(--font-mono) !important; }
.text-muted-gg     { color: var(--text-muted) !important; }
.text-secondary-gg { color: var(--text-secondary) !important; }
.text-accent       { color: var(--accent) !important; }
.text-danger-gg    { color: var(--danger) !important; }
.text-warning-gg   { color: var(--warning) !important; }

/* ---- Commit-grid motif --------------------------------------------------- */

.commit-grid-bg {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 5px;
  padding: 24px;
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 90%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 90%);
}

.commit-grid-bg span {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--accent-soft);
}
.commit-grid-bg span.lit-1 { background: rgba(63,214,142,0.16); }
.commit-grid-bg span.lit-2 { background: rgba(63,214,142,0.30); }
.commit-grid-bg span.lit-3 { background: rgba(63,214,142,0.50); }

/* ---- Layout shell -------------------------------------------------------- */

.gg-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.gg-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

/* Main content */
.gg-main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 72px;
  max-width: 1200px;
}

/* Page content constraint */
.gg-page-content {
  max-width: 1100px;
}

/* ---- Logo ---------------------------------------------------------------- */

.gg-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  padding: 4px 8px 20px;
  color: var(--text-primary);
  text-decoration: none;
}
.gg-logo:hover { color: var(--text-primary); }

.gg-logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.gg-logo-mark span {
  border-radius: 2px;
  background: var(--accent);
}
.gg-logo-mark span:nth-child(1) { opacity: 1.0; }
.gg-logo-mark span:nth-child(2) { opacity: 0.5; }
.gg-logo-mark span:nth-child(3) { opacity: 0.7; }
.gg-logo-mark span:nth-child(4) { opacity: 0.35; }

/* ---- Nav links ----------------------------------------------------------- */

.gg-nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 4px;
  margin-top: 16px;
}
.gg-nav-section:first-child { margin-top: 0; }

.gg-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
  position: relative;
}
.gg-nav-link:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.gg-nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.gg-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.gg-nav-link svg {
  flex-shrink: 0;
  opacity: 0.8;
}
.gg-nav-link.active svg {
  opacity: 1;
}

/* Sidebar footer */
.gg-sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.gg-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.gg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft-mid);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
  border: 1px solid var(--accent-border);
}

.gg-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

/* Mobile topbar */
.gg-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gg-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ---- Page header --------------------------------------------------------- */

.gg-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.gg-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gg-page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ---- Cards --------------------------------------------------------------- */

.gg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--t-normal), box-shadow var(--t-normal);
}

.gg-card-tight { padding: 14px 18px; }
.gg-card-sm    { padding: 16px; }

.gg-card-interactive {
  cursor: pointer;
}
.gg-card-interactive:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.gg-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ---- Stat cards ---------------------------------------------------------- */

.gg-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.gg-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.gg-stat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.gg-stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.gg-stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Buttons ------------------------------------------------------------- */

.btn-gg-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #072918;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  transition: background var(--t-fast), box-shadow var(--t-fast), transform 0.08s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-gg-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #072918;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn-gg-primary:active { transform: translateY(1px); }
.btn-gg-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-gg-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn-gg-outline:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
  color: var(--text-primary);
}
.btn-gg-outline:active { opacity: 0.85; }
.btn-gg-outline:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-gg-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
}
.btn-gg-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }

.btn-gg-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-weight: 500;
  font-size: 0.875rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.btn-gg-danger:hover { background: var(--danger-soft); }

.btn-gg-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
  font-size: 0.95rem;
  line-height: 1;
}
.btn-gg-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}
.btn-gg-icon.active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

/* w-100 shorthand */
.w-100 { width: 100%; }

/* ---- Forms --------------------------------------------------------------- */

.form-group { margin-bottom: 18px; }

.form-label-gg {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-control-gg,
.form-select-gg {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-control-gg:focus,
.form-select-gg:focus {
  border-color: var(--accent-dim);
  box-shadow: var(--shadow-glow);
}
.form-control-gg:hover:not(:focus),
.form-select-gg:hover:not(:focus) {
  border-color: var(--border-hover);
}

.form-control-gg::placeholder { color: var(--text-placeholder); }

textarea.form-control-gg {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* Select arrow */
.form-select-gg {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236b7f74' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}
.form-select-gg option {
  background: var(--surface);
  color: var(--text-primary);
}

/* ---- Badges -------------------------------------------------------------- */

.badge-gg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-easy   { background: rgba(63,214,142,0.12); color: var(--easy);   }
.badge-medium { background: rgba(224,172,82,0.12); color: var(--medium); }
.badge-hard   { background: rgba(229,98,106,0.12); color: var(--hard);   }
.badge-neutral {
  background: var(--surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-status-committed { background: var(--accent-soft);  color: var(--accent);   }
.badge-status-pending   { background: var(--warning-soft); color: var(--warning);  }
.badge-status-failed    { background: var(--danger-soft);  color: var(--danger);   }
.badge-status-ready     { background: var(--accent-soft);  color: var(--accent);   }

/* ---- Tag chips ----------------------------------------------------------- */

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px 10px 3px 11px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: border-color var(--t-fast);
}
.tag-chip:hover { border-color: var(--border-hover); }
.tag-chip button {
  background: none;
  border: none;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color var(--t-fast);
}
.tag-chip button:hover { color: var(--danger); }

/* ---- Auth / centered pages ----------------------------------------------- */

.gg-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 32px 20px;
}

.gg-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 38px 36px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-card);
}

.gg-auth-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 24px;
}

.gg-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.gg-auth-divider::before,
.gg-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.gg-auth-divider span {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* GitHub button with icon */
.btn-github {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.btn-github:hover {
  background: var(--surface-active);
  border-color: var(--border-hover);
}

/* ---- Contribution calendar ----------------------------------------------- */

.contrib-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.contrib-cell {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  transition: transform 0.08s;
  cursor: default;
}
.contrib-cell:hover { transform: scale(1.4); z-index: 1; }
.contrib-cell[data-level="1"] { background: rgba(63,214,142,0.20); border-color: transparent; }
.contrib-cell[data-level="2"] { background: rgba(63,214,142,0.42); border-color: transparent; }
.contrib-cell[data-level="3"] { background: rgba(63,214,142,0.68); border-color: transparent; }
.contrib-cell[data-level="4"] { background: var(--accent);          border-color: transparent; }

.contrib-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.contrib-legend-cell {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

/* ---- Bar rows (stats) ---------------------------------------------------- */

.gg-bar-row { margin-bottom: 10px; }
.gg-bar-row:last-child { margin-bottom: 0; }

.gg-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-size: 0.82rem;
}

.gg-bar-track {
  height: 5px;
  border-radius: 4px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.gg-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ---- Problem card -------------------------------------------------------- */

.gg-problem-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-normal), box-shadow var(--t-normal), transform 0.12s;
  margin-bottom: 10px;
}
.gg-problem-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.gg-problem-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.gg-problem-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ---- Empty state --------------------------------------------------------- */

.gg-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.gg-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.gg-empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.gg-empty-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ---- Loading states ------------------------------------------------------ */

.gg-skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface-hover) 37%,
    var(--surface) 63%
  );
  background-size: 400% 100%;
  animation: gg-shimmer 1.4s ease infinite;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}
@keyframes gg-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}

/* Top-of-page loading bar */
.gg-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.3s ease, opacity 0.4s ease;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ---- Spinner ------------------------------------------------------------- */

.gg-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gg-spin 0.7s linear infinite;
}
.gg-spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
@keyframes gg-spin {
  to { transform: rotate(360deg); }
}

/* ---- Toasts -------------------------------------------------------------- */

.gg-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.gg-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: var(--shadow-hover);
  font-size: 0.86rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: gg-toast-in 0.2s ease;
  pointer-events: all;
  line-height: 1.45;
}
.gg-toast.success { border-left: 3px solid var(--accent); }
.gg-toast.error   { border-left: 3px solid var(--danger); }
.gg-toast.info    { border-left: 3px solid var(--warning); }

@keyframes gg-toast-in {
  from { opacity: 0; transform: translateX(12px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0)   scale(1); }
}

/* ---- Misc utilities ------------------------------------------------------ */

.gg-divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 0;
}

/* Commit SHA chip */
.gg-sha {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  color: var(--text-muted);
}

/* Settings row */
.gg-settings-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.gg-settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.gg-settings-row:first-child { padding-top: 0; }

.gg-settings-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-top: 2px;
}

.gg-settings-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.gg-settings-value {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Theme toggle pills */
.gg-theme-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.gg-theme-pill {
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  transition: background var(--t-fast), color var(--t-fast);
}
.gg-theme-pill.active {
  background: var(--surface-active);
  color: var(--text-primary);
}

/* Step indicator (onboarding) */
.gg-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}
.gg-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
}
.gg-step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(50% + 14px);
  right: calc(-50% + 14px);
  height: 2px;
  background: var(--border);
  transition: background var(--t-normal);
}
.gg-step-item.completed:not(:last-child)::after {
  background: var(--accent-border);
}
.gg-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-elevated);
  transition: all var(--t-normal);
  z-index: 1;
}
.gg-step-item.active .gg-step-circle {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.gg-step-item.completed .gg-step-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: #072918;
}
.gg-step-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.gg-step-item.active .gg-step-label { color: var(--accent); }
.gg-step-item.completed .gg-step-label { color: var(--text-secondary); }

/* Code section on problem form */
.gg-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Recent commit list item */
.gg-commit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
}
.gg-commit-row:last-child { border-bottom: none; padding-bottom: 0; }
.gg-commit-row:first-child { padding-top: 0; }

/* ---- Responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
  .gg-sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-w) - 20px);
    z-index: 100;
    transition: left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  .gg-sidebar.open {
    left: 0;
    box-shadow: 4px 0 32px rgba(0,0,0,0.4);
  }
  .gg-sidebar-backdrop.open { display: block; }
  .gg-topbar { display: flex; }
  .gg-main   { padding: 72px 18px 60px; }
  .gg-page-header { margin-bottom: 20px; }
  .gg-page-title { font-size: 1.3rem; }
}

@media (max-width: 600px) {
  .gg-auth-card { padding: 28px 22px; border-radius: var(--radius-lg); }
  .gg-main { padding: 66px 14px 60px; }
}

/* ---- Bootstrap grid passthrough (loaded via shell.js) -------------------- */
/* These guarantee correct grid behaviour even before BS is injected */
.row { --bs-gutter-x: 1.5rem; --bs-gutter-y: 0; }

/* ---- Custom Scrollbars & Selection --------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

::selection { background: var(--accent-soft-mid); color: var(--text-primary); }

