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

:root {
  --bg-primary: #0d0d0f;
  --bg-secondary: #16161a;
  --bg-tertiary: #1e1e24;
  --bg-card: #1a1a20;
  --bg-input: #22222a;
  --text-primary: #f0ece4;
  --text-secondary: #a8a4a0;
  --text-muted: #6b6966;
  --accent: #c9a96e;
  --accent-hover: #d4b87e;
  --accent-dim: rgba(201,169,110,0.15);
  --border: #2a2a32;
  --border-light: #35353f;
  --success: #5cb85c;
  --warning: #f0ad4e;
  --danger: #d9534f;
  --info: #5bc0de;
  --ai-border: #c9a96e;
  --ai-bg: rgba(201,169,110,0.06);
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
  --stage-1: #c9a96e; --stage-2: #7eb8c9; --stage-3: #9ec97e;
  --stage-4: #c97eb8; --stage-5: #c9b87e; --stage-6: #7ec9a9;
  --stage-7: #7e8ec9; --stage-8: #c97e7e; --stage-9: #b87ec9;
  --stage-10: #7ec9c9;
}

[data-theme="light"] {
  --bg-primary: #f5f2ed; --bg-secondary: #ffffff; --bg-tertiary: #f0ece4;
  --bg-card: #ffffff; --bg-input: #f5f2ed;
  --text-primary: #1a1a20; --text-secondary: #555; --text-muted: #888;
  --accent: #a0834a; --accent-hover: #8a6e3a; --accent-dim: rgba(160,131,74,0.1);
  --border: #e0dcd4; --border-light: #d0ccc4;
  --ai-bg: rgba(160,131,74,0.05); --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { font-size:16px; }
body { font-family:'Raleway',sans-serif; background:var(--bg-primary); color:var(--text-primary); min-height:100vh; line-height:1.6; }
h1,h2,h3,h4 { font-family:'Playfair Display',serif; font-weight:600; }

/* HEADER */
.header { background:var(--bg-secondary); border-bottom:1px solid var(--border); padding:0 2rem; height:64px; display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:100; }
.header-brand { display:flex; align-items:center; gap:12px; }
.header-brand h1 { font-size:1.3rem; color:var(--accent); letter-spacing:1px; }
.header-brand span { color:var(--text-muted); font-size:0.85rem; font-weight:300; }
.header-right { display:flex; align-items:center; gap:1rem; }
.user-badge { display:flex; align-items:center; gap:8px; padding:6px 14px; background:var(--accent-dim); border:1px solid var(--accent); border-radius:20px; font-size:0.85rem; color:var(--accent); cursor:pointer; }
.user-badge .avatar { width:28px; height:28px; border-radius:50%; background:var(--accent); color:var(--bg-primary); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:0.75rem; }
.theme-toggle { background:none; border:1px solid var(--border); color:var(--text-secondary); border-radius:50%; width:36px; height:36px; cursor:pointer; font-size:1.1rem; display:flex; align-items:center; justify-content:center; transition:var(--transition); }
.theme-toggle:hover { border-color:var(--accent); color:var(--accent); }

/* LOGIN */
.login-screen { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:100vh; background:var(--bg-primary); padding:2rem; }
.login-box { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:3rem; max-width:420px; width:100%; text-align:center; box-shadow:var(--shadow); }
.login-box h1 { color:var(--accent); font-size:2rem; margin-bottom:0.5rem; }
.login-box p { color:var(--text-secondary); margin-bottom:2rem; font-size:0.9rem; }
.login-users { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.login-user-btn { background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); padding:1.2rem 1rem; cursor:pointer; transition:var(--transition); display:flex; flex-direction:column; align-items:center; gap:8px; }
.login-user-btn:hover { border-color:var(--accent); background:var(--accent-dim); }
.login-user-btn .user-icon { width:48px; height:48px; border-radius:50%; background:var(--accent); color:var(--bg-primary); display:flex; align-items:center; justify-content:center; font-size:1.2rem; font-weight:700; font-family:'Playfair Display',serif; }
.login-user-btn .user-name { color:var(--text-primary); font-weight:600; font-size:0.95rem; }
.login-user-btn .user-role { color:var(--text-muted); font-size:0.75rem; }

/* MAIN LAYOUT */
.app-container { display:flex; min-height:calc(100vh - 64px); }
.sidebar { width:260px; background:var(--bg-secondary); border-right:1px solid var(--border); padding:1.5rem 0; flex-shrink:0; overflow-y:auto; }
.sidebar-section { padding:0 1.2rem; margin-bottom:1.5rem; }
.sidebar-section h3 { font-size:0.7rem; text-transform:uppercase; letter-spacing:2px; color:var(--text-muted); margin-bottom:0.8rem; font-family:'Raleway',sans-serif; font-weight:600; }
.sidebar-filter { display:flex; align-items:center; gap:8px; padding:8px 12px; border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); font-size:0.85rem; color:var(--text-secondary); }
.sidebar-filter:hover, .sidebar-filter.active { background:var(--accent-dim); color:var(--accent); }
.sidebar-filter .dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; background:transparent; border:1.5px solid var(--accent); }
.sidebar-filter.active .dot, .sidebar-filter:hover .dot { background:currentColor; }
.main-content { flex:1; padding:2rem; overflow-y:auto; max-width:1200px; }

/* BUTTONS */
.btn { padding:10px 20px; border:none; border-radius:var(--radius-sm); font-family:'Raleway',sans-serif; font-weight:600; font-size:0.85rem; cursor:pointer; transition:var(--transition); display:inline-flex; align-items:center; gap:8px; }
.btn-primary { background:var(--accent); color:var(--bg-primary); }
.btn-primary:hover { background:var(--accent-hover); }
.btn-secondary { background:var(--bg-input); color:var(--text-primary); border:1px solid var(--border); }
.btn-secondary:hover { border-color:var(--accent); color:var(--accent); }
.btn-sm { padding:6px 14px; font-size:0.8rem; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-success { background:var(--success); color:#fff; }
.btn-ai { background:linear-gradient(135deg, var(--accent), #d4b87e); color:var(--bg-primary); position:relative; overflow:hidden; }
.btn-ai::before { content:'✦'; margin-right:4px; }

/* CARDS */
.projects-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); gap:1.2rem; }
.project-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:1.5rem; cursor:pointer; transition:var(--transition); position:relative; overflow:hidden; }
.project-card:hover { border-color:var(--accent); transform:translateY(-2px); box-shadow:var(--shadow); }
.project-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; }
.project-card[data-stage="1"]::before { background:var(--stage-1); }
.project-card[data-stage="2"]::before { background:var(--stage-2); }
.project-card[data-stage="3"]::before { background:var(--stage-3); }
.project-card[data-stage="4"]::before { background:var(--stage-4); }
.project-card[data-stage="5"]::before { background:var(--stage-5); }
.project-card[data-stage="6"]::before { background:var(--stage-6); }
.project-card[data-stage="7"]::before { background:var(--stage-7); }
.project-card[data-stage="8"]::before { background:var(--stage-8); }
.project-card[data-stage="9"]::before { background:var(--stage-9); }
.project-card[data-stage="10"]::before { background:var(--stage-10); }
.card-header { display:flex; justify-content:space-between; align-items:start; margin-bottom:0.8rem; }
.card-client { font-family:'Playfair Display',serif; font-size:1.1rem; font-weight:600; }
.card-type { color:var(--text-muted); font-size:0.8rem; margin-top:2px; }
.card-stage-badge { padding:4px 10px; border-radius:12px; font-size:0.7rem; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; white-space:nowrap; }
.card-meta { display:flex; gap:1rem; margin-top:0.8rem; font-size:0.8rem; color:var(--text-muted); }

/* STAGE TIMELINE */
.stage-timeline { display:flex; gap:0; margin-bottom:2rem; overflow-x:auto; padding-bottom:4px; }
.stage-step { flex:1; min-width:90px; text-align:center; position:relative; cursor:pointer; padding:12px 4px 8px; }
.stage-step::before { content:''; position:absolute; top:28px; left:0; right:0; height:2px; background:var(--border); }
.stage-step:first-child::before { left:50%; }
.stage-step:last-child::before { right:50%; }
.stage-dot { width:20px; height:20px; border-radius:50%; border:2px solid var(--border); background:var(--bg-secondary); display:inline-flex; align-items:center; justify-content:center; font-size:0.6rem; font-weight:700; position:relative; z-index:1; transition:var(--transition); margin-bottom:6px; }
.stage-step.completed .stage-dot { background:var(--success); border-color:var(--success); color:#fff; }
.stage-step.current .stage-dot { background:var(--accent); border-color:var(--accent); color:var(--bg-primary); transform:scale(1.2); }
.stage-step.current { color:var(--accent); }
.stage-label { font-size:0.65rem; color:var(--text-muted); line-height:1.3; display:block; }
.stage-step.completed .stage-label { color:var(--success); }
.stage-step.current .stage-label { color:var(--accent); font-weight:600; }

/* FORMS */
.form-group { margin-bottom:1.2rem; }
.form-group label { display:block; font-size:0.8rem; font-weight:600; color:var(--text-secondary); margin-bottom:6px; text-transform:uppercase; letter-spacing:0.5px; }
.form-group input, .form-group textarea, .form-group select {
  width:100%; padding:10px 14px; background:var(--bg-input); border:1px solid var(--border);
  border-radius:var(--radius-sm); color:var(--text-primary); font-family:'Raleway',sans-serif;
  font-size:0.9rem; transition:var(--transition); outline:none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-dim);
}
.form-group textarea { min-height:80px; resize:vertical; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.form-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:1rem; }

/* AI RESULT */
.ai-result { background:var(--ai-bg); border:1px solid var(--ai-border); border-radius:var(--radius); padding:1.5rem; margin:1.5rem 0; position:relative; }
.ai-result::before { content:'✦ Análise IA'; position:absolute; top:-10px; left:16px; background:var(--bg-primary); padding:0 8px; font-size:0.7rem; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:1px; }
[data-theme="light"] .ai-result::before { background:var(--bg-card); }
.ai-result h4 { color:var(--accent); font-size:0.95rem; margin-bottom:0.5rem; }
.ai-result ul { list-style:none; padding:0; }
.ai-result ul li { padding:4px 0 4px 16px; position:relative; font-size:0.88rem; color:var(--text-secondary); }
.ai-result ul li::before { content:'›'; position:absolute; left:0; color:var(--accent); font-weight:700; }
.ai-result p { font-size:0.88rem; color:var(--text-secondary); line-height:1.7; }
.ai-result pre { background:var(--bg-input); padding:1rem; border-radius:var(--radius-sm); font-size:0.82rem; white-space:pre-wrap; color:var(--text-primary); margin-top:0.5rem; line-height:1.6; overflow-x:auto; }
.ai-section { margin-bottom:1.2rem; }

/* CHECKLIST */
.checklist-item { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); font-size:0.88rem; }
.checklist-item:last-child { border-bottom:none; }
.checklist-item input[type="checkbox"] { accent-color:var(--accent); width:18px; height:18px; cursor:pointer; }
.checklist-item label { cursor:pointer; flex:1; }
.checklist-item .status-badge { font-size:0.7rem; padding:2px 8px; border-radius:10px; }

/* STATUS BADGES */
.status-em-andamento { background:rgba(92,192,222,0.15); color:var(--info); }
.status-aguardando { background:rgba(240,173,78,0.15); color:var(--warning); }
.status-aprovado { background:rgba(92,184,92,0.15); color:var(--success); }
.status-revisao { background:rgba(217,83,79,0.15); color:var(--danger); }

/* FILE REFERENCES */
.file-list { margin:1rem 0; }
.file-item { display:flex; align-items:center; gap:10px; padding:8px 12px; background:var(--bg-input); border-radius:var(--radius-sm); margin-bottom:6px; font-size:0.85rem; }
.file-item .file-icon { color:var(--accent); }
.file-item a { color:var(--accent); text-decoration:none; }
.file-item a:hover { text-decoration:underline; }

/* COMMENTS */
.comments-section { margin-top:2rem; border-top:1px solid var(--border); padding-top:1.5rem; }
.comment { display:flex; gap:12px; margin-bottom:1rem; padding:12px; background:var(--bg-input); border-radius:var(--radius-sm); }
.comment-avatar { width:32px; height:32px; border-radius:50%; background:var(--accent-dim); color:var(--accent); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:0.75rem; flex-shrink:0; }
.comment-body { flex:1; }
.comment-meta { font-size:0.75rem; color:var(--text-muted); margin-bottom:4px; }
.comment-text { font-size:0.88rem; }

/* HISTORY */
.history-list { max-height:300px; overflow-y:auto; }
.history-item { display:flex; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); font-size:0.82rem; }
.history-item:last-child { border-bottom:none; }
.history-dot { width:8px; height:8px; border-radius:50%; background:var(--accent); margin-top:6px; flex-shrink:0; }
.history-content { flex:1; }
.history-action { color:var(--text-primary); }
.history-meta { color:var(--text-muted); font-size:0.75rem; }

/* STAGE CONTENT */
.stage-content { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:2rem; margin-bottom:1.5rem; }
.stage-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:1.5rem; padding-bottom:1rem; border-bottom:1px solid var(--border); }
.stage-title { font-size:1.3rem; }
.stage-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* TABS */
.tabs { display:flex; gap:0; border-bottom:1px solid var(--border); margin-bottom:1.5rem; }
.tab { padding:10px 20px; font-size:0.85rem; color:var(--text-muted); cursor:pointer; border-bottom:2px solid transparent; transition:var(--transition); font-weight:500; }
.tab:hover { color:var(--text-primary); }
.tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.tab-content { display:none; }
.tab-content.active { display:block; }

/* ZONE BARS */
.zone-bar { display:flex; align-items:center; gap:12px; margin-bottom:8px; }
.zone-name { width:180px; font-size:0.85rem; color:var(--text-secondary); text-align:right; }
.zone-track { flex:1; height:28px; background:var(--bg-input); border-radius:4px; overflow:hidden; position:relative; }
.zone-fill { height:100%; border-radius:4px; display:flex; align-items:center; justify-content:flex-end; padding-right:8px; font-size:0.7rem; font-weight:700; color:var(--bg-primary); transition:width 0.5s ease; }
.zone-area { font-size:0.8rem; color:var(--text-muted); width:60px; }

/* SECTION TITLE */
.section-title { display:flex; align-items:center; gap:8px; margin-bottom:1.5rem; }
.section-title h2 { font-size:1.5rem; }
.section-title .count { background:var(--accent-dim); color:var(--accent); padding:2px 10px; border-radius:12px; font-size:0.8rem; font-weight:600; }

/* STAGE STATUS SELECT */
.stage-status-select { padding:6px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text-primary); font-size:0.8rem; }

/* NEW PROJECT MODAL */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; z-index:200; backdrop-filter:blur(4px); }
.modal { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:2rem; max-width:500px; width:90%; max-height:90vh; overflow-y:auto; box-shadow:var(--shadow); }
.modal h2 { margin-bottom:1.5rem; color:var(--accent); }

/* EMPTY STATE */
.empty-state { text-align:center; padding:4rem 2rem; color:var(--text-muted); }
.empty-state .icon { font-size:3rem; margin-bottom:1rem; opacity:0.3; }
.empty-state h3 { color:var(--text-secondary); margin-bottom:0.5rem; }

/* SCROLLBAR */
::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:var(--bg-primary); }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--accent); }

/* RESPONSIVE */
@media (max-width:768px) {
  .sidebar { display:none; }
  .main-content { padding:1rem; }
  .form-row, .form-row-3 { grid-template-columns:1fr; }
  .projects-grid { grid-template-columns:1fr; }
  .header { padding:0 1rem; }
  .stage-timeline { gap:0; }
  .stage-label { font-size:0.55rem; }
}

/* MEMORIAL EXPORT */
.memorial-export { background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius); padding:1.5rem; margin:1rem 0; max-height:500px; overflow-y:auto; white-space:pre-wrap; font-family:'Courier New',monospace; font-size:0.85rem; line-height:1.7; }

/* LOADING */
.ai-loading { display:flex; align-items:center; gap:10px; padding:1rem; color:var(--accent); font-size:0.9rem; }
.ai-loading .spinner { width:20px; height:20px; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Add file form */
.add-file-row { display:flex; gap:8px; margin-bottom:1rem; }
.add-file-row input { flex:1; }

/* SVG INLINE ICONS */
.svg-icon { display:inline-flex; align-items:center; justify-content:center; vertical-align:middle; color:var(--accent); flex-shrink:0; }
.svg-icon svg { display:block; }
.svg-icon-lg { display:inline-flex; align-items:center; vertical-align:middle; color:var(--accent); margin-right:6px; }
.svg-icon-lg svg { display:block; }
.svg-check { color:var(--success); }
.card-stage-badge .svg-icon { color:inherit; }
.card-meta .svg-icon, .card-meta svg { display:inline; vertical-align:middle; color:var(--text-muted); margin-right:3px; }
.card-meta span { display:inline-flex; align-items:center; gap:4px; }
.stage-title .svg-icon-lg { color:var(--accent); }
.sidebar-filter .svg-icon { margin-right:2px; }
.file-icon { color:var(--accent); display:inline-flex; align-items:center; }
.file-icon svg { display:block; }

/* PREMIUM CARD HOVER */
.project-card { transition:all 0.3s cubic-bezier(0.25,0.46,0.45,0.94); }
.project-card:hover { border-color:var(--accent); transform:translateY(-3px) scale(1.01); box-shadow:0 8px 32px rgba(201,169,110,0.15), var(--shadow); }

/* PREMIUM BUTTON STYLES */
.btn { transition:all 0.25s ease; }
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(201,169,110,0.3); }
.btn-ai::before { content:''; }
.btn-ai .sparkle { margin-right:4px; }
.btn svg { vertical-align:middle; }

/* REMOVE BUTTONS */
.btn-remove { color:var(--danger); background:none; border:none; cursor:pointer; opacity:0.6; transition:opacity 0.2s; font-size:0.9rem; }
.btn-remove:hover { opacity:1; }

/* THEME TOGGLE SVG */
.theme-toggle { display:inline-flex; align-items:center; justify-content:center; }
.theme-toggle svg { display:block; }

/* LOGIN REFINEMENTS */
.login-user-btn { border:1px solid rgba(42,42,50,0.6); transition:all 0.3s ease; }
.login-user-btn:hover { border-color:var(--accent); background:var(--accent-dim); transform:translateY(-2px); box-shadow:0 6px 20px rgba(201,169,110,0.12); }
.login-user-btn .user-icon { border:2px solid var(--accent); box-shadow:0 0 0 3px rgba(201,169,110,0.1); }
.login-box { border:1px solid rgba(42,42,50,0.5); }
.login-box h1 { letter-spacing:2px; }

/* STAGE DOTS WITH CHECK SVG */
.stage-dot { overflow:hidden; }
.stage-dot svg { display:block; }
.stage-step.completed .stage-dot { display:inline-flex; align-items:center; justify-content:center; }
.stage-step.completed .stage-dot svg { color:#fff; }

/* SUBTLE BORDER REFINEMENTS */
.sidebar { border-right:1px solid rgba(42,42,50,0.5); }
.header { border-bottom:1px solid rgba(42,42,50,0.5); }
.modal { border:1px solid rgba(42,42,50,0.5); }
.stage-content { border:1px solid rgba(42,42,50,0.5); }

/* HISTORY DOT REFINEMENT */
.history-dot { width:8px; height:8px; border-radius:50%; background:transparent; border:1.5px solid var(--accent); margin-top:6px; flex-shrink:0; }

/* EMPTY STATE SVG */
.empty-state .icon { font-size:inherit; opacity:0.2; color:var(--accent); }
.empty-state .icon svg { display:block; margin:0 auto; }

/* AI BUTTON SPARKLE */
.btn-ai { position:relative; overflow:hidden; }
.btn-ai::after { content:'✦'; margin-left:0; font-size:0.7rem; opacity:0; width:0; transition:all 0.3s; }
.btn-ai:hover::after { opacity:1; width:14px; margin-left:6px; }
