:root { color-scheme: light dark; }
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f6f8fa;
  color: #1f2328;
}

  [data-theme="dark"] body { background: #0d1117; color: #e6edf3; }
  [data-theme="dark"] .card { background: #161b22; border-color: #30363d; }
  [data-theme="dark"] .gh-btn { background: #21262d; border-color: #30363d; color: #e6edf3; }
  [data-theme="dark"] .gh-btn:hover { background: #30363d; }
  [data-theme="dark"] a { color: #58a6ff; }
  [data-theme="dark"] .muted { color: #7d8590; }

:root { --sidebar-w: 240px; }

.app { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  background: #fff;
  border-right: 1px solid #d0d7de;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 12px;
  font-weight: 600; font-size: 16px;
  text-decoration: none; color: inherit;
}
.brand-mark { display: block; border-radius: 6px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: block;
  padding: 7px 10px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  color: #57606a; text-decoration: none;
  white-space: nowrap;
}
.sidebar-nav a:hover { background: #eaeef2; color: #1f2328; }
.sidebar-nav a.active { background: #eaeef2; color: #1f2328; font-weight: 600; }

.sidebar-spacer { flex: 1 1 auto; }   /* pushes footer to the bottom */

.sidebar-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 4px;
  border-top: 1px solid #d0d7de;
}
.sidebar-foot .user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; min-width: 0;
}
.sidebar-foot .user img { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; }
.sidebar-foot .user-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.sidebar-foot .signout { color: inherit; text-decoration: none; opacity: .7; flex: 0 0 auto; }
.sidebar-foot .signout:hover { opacity: 1; }

.mobile-bar { display: none; }       /* shown only in the <=820 media query */
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 1px solid #d0d7de; border-radius: 6px;
  color: #57606a; cursor: pointer;
}
.nav-toggle:hover { background: #eaeef2; color: #1f2328; }
.mobile-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; text-decoration: none; color: inherit;
}
.sidebar-overlay { display: none; }  /* becomes a tap-scrim only when open on mobile */

[data-theme="dark"] .sidebar { background: #161b22; border-color: #30363d; }
[data-theme="dark"] .sidebar .brand { color: #e6edf3; }
[data-theme="dark"] .sidebar-nav a { color: #7d8590; }
[data-theme="dark"] .sidebar-nav a:hover,
[data-theme="dark"] .sidebar-nav a.active { background: #21262d; color: #e6edf3; }
[data-theme="dark"] .sidebar-foot { border-top-color: #30363d; }
[data-theme="dark"] .mobile-bar { background: #161b22; border-color: #30363d; }
[data-theme="dark"] .nav-toggle { border-color: #30363d; color: #7d8590; }
[data-theme="dark"] .nav-toggle:hover { background: #21262d; color: #e6edf3; }

main {
  flex: 1 1 auto;
  min-width: 0;            /* lets flex child shrink; prevents board/grid overflow */
  padding: 40px 40px;
  max-width: 1180px;       /* readable cap for the WIDEST surface */
}
h1 { margin: 0 0 8px; font-size: 28px; }
.muted { color: #57606a; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 32px;
}
.card {
  display: block;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform .08s ease, border-color .08s ease;
}
.card:hover { transform: translateY(-1px); border-color: #8c959f; }
.card .name { font-weight: 600; margin-bottom: 4px; }
.card .desc { font-size: 13px; color: #57606a; }

  [data-theme="dark"] .card .desc { color: #7d8590; }

.login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login .box {
  text-align: center;
  padding: 40px 32px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  max-width: 380px;
  width: 100%;
}

  [data-theme="dark"] .login .box { background: #161b22; border-color: #30363d; }

.login .login-mark { margin-bottom: 12px; }
.login .login-mark svg { width: 56px; height: 56px; border-radius: 12px; }
.login h1 { font-size: 22px; margin-bottom: 6px; }
.login .sub { font-size: 14px; color: #57606a; margin-bottom: 28px; }
.gh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: #1f2328; color: #fff;
  border: 1px solid #1f2328;
  border-radius: 6px;
  font-weight: 500; text-decoration: none;
  cursor: pointer;
}
.gh-btn:hover { background: #32383f; }
.gh-btn svg { width: 18px; height: 18px; fill: currentColor; }
.login .footer { margin-top: 24px; font-size: 12px; color: #57606a; }
.login .footer code { font-family: ui-monospace, SFMono-Regular, monospace; }

/* Theme toggle button (in sidebar footer) */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  padding: 0; margin: 0;
  background: transparent;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  color: #57606a;
  cursor: pointer;
  line-height: 1;
}
.theme-toggle:hover { background: #eaeef2; color: #1f2328; }
.theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.theme-toggle .ti-sun  { display: none; }
.theme-toggle .ti-moon { display: block; }
[data-theme="dark"] .theme-toggle { border-color: #30363d; color: #7d8590; }
[data-theme="dark"] .theme-toggle:hover { background: #21262d; color: #e6edf3; }
[data-theme="dark"] .theme-toggle .ti-moon { display: none; }
[data-theme="dark"] .theme-toggle .ti-sun  { display: block; }

:focus-visible {
  outline: 2px solid #0969da;
  outline-offset: 2px;
  border-radius: 3px;
}
[data-theme="dark"] :focus-visible { outline-color: #58a6ff; }

/* Skip-to-content link: off-screen until focused, then pinned top-left. */
.skip-link {
  position: absolute;
  left: 8px; top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: #fff; color: #0969da;
  border: 1px solid #d0d7de; border-radius: 6px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: top .12s ease;
}
.skip-link:focus { top: 8px; }
[data-theme="dark"] .skip-link { background: #161b22; color: #58a6ff; border-color: #30363d; }

@media (max-width: 820px) {
  .app { display: block; }                 /* stack: bar on top, main below */
  .mobile-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    background: #fff; border-bottom: 1px solid #d0d7de;
    position: sticky; top: 0; z-index: 30;
  }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100vh; width: min(82vw, 300px); flex-basis: auto;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 0 0 0 1px rgba(0,0,0,.04);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }        /* scroll-lock: no scroll bleed behind the scrim */
  .sidebar-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.40); z-index: 40;
  }
  .sidebar-overlay[hidden] { display: none; }
  main { padding: 24px 16px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
