:root {
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #f1f3f7;
  --bg-hover: #eef0f5;
  --border: #e2e5eb;
  --border-light: #d4d8e0;
  --text-primary: #1a1d26;
  --text-secondary: #5f6578;
  --text-muted: #9198a8;
  --accent: #6c5ce7;
  --accent-light: #5a4bd1;
  --accent-glow: rgba(108, 92, 231, 0.10);
  --accent-soft: rgba(108, 92, 231, 0.06);
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.07);
  --info: #4f46e5;
  --info-bg: rgba(79, 70, 229, 0.07);
  --cyan: #0891b2;
  --cyan-bg: rgba(8, 145, 178, 0.07);
  --orange: #ea580c;
  --pink: #db2777;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

.app-layout {
  display: grid;
  grid-template-columns: 256px 1fr;
  grid-template-rows: 60px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* TOP BAR */
.topbar {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo-area { display: flex; align-items: center; gap: 12px; }

.logo-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: white;
}

.logo-text { font-size: 19px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); }

.logo-sub {
  font-size: 10px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase;
  margin-left: 10px; padding: 3px 8px; background: var(--bg-elevated); border-radius: 4px; font-weight: 600;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.search-bar { position: relative; }

.search-bar input {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px 8px 36px; color: var(--text-primary); font-size: 13px; width: 280px;
  outline: none; transition: all 0.2s; font-family: 'Inter', sans-serif;
}

.search-bar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: white; }
.search-bar input::placeholder { color: var(--text-muted); }

.search-bar svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; color: white;
}

/* SIDEBAR */
.sidebar {
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  padding: 20px 0; overflow: hidden; display: flex; flex-direction: column;
}

.sidebar-section { padding: 0 14px; margin-bottom: 22px; }

.sidebar-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); padding: 0 12px; margin-bottom: 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  cursor: pointer; color: var(--text-secondary); font-size: 13px; font-weight: 500;
  transition: all 0.15s; position: relative;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }

.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--accent); border-radius: 0 3px 3px 0;
}

.nav-item svg { flex-shrink: 0; }

.nav-badge {
  margin-left: auto; background: var(--accent); color: white;
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
}

.sidebar-projects { flex: 1; overflow-y: auto; padding: 0 14px; }

.project-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 8px;
  cursor: pointer; color: var(--text-secondary); font-size: 13px; transition: all 0.15s;
}

.project-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.project-nav-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }

.project-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.new-project-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 8px 14px;
  border: 1px dashed var(--border-light); border-radius: 8px; cursor: pointer;
  color: var(--text-muted); font-size: 13px; background: transparent;
  transition: all 0.2s; font-family: 'Inter', sans-serif;
}

.new-project-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* MAIN */
.main-content { background: var(--bg-primary); overflow-y: auto; padding: 28px 32px; }

.dashboard-header { margin-bottom: 26px; }
.dashboard-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 4px; }
.dashboard-header p { color: var(--text-secondary); font-size: 14px; }

.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 26px; }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; transition: all 0.2s; box-shadow: var(--shadow-sm);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}

.stat-card .stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; margin-bottom: 3px; }

.stat-card .stat-label {
  font-size: 12px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 500;
}

.content-grid { display: grid; grid-template-columns: 1fr 370px; gap: 18px; }

/* CARDS */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 14px; font-weight: 600; }

.card-body { padding: 0; overflow-x: auto; }
.card-body table { min-width: 600px; }

table { width: 100%; border-collapse: collapse; }

table th {
  text-align: left; padding: 10px 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}

table td { padding: 12px 20px; font-size: 13px; border-bottom: 1px solid var(--border); }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg-hover); }
table tr { cursor: default; transition: background 0.1s; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
}

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-paused { background: var(--warning-bg); color: var(--warning); }
.badge-completed { background: var(--info-bg); color: var(--info); }
.badge-cancelled { background: var(--danger-bg); color: var(--danger); }

.phase-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 500;
}

.phase-prospect { background: rgba(245,158,11,0.10); color: #f59e0b; }
.phase-request { background: rgba(108,92,231,0.08); color: var(--accent); }
.phase-prototype { background: var(--cyan-bg); color: var(--cyan); }
.phase-development { background: var(--warning-bg); color: var(--warning); }
.phase-testing { background: rgba(219,39,119,0.08); color: var(--pink); }
.phase-review { background: var(--info-bg); color: var(--info); }
.phase-delivery { background: var(--success-bg); color: var(--success); }

/* ACTIVITY */
.activity-item {
  display: flex; gap: 12px; padding: 13px 20px;
  border-bottom: 1px solid var(--border); transition: background 0.15s; cursor: pointer;
}

.activity-item:hover { background: var(--bg-hover); }
.activity-item:last-child { border-bottom: none; }

.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }

.activity-text { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; transition: all 0.15s; font-family: 'Inter', sans-serif;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-light); box-shadow: 0 2px 10px var(--accent-glow); }

.btn-secondary { background: var(--bg-card); color: #374151; border: 1px solid #9ca3af; }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: #6b7280; }

.btn-ghost { background: transparent; color: var(--text-secondary); padding: 6px 10px; }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.15); }
.btn-danger:hover { background: rgba(220,38,38,0.12); }

.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* MODALS */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.25); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; animation: fadeIn 0.15s;
}

.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  width: 540px; max-height: 85vh; overflow-y: auto; animation: slideUp 0.2s; box-shadow: var(--shadow-lg);
}

.modal-lg { width: 700px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 6px; transition: all 0.15s;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px;
  border-top: 1px solid var(--border); background: var(--bg-elevated); border-radius: 0 0 16px 16px;
}

/* FORMS */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 13px; color: var(--text-primary); font-size: 13px;
  outline: none; transition: all 0.2s; font-family: 'Inter', sans-serif;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: white;
}
/* Hide browser's native password reveal button */
.form-input::-ms-reveal,
.form-input::-webkit-credentials-auto-fill-button { display: none; }
input[type="password"]::-ms-reveal { display: none; }

.form-textarea { min-height: 80px; resize: vertical; }
.form-select { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* PROJECT DETAIL */
.project-header-bar {
  display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px;
}

.project-title-area h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 6px; }

.project-meta { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-secondary); }
.project-meta span { display: flex; align-items: center; gap: 5px; }
.project-actions { display: flex; gap: 8px; }

/* TABS */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }

.tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s; background: none; border-top: none; border-left: none;
  border-right: none; font-family: 'Inter', sans-serif;
}

.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* TIMELINE */
.timeline { position: relative; padding-left: 28px; }

.timeline::before {
  content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}

.timeline-item {
  position: relative; margin-bottom: 20px; padding: 16px 20px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  transition: all 0.2s; box-shadow: var(--shadow-sm);
}

.timeline-item:hover { box-shadow: var(--shadow-md); border-color: var(--border-light); }

.timeline-dot {
  position: absolute; left: -24px; top: 20px; width: 12px; height: 12px;
  border-radius: 50%; border: 2.5px solid var(--bg-primary);
}

.timeline-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.timeline-item-title { font-size: 14px; font-weight: 600; }
.timeline-item-date { font-size: 11px; color: var(--text-muted); }
.timeline-item-body { font-size: 13px; color: var(--text-secondary); line-height: 1.65; }
.timeline-item-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); font-weight: 500;
}

/* PROGRESS */
.progress-bar-container { width: 100%; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }

/* PHASE STEPS */
.phase-steps { display: flex; gap: 0; margin-bottom: 28px; }

.phase-step { flex: 1; text-align: center; position: relative; padding: 0 6px; }

.phase-step-dot {
  width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; position: relative; z-index: 2;
  border: 2px solid #6b7280; background: var(--bg-card); color: #374151;
}

.phase-step.completed .phase-step-dot { background: var(--success); border-color: var(--success); color: white; }
.phase-step.current .phase-step-dot { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 0 0 4px var(--accent-glow); }

.phase-step-label { font-size: 11px; color: #4b5563; font-weight: 500; }
.phase-step.completed .phase-step-label { color: var(--success); }
.phase-step.current .phase-step-label { color: var(--accent); font-weight: 600; }

.phase-step-line {
  position: absolute; top: 16px; left: calc(50% + 20px); right: calc(-50% + 20px);
  height: 2px; background: var(--border); z-index: 1;
}

.phase-step.completed .phase-step-line { background: var(--success); }
.phase-step:last-child .phase-step-line { display: none; }

/* DOCS */
.doc-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 20px;
  border-bottom: 1px solid var(--border); transition: background 0.15s;
}

.doc-item:hover { background: var(--bg-hover); }
.doc-item:last-child { border-bottom: none; }

.doc-icon {
  min-width: 40px; height: 40px; padding: 0 6px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px;
}

.doc-icon.pdf { background: var(--danger-bg); color: var(--danger); }
.doc-icon.doc { background: var(--info-bg); color: var(--info); }
.doc-icon.img { background: var(--cyan-bg); color: var(--cyan); }
.doc-icon.note { background: var(--warning-bg); color: var(--warning); }

.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 500; color: #1a1a1a; white-space: nowrap; }
.doc-meta { font-size: 11px; color: #1a1a1a; margin-top: 2px; }

.doc-actions { display: flex; gap: 4px; }
.doc-actions .btn { cursor: pointer; transition: background 0.15s; }
.doc-actions .btn:hover { background: var(--border-light); }

/* STATUS BADGES */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; white-space: nowrap; line-height: 1.5;
  border: 1px solid transparent;
}
.status-badge.pending_review { background: #FEE2E2; color: #DC2626; border-color: #FECACA; }
.status-badge.reviewed       { background: #FEF3C7; color: #D97706; border-color: #FDE68A; }
.status-badge.approved       { background: #D1FAE5; color: #059669; border-color: #A7F3D0; }
.status-badge.stored         { background: #E5E7EB; color: #1F2937; border-color: #D1D5DB; }

.status-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.pending_review { background: #DC2626; }
.status-dot.reviewed       { background: #D97706; }
.status-dot.approved       { background: #059669; }
.status-dot.stored         { background: #1F2937; }

/* Admin status dropdown */
.status-dropdown-wrap { position: relative; }
.status-dropdown {
  display: none; position: fixed; z-index: 9999;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg); overflow: hidden; min-width: 160px;
}
.status-dropdown.open { display: block; }
.status-dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--text-primary); border: none;
  background: none; width: 100%; text-align: left; transition: background .1s;
}
.status-dropdown-item:hover { background: var(--bg-hover); }
.status-dropdown-item.active { font-weight: 700; background: var(--bg-tertiary); }

/* VERSION */
.version-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 12px; box-shadow: var(--shadow-sm); transition: all 0.2s;
}

.version-card:hover { box-shadow: var(--shadow-md); }

.version-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

.version-tag { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; color: var(--accent); }
.version-date { font-size: 11px; color: var(--text-muted); }

.version-changes { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.version-changes li {
  margin-bottom: 4px; list-style: none; padding-left: 16px; position: relative;
}

.version-changes li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }

/* EMPTY */
.empty-state { text-align: center; padding: 60px 40px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; }
.empty-state svg { margin-bottom: 16px; opacity: 0.35; display: block; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; max-width: 320px; margin-left: auto; margin-right: auto; }

/* CONFIRM */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.25); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 2000; animation: fadeIn 0.15s;
}

.confirm-box {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; max-width: 400px; text-align: center; box-shadow: var(--shadow-lg);
}

.confirm-box h3 { font-size: 16px; margin-bottom: 8px; }
.confirm-box p { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; }

/* Links como nav-items (sidebar con <a>) */
a.nav-item,
a.project-nav-item {
  text-decoration: none;
  color: inherit;
}

a.nav-item:hover,
a.project-nav-item:hover {
  text-decoration: none;
}

/* Tabs como links */
a.tab {
  text-decoration: none;
  color: inherit;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}

/* ── Hamburger button ─────────────────────────────────────────────────── */
.btn-hamburger {
  display: flex;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.btn-hamburger:hover { background: var(--bg-hover); }

/* ── Sidebar close button (hidden on desktop) ─────────────────────────── */
.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
  align-self: flex-end;
  margin: 8px 14px 0;
}
.sidebar-close-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Sidebar collapsed state (desktop) ───────────────────────────────── */
.app-layout.sidebar-collapsed { grid-template-columns: 0px 1fr !important; }
.app-layout.sidebar-collapsed .sidebar {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-right: none !important;
  visibility: hidden;
}

/* Smooth transitions */
.sidebar { transition: width 0.25s ease, padding 0.25s ease, border 0.25s ease, visibility 0.25s ease; }
.app-layout { transition: grid-template-columns 0.25s ease; }

/* ── Sidebar overlay (hidden on desktop) ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 60px;
  background: rgba(0,0,0,0.3);
  z-index: 140;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  /* Layout */
  .app-layout { grid-template-columns: 1fr; }
  .app-layout.sidebar-collapsed { grid-template-columns: 1fr; }
  .main-content { padding: 20px 16px; }

  /* Hamburger always visible on mobile */
  .btn-hamburger { display: flex !important; }

  /* Sidebar: off-canvas mobile */
  .sidebar {
    display: flex;
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: block; }

  /* Topbar */
  .topbar { padding: 0 12px; }
  .topbar-actions { gap: 8px; }
  .search-bar { display: none; }
  .logo-sub { display: none; }
  .logo-text { font-size: 16px; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Modals */
  .modal { width: 95vw !important; max-width: 95vw !important; }
  .modal-lg { width: 95vw !important; max-width: 95vw !important; }
  .modal-body { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .confirm-box { max-width: 90vw; margin: 0 16px; }

  /* Project detail */
  .project-header-bar {
    flex-direction: column;
    gap: 12px;
  }
  .project-meta {
    flex-wrap: wrap;
    gap: 8px;
  }
  .project-title-area h1 { font-size: 18px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; padding: 10px 12px; }

  /* Phase steps */
  .phase-steps { flex-wrap: wrap; gap: 8px; }
  .phase-step-line { display: none; }

  /* Content grid */
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════
   NOTIFICATION BELL
   ═══════════════════════════════════════════════════════════════════════ */
.notification-wrapper { position: relative; }

.btn-notification {
  position: relative;
  background: none; border: none; cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.btn-notification:hover { background: var(--bg-elevated); color: var(--text-primary); }

.notification-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 700; line-height: 16px;
  border-radius: 8px; text-align: center;
}

.notification-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; max-height: 420px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  z-index: 200; display: none;
  animation: slideUp 0.15s ease;
  overflow: hidden;
}
.notification-dropdown.open { display: block; }

.notification-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}

.notification-list {
  max-height: 360px; overflow-y: auto;
}

.notification-item {
  display: block; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--bg-hover); }

.notification-item.unread {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}
.notification-item.unread:hover { background: var(--accent-glow); }

.notif-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.notif-empty {
  padding: 32px 16px; text-align: center;
  font-size: 13px; color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   VERSION DETAIL PAGE
   ═══════════════════════════════════════════════════════════════════════ */
.version-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}

.version-detail-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 24px;
}

.version-detail-section-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.04em;
}

/* Review badge on version cards */
.review-badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 6px;
  background: var(--success-bg); color: var(--success);
}

.review-submitted-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px;
  background: var(--success-bg); color: var(--success);
}

/* Review info */
.review-info-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 16px;
}

.review-feedback-display {
  font-size: 14px; line-height: 1.7; color: var(--text-secondary);
  padding: 16px; background: var(--bg-elevated); border-radius: 8px;
  margin-bottom: 16px; white-space: pre-wrap;
}

/* Review image gallery (read-only) */
.review-image-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-top: 12px;
}

.review-gallery-item { position: relative; }

.review-gallery-item img {
  width: 100%; height: 160px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border);
  cursor: pointer; transition: opacity 0.15s;
}
.review-gallery-item img:hover { opacity: 0.85; }

.review-gallery-name {
  display: block; font-size: 11px; color: var(--text-muted);
  margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Image upload zone */
.image-upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 32px 24px; text-align: center; cursor: pointer;
  transition: all 0.2s; color: var(--text-muted);
}
.image-upload-zone:hover,
.image-upload-zone.dragover {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent);
}
.image-upload-zone svg { margin: 0 auto 8px; display: block; }
.image-upload-zone p { font-size: 13px; margin: 0; }
.upload-link { color: var(--accent); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* Image grid (editable thumbnails) */
.review-image-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-top: 12px;
}

.review-image-thumb {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-elevated);
}

.review-image-thumb img {
  width: 100%; height: 120px; object-fit: cover; display: block;
}

.review-image-thumb.loading {
  height: 120px; display: flex; align-items: center; justify-content: center;
}

.loading-spinner {
  width: 24px; height: 24px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.remove-image-btn {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white; transition: background 0.15s;
}
.remove-image-btn:hover { background: var(--danger); }

.image-thumb-name {
  display: block; padding: 4px 6px; font-size: 10px;
  color: var(--text-muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* Submit review button */
.btn-submit-review {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; font-size: 14px; font-weight: 600;
}

/* Image preview overlay */
.review-image-preview-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.review-image-preview-content { position: relative; max-width: 90vw; max-height: 90vh; }

.review-image-preview-content img {
  max-width: 90vw; max-height: 85vh; object-fit: contain;
  border-radius: 8px;
}

.review-image-preview-close {
  position: absolute; top: -12px; right: -12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white; transition: background 0.15s;
}
.review-image-preview-close:hover { background: rgba(255,255,255,0.3); }

/* Form inputs for review page */
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.form-input, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary);
  font-size: 14px; font-family: 'Inter', sans-serif;
  outline: none; transition: all 0.2s; resize: vertical;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-secondary);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

/* PDF.js text layer — official styles for text selection */
.textLayer {
  position: absolute; text-align: initial; inset: 0; overflow: hidden;
  opacity: 0.25; line-height: 1; text-size-adjust: none;
  forced-color-adjust: none; transform-origin: 0 0; z-index: 2;
}
.textLayer :is(span, br) {
  color: transparent; position: absolute; white-space: pre;
  cursor: text; transform-origin: 0 0;
}
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(108, 92, 231, 0.6); }
.textLayer ::-moz-selection { background: rgba(108, 92, 231, 0.6); }
.textLayer br::selection { background: transparent; }
.textLayer br::-moz-selection { background: transparent; }
.textLayer .endOfContent {
  display: block; position: absolute; inset: 100% 0 0; z-index: -1;
  cursor: default; user-select: none;
}
.textLayer .endOfContent.active { top: 0; }
#pdfCanvas { position: relative; z-index: 1; }

@media (max-width: 768px) {
  .notification-dropdown { width: 300px; right: -60px; }
  .review-image-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .version-detail-header { flex-direction: column; align-items: flex-start; }
}