:root{
  --teal-900:#0F2027; --teal-800:#172E33; --teal-700:#1F3B41;
  --mist-50:#F5F7F6; --white:#FFFFFF; --line-light:#E4E9E7; --line-dark:#2B3E42;
  --brand-600:#0E8A79; --brand-500:#14A38F; --brand-100:#DFF3EF;
  --ink-900:#12211F; --ink-600:#4E6461; --ink-400:#8AA09C;
  --green:#16A34A; --amber:#D97706; --red:#DC2626; --gray:#94A3A8;
  --bg:var(--mist-50); --surface:var(--white); --border:var(--line-light);
  --text:var(--ink-900); --text-dim:var(--ink-600); --text-faint:var(--ink-400);
  --radius:18px; --radius-sm:12px;
  --shadow:0 1px 2px rgba(15,32,39,.04), 0 10px 28px -10px rgba(15,32,39,.10);
}
[data-theme="dark"]{
  --bg:var(--teal-900); --surface:var(--teal-800); --border:var(--line-dark);
  --text:#EAF3F1; --text-dim:#A9BFBB; --text-faint:#6F8985;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 14px 32px -14px rgba(0,0,0,.6);
}
*{box-sizing:border-box; margin:0; padding:0;}
body{ font-family:'Inter',system-ui,sans-serif; background:var(--bg); color:var(--text); -webkit-font-smoothing:antialiased; min-height:100vh; transition:background .25s,color .25s; }
.display{ font-family:'Manrope',sans-serif; letter-spacing:-.01em; }

#login{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.login-card{ width:100%; max-width:380px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:36px 28px; box-shadow:var(--shadow); }
.brand{ display:flex; align-items:center; gap:10px; margin-bottom:26px; }
.brand-mark{ width:36px; height:36px; border-radius:11px; background:linear-gradient(150deg,var(--brand-500),var(--brand-600)); position:relative; flex-shrink:0; }
.brand-mark svg{ position:absolute; inset:8px; }
.brand-name{ font-family:'Manrope'; font-weight:700; font-size:16px; }
.brand-name span{ display:block; font-family:'Inter'; font-weight:500; font-size:11px; color:var(--text-faint); letter-spacing:.03em; margin-top:1px;}
.login-card h1{ font-size:22px; font-weight:700; margin-bottom:6px; font-family:'Manrope'; }
.login-card p{ color:var(--text-dim); font-size:13.5px; margin-bottom:24px; }
.field{ margin-bottom:14px; }
.field label{ display:block; font-size:12.5px; font-weight:500; color:var(--text-dim); margin-bottom:6px; }
.field input{ width:100%; padding:11px 13px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--bg); color:var(--text); font-size:14px; font-family:inherit; }
.btn-primary{ width:100%; padding:12px; border-radius:var(--radius-sm); border:none; background:var(--brand-600); color:#fff; font-weight:700; font-size:14px; cursor:pointer; margin-top:6px; font-family:'Manrope'; }
.btn-primary:disabled{ opacity:.6; }
.btn-ghost{ width:100%; padding:11px; border-radius:var(--radius-sm); border:1px solid var(--border); background:transparent; color:var(--text-dim); font-weight:500; font-size:13.5px; cursor:pointer; margin-top:10px; font-family:inherit; }
.login-note{ margin-top:16px; font-size:11.5px; color:var(--text-faint); text-align:center; line-height:1.5; }
.login-error{ background:rgba(220,38,38,.1); color:var(--red); font-size:12.5px; font-weight:500; padding:9px 12px; border-radius:var(--radius-sm); margin-bottom:14px; display:none; }
.login-error.show{ display:block; }

#app{ display:none; min-height:100vh; }
#app.active{ display:flex; }
.sidebar{ width:220px; flex-shrink:0; background:var(--surface); border-right:1px solid var(--border); padding:22px 14px; display:none; flex-direction:column; }
.sidebar .brand{ padding:0 8px; margin-bottom:26px; }
.nav-item{ display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:var(--radius-sm); color:var(--text-dim); font-size:13.5px; font-weight:600; cursor:pointer; margin-bottom:2px; }
.nav-item.active{ background:var(--brand-100); color:var(--brand-600); }
[data-theme="dark"] .nav-item.active{ background:rgba(20,163,143,.16); color:#5FCBB8; }
.logout-link{ font-size:12px; color:var(--text-faint); cursor:pointer; }

.main{ flex:1; min-width:0; padding-bottom:90px; }
.topbar{ display:flex; align-items:center; justify-content:space-between; padding:20px 20px 4px; }
.greeting{ font-family:'Manrope'; font-weight:800; font-size:22px; }
.theme-toggle{ display:flex; gap:2px; background:var(--surface); border:1px solid var(--border); border-radius:20px; padding:3px; }
.theme-toggle button{ border:none; background:transparent; width:26px; height:26px; border-radius:50%; font-size:12px; cursor:pointer; color:var(--text-faint); }
.theme-toggle button.active{ background:var(--brand-600); color:#fff; }

.view{ padding:8px 20px 20px; }

.status-hero{ display:flex; align-items:center; gap:18px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; margin:14px 0 22px; box-shadow:var(--shadow); }
.ring-wrap{ position:relative; width:76px; height:76px; flex-shrink:0; }
.ring-wrap svg{ transform:rotate(-90deg); }
.ring-bg{ fill:none; stroke:var(--border); stroke-width:7; }
.ring-seg{ fill:none; stroke-width:7; stroke-linecap:round; }
.ring-center{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-family:'Manrope'; font-weight:800; font-size:18px; }
.status-copy p{ font-size:13px; color:var(--text-dim); margin-top:2px; }
.status-copy .line{ font-size:12.5px; font-weight:600; display:flex; align-items:center; gap:6px; margin-top:5px; }
.dot{ width:7px; height:7px; border-radius:50%; flex-shrink:0; }

.section-title{ font-size:13px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:.05em; margin:22px 0 10px; }

.item-card{ display:flex; align-items:center; gap:13px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; margin-bottom:9px; box-shadow:var(--shadow); }
.item-icon{ width:42px; height:42px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:19px; flex-shrink:0; }
.item-body{ flex:1; min-width:0; }
.item-title{ font-weight:700; font-size:13.5px; font-family:'Manrope'; }
.item-sub{ font-size:12px; color:var(--text-dim); margin-top:2px; }
.item-badge{ font-size:11px; font-weight:700; padding:4px 9px; border-radius:20px; white-space:nowrap; }
.badge-green{ background:rgba(22,163,74,.12); color:var(--green); }
.badge-amber{ background:rgba(217,119,6,.12); color:var(--amber); }
.badge-red{ background:rgba(220,38,38,.12); color:var(--red); }
.badge-gray{ background:rgba(148,163,168,.15); color:var(--gray); }

.week-strip{ display:flex; gap:8px; overflow-x:auto; padding-bottom:6px; }
.week-strip::-webkit-scrollbar{ display:none; }
.week-card{ flex-shrink:0; width:110px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px; box-shadow:var(--shadow); }
.week-card .d{ font-size:10.5px; color:var(--text-faint); font-weight:700; text-transform:uppercase; }
.week-card .t{ font-size:12.5px; font-weight:700; margin-top:5px; font-family:'Manrope'; line-height:1.25; }

.vehicle-card{ background:linear-gradient(135deg,var(--brand-600),#0B6D5F); color:#fff; border-radius:var(--radius); padding:18px; box-shadow:var(--shadow); }
.vehicle-card .name{ font-family:'Manrope'; font-weight:800; font-size:16px; }
.vehicle-card .km{ font-size:12px; opacity:.85; margin-top:2px; }
.vehicle-chips{ display:flex; gap:8px; margin-top:14px; flex-wrap:wrap; }
.vehicle-chip{ background:rgba(255,255,255,.16); font-size:11px; font-weight:700; padding:5px 10px; border-radius:20px; display:flex; align-items:center; gap:5px; }

.category-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
.category-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px; box-shadow:var(--shadow); display:flex; align-items:center; gap:10px; }
.category-card .ic{ font-size:18px; }
.category-card .n{ font-size:12.5px; font-weight:700; font-family:'Manrope'; }

.placeholder-view{ background:var(--surface); border:1px dashed var(--border); border-radius:var(--radius); padding:40px 20px; text-align:center; color:var(--text-faint); font-size:13px; }
.placeholder-view strong{ display:block; color:var(--text); font-size:15px; margin-bottom:6px; font-family:'Manrope'; }

.fab{ position:fixed; bottom:86px; right:20px; width:54px; height:54px; border-radius:50%; background:var(--brand-600); color:#fff; border:none; font-size:24px; box-shadow:0 10px 24px -6px rgba(14,138,121,.55); cursor:pointer; z-index:25; }

.bottom-nav{ position:fixed; bottom:0; left:0; right:0; background:var(--surface); border-top:1px solid var(--border); display:flex; padding:8px 4px calc(8px + env(safe-area-inset-bottom)); z-index:20; }
.bn-item{ flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 0; color:var(--text-faint); cursor:pointer; }
.bn-item.active{ color:var(--brand-600); }
.bn-icon{ width:20px; height:20px; }
.bn-label{ font-size:10px; font-weight:700; }

@media (min-width:860px){
  .sidebar{ display:flex; } .bottom-nav{ display:none; } .fab{ right:calc(50% - 500px + 24px); }
  .main{ padding-bottom:20px; } .view{ max-width:640px; padding:8px 34px 34px; }
}

/* ---------------- MODAL ---------------- */
.modal-backdrop{ position:fixed; inset:0; background:rgba(15,32,39,.45); display:flex; align-items:flex-end; justify-content:center; z-index:50; opacity:0; pointer-events:none; transition:opacity .2s; }
.modal-backdrop.open{ opacity:1; pointer-events:auto; }
.modal-sheet{ width:100%; max-width:480px; background:var(--surface); border-radius:20px 20px 0 0; padding:22px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow:0 -10px 40px rgba(0,0,0,.25); transform:translateY(12px); transition:transform .2s; max-height:80vh; overflow-y:auto; }
.modal-backdrop.open .modal-sheet{ transform:translateY(0); }
.modal-close{ text-align:right; font-size:14px; color:var(--text-faint); cursor:pointer; margin-bottom:6px; }
.modal-title{ font-family:'Manrope'; font-weight:800; font-size:17px; margin-bottom:16px; }
.type-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.type-option{ background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px 8px; display:flex; flex-direction:column; align-items:center; gap:8px; font-size:12px; font-weight:700; font-family:'Manrope'; color:var(--text); cursor:pointer; }
.type-option .ic{ font-size:24px; }
.type-option:active{ background:var(--brand-100); }
.field select{ width:100%; padding:11px 13px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--bg); color:var(--text); font-size:14px; font-family:inherit; }
.modal-error{ background:rgba(220,38,38,.1); color:var(--red); font-size:12.5px; font-weight:500; padding:9px 12px; border-radius:var(--radius-sm); margin-bottom:10px; display:none; }
.modal-error.show{ display:block; }
@media (min-width:860px){
  .modal-backdrop{ align-items:center; }
  .modal-sheet{ border-radius:20px; }
}

/* ---------------- SEARCH ---------------- */
.search-input{ width:100%; padding:12px 14px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface); color:var(--text); font-size:14px; font-family:inherit; box-shadow:var(--shadow); }

/* ---------------- NOTIFICATIONS ---------------- */
.notif-wrap{ position:relative; }
.notif-bell{ width:36px; height:36px; border-radius:50%; background:var(--surface); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:15px; cursor:pointer; position:relative; }
.notif-badge{ position:absolute; top:-3px; right:-3px; background:var(--red); color:#fff; font-size:10px; font-weight:700; min-width:16px; height:16px; border-radius:8px; display:flex; align-items:center; justify-content:center; padding:0 3px; }
.notif-panel{ position:absolute; top:44px; right:0; width:300px; max-height:380px; overflow-y:auto; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); opacity:0; pointer-events:none; transform:translateY(-6px); transition:opacity .15s, transform .15s; z-index:40; }
.notif-panel.open{ opacity:1; pointer-events:auto; transform:translateY(0); }
.notif-item{ display:flex; gap:9px; padding:10px 0; border-bottom:1px solid var(--border); }
.notif-item:last-of-type{ border-bottom:none; }
.notif-item .dot{ width:7px; height:7px; border-radius:50%; margin-top:5px; flex-shrink:0; }
.notif-item p{ font-size:12.5px; line-height:1.4; }
.notif-item.unread p{ font-weight:600; }

/* ---------------- PWA INSTALL BANNER ---------------- */
.install-banner{ position:fixed; left:16px; right:16px; bottom:96px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; box-shadow:var(--shadow); display:none; align-items:center; gap:10px; z-index:30; }
.install-banner.show{ display:flex; }
.install-banner p{ flex:1; font-size:12.5px; font-weight:600; }
.install-banner button{ background:var(--brand-600); color:#fff; border:none; border-radius:20px; padding:7px 14px; font-size:12px; font-weight:700; cursor:pointer; }
.install-banner .dismiss{ color:var(--text-faint); font-size:16px; cursor:pointer; padding:0 4px; }
@media (min-width:860px){ .install-banner{ left:auto; right:24px; width:320px; } }

/* ---------------- FILTER CHIPS (Calendario) ---------------- */
.period-row{ display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; -ms-overflow-style:none; scrollbar-width:none; }
.period-row::-webkit-scrollbar{ display:none; }
.chip{ flex-shrink:0; padding:7px 14px; border-radius:20px; border:1px solid var(--border); background:var(--surface); font-size:12.5px; font-weight:600; color:var(--text-dim); cursor:pointer; white-space:nowrap; }
.chip.active{ background:var(--brand-600); border-color:var(--brand-600); color:#fff; }

/* ---------------- TASKS ---------------- */
.task-row{ display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; margin-bottom:8px; cursor:pointer; box-shadow:var(--shadow); }
.task-check{ width:20px; height:20px; border-radius:6px; border:2px solid var(--border); flex-shrink:0; }
.task-check:hover{ border-color:var(--brand-500); }
.task-name{ font-size:13px; font-weight:600; }

/* ---------------- CATEGORY FILTER LABEL ---------------- */
.category-filter-label{ display:flex; align-items:center; justify-content:space-between; background:var(--brand-100); color:var(--brand-600); font-size:12.5px; font-weight:700; padding:8px 12px; border-radius:var(--radius-sm); margin-top:10px; }
[data-theme="dark"] .category-filter-label{ background:rgba(20,163,143,.16); color:#5FCBB8; }
.category-filter-label .clear{ cursor:pointer; opacity:.7; }
