/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg-page:     #0d1117;
  --bg-panel:    #161b22;
  --bg-hover:    #1c2128;
  --border:      #30363d;
  --border-sub:  #21262d;
  --text:        #c9d1d9;
  --text-dim:    #8b949e;
  --text-bright: #e6edf3;
  --accent:      #58a6ff;
  --accent-dim:  #1f3a6e;
  --green:       #3fb950;
  --yellow:      #d29922;
  --red:         #f85149;
  --purple:      #a371f7;
  --amber:       #d29922;

  --sidebar-w:   240px;
  --header-h:    52px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#dash-header {
  height: var(--header-h);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
}

#dash-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.5px;
  text-decoration: none;
  margin-right: auto;
}

#dash-github-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3px 10px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
#dash-github-chip:hover { border-color: var(--accent); color: var(--accent); }
#dash-github-chip.connected { color: var(--green); border-color: rgba(63, 185, 80, 0.3); }
#dash-github-chip.unconfigured { opacity: 0.45; cursor: default; }
#dash-github-chip.unconfigured:hover { border-color: var(--border); color: var(--text-dim); }

#dash-username {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

#dash-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
#dash-logout:hover { border-color: var(--red); color: var(--red); }

/* ── App shell ───────────────────────────────────────────────────────────── */
#dash-app {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#dash-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

#sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 44px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-sub);
}

#sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  flex: 1;
}

#sidebar-new-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--accent-dim);
  background: none;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-right: 6px;
}
#sidebar-new-btn:hover { background: var(--accent-dim); }

.sidebar-section-hdr {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  padding: 10px 14px 4px;
  opacity: 0.7;
}

#sidebar-search-wrap {
  padding: 8px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-sub);
}

#sidebar-search {
  width: 100%;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 9px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
#sidebar-search:focus { border-color: var(--accent); }
#sidebar-search::placeholder { color: var(--text-dim); }
/* Remove default search cancel button styling */
#sidebar-search::-webkit-search-cancel-button { display: none; }

#sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
#sidebar-list::-webkit-scrollbar { width: 4px; }
#sidebar-list::-webkit-scrollbar-track { background: transparent; }
#sidebar-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Sidebar project item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s;
  position: relative;
  min-width: 0;
}
.sidebar-item:hover { background: var(--bg-hover); }
.sidebar-item.active {
  background: var(--accent-dim);
}
.sidebar-item.active .sidebar-item-name { color: var(--accent); }
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-item-icon {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}
.sidebar-item-icon.github { color: var(--accent); }
.sidebar-item-icon.local  { color: var(--text-dim); }

.sidebar-item-name {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.sidebar-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item-tag {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-lo);
  background: var(--bg-hover);
  border: 1px solid var(--border-sub);
  border-radius: 3px;
  padding: 1px 4px;
  flex-shrink: 0;
}

/* Sidebar empty state */
#sidebar-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
#sidebar-empty p { margin-bottom: 12px; }

/* ── Detail panel ─────────────────────────────────────────────────────────── */
#dash-detail {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  background: var(--bg-page);
}
#dash-detail::-webkit-scrollbar { width: 6px; }
#dash-detail::-webkit-scrollbar-track { background: transparent; }
#dash-detail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#detail-content {
  max-width: 860px;
  padding: 32px 36px;
}

/* ── Detail — empty state ─────────────────────────────────────────────────── */
#detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  color: var(--text-dim);
  min-height: 60vh;
}
#detail-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 20px;
  opacity: 0.4;
}
#detail-empty h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
#detail-empty p {
  font-size: 14px;
  max-width: 360px;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ── Detail — project header ──────────────────────────────────────────────── */
#detail-proj-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-sub);
}

#detail-proj-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
  word-break: break-word;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.detail-meta-row a {
  color: var(--accent);
  text-decoration: none;
}
.detail-meta-row a:hover { text-decoration: underline; }

.meta-sep {
  color: var(--border);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.source-badge.github { background: rgba(88, 166, 255, 0.12); color: var(--accent); border: 1px solid rgba(88, 166, 255, 0.25); }
.source-badge.local  { background: rgba(139, 148, 158, 0.12); color: var(--text-dim); border: 1px solid rgba(139, 148, 158, 0.2); }
.source-badge.zip    { background: rgba(63, 185, 80, 0.1); color: var(--green); border: 1px solid rgba(63, 185, 80, 0.2); }

/* Action buttons row */
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.detail-actions .btn-spacer {
  flex: 1;
}

/* ── Section blocks ───────────────────────────────────────────────────────── */
.detail-section {
  margin-bottom: 28px;
}

.detail-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}

.detail-section-header h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  flex: 1;
}

.section-toggle {
  font-size: 11px;
  color: var(--text-dim);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.section-toggle.collapsed { transform: rotate(-90deg); }

.detail-section-body {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.detail-section-body.hidden { display: none; }

/* ── File list ────────────────────────────────────────────────────────────── */
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-sub);
  transition: background 0.1s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--bg-hover); }

.file-icon {
  font-size: 14px;
  flex-shrink: 0;
  color: var(--text-dim);
}

.file-name {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
}

.file-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.file-badge.pcb { background: rgba(163, 113, 247, 0.15); color: var(--purple); border: 1px solid rgba(163, 113, 247, 0.3); }
.file-badge.sch { background: rgba(210, 153, 34, 0.12); color: var(--amber); border: 1px solid rgba(210, 153, 34, 0.25); }
.file-badge.sym { background: rgba(88, 166, 255, 0.12); color: var(--accent); border: 1px solid rgba(88, 166, 255, 0.25); }
.file-badge.other { background: rgba(139, 148, 158, 0.12); color: var(--text-dim); border: 1px solid rgba(139, 148, 158, 0.2); }

.file-open-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.file-open-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── GitHub info block ────────────────────────────────────────────────────── */
.gh-info-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
}

.gh-info-row {
  display: contents;
}

.gh-info-label {
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-sub);
  white-space: nowrap;
}
.gh-info-label:last-of-type { border-bottom: none; }

.gh-info-value {
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border-sub);
  word-break: break-all;
}
.gh-info-value:last-of-type { border-bottom: none; }
.gh-info-value a { color: var(--accent); text-decoration: none; }
.gh-info-value a:hover { text-decoration: underline; }

.gh-info-row:last-child .gh-info-label,
.gh-info-row:last-child .gh-info-value { border-bottom: none; }

/* Sync output block */
#sync-output-wrap {
  margin-top: 12px;
}

.sync-output-box {
  background: var(--bg-page);
  border: 1px solid var(--border-sub);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}
.sync-output-box.success { color: var(--green); border-color: rgba(63, 185, 80, 0.3); }
.sync-output-box.error   { color: var(--red);   border-color: rgba(248, 81, 73, 0.3); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover:not(:disabled) { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary  { background: var(--accent); color: #fff; }
.btn-secondary {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-danger {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.btn-sync {
  background: none;
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--green);
}
.btn-sync:hover:not(:disabled) { background: rgba(63, 185, 80, 0.1); }

/* Icon-only button */
.btn-icon {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.15s;
  padding: 0;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: rgba(88, 166, 255, 0.1); }

/* Mobile back button */
#detail-back-btn {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
}
#detail-back-btn:hover { opacity: 0.8; }

/* ── Import modal ─────────────────────────────────────────────────────────── */
#import-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#import-overlay.open { display: flex; }

/* Admin modal */
#dash-admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#dash-admin-modal > div {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  width: 100%;
  max-width: 480px;
}
#dash-admin-modal h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.dash-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
#dash-admin-modal input[type="text"],
#dash-admin-modal input[type="password"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  min-width: 0;
}

#import-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  width: 560px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

#import-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

#import-box h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  flex: 1;
}

#import-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.itab {
  flex: 1;
  padding: 7px 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.itab.active { background: var(--accent-dim); color: var(--accent); }
.itab:hover:not(.active) { background: var(--bg-hover); }

.itab-body { display: flex; flex-direction: column; gap: 12px; }
.itab-body.hidden { display: none; }

.import-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.import-field label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}
.label-opt {
  font-weight: 400;
  color: var(--text-dim);
  opacity: 0.7;
}
.import-field input[type="text"],
.import-field input[type="file"] {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  width: 100%;
}
.import-field input:focus { border-color: var(--accent); }
.import-field input::placeholder { color: var(--text-dim); }

.import-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.import-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.import-hint code {
  background: var(--bg-hover);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text);
}

#import-progress {
  font-size: 12px;
  color: var(--text-dim);
  min-height: 18px;
}
#import-progress.error   { color: var(--red); }
#import-progress.success { color: var(--green); }

.import-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── GitHub connect box ───────────────────────────────────────────────────── */
.gh-connect-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.gh-connect-icon {
  font-size: 24px;
  color: var(--accent);
  flex-shrink: 0;
}
.gh-connect-text {
  flex: 1;
  min-width: 0;
}
.gh-connect-text strong {
  font-size: 13px;
  color: var(--text-bright);
  display: block;
  margin-bottom: 3px;
}
.gh-connect-text p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ── GitHub repo browser ──────────────────────────────────────────────────── */
#gh-repo-search-wrap {
  margin-bottom: 8px;
}

#gh-repo-search {
  width: 100%;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
#gh-repo-search:focus { border-color: var(--accent); }
#gh-repo-search::placeholder { color: var(--text-dim); }
#gh-repo-search::-webkit-search-cancel-button { display: none; }

#gh-repo-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-page);
}
#gh-repo-list::-webkit-scrollbar { width: 4px; }
#gh-repo-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.repo-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-sub);
  transition: background 0.1s;
}
.repo-row:last-child { border-bottom: none; }
.repo-row:hover { background: var(--bg-hover); }

.repo-row-main {
  flex: 1;
  min-width: 0;
}

.repo-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.repo-row-desc {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo-row-badges {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.repo-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.repo-badge.private { background: rgba(248, 81, 73, 0.1); color: #f97316; border: 1px solid rgba(248, 81, 73, 0.2); }
.repo-badge.public  { background: rgba(63, 185, 80, 0.1); color: var(--green); border: 1px solid rgba(63, 185, 80, 0.2); }
.repo-badge.kicad   { background: rgba(163, 113, 247, 0.1); color: var(--purple); border: 1px solid rgba(163, 113, 247, 0.2); }

.repo-row-time {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  margin-top: 3px;
}

/* Skeleton loading rows */
.repo-skeleton {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-sub);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.repo-skeleton:last-child { border-bottom: none; }

.skel {
  background: var(--bg-hover);
  border-radius: 3px;
  animation: skel-pulse 1.4s ease-in-out infinite;
}
.skel-line-lg { height: 12px; width: 55%; }
.skel-line-sm { height: 10px; width: 80%; }

@keyframes skel-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ── Manual URL section ───────────────────────────────────────────────────── */
#gh-manual-section {
  border: 1px solid var(--border-sub);
  border-radius: 6px;
  overflow: hidden;
}

#gh-manual-summary {
  list-style: none;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  background: var(--bg-hover);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
#gh-manual-summary::-webkit-details-marker { display: none; }
#gh-manual-summary::before {
  content: '▶';
  font-size: 9px;
  transition: transform 0.15s;
}
details[open] > #gh-manual-summary::before { transform: rotate(90deg); }
#gh-manual-summary:hover { color: var(--text); }

.gh-manual-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--bg-page);
}

/* ── Project picker ───────────────────────────────────────────────────────── */
#gh-picker {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
#gh-picker label.picker-title { color: var(--text-dim); margin-bottom: 4px; font-weight: 500; }
.gh-pick-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  padding: 3px 0;
}
.gh-pick-option:hover { color: var(--accent); }
.gh-pick-option input { accent-color: var(--accent); }

/* ── Login modal ──────────────────────────────────────────────────────────── */
#login-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
#login-modal.open { display: flex; }

#login-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 360px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#login-box h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  text-align: center;
}
#login-box input {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  width: 100%;
}
#login-box input:focus { border-color: var(--accent); }
#login-box input::placeholder { color: var(--text-dim); }
#login-error {
  font-size: 12px;
  color: var(--red);
  min-height: 16px;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  z-index: 400;
  display: none;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  line-height: 1.4;
}
#toast.show    { display: block; }
#toast.success { border-color: var(--green); color: var(--green); }
#toast.error   { border-color: var(--red);   color: var(--red);   }
#toast.info    { border-color: var(--accent); color: var(--text); }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive — mobile ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  body { overflow: auto; }

  #dash-app {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }

  #dash-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: calc(100vh - var(--header-h));
    overflow: hidden;
  }

  #dash-sidebar.mobile-hidden { display: none; }

  #dash-detail {
    overflow: visible;
    height: auto;
    min-height: calc(100vh - var(--header-h));
  }

  #dash-detail.mobile-hidden { display: none; }

  #detail-content {
    padding: 20px 16px;
  }

  #detail-back-btn { display: flex; }

  #import-box { padding: 18px; }

  .import-field-row {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    flex-wrap: wrap;
  }
  .detail-actions .btn-spacer { display: none; }
}
