/* ══════════════════════════════════════════════════════════════════════
   GLOBAL RESET — single source of truth
══════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══════════════════════════════════════════════════════════════════════
   SHARED TOP BAR — single source of truth for every header bar
══════════════════════════════════════════════════════════════════════ */
:root {
  /* ═══ Shared brand tokens ═══ */
  --brand-accent:      #7f77dd;
  --brand-accent-dim:  #534ab7;
  --brand-danger:      #e24b4a;
  --brand-danger-dim:  #c43a39;
  --brand-success:     #1d9e75;

  --hdr-bg:       #0e0f11;
  --hdr-surface:  #16181c;
  --hdr-col:      #1d1f25;
  --hdr-hover:    #24272f;
  --hdr-border:   rgba(255,255,255,0.07);
  --hdr-border2:  rgba(255,255,255,0.14);
  --hdr-text:     #e8e6f0;
  --hdr-muted:    #9896a8;
  --hdr-dim:      #5c5a6b;
  --hdr-accent:   var(--brand-accent);
  --hdr-accent-s: rgba(127,119,221,0.15);
  --hdr-danger:   var(--brand-danger);
  --hdr-height:   56px;
}
html[data-app-theme="light"] {
  --brand-accent:      #6c64cc;
  --brand-accent-dim:  #4e47a0;
  --brand-danger:      #d93535;
  --brand-danger-dim:  #b82f2f;
  --brand-success:     #1a8c68;

  --hdr-bg:       #f4f3f8;
  --hdr-surface:  #ffffff;
  --hdr-col:      #f9f8fc;
  --hdr-hover:    #f0eef8;
  --hdr-border:   rgba(0,0,0,0.08);
  --hdr-border2:  rgba(0,0,0,0.15);
  --hdr-text:     #1a1828;
  --hdr-muted:    #5a5870;
  --hdr-dim:      #9896a8;
  --hdr-accent:   var(--brand-accent);
  --hdr-accent-s: rgba(108,100,204,0.12);
  --hdr-danger:   var(--brand-danger);
}

.app-topbar {
  height: var(--hdr-height);
  background: var(--hdr-surface);
  border-bottom: 1px solid var(--hdr-border);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; flex-shrink: 0; z-index: 40;
  font-family: 'Inter', system-ui, sans-serif;
}
/* Force the top bar to the exact same background everywhere. */
.app-topbar, #toolbar, #tm-header, header.app-topbar {
  background: var(--hdr-surface) !important;
  border-bottom: 1px solid var(--hdr-border) !important;
}

.app-switcher, .app-view-switcher { position: relative; }
.app-switcher-btn {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px 0 8px;
  border-radius: 10px;
  background: var(--hdr-col); border: 0.5px solid var(--hdr-border);
  cursor: pointer; color: var(--hdr-text); font-size: 13px; font-weight: 500;
  transition: background .12s, border-color .12s;
}
.app-switcher-btn:hover { background: var(--hdr-hover); border-color: var(--hdr-border2); }
.app-switcher-btn .btn-icon {
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.app-switcher-btn .btn-icon i { font-size: 15px; color: var(--hdr-dim); }
.app-switcher-btn span { font-size: 13px; font-weight: 500; }
.app-switcher-btn .app-chevron, .app-switcher-btn .chevron {
  font-size: 14px; color: var(--hdr-dim); margin-left: 2px; transition: transform .18s;
}
.app-switcher-btn.open .app-chevron, .app-switcher-btn.open .chevron { transform: rotate(180deg); }

.app-switcher-dd {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 220px; background: var(--hdr-surface);
  border: 0.5px solid var(--hdr-border2); border-radius: 14px;
  padding: 6px; z-index: 200; box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.app-switcher-dd.open { display: block; animation: appDdIn .14s ease; }
@keyframes appDdIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
.app-dd-item, .dd-item, .tm-dd-item, .wb-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  font-size: 13px; color: var(--hdr-muted); transition: background .1s, color .1s;
}
.app-dd-item:hover, .dd-item:hover:not(.dd-disabled), .tm-dd-item:hover, .wb-dd-item:hover { background: var(--hdr-hover); color: var(--hdr-text); }
.app-dd-item.active, .dd-item.dd-active, .tm-dd-item.active, .wb-dd-item.wb-dd-active { background: var(--hdr-accent-s); color: var(--hdr-accent); }
.app-dd-item.disabled, .dd-item.dd-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.app-dd-icon, .dd-icon, .tm-dd-icon, .wb-dd-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--hdr-dim);
}
.app-dd-item.active .app-dd-icon, .dd-item.dd-active .dd-icon, .tm-dd-item.active .tm-dd-icon { color: var(--hdr-accent); }
.app-dd-text, .dd-item-text, .tm-dd-text, .wb-dd-text { flex: 1; }
.app-dd-title, .dd-item-title, .tm-dd-title, .wb-dd-title { font-weight: 500; font-size: 13px; }
.app-dd-sub, .dd-item-sub, .tm-dd-sub, .wb-dd-sub { font-size: 11px; color: var(--hdr-dim); margin-top: 1px; }
.app-dd-badge, .dd-badge, .tm-dd-badge, .wb-dd-badge { font-size: 10px; padding: 1px 6px; border-radius: 20px; background: var(--hdr-col); color: var(--hdr-dim); font-weight: 500; flex-shrink: 0; }
.app-dd-item.active .app-dd-badge, .dd-item.dd-active .dd-badge, .tm-dd-item.active .tm-dd-badge { background: var(--hdr-accent-s); color: var(--hdr-accent); }
.app-dd-sep, .dd-sep, .tm-dd-sep, .wb-dd-sep { height: 0.5px; background: var(--hdr-border); margin: 4px 0; }

.app-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* Toolbar/header pill button */
.app-hbtn, .tm-hbtn {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--hdr-border2); background: var(--hdr-col); color: var(--hdr-muted);
  font-family: 'Inter', sans-serif; transition: background .12s, color .12s;
  white-space: nowrap;
}
.app-hbtn:hover, .tm-hbtn:hover { background: var(--hdr-hover); color: var(--hdr-text); }
.app-hbtn.primary, .tm-hbtn.primary { background: var(--hdr-accent); color: #fff; border-color: transparent; }
.app-hbtn.primary:hover, .tm-hbtn.primary:hover { opacity: .88; }
.app-hbtn i, .tm-hbtn i { font-size: 14px; }
.app-hbtn:disabled { opacity: 1; cursor: default; color: var(--hdr-dim); }
.app-hbtn:disabled:hover { background: var(--hdr-col); color: var(--hdr-dim); }
.app-hbtn.icon-only { width: 32px; padding: 0; justify-content: center; font-size: 14px; }

/* ══════════════════════════════════════════════════════════════════════
   SHARED MODAL BACKDROP / TOAST / FORM / DOT
══════════════════════════════════════════════════════════════════════ */
.app-modal-backdrop {
  display: none; position: fixed; inset: 0;
  align-items: center; justify-content: center;
}
.app-modal-backdrop.open { display: flex; }

.app-toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 9px 18px; font-size: 13px;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; white-space: nowrap;
  border-radius: 10px; border: 1px solid transparent;
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes appModalIn { from{opacity:0;transform:translateY(8px)scale(.98)} to{opacity:1;transform:none} }

.app-form-group { display: flex; flex-direction: column; gap: 6px; }
.app-dot-sm { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

@keyframes viewFadeIn { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:translateY(0); } }
.view-transition { animation: viewFadeIn 0.18s ease forwards; }

/* ══════════════════════════════════════════════════════════════════════
   PAGE-SPECIFIC STYLES — GitLab Projects Explorer
   (everything below is exclusive to this page)
══════════════════════════════════════════════════════════════════════ */

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--hdr-bg); color: var(--hdr-text);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
::selection { background: var(--brand-accent); color: #fff; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hdr-hover); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* This page's bar wraps to host the profile, unlike the fixed 56px bars */
.app-topbar {
  position: sticky; top: 0;
  min-height: var(--hdr-height);
  padding: 10px 16px; flex-wrap: wrap;
}
.tb-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; flex-wrap: wrap; }
.tb-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: block;
  border: 1.5px solid var(--hdr-border2); box-shadow: 0 0 0 3px var(--hdr-accent-s);
}
.tb-info { min-width: 0; }
.tb-namerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-name { font-size: 14.5px; font-weight: 600; }
.handle { color: var(--hdr-accent); text-decoration: none; font-size: 12.5px; font-weight: 500; }
.handle:hover { text-decoration: underline; }
.tb-meta { display: inline-flex; align-items: center; gap: 5px; color: var(--hdr-dim); font-size: 12px; white-space: nowrap; }
.tb-bio {
  width: 100%; margin-top: 3px;
  color: var(--hdr-muted); font-size: 12.5px; line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Header skeleton (before user data arrives) */
.tb-sk { display: flex; align-items: center; gap: 12px; flex: 1; }
.tb-sk .avatar-sk { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.tb-sk .lines-sk { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.tb-sk .l1 { height: 11px; width: 180px; border-radius: 6px; }
.tb-sk .l2 { height: 9px; width: 260px; border-radius: 6px; }

/* Theme toggle icons */
.ic-sun { display: none; }
html[data-app-theme="light"] .ic-sun { display: block; }
html[data-app-theme="light"] .ic-moon { display: none; }

/* Language dropdown: right-aligned (sits at the bar's right edge),
   overriding the shared left-aligned default */
#lang-dd { left: auto; right: 0; min-width: 170px; }
html[data-app-theme="light"] #lang-dd { box-shadow: 0 8px 32px rgba(20,30,60,.14); }
.app-dd-icon svg { visibility: hidden; }
.app-dd-item.active .app-dd-icon svg { visibility: visible; }

.container { max-width: 1000px; margin: 0 auto; padding: 0 24px; }
.fade { animation: viewFadeIn 0.18s ease both; }

/* Panels */
.panel { background: var(--hdr-surface); border: 1px solid var(--hdr-border); border-radius: 14px; }

/* Languages chart */
.langs { margin-top: 24px; padding: 18px 20px; }
.panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--hdr-dim); font-weight: 500; }
.lang-row { display: flex; align-items: center; gap: 10px; margin-top: 11px; font-size: 13px; color: var(--hdr-muted); }
.lang-name { width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-bar { flex: 1; height: 6px; background: var(--hdr-col); border-radius: 99px; overflow: hidden; }
.lang-bar i { display: block; height: 100%; border-radius: 99px; transition: width .5s ease; }
.lang-count { width: 26px; text-align: right; color: var(--hdr-dim); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin: 28px 0 14px; }
.toolbar h2 { font-size: 16px; font-weight: 600; display: flex; align-items: center; }
.count-badge {
  display: inline-grid; place-items: center; min-width: 24px; height: 20px; padding: 0 8px;
  margin-left: 8px; border-radius: 20px; background: var(--hdr-accent-s);
  color: var(--hdr-accent); font-size: 11px; font-weight: 500;
}
.controls { display: flex; gap: 8px; }
input, select {
  background: var(--hdr-col); border: 1px solid var(--hdr-border);
  color: var(--hdr-text); border-radius: 8px; padding: 8px 12px;
  font: inherit; font-size: 13px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--hdr-dim); }
input:focus, select:focus { border-color: var(--hdr-accent); box-shadow: 0 0 0 3px var(--hdr-accent-s); }
input { width: 220px; }

/* Project grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card {
  background: var(--hdr-surface); border: 1px solid var(--hdr-border); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
  animation: viewFadeIn 0.18s ease both;
  transition: border-color .15s, transform .15s, box-shadow .15s, background .15s;
  color: inherit; text-decoration: none; cursor: pointer;
}
.card:hover, .card:focus-visible {
  border-color: var(--hdr-accent);
  background: var(--hdr-hover);
  box-shadow: 0 0 0 3px var(--hdr-accent-s);
  transform: translateY(-2px);
  outline: none;
}
.card:hover h3 { color: var(--hdr-accent); }
.card h3 { font-size: 14px; font-weight: 600; line-height: 1.4; transition: color .15s; }
.desc {
  color: var(--hdr-muted); font-size: 12.5px; line-height: 1.55; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.readme {
  color: var(--hdr-muted); font-size: 12.5px; line-height: 1.55; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.readme.sk { flex: 0 0 auto; min-height: 58px; border-radius: 6px; }
.no-desc { color: var(--hdr-dim); font-style: italic; }
.topics { display: flex; gap: 6px; flex-wrap: wrap; }
.topic {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--hdr-col); border: 1px solid var(--hdr-border); color: var(--hdr-dim);
}
.foot {
  display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--hdr-dim);
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--hdr-border);
}
.foot span { display: inline-flex; align-items: center; gap: 4px; }
.updated { margin-left: auto; }
.empty { text-align: center; color: var(--hdr-dim); padding: 44px 0; font-size: 13px; }

/* Load more */
.load-more-row { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 22px 0 8px; }
.showing { font-size: 12px; color: var(--hdr-dim); }

/* Skeletons */
.sk { position: relative; overflow: hidden; background: var(--hdr-col); border-radius: 14px; }
.sk::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  animation: shimmer 1.4s infinite;
}
html[data-app-theme="light"] .sk::after { background: linear-gradient(90deg, transparent, rgba(0,0,0,.04), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.langs-sk { height: 90px; margin-top: 24px; }
.sk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 28px; }
.card-sk { height: 150px; }

/* Error */
.error-box { text-align: center; padding: 90px 20px; color: var(--hdr-muted); font-size: 13.5px; }
.error-box h2 { color: var(--hdr-text); font-size: 16px; margin-bottom: 10px; font-weight: 600; }
.error-box .app-hbtn { margin: 20px auto 0; }

/* Narrow screens: drop bio/meta from the bar, keep identity */
@media (max-width: 720px) {
  .tb-bio, .tb-meta { display: none; }
}