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

:root {
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --border:      #e2e8f0;
  --accent:      #6366f1;
  --accent-2:    #818cf8;
  --accent-glow: rgba(99,102,241,.15);
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --muted:       #94a3b8;
  --text:        #0f172a;
  --text-2:      #475569;
  --text-3:      #94a3b8;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(15,23,42,.08);
  --shadow-sm:   0 1px 4px rgba(15,23,42,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top nav ──────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; letter-spacing: -.3px;
  color: var(--text); cursor: pointer; user-select: none;
}
.topbar-brand .dot {
  width: 28px; height: 28px; background: var(--accent);
  border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
}
.topbar-brand .dot svg { width: 15px; height: 15px; fill: #fff; }
.topbar-sep { color: var(--border); font-size: 18px; font-weight: 300; }
.topbar-breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.crumb-projects { color: var(--text-3); cursor: pointer; transition: color .15s; }
.crumb-projects:hover { color: var(--accent); }
.crumb-sep { color: var(--text-3); font-size: 12px; }
.crumb-current { font-weight: 600; color: var(--text); }
.topbar-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-2); }
.topbar-meta .badge {
  background: var(--accent-glow); color: var(--accent);
  padding: 3px 9px; border-radius: 20px; font-weight: 600; font-size: 12px;
}
.topbar-user { font-weight: 600; color: var(--text); }
.topbar-link {
  color: var(--text-2); text-decoration: none; font-weight: 600;
  padding: 5px 10px; border-radius: 6px; transition: background .15s, color .15s;
}
.topbar-link:hover { background: var(--surface-2); color: var(--accent); }

/* ── Projects view ────────────────────────── */
.projects-view { flex: 1; padding: 10px 38px 48px 38px; overflow-y: auto; }
.projects-page-header { margin-bottom: 20px; }
.projects-page-header h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  color: var(--text); margin-bottom: 6px;
}
.projects-page-header p { font-size: 14px; color: var(--text-2); }

/* ── Toolbar (kereső + szűrő) ─────────────── */
.projects-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 24px;
}
.toolbar-search {
  flex: 1; min-width: 220px; max-width: 360px;
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: var(--surface); transition: border-color .15s;
}
.toolbar-search:focus { outline: none; border-color: var(--accent); }
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 20px;
  font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface);
  cursor: pointer; transition: all .15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.empty-state {
  text-align: center; padding: 64px 24px; color: var(--text-3);
  font-size: 15px; background: var(--surface); border: 1.5px dashed var(--border);
  border-radius: var(--radius); margin-top: 8px;
}

/* ── Project card ─────────────────────────── */
.project-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 24px; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  gap: 16px; position: relative; overflow: hidden;
}
.project-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--pcolor, var(--accent)); opacity: 0; transition: opacity .2s;
}
.project-card:hover { border-color: var(--pcolor, var(--accent)); box-shadow: var(--shadow); transform: translateY(-2px); }
.project-card:hover::before { opacity: 1; }
.pcard-top { display: flex; align-items: flex-start; gap: 14px; }
.pcard-avatar {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 15px; font-weight: 800; color: #fff; flex-shrink: 0; letter-spacing: -.5px;
}
.pcard-title-group { flex: 1; min-width: 0; }
.pcard-title {
  font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcard-client { font-size: 13px; color: var(--text-2); }
.pcard-status {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; flex-shrink: 0;
}
.ps-active    { background: #d1fae5; color: #065f46; }
.ps-completed { background: #e0e7ff; color: #3730a3; }
.ps-paused    { background: #fef3c7; color: #92400e; }
.ps-draft     { background: #f1f5f9; color: #64748b; }
.pcard-desc {
  font-size: 13px; color: var(--text-2); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.pcard-stats { display: flex; gap: 20px; }
.pcard-stat-value { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.pcard-stat-label { font-size: 11px; color: var(--text-3); }
.pcard-arrow {
  width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--border);
  display: grid; place-items: center; color: var(--text-3);
  transition: background .2s, border-color .2s, color .2s; flex-shrink: 0;
}
.project-card:hover .pcard-arrow { background: var(--pcolor, var(--accent)); border-color: var(--pcolor, var(--accent)); color: #fff; }
.pcard-arrow svg { width: 14px; height: 14px; }

/* ── Project view layout ──────────────────── */
.layout { display: grid; grid-template-columns: 320px 1fr; flex: 1; min-height: 0; }

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; height: calc(100vh - 60px); position: sticky; top: 60px;
}
.sidebar-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.back-to-projects {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-3); cursor: pointer;
  margin-bottom: 14px; background: none; border: none; padding: 0; transition: color .15s;
}
.back-to-projects:hover { color: var(--accent); }
.back-to-projects svg { width: 12px; height: 12px; }
.sidebar-header h2 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3); margin-bottom: 3px;
}
.sidebar-header .project-title { font-size: 17px; font-weight: 700; color: var(--text); }
.sidebar-header .project-client { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.sidebar-section { padding: 16px 24px 8px; }
.sidebar-section label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3);
}

/* ── Timeline ─────────────────────────────── */
.timeline { padding: 8px 24px 32px; flex: 1; }
.timeline-item { position: relative; padding-left: 28px; padding-bottom: 6px; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 6px; top: 26px; bottom: 0; width: 2px; background: var(--border);
}
.timeline-dot {
  position: absolute; left: 0; top: 14px; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid var(--border); background: var(--surface); transition: all .2s;
}
.timeline-item.active .timeline-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.timeline-item.latest .timeline-dot { background: var(--success); border-color: var(--success); }
.timeline-item.active.latest .timeline-dot { box-shadow: 0 0 0 4px rgba(16,185,129,.15); }
.timeline-card {
  background: transparent; border: 1.5px solid transparent;
  border-radius: var(--radius-sm); padding: 10px 12px;
  cursor: pointer; transition: all .18s ease; margin-bottom: 4px;
}
.timeline-card:hover { background: var(--surface-2); border-color: var(--border); }
.timeline-item.active .timeline-card { background: var(--accent-glow); border-color: var(--accent); }
.timeline-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.version-tag { font-weight: 700; font-size: 14px; color: var(--text); }
.timeline-item.active .version-tag        { color: var(--accent); }
.timeline-item.latest .version-tag        { color: var(--success); }
.timeline-item.active.latest .version-tag { color: var(--success); }
.status-pill {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .04em;
}
.pill-latest  { background: #d1fae5; color: #065f46; }
.pill-stable  { background: #e0e7ff; color: #3730a3; }
.pill-rc      { background: #fef3c7; color: #92400e; }
.pill-draft   { background: #f1f5f9; color: #64748b; }
.timeline-date { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.timeline-desc {
  font-size: 12px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Main panel ───────────────────────────── */
.main {
  overflow-y: auto; height: calc(100vh - 60px);
  padding: 32px; display: flex; flex-direction: column; gap: 24px;
}
.main > * { flex-shrink: 0; }

/* ── Info strip ───────────────────────────── */
.info-strip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  display: flex; align-items: flex-start; gap: 24px; box-shadow: var(--shadow-sm);
}
.info-strip .version-hero {
  font-size: 36px; font-weight: 800; color: var(--accent);
  letter-spacing: -1px; line-height: 1; white-space: nowrap;
}
.info-strip-body { flex: 1; }
.info-strip-body h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.info-strip-body p  { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.info-strip-actions { display: flex; align-items: center; align-self: center; gap: 10px; flex-shrink: 0; }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; text-decoration: none; transition: all .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn svg { width: 14px; height: 14px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 10px; }
.btn-lg svg { width: 16px; height: 16px; }

/* ── Cards ────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .07em;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-body { padding: 20px 24px; }

/* ── Changelog ────────────────────────────── */
.changelog-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.changelog-item { display: flex; gap: 12px; align-items: flex-start; }
.changelog-icon { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; margin-top: 1px; display: grid; place-items: center; }
.ci-add    { background: #d1fae5; }
.ci-fix    { background: #dbeafe; }
.ci-change { background: #fef3c7; }
.ci-remove { background: #fee2e2; }
.changelog-icon svg { width: 10px; height: 10px; }
.changelog-text { font-size: 13px; color: var(--text-2); line-height: 1.55; }
.changelog-text strong { color: var(--text); font-weight: 600; }

/* ── Preview frame ────────────────────────── */
.preview-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); box-shadow: var(--shadow); }
.preview-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.preview-dots { display: flex; gap: 5px; }
.preview-dots span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pd-r { background: #ff5f57; } .pd-y { background: #febc2e; } .pd-g { background: #28c840; }
.preview-url { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-tools { display: flex; gap: 4px; }
.preview-tool {
  width: 30px; height: 26px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-3); cursor: pointer;
  display: grid; place-items: center; transition: all .15s;
}
.preview-tool:hover { border-color: var(--accent); color: var(--accent); }
.preview-tool.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.preview-tool svg { width: 14px; height: 14px; }
.preview-iframe-wrap { width: 100%; height: 520px; position: relative; background: var(--surface-2); transition: max-width .25s ease; margin: 0 auto; }
.preview-iframe-wrap iframe { width: 100%; height: 100%; border: none; display: block; background: #fff; }
.preview-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--surface-2); }
.preview-overlay svg { width: 48px; height: 48px; color: var(--muted); }
.preview-overlay p { font-size: 14px; color: var(--text-3); text-align: center; }
.preview-note { margin-top: 12px; font-size: 12px; color: var(--text-3); line-height: 1.55; padding: 0 4px; }
.preview-note strong { color: var(--text-2); }

/* ── Stats row ────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Animations ───────────────────────────── */
.fade { animation: fadeIn .22s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ══════════════════════════════════════════════
   AUTH (login / setup)
   ══════════════════════════════════════════════ */
.auth-body {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f1f5f9 100%);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 36px 34px; width: 100%; max-width: 400px; margin: 24px;
}
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; color: var(--text); margin-bottom: 24px;
}
.auth-brand-dot {
  width: 30px; height: 30px; background: var(--accent);
  border-radius: 8px; display: grid; place-items: center;
}
.auth-brand-dot svg { width: 16px; height: 16px; fill: #fff; }
.auth-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--text-2); margin-bottom: 22px; }
.auth-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.auth-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.auth-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.auth-btn {
  width: 100%; margin-top: 22px; padding: 12px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
  border-radius: var(--radius-sm); transition: background .15s;
}
.auth-btn:hover { background: var(--accent-2); }
.auth-error {
  background: #fee2e2; color: #991b1b; font-size: 13px; font-weight: 500;
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 4px;
}
.auth-notice {
  background: #eff6ff; color: #1e40af; font-size: 13px; font-weight: 500;
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 12px;
}
.auth-ok {
  background: #d1fae5; color: #065f46; font-size: 13px; line-height: 1.6;
  padding: 14px 16px; border-radius: var(--radius-sm);
}
.auth-ok a { color: #065f46; font-weight: 700; }

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 860px) {
  .topbar { padding: 0 16px; }
  .projects-view { padding: 10px 16px 40px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .timeline { display: flex; gap: 10px; overflow-x: auto; padding: 8px 16px 16px; }
  .timeline-item { padding-left: 0; padding-bottom: 0; min-width: 190px; }
  .timeline-item:not(:last-child)::before { display: none; }
  .timeline-dot { display: none; }
  .main { height: auto; padding: 20px 16px; }
  .stats-row { grid-template-columns: 1fr; }
  .info-strip { flex-direction: column; gap: 14px; }
  .info-strip-actions { width: 100%; }
  .preview-iframe-wrap { height: 420px; max-width: none !important; }
  .topbar-brand { font-size: 14px; }
}
