﻿/* ===== VARIÁVEIS ===== */
:root {
  --bg: #0B0F17;
  --surface: #111827;
  --surface-el: #151E2E;
  --border: #1F2937;
  --primary: #4F7CFF;
  --primary-10: rgba(79,124,255,0.10);
  --primary-20: rgba(79,124,255,0.20);
  --success: #22C55E;
  --success-10: rgba(34,197,94,0.10);
  --warning: #F59E0B;
  --warning-10: rgba(245,158,11,0.10);
  --danger: #EF4444;
  --danger-10: rgba(239,68,68,0.10);
  --text-1: #F9FAFB;
  --text-2: #9CA3AF;
  --text-3: #6B7280;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 200ms ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; outline: none; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input, textarea, select { font: inherit; color: inherit; border: none; outline: none; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 4px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== LAYOUT ===== */
.app-shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* Sidebar desktop */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo { padding: 28px 24px 20px; display: flex; align-items: center; gap: 12px; }
.sidebar-logo .brand-mark { height: 28px; width: auto; flex-shrink: 0; }
.sidebar-logo .brand-text { display: flex; flex-direction: column; }
.sidebar-logo .wordmark { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; color: var(--text-1); line-height: 1.2; }
.sidebar-logo .wordmark span { color: var(--primary); }
.sidebar-logo .byline { font-size: 9px; color: var(--text-3); letter-spacing: 2.5px; text-transform: uppercase; margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: all var(--transition); width: 100%; text-align: left;
}
.sidebar-item:hover { background: rgba(255,255,255,0.05); color: var(--text-1); }
.sidebar-item.active { background: var(--primary-10); color: var(--primary); }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.sidebar-footer .user-name { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.sidebar-footer .logout-btn { font-size: 12px; color: var(--text-3); transition: color var(--transition); }
.sidebar-footer .logout-btn:hover { color: var(--danger); }
.sidebar-footer .version { font-size: 11px; color: var(--border); margin-top: 8px; }

/* Main content */
.main-content { flex: 1; min-width: 0; overflow-y: auto; }
.screen {
  max-width: 680px;
  margin: 0 auto;
  padding:
    calc(20px + env(safe-area-inset-top, 0px))
    calc(20px + env(safe-area-inset-right, 0px))
    calc(120px + env(safe-area-inset-bottom, 0px))
    calc(20px + env(safe-area-inset-left, 0px));
}

/* Marca discreta nas telas logadas (mobile only — desktop já tem sidebar) */
.screen-brand { margin-bottom: 18px; text-align: center; }
.screen-brand img { height: 30px; width: auto; display: block; object-fit: contain; margin: 0 auto; }
.screen-brand.home-brand { margin-bottom: 26px; }
@media (min-width: 768px) { .screen-brand { display: none; } }
.screen-header { margin-bottom: 24px; }
.screen-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }

/* Bottom nav mobile */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  gap: 2px;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 8px 4px; border-radius: var(--radius-sm);
  font-size: 10px; font-weight: 500; color: var(--text-3);
  transition: color var(--transition), background var(--transition); position: relative;
}
.nav-item:active { opacity: 0.7; }
.nav-item.active { color: var(--primary); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2px; background: var(--primary);
  border-radius: 0 0 2px 2px;
}
.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }

/* ===== COMPONENTES ===== */

/* Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; border-radius: var(--radius); transition: all var(--transition);
  white-space: nowrap; user-select: none;
}
.btn-sm  { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-md  { padding: 8px 16px; font-size: 14px; }
.btn-lg  { padding: 14px 24px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { opacity: 0.8; transform: scale(0.98); }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text-1); }
.btn-secondary:hover { background: var(--surface-el); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface); color: var(--text-1); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-el { background: var(--surface-el); border: 1px solid var(--border); border-radius: var(--radius); }
.card-p { padding: 20px; }

/* Input / Textarea */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.8px; }
.input {
  width: 100%; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 16px; color: var(--text-1);
  transition: border-color var(--transition);
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-10); }
.input::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 80px; }
select.input { cursor: pointer; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .form-grid-2 { grid-template-columns: 1fr; } }
.input.input-error { border-color: var(--danger) !important; }
.field-error { font-size: 12px; color: var(--danger); margin-top: -2px; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-high    { background: var(--danger-10);  color: var(--danger);  }
.badge-medium  { background: var(--warning-10); color: var(--warning); }
.badge-low     { background: var(--success-10); color: var(--success); }
.badge-work     { background: var(--primary-10); color: var(--primary); }
.badge-personal { background: rgba(236,72,153,0.10); color: #EC4899; }
.badge-health   { background: var(--success-10); color: var(--success); }
.badge-financial{ background: var(--warning-10); color: var(--warning); }
.badge-study    { background: rgba(139,92,246,0.10); color: #8B5CF6; }
.badge-ideas    { background: var(--primary-10); color: var(--primary); }
.badge-quick    { background: rgba(255,255,255,0.06); color: var(--text-2); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 0;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-el); color: var(--text-1); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* Drawer */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.6);
}
.drawer-box {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 51;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  max-height: 92vh; overflow-y: auto;
}
.drawer-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 12px auto 0;
}
.drawer-header { padding: 16px 20px 0; }
.drawer-title { font-size: 16px; font-weight: 600; }
.drawer-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }

/* Quick action button (Home) */
.quick-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  background: transparent; cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  margin-bottom: 28px;
}
.quick-action-btn:hover, .quick-action-btn:active { border-color: var(--primary); color: var(--primary); }
.quick-sheet-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; padding: 12px 20px 8px; }

/* Offline Banner */
.offline-banner {
  position: sticky; top: 0; left: 0; right: 0; z-index: 60;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500;
}
.offline-banner.offline { background: rgba(239,68,68,0.15); border-bottom: 1px solid rgba(239,68,68,0.2); color: var(--danger); }
.offline-banner.pending { background: rgba(245,158,11,0.15); border-bottom: 1px solid rgba(245,158,11,0.2); color: var(--warning); }

/* ===== TELA AUTH ===== */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 24px;
}
.auth-box { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .brand-mark { max-width: 160px; width: 100%; height: auto; display: block; margin: 0 auto 20px; }
.auth-logo .wordmark { font-size: 28px; font-weight: 900; letter-spacing: -1px; }
.auth-logo .wordmark span { color: var(--primary); }
.auth-logo .byline { font-size: 10px; color: var(--text-3); letter-spacing: 3px; text-transform: uppercase; margin-top: 4px; }
.ob-logo-big .brand-mark { max-width: 200px; width: 100%; height: auto; display: block; margin: 0 auto 16px; }
.ob-logo-big .wordmark { font-size: 40px; font-weight: 900; letter-spacing: -2px; }
.ob-logo-big .wordmark span { color: var(--primary); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.auth-card h1 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.auth-card p { font-size: 14px; color: var(--text-3); margin-bottom: 24px; }
.auth-link { font-size: 14px; color: var(--text-3); margin-top: 16px; text-align: center; }
.auth-link a { color: var(--primary); font-weight: 500; cursor: pointer; }
.auth-link a:hover { text-decoration: underline; }
.demo-hint {
  margin-top: 16px; padding: 8px 12px;
  background: var(--primary-10); border: 1px solid rgba(79,124,255,0.15);
  border-radius: 8px; font-size: 11px; color: var(--text-3); text-align: center;
}
.demo-hint span { color: var(--text-2); }
.error-box {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--danger-10); border: 1px solid rgba(239,68,68,0.2);
  color: var(--danger); font-size: 14px; margin-bottom: 16px;
}

/* ===== ONBOARDING ===== */
.onboarding {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 48px 24px; background: var(--bg);
}
.ob-dots { display: flex; gap: 6px; align-items: center; }
.ob-dot { height: 6px; border-radius: 3px; transition: all 300ms ease; background: var(--border); width: 6px; }
.ob-dot.active { background: var(--primary); width: 24px; }
.ob-dot.done { background: rgba(79,124,255,0.4); }
.ob-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 360px; }
.ob-logo-big { font-size: 48px; font-weight: 900; letter-spacing: -2px; margin-bottom: 4px; }
.ob-logo-big span { color: var(--primary); }
.ob-focus-option {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 16px; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition); text-align: left;
  margin-bottom: 10px;
}
.ob-focus-option.selected { border-color: var(--primary); background: var(--primary-10); }
.ob-focus-option .icon { font-size: 24px; flex-shrink: 0; }
.ob-focus-option .focus-label { font-size: 14px; font-weight: 600; }
.ob-focus-option .focus-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ob-check-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--success-10); border: 2px solid var(--success);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px; animation: scaleIn 0.3s ease;
}
.ob-footer { width: 100%; max-width: 360px; }

/* ===== TELA HOJE ===== */
.greeting-date { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: 0.3px; margin-bottom: 6px; }
.greeting-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; }
.greeting-sub { font-size: 14px; color: var(--text-3); margin-top: 6px; letter-spacing: 0.1px; }
.section { margin-bottom: 28px; }
.section-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px; }

/* Home redesign */
.home-header { margin-bottom: 24px; }
.home-summary-card { background: var(--surface-el); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 20px; }
.home-summary-hd { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.home-summary-stats { font-size: 14px; font-weight: 600; color: var(--text-1); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.home-summary-dot { color: var(--text-3); font-weight: 400; }
.home-summary-focus { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.home-summary-focus-label { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.7px; }
.home-summary-focus-text { font-size: 14px; font-weight: 500; color: var(--text-1); line-height: 1.4; }
.home-quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 28px; }
.home-quick-btn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-el); border: 1px solid var(--border); border-radius: 10px; font-size: 12px; font-weight: 500; color: var(--text-2); cursor: pointer; transition: border-color var(--transition), color var(--transition); }
.home-quick-btn:hover, .home-quick-btn:active { border-color: var(--primary); color: var(--primary); }
.home-quick-btn svg { flex-shrink: 0; color: var(--text-3); }
.home-section { margin-bottom: 22px; }
.home-section-hd { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; padding: 0 2px; }
.home-section-hd span { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; }
.home-section-body { background: var(--surface-el); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.home-section-body .priority-item, .home-section-body .task-item { border-radius: 0; }
.home-section-body .priority-item + .priority-item,
.home-section-body .task-item + .task-item,
.home-section-body .event-item + .event-item,
.home-section-body .project-home-card + .project-home-card { border-top: 1px solid var(--border); }
.home-empty { padding: 18px 16px; text-align: center; }
.home-empty-msg { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.home-empty-sub { font-size: 12px; color: var(--text-3); line-height: 1.4; margin-bottom: 12px; }
.home-empty-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--text-2); cursor: pointer; background: transparent; transition: border-color var(--transition), color var(--transition); }
.home-empty-btn:hover, .home-empty-btn:active { border-color: var(--primary); color: var(--primary); }
.section-icon { width: 14px; height: 14px; }

/* Priority item */
.priority-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  cursor: pointer; transition: background var(--transition);
}
.priority-item:hover { background: var(--surface-el); }
.priority-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: all var(--transition);
}
.priority-check.done { background: var(--primary); border-color: var(--primary); }
.priority-text { font-size: 14px; font-weight: 500; transition: all var(--transition); }
.priority-text.done { text-decoration: line-through; color: var(--text-3); }

/* Task item */
.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; cursor: pointer; transition: background var(--transition);
}
.task-item:hover { background: var(--surface-el); }
.task-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; margin-top: 1px;
  transition: all var(--transition);
}
.task-check.done { background: var(--success); border-color: var(--success); }
.task-title { font-size: 14px; font-weight: 500; line-height: 1.4; }
.task-title.done { text-decoration: line-through; color: var(--text-3); }
.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.task-date { font-size: 12px; color: var(--text-3); }
.task-info { flex: 1; min-width: 0; }

/* Event item */
.event-item { display: flex; align-items: stretch; gap: 0; }
.event-bar { width: 3px; flex-shrink: 0; border-radius: 2px; margin: 14px 0; }
.event-content { flex: 1; padding: 14px 16px; }
.event-time { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.event-title { font-size: 14px; font-weight: 500; }
.event-duration { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Note card */
.note-card { padding: 16px; cursor: pointer; transition: background var(--transition); }
.note-card:hover { background: var(--surface-el); }
.note-card:active { background: var(--surface-el); }
.note-card-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.note-card-preview { font-size: 13px; color: var(--text-3); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; flex-wrap: wrap; gap: 4px; }
.note-date { font-size: 11px; color: var(--text-3); }
.notes-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat-card { padding: 16px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -1px; margin-bottom: 2px; }
.stat-label { font-size: 12px; color: var(--text-3); }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.stat-trend { font-size: 11px; margin-top: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* Chart bars */
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 80px; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-bar-count { font-size: 10px; color: var(--text-3); }
.chart-bar-wrap { width: 100%; display: flex; align-items: flex-end; justify-content: center; height: 56px; }
.chart-bar { width: 100%; border-radius: 4px 4px 0 0; transition: height 500ms ease; background: var(--border); min-height: 2px; }
.chart-bar.today-bar { background: var(--primary); }
.chart-day { font-size: 10px; color: var(--text-3); }
.chart-day.today { color: var(--primary); }

/* Category bars */
.cat-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cat-label { font-size: 12px; color: var(--text-2); width: 72px; flex-shrink: 0; }
.cat-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 2px; transition: width 700ms ease; }
.cat-count { font-size: 12px; color: var(--text-3); width: 24px; text-align: right; flex-shrink: 0; }

/* Calendar */
.cal-toggle { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; }
.cal-toggle-btn { flex: 1; padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-3); transition: all var(--transition); }
.cal-toggle-btn.active { background: var(--primary); color: #fff; }
.cal-week-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; margin: 12px 0; }
.cal-day-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border-radius: var(--radius); cursor: pointer; transition: all var(--transition);
  color: var(--text-3);
}
.cal-day-btn .day-name { font-size: 9px; font-weight: 600; text-transform: uppercase; }
.cal-day-btn .day-num { font-size: 15px; font-weight: 700; }
.cal-day-btn .day-dots { display: flex; gap: 2px; }
.cal-day-btn .day-dot { width: 4px; height: 4px; border-radius: 50%; }
.cal-day-btn.today { background: var(--primary-10); color: var(--primary); }
.cal-day-btn.selected { background: var(--primary); color: #fff; }
.cal-day-btn.selected .day-dot { background: rgba(255,255,255,0.6) !important; }
.cal-month-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-month-cell {
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  border-radius: 8px; font-size: 14px; cursor: pointer; transition: all var(--transition);
  color: var(--text-2);
}
.cal-month-cell.today { background: var(--primary-10); color: var(--primary); font-weight: 700; }
.cal-month-cell.selected { background: var(--primary); color: #fff; font-weight: 700; }
.cal-month-cell .has-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }
.cal-month-cell.selected .has-dot { background: rgba(255,255,255,0.6); }
.cal-month-header { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 4px; }
.cal-month-header span { text-align: center; font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; padding: 4px 0; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav-btn { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-3); transition: all var(--transition); }
.cal-nav-btn:hover { background: var(--surface); color: var(--text-1); }
.cal-nav-title { font-size: 15px; font-weight: 600; }

/* Tabs */
.tabs {
  display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px; overflow-x: auto; margin-bottom: 16px;
  -ms-overflow-style: none; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text-3); transition: all var(--transition); min-height: 36px;
}
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-count { font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.tab-btn.active .tab-count { background: rgba(255,255,255,0.2); }
.tab-btn:not(.active) .tab-count { background: var(--border); color: var(--text-3); }

/* Search */
.search-bar { position: relative; }
.search-bar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search-bar .input { padding-left: 38px; }

/* Category filter */
.cat-filter { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; -ms-overflow-style: none; scrollbar-width: none; }
.cat-filter::-webkit-scrollbar { display: none; }
.cat-pill { padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; white-space: nowrap; border: 1px solid var(--border); color: var(--text-3); transition: all var(--transition); cursor: pointer; }
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); }

/* Spacer */
.form-actions { display: flex; gap: 10px; padding-top: 8px; }

/* Priority selector */
.priority-selector { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.priority-btn { padding: 8px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; border: 1px solid var(--border); color: var(--text-3); transition: all var(--transition); }
.priority-btn.sel-high   { background: var(--danger-10);  border-color: rgba(239,68,68,0.3);  color: var(--danger);  }
.priority-btn.sel-medium { background: var(--warning-10); border-color: rgba(245,158,11,0.3); color: var(--warning); }
.priority-btn.sel-low    { background: var(--success-10); border-color: rgba(34,197,94,0.3);  color: var(--success); }

/* Type selector */
.type-selector { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.type-btn { padding: 7px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; border: 1px solid var(--border); color: var(--text-3); transition: all var(--transition); }
.type-btn.active { background: var(--primary-10); border-color: rgba(79,124,255,0.3); color: var(--primary); }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-state svg { width: 36px; height: 36px; margin: 0 auto 12px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }
.empty-action { margin-top: 14px; }

/* Utils */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-3); }
.text-secondary { color: var(--text-2); }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-divided > * + * { border-top: 1px solid var(--border); }
.spin { animation: spin 1s linear infinite; }
.hidden { display: none !important; }

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin    { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

[x-cloak] { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .notes-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .screen { padding: 32px 32px 40px 32px; }
  .notes-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .sidebar { display: none; }
  .screen { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 359px) {
  .notes-grid { grid-template-columns: 1fr; }
  .screen-title { font-size: 20px; }
}

/* ===== PROJETOS ===== */

/* Tela lista de projetos */
.project-filter { display: flex; gap: 4px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.project-filter::-webkit-scrollbar { display: none; }
.project-filter-btn { flex-shrink: 0; }
.project-filter-btn { flex: 1; padding: 7px 8px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-3); transition: all var(--transition); }
.project-filter-btn.active { background: var(--primary); color: #fff; }

.project-card { padding: 16px 16px 14px; cursor: pointer; transition: background var(--transition); }
.project-card:active { background: var(--surface-el); }
.project-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.project-color-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.project-name { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.3; flex: 1; }
.project-card-row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-card-sub { font-size: 12px; color: var(--text-3); margin: 0 0 10px; display: flex; align-items: center; gap: 5px; flex: 1; }
.project-card-sep { opacity: 0.35; }
.project-sub-overdue { color: var(--danger); }
.project-card-chevron { color: var(--border); flex-shrink: 0; }
.project-card-action { margin-bottom: 12px; padding: 8px 10px; background: rgba(79,124,255,0.06); border-radius: 8px; border-left: 2px solid var(--primary); }
.project-action-label { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 2px; }
.project-action-text { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.project-progress { margin-bottom: 0; }
.project-progress-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.project-progress-fill { height: 100%; border-radius: 2px; transition: width 500ms ease; }
.project-progress-label { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.project-progress-pct { font-size: 11px; font-weight: 600; color: var(--text-3); }
.project-progress-count { font-size: 11px; color: var(--text-3); }
.project-status-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }
.project-status-active    { background: var(--primary-10); color: var(--primary); }
.project-status-waiting   { background: rgba(255,255,255,0.06); color: var(--text-2); }
.project-status-completed { background: var(--success-10); color: var(--success); }
.project-status-archived  { background: rgba(255,255,255,0.04); color: var(--text-3); }

/* Project detail / Kanban */
.project-detail-header {
  padding: 20px 20px 0;
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
}
.project-detail-back { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 14px; font-weight: 500; margin-bottom: 16px; cursor: pointer; }
.project-detail-back svg { width: 18px; height: 18px; }
.project-detail-back:hover { color: var(--text-1); }
.project-detail-title { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.project-detail-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.project-detail-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.project-detail-fill { height: 100%; border-radius: 2px; background: var(--primary); transition: width 500ms ease; }
.project-detail-pct { font-size: 13px; font-weight: 700; color: var(--primary); min-width: 36px; text-align: right; }
.project-detail-deadline { font-size: 12px; color: var(--text-3); }

/* Kanban */
.kanban-container {
  display: flex; gap: 12px;
  overflow-x: auto; padding: 16px 20px calc(104px + env(safe-area-inset-bottom, 0px));
  -ms-overflow-style: none; scrollbar-width: none;
}
.kanban-container::-webkit-scrollbar { display: none; }
.kanban-col {
  flex-shrink: 0; width: 260px;
  display: flex; flex-direction: column; gap: 8px;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); position: sticky; top: 0;
}
.kanban-col-name { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; }
.kanban-col-count { font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--border); padding: 2px 7px; border-radius: 6px; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.kanban-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.kanban-card.pri-high::before   { background: var(--danger);  }
.kanban-card.pri-medium::before { background: var(--warning); }
.kanban-card.pri-low::before    { background: var(--success); }
.kanban-card:active { border-color: var(--primary); }
.kanban-card-title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; }
.kanban-card-desc  { font-size: 12px; color: var(--text-3); line-height: 1.5; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kanban-card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.kanban-label { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--primary-10); color: var(--primary); }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; }
.kanban-card-date { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 3px; }
.kanban-card-date.overdue { color: var(--danger); }
.kanban-card-checklist { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 3px; }
.kanban-add-card {
  padding: 10px 12px; border-radius: var(--radius); border: 1px dashed var(--border);
  font-size: 13px; color: var(--text-3); width: 100%; text-align: left;
  transition: all var(--transition); background: transparent;
}
.kanban-add-card:hover { border-color: var(--primary); color: var(--primary); }

/* ===== PROJECT DETAIL SHELL + SEÇÕES VERTICAIS (mobile) ===== */
.project-detail-shell { display: flex; flex-direction: column; min-height: 100dvh; }

.project-sections { display: flex; flex-direction: column; flex: 1; }
.project-section { background: var(--surface); border-bottom: 1px solid var(--border); }
.project-section:first-child { border-top: 1px solid var(--border); }
.project-section-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; cursor: pointer; user-select: none;
  transition: background var(--transition); -webkit-tap-highlight-color: transparent;
}
.project-section-header:active { background: var(--surface-el); }
.project-section-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.project-section-name { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.8px; flex: 1; }
.project-section-count { font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--surface-el); padding: 2px 8px; border-radius: 6px; }
.project-section-chevron { color: var(--text-3); transition: transform var(--transition); flex-shrink: 0; }
.project-section-chevron.open { transform: rotate(90deg); }
.project-section-body { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px; }

.section-card {
  background: var(--surface-el); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px 10px 17px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.section-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 0;
}
.section-card.pri-high::before   { background: var(--danger);  }
.section-card.pri-medium::before { background: var(--warning); }
.section-card.pri-low::before    { background: var(--success); }
.section-card:active { border-color: var(--primary); }
.section-card-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.section-card-title { font-size: 14px; font-weight: 600; line-height: 1.4; flex: 1; }
.section-card-desc { font-size: 12px; color: var(--text-3); line-height: 1.5; margin: 4px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.section-card-footer { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.section-add-card {
  padding: 10px 14px; border-radius: var(--radius-sm); border: 1px dashed var(--border);
  font-size: 13px; color: var(--text-3); width: 100%; text-align: left;
  transition: all var(--transition); background: transparent; margin-top: 4px;
}
.section-add-card:hover { border-color: var(--primary); color: var(--primary); }

/* Responsive: mobile = seções verticais, desktop = kanban horizontal */
@media (max-width: 767px) {
  .project-detail-shell { min-height: 100dvh; }
  .kanban-container { display: none !important; }
  .project-sections { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 768px) {
  .project-detail-shell { height: 100dvh; overflow: hidden; }
  .project-sections { display: none !important; }
  .kanban-container { display: flex; }
}

/* Card detail bottom sheet */
.card-sheet {
  position: fixed; inset: 0; z-index: 50;
}
.card-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.card-sheet-box {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 92vh; overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}
.card-sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 4px; }
.card-sheet-header { padding: 8px 20px 16px; border-bottom: 1px solid var(--border); }
.card-sheet-title { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; margin-bottom: 6px; }
.card-sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-sheet-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.card-sheet-section-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.checklist-check {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all var(--transition); cursor: pointer;
}
.checklist-check.done { background: var(--success); border-color: var(--success); }
.checklist-item-title { font-size: 14px; flex: 1; }
.checklist-item-title.done { text-decoration: line-through; color: var(--text-3); }
.move-cols-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.move-col-btn { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--text-2); transition: all var(--transition); text-align: left; }
.move-col-btn:hover { border-color: var(--primary); color: var(--primary); }
.move-col-btn.current-col { border-color: var(--primary); background: var(--primary-10); color: var(--primary); }

/* Home — Projetos block */
.project-home-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer; transition: background var(--transition);
}
.project-home-card:active { background: var(--surface-el); }
.project-home-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.project-home-info { flex: 1; min-width: 0; }
.project-home-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-home-next { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.project-home-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.project-home-pct { font-size: 13px; font-weight: 700; color: var(--primary); }
.project-home-deadline { font-size: 11px; color: var(--text-3); }

/* New project modal */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; transition: all var(--transition); border: 2px solid transparent; }
.color-swatch.selected { border-color: white; transform: scale(1.15); }

/* ===== BOTTOM SHEET "MAIS" ===== */
.more-sheet-overlay { position: fixed; inset: 0; z-index: 45; }
.more-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.more-sheet-box {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.more-sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 0; }
.more-sheet-brand { text-align: center; padding: 16px 24px 20px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.more-sheet-brand img { height: 28px; width: auto; max-width: 140px; opacity: 0.85; display: block; margin: 0 auto 8px; object-fit: contain; }
.more-sheet-brand p { font-size: 12px; color: var(--text-3); letter-spacing: 0.2px; }
.more-sheet-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; width: 100%; text-align: left;
  transition: background var(--transition);
}
.more-sheet-item:hover, .more-sheet-item:active { background: var(--surface-el); }
.more-sheet-item svg { width: 20px; height: 20px; color: var(--text-2); flex-shrink: 0; }
.more-sheet-item span { font-size: 15px; font-weight: 500; }
.more-sheet-item.active span, .more-sheet-item.active svg { color: var(--primary); }
.more-sheet-divider { height: 1px; background: var(--border); margin: 4px 20px; }
