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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a26;
  --bg-card: #16161f;
  --bg-hover: #1e1e2c;
  --bg-input: #0e0e18;
  --border: #1e1e30;
  --border-light: #252538;

  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #6e6e80;

  --accent: #7c6cff;
  --accent-hover: #8f80ff;
  --accent-2: #e040fb;
  --accent-glow: rgba(124, 108, 255, 0.15);
  --accent-soft: rgba(124, 108, 255, 0.08);

  --green: #00e676;
  --green-bg: rgba(0, 230, 118, 0.1);
  --yellow: #ffd600;
  --yellow-bg: rgba(255, 214, 0, 0.1);
  --orange: #ff9100;
  --orange-bg: rgba(255, 145, 0, 0.1);
  --red: #ff5252;
  --red-bg: rgba(255, 82, 82, 0.1);
  --cyan: #00e5ff;
  --cyan-bg: rgba(0, 229, 255, 0.1);

  --sidebar-width: 264px;
  --topbar-height: 56px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.5);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --content-max: 1680px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1100px 600px at 100% -10%, rgba(124, 108, 255, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(224, 64, 251, 0.05), transparent 55%),
    var(--bg-primary);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-size: 15px;
}

::selection { background: var(--accent-glow); color: #fff; }

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 8px; border: 2px solid var(--bg-primary); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-secondary), #0e0e16);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition), box-shadow var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 20px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-icon { width: 38px; height: 38px; object-fit: contain; }
.sidebar-logo .logo-text { font-size: 18px; font-weight: 700; letter-spacing: -0.4px; }
.sidebar-logo .logo-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 3px; margin-top: 10px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  position: relative;
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); transform: translateX(2px); }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.sidebar-nav a .nav-icon {
  width: 22px;
  text-align: center;
  font-size: 15px;
  opacity: 0.9;
  flex-shrink: 0;
}
.sidebar-nav .nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  padding: 18px 12px 6px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 12px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}
.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.sidebar-user .user-role { font-size: 11px; color: var(--text-muted); }

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}
.btn-logout:hover { background: var(--red-bg); border-color: rgba(255, 82, 82, 0.35); color: var(--red); }

/* ---------- Topbar (mobile/tablet) ---------- */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  z-index: 210;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: rgba(18, 18, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 19px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}
.topbar-menu-btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -0.3px; }
.topbar-logo { width: 26px; height: 26px; object-fit: contain; }
.topbar-user {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- Main content ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 34px 40px;
  min-height: 100vh;
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.2; }
.page-header .page-description { font-size: 14px; color: var(--text-muted); margin-top: 6px; max-width: 620px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.2px;
  line-height: 1;
  min-height: 42px;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff; box-shadow: 0 3px 14px rgba(124, 108, 255, 0.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-hover), #a090ff); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124, 108, 255, 0.4); }
.btn-success { background: linear-gradient(135deg, var(--green), #00b248); color: #04210f; box-shadow: 0 3px 12px rgba(0, 230, 118, 0.22); }
.btn-success:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-danger { background: transparent; border: 1px solid rgba(255, 82, 82, 0.4); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-secondary { background: var(--bg-tertiary); border: 1px solid var(--border-light); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--text-muted); }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; border-radius: var(--radius-xs); }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 8px 12px; }
.btn-loading { opacity: 0.7; cursor: wait; pointer-events: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---------- Alerts ---------- */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
  border: 1px solid transparent;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.alert-danger { background: var(--red-bg); color: var(--red); border-color: rgba(255, 82, 82, 0.2); }
.alert-success { background: var(--green-bg); color: var(--green); border-color: rgba(0, 230, 118, 0.2); }
.alert-info { background: var(--cyan-bg); color: var(--cyan); border-color: rgba(0, 229, 255, 0.2); }

/* ---------- Repo grid & cards ---------- */
.repo-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.repo-card {
  --rc: var(--text-muted);
  --rc-glow: rgba(110, 110, 128, 0.08);
  background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border);
  border-left: 4px solid var(--rc);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.repo-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle at top right, var(--rc-glow), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.repo-card.status-green  { --rc: var(--green);  --rc-glow: rgba(0, 230, 118, 0.12); }
.repo-card.status-yellow { --rc: var(--yellow); --rc-glow: rgba(255, 214, 0, 0.1); }
.repo-card.status-orange { --rc: var(--orange); --rc-glow: rgba(255, 145, 0, 0.1); }
.repo-card.status-cyan   { --rc: var(--cyan);   --rc-glow: rgba(0, 229, 255, 0.1); }
.repo-card.status-red    { --rc: var(--red);    --rc-glow: rgba(255, 82, 82, 0.1); }
.repo-card.status-gray   { --rc: var(--text-muted); }
.repo-card:hover {
  border-color: var(--rc);
  background: var(--bg-hover);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(124,108,255,0.05);
  transform: translateY(-3px);
}
.repo-card:hover::before { opacity: 1; }

.repo-status-ring {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  z-index: 1;
}
.repo-card:hover .repo-status-ring {
  transform: scale(1.08);
  box-shadow: 0 0 20px var(--rc-glow);
}
.repo-status-ring .ring-num { font-size: 18px; line-height: 1; font-weight: 700; }
.repo-status-ring .ring-arrow { font-size: 11px; line-height: 1; margin-top: 2px; opacity: 0.9; }
.repo-status-ring.green  { background: var(--green-bg);  border: 1.5px solid var(--green);  color: var(--green); }
.repo-status-ring.yellow { background: var(--yellow-bg); border: 1.5px solid var(--yellow); color: var(--yellow); }
.repo-status-ring.orange { background: var(--orange-bg); border: 1.5px solid var(--orange); color: var(--orange); }
.repo-status-ring.cyan   { background: var(--cyan-bg);   border: 1.5px solid var(--cyan);   color: var(--cyan); }
.repo-status-ring.red    { background: var(--red-bg);    border: 1.5px solid var(--red);    color: var(--red); }
.repo-status-ring.gray   { background: var(--bg-tertiary); border: 1.5px solid var(--text-muted); color: var(--text-muted); }

.repo-info { flex: 1; min-width: 0; padding-top: 3px; }
.repo-info h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 10px; line-height: 1.25; }
.repo-info h3 a { color: var(--text-primary); text-decoration: none; transition: color var(--transition); }
.repo-info h3 a:hover { color: var(--accent); }

.repo-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 769px) {
  .repo-meta-line {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}
.repo-meta-line .sep { color: var(--border-light); }

/* ---------- Clean repo dot ---------- */
.repo-status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 20px;
  margin-left: 5px;
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.35);
  position: relative;
  z-index: 1;
}
.repo-status-dot.green { background: var(--green); }

/* ---------- Owner & branch row ---------- */
.repo-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding-top: 2px;
}
.repo-owner {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}
.repo-branch {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ---------- Bottom row: badges + actions ---------- */
.repo-bottom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.repo-badges-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badges {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.badge-green  { background: var(--green-bg);  color: var(--green); border: 1px solid rgba(0, 230, 118, 0.15); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(255, 214, 0, 0.15); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(255, 145, 0, 0.15); }
.badge-red    { background: var(--red-bg);    color: var(--red); border: 1px solid rgba(255, 82, 82, 0.15); }
.badge-cyan   { background: var(--cyan-bg);   color: var(--cyan); border: 1px solid rgba(0, 229, 255, 0.15); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-light); }

.repo-status-pill {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 1;
}
.repo-status-pill.green  { background: var(--green-bg);  color: var(--green); border: 1px solid rgba(0, 230, 118, 0.15); }
.repo-status-pill.yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(255, 214, 0, 0.15); }
.repo-status-pill.orange { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(255, 145, 0, 0.15); }
.repo-status-pill.cyan   { background: var(--cyan-bg);   color: var(--cyan); border: 1px solid rgba(0, 229, 255, 0.15); }
.repo-status-pill.red    { background: var(--red-bg);    color: var(--red); border: 1px solid rgba(255, 82, 82, 0.15); }
.repo-status-pill.gray   { background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border-light); }

.repo-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-state .empty-icon { font-size: 52px; margin-bottom: 18px; opacity: 0.5; }
.empty-state h3 { font-size: 19px; color: var(--text-primary); margin-bottom: 8px; font-weight: 600; }
.empty-state p { color: var(--text-muted); margin-bottom: 22px; font-size: 14px; max-width: 400px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-body { padding: 22px; }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 70px; height: 70px;
  background: radial-gradient(circle at top right, var(--accent-glow), transparent 70%);
  opacity: 0.6;
}
.stat-card .stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 10px; }
.stat-card .stat-value { font-size: 30px; font-weight: 700; letter-spacing: -1px; }

/* ---------- Console ---------- */
.console {
  background: #0a0a14;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.8;
  color: #c0c0d0;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.console-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.console-header .dot { width: 10px; height: 10px; border-radius: 50%; }
.console-header .dot.red { background: #ff5f57; }
.console-header .dot.yellow { background: #febc2e; }
.console-header .dot.green { background: #28c840; }
.console .added { color: #4caf50; }
.console .modified { color: #ff9800; }
.console .deleted { color: var(--red); }
.console .renamed { color: #ce93d8; }
.console .warning { color: var(--yellow); }
.sync-console {
  background: #08080f;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.8;
  max-height: 450px;
  overflow-y: auto;
  min-height: 180px;
  white-space: pre-wrap;
  word-break: break-word;
}
.sync-console .success { color: var(--green); }
.sync-console .danger { color: var(--red); }
.sync-console .warning { color: var(--yellow); }
.sync-console .info { color: #58a6ff; }
.sync-console .muted { color: var(--text-muted); }

/* ---------- Sections ---------- */
.section { margin-bottom: 30px; }
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.log-entry { padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.log-entry:last-child { border-bottom: none; }
.log-entry .time { color: var(--text-muted); }
.log-entry .action { font-weight: 600; }
.flex-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ---------- Forms ---------- */
.form-container { max-width: 640px; }
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.form-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.form-card .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 26px; }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 15px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group .help-text { display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition);
}
.checkbox-group:hover { border-color: var(--text-muted); }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.checkbox-group span { font-size: 13px; color: var(--text-secondary); }
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.repo-meta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}
.repo-meta-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.repo-meta-item .label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.repo-meta-item .value { font-size: 13px; color: var(--text-primary); font-family: 'JetBrains Mono', monospace; word-break: break-word; }

/* ---------- Login ---------- */
.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 108, 255, 0.12), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(224, 64, 251, 0.08), transparent 35%),
    var(--bg-primary);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(22, 22, 31, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 42px;
  box-shadow: var(--shadow-lg);
}
.login-card .login-logo { text-align: center; margin-bottom: 30px; }
.login-card .login-logo .icon { width: 64px; height: 64px; object-fit: contain; margin-bottom: 16px; }
.login-card h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.login-card .login-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Mobile menu helpers ---------- */
.mobile-menu-btn { display: none; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 190;
  opacity: 0;
  animation: fadeIn 0.2s ease forwards;
}

/* ---------- Folder browser ---------- */
.folder-browser {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  margin-top: 6px;
  overflow: hidden;
}
.fb-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  overflow-x: auto;
  white-space: nowrap;
}
.fb-breadcrumbs a { color: var(--accent); text-decoration: none; padding: 3px 7px; border-radius: 4px; transition: background var(--transition); }
.fb-breadcrumbs a:hover { background: var(--accent-glow); }
.fb-breadcrumbs .fb-sep { color: var(--text-muted); }
.fb-breadcrumbs .fb-current { color: var(--text-primary); font-weight: 600; padding: 3px 7px; }
.fb-toolbar { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fb-toolbar button {
  padding: 6px 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.fb-toolbar button:hover { background: var(--bg-hover); color: var(--text-primary); }
.fb-toolbar button.fb-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.fb-list { max-height: 300px; overflow-y: auto; }
.fb-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}
.fb-entry:hover { background: var(--bg-hover); }
.fb-entry.selected { background: var(--accent-soft); border-left: 2px solid var(--accent); }
.fb-entry .fb-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.fb-entry .fb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.fb-entry .fb-tag { font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 600; }
.fb-entry .fb-tag.git-tag { background: var(--orange-bg); color: var(--orange); }
.fb-loading { text-align: center; padding: 14px; color: var(--text-muted); font-size: 12px; }
.fb-selected-path {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  flex-wrap: wrap;
}
.fb-selected-path .fb-select-btn {
  margin-left: auto;
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}
.fb-selected-path .fb-select-btn:hover { background: var(--accent-hover); }
.fb-full-preview { white-space: pre-wrap; word-break: break-word; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-secondary); max-height: 320px; overflow: auto; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 880px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; color: var(--text-primary);
}
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 24px; cursor: pointer; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body {
  padding: 20px; overflow-y: auto; font-size: 13px; line-height: 1.6;
  font-family: 'JetBrains Mono', monospace; white-space: pre-wrap;
  word-break: break-word; color: var(--text-secondary);
}
.modal-body .diff-added { color: #4caf50; }
.modal-body .diff-removed { color: var(--red); }
.modal-body .diff-header { color: var(--accent); font-weight: 600; }
.modal-body .diff-hunk { color: var(--cyan); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Accounts UI ---------- */
.accounts-list { display: flex; flex-direction: column; gap: 12px; }
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.account-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.account-label { font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.account-user { font-size: 12px; color: var(--text-muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.account-token-hint { font-family: 'JetBrains Mono', monospace; color: var(--text-muted); }
.account-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.account-edit-form {
  margin: 4px 0 10px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.account-edit-form .form-actions { margin-top: 8px; }
select {
  width: 100%;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- PR cards ---------- */
.pr-grid { display: flex; flex-direction: column; gap: 14px; }
.pr-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.pr-card:hover { border-color: var(--border-light); box-shadow: var(--shadow); transform: translateY(-1px); }
.pr-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pr-number { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; color: var(--accent); }
.pr-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.pr-title a { color: var(--text-primary); text-decoration: none; transition: color var(--transition); }
.pr-title a:hover { color: var(--accent); }
.pr-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-bottom: 10px; flex-wrap: wrap; }
.pr-repo { color: var(--cyan); font-family: 'JetBrains Mono', monospace; }
.pr-author { color: var(--text-secondary); }
.pr-date { color: var(--text-muted); }
.pr-branches { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.branch-badge { background: var(--bg-tertiary); border: 1px solid var(--border-light); border-radius: 6px; padding: 3px 10px; font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--text-secondary); }
.pr-arrow { color: var(--text-muted); font-size: 16px; }
.pr-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ''; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px; background: var(--border); border-radius: 2px; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -24px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg-tertiary); border: 2px solid var(--border); z-index: 1;
}
.timeline-dot.commit { background: var(--green); border-color: var(--green); }
.timeline-dot.push { background: var(--cyan); border-color: var(--cyan); }
.timeline-dot.pull { background: var(--yellow); border-color: var(--yellow); }
.timeline-dot.sync { background: var(--accent); border-color: var(--accent); }
.timeline-dot.merge { background: var(--orange); border-color: var(--orange); }
.timeline-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; transition: border-color var(--transition); }
.timeline-content:hover { border-color: var(--border-light); }
.timeline-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.timeline-type { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.timeline-repo { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.timeline-date { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.timeline-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.timeline-body .commit-hash { font-family: 'JetBrains Mono', monospace; color: var(--accent); margin-right: 8px; font-size: 12px; }
.timeline-author { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.timeline-detail { color: var(--text-muted); font-size: 11px; }

/* ---------- Charts ---------- */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.chart-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 16px; }
.chart-container { position: relative; height: 250px; }

/* ---------- Webhook / watch / misc ---------- */
.webhook-url { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.webhook-url code { flex: 1; min-width: 0; padding: 12px 16px; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-sm); font-size: 13px; word-break: break-all; color: var(--accent); }
.setup-guide { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 22px; }
.setup-guide ol { padding-left: 20px; color: var(--text-secondary); font-size: 13px; line-height: 2; }

.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.watch-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.watch-panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.watch-status-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.watch-status-dot.green { background: var(--green); }
.watch-status-dot.orange { background: var(--orange); }
.watch-status-dot.red { background: var(--red); }
.watch-console { background: #08080f; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.7; max-height: 220px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.global-console { background: #08080f; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.8; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.watch-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Generic table (diffs / commit details) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table td:first-child { color: var(--text-muted); white-space: nowrap; width: 90px; }

/* ---------- Utility classes ---------- */
.muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-cyan { color: var(--cyan); }
.text-red { color: var(--red); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.hidden { display: none !important; }

/* ---------- Entrance animation ---------- */
.repo-card, .stat-card, .form-card, .card, .empty-state, .pr-card, .account-row, .watch-panel {
  animation: fadeIn 0.35s ease forwards;
}

/* ======================== RESPONSIVE ======================== */

/* Large desktop */
@media (min-width: 1600px) {
  .main-content { padding: 40px 56px; }
  .page-header h1 { font-size: 30px; }
  body { font-size: 15px; }
  .repo-grid { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 24px; }
}

@media (min-width: 2000px) {
  .repo-grid { grid-template-columns: repeat(auto-fill, minmax(450px, 1fr)); gap: 26px; }
}

/* Tablet & below: off-canvas sidebar + topbar */
@media (max-width: 1024px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: none;
    width: 280px;
    padding-top: calc(var(--topbar-height) + 16px);
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content {
    margin: 0;
    padding: calc(var(--topbar-height) + 22px) 28px 28px;
    max-width: 100%;
  }
  .page-header h1 { font-size: 25px; }
}

@media (max-width: 768px) {
  body { font-size: 14px; }
  .main-content { padding: calc(var(--topbar-height) + 18px) 18px 24px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-header h1 { font-size: 23px; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; min-width: 0; }
  .flex-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-container { height: 200px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .repo-card { flex-direction: column; align-items: flex-start; gap: 16px; }
  .repo-info { width: 100%; }
  .repo-bottom-row { flex-wrap: wrap; }
  .repo-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .repo-actions .btn { flex: 0 1 auto; }
  .repo-status-ring { min-width: 46px; width: 46px; height: 46px; font-size: 13px; }
  .repo-status-dot { margin-top: 6px; }
  .repo-meta-row { flex-wrap: wrap; gap: 6px; }
  .repo-branch { margin-left: 0; }
  .form-card { padding: 22px; }
  .login-card { padding: 30px 24px; }
  .repo-meta { flex-direction: column; gap: 14px; align-items: flex-start; }
  .repo-meta-item { width: 100%; }
  .section-title { font-size: 13px; }
  .account-row { flex-direction: column; align-items: stretch; }
  .account-actions { justify-content: flex-start; }
  .account-edit-form .form-row { grid-template-columns: 1fr; }
  .pr-card { padding: 16px 18px; }
}

@media (max-width: 600px) {
  .repo-grid { grid-template-columns: 1fr; }
  .watch-grid { grid-template-columns: 1fr; }
  .repo-bottom-row { flex-direction: column; align-items: stretch; }
  .repo-badges-left { width: 100%; }
  .repo-actions { flex-direction: column; align-items: stretch; }
  .repo-actions .btn { width: 100%; }
  .repo-actions form { display: flex; width: 100%; }
  .repo-actions form .btn { width: 100%; }
  .header-actions { flex-direction: column; align-items: stretch; }
  .header-actions .btn { width: 100%; }
  .page-header h1 { font-size: 21px; }
  .form-group input, .form-group select { font-size: 16px; }
  .console, .sync-console, .watch-console, .global-console { font-size: 11.5px; }
  .timeline { padding-left: 26px; }
  .timeline-dot { left: -20px; }
}

@media (max-width: 400px) {
  .main-content { padding: calc(var(--topbar-height) + 14px) 14px 18px; }
  .btn { padding: 10px 14px; font-size: 13px; }
  .repo-card { padding: 16px; }
  .page-header h1 { font-size: 19px; }
  .stat-card .stat-value { font-size: 26px; }
  .login-card { padding: 26px 18px; }
}

/* Touch devices: larger tap targets */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .sidebar-nav a { padding: 13px 14px; }
  .fb-entry { padding: 13px 14px; }
  .checkbox-group input[type="checkbox"] { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
