
/* ════════════════════════════════════
   DESIGN SYSTEM — Apple-inspired
   Pure white · iOS blue · SF-style spacing
════════════════════════════════════ */
:root {
  /* Colors */
  --blue:   #007AFF;
  --blue-l: rgba(0,122,255,.1);
  --blue-m: rgba(0,122,255,.18);
  --green:  #34C759;
  --green-l:rgba(52,199,89,.1);
  --red:    #FF3B30;
  --red-l:  rgba(255,59,48,.1);
  --orange: #FF9500;
  --orange-l:rgba(255,149,0,.1);
  --purple: #AF52DE;
  --purple-l:rgba(175,82,222,.1);
  --teal:   #5AC8FA;
  --teal-l: rgba(90,200,250,.1);

  /* Neutrals */
  --bg:       #F2F2F7;
  --bg2:      #EFEFF4;
  --surface:  #FFFFFF;
  --surface2: #F9F9FB;
  --border:   rgba(60,60,67,.12);
  --border2:  rgba(60,60,67,.08);
  --text:     #1C1C1E;
  --text2:    #3C3C43;
  --muted:    rgba(60,60,67,.6);
  --muted2:   rgba(60,60,67,.3);

  /* Typography */
  --f: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 2px 8px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
}

* { box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
body { background:var(--bg); color:var(--text); font-family:var(--f); min-height:100vh; overflow-x:hidden; -webkit-font-smoothing:antialiased; }
button,input,select,textarea { font-family:var(--f); }
::-webkit-scrollbar { width:0; }

/* ── ANIMATIONS ── */
@keyframes fadeUp   { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeIn   { from{opacity:0} to{opacity:1} }
@keyframes scaleIn  { from{opacity:0;transform:scale(.96)} to{opacity:1;transform:scale(1)} }
@keyframes slideUp  { from{transform:translateY(100%)} to{transform:translateY(0)} }
@keyframes pulse    { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
@keyframes spin     { to{transform:rotate(360deg)} }
@keyframes shimmer  {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── SKELETON LOADER ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, #e8e8ed 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

/* ══════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════ */
.login-screen {
  min-height:100vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; padding:32px 24px;
  background:linear-gradient(160deg, #EBF4FF 0%, #F2F2F7 50%, #F0FFF4 100%);
}
.login-logo-wrap {
  text-align:center; margin-bottom:40px;
  animation: fadeUp .5s ease;
}
.login-icon {
  width:80px; height:80px; border-radius:22px;
  background:var(--blue); display:inline-flex;
  align-items:center; justify-content:center;
  margin-bottom:16px;
  box-shadow: 0 8px 32px rgba(0,122,255,.3);
}
.login-icon svg { width:44px; height:44px; color:#fff; stroke-width:2; }
.login-brand { font-size:1.8rem; font-weight:700; letter-spacing:-.5px; color:var(--text); }
.login-brand span { color:var(--blue); }
.login-sub { font-size:.85rem; color:var(--muted); margin-top:4px; }

.login-card {
  background:var(--surface); border-radius:var(--r-xl);
  padding:28px 24px; width:100%; max-width:360px;
  box-shadow:var(--shadow-lg);
  animation: scaleIn .4s ease .1s both;
}
.login-step-title { font-size:1.1rem; font-weight:600; margin-bottom:6px; }
.login-step-sub   { font-size:.82rem; color:var(--muted); margin-bottom:20px; }

.role-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.role-btn {
  background:var(--surface2); border:1.5px solid var(--border);
  border-radius:var(--r-lg); padding:20px 12px; text-align:center;
  cursor:pointer; transition:all .18s;
}
.role-btn:hover { border-color:var(--blue); background:var(--blue-l); transform:translateY(-1px); }
.role-btn.sel   { border-color:var(--blue); background:var(--blue-l); }
.role-btn:active{ transform:scale(.97); }
.role-icon  { font-size:1.8rem; margin-bottom:8px; }
.role-name  { font-size:.88rem; font-weight:600; }
.role-desc  { font-size:.7rem; color:var(--muted); margin-top:2px; line-height:1.4; }

.tech-item {
  display:flex; align-items:center; gap:12px;
  background:var(--surface2); border:1.5px solid var(--border);
  border-radius:var(--r); padding:12px 14px; margin-bottom:8px;
  cursor:pointer; transition:all .15s;
}
.tech-item:hover, .tech-item.sel { border-color:var(--blue); background:var(--blue-l); }
.tech-av {
  width:38px; height:38px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:.88rem; flex-shrink:0;
}
.tech-item-name { font-weight:600; font-size:.9rem; }

/* PIN PAD */
.pin-label { font-size:.78rem; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; text-align:center; margin-bottom:14px; }
.pin-dots  { display:flex; gap:10px; justify-content:center; margin-bottom:22px; }
.pin-dot   {
  width:14px; height:14px; border-radius:50%;
  background:var(--muted2); transition:all .2s;
}
.pin-dot.on  { background:var(--blue); transform:scale(1.1); }
.pin-dot.err { background:var(--red); animation:pulse .3s ease; }
.pin-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.pkey {
  background:var(--surface2); border:none; border-radius:var(--r);
  padding:16px 8px; font-size:1.1rem; font-weight:500;
  color:var(--text); cursor:pointer; text-align:center;
  transition:all .12s; user-select:none;
  box-shadow:var(--shadow-sm);
}
.pkey:active  { background:var(--blue-l); color:var(--blue); transform:scale(.94); box-shadow:none; }
.pkey.del     { color:var(--red); font-size:.9rem; }
.pkey.emp     { background:transparent; box-shadow:none; cursor:default; }
.pin-err      { color:var(--red); font-size:.78rem; text-align:center; margin-top:8px; min-height:18px; }
.btn-back     { background:none; border:none; color:var(--blue); font-size:.85rem; cursor:pointer; display:block; text-align:center; width:100%; margin-top:14px; font-weight:500; }

/* ══════════════════════════════════
   APP SHELL
══════════════════════════════════ */
.app-screen { display:none; }

/* NAV ICON (sidebar logo) */
.nav-icon  { width:28px; height:28px; border-radius:7px; background:var(--blue); display:flex; align-items:center; justify-content:center; }
.nav-icon svg { width:14px; height:14px; color:#fff; stroke-width:2.5; }
.nav-name  { font-size:.98rem; font-weight:700; letter-spacing:-.3px; }
.syncing { animation:spin .8s linear infinite; }

/* FLOATING TOP ACTIONS — hidden on mobile, hidden on desktop (moved to sidebar) */
.top-actions {
  display: none;
}
.ta-btn {
  position:relative; width:40px; height:40px; border-radius:50%;
  background:var(--surface); border:none; cursor:pointer;
  box-shadow:0 2px 12px rgba(0,0,0,.10); display:flex;
  align-items:center; justify-content:center;
}
.ta-btn svg { color:var(--text2); }
.ta-avatar {
  width:40px; height:40px; border-radius:50%; border:none;
  cursor:pointer; padding:0; overflow:hidden;
  box-shadow:0 2px 12px rgba(0,0,0,.15);
}
#profileAvatar {
  width:40px; height:40px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:.88rem; color:#fff;
}

/* PROFILE DROPDOWN */
.profile-dropdown {
  position:fixed; top:62px; right:12px; z-index:300;
  background:var(--surface); border-radius:var(--r-xl);
  box-shadow:0 8px 32px rgba(0,0,0,.18); min-width:230px;
  overflow:hidden; animation:fadeUp .18s ease;
}
.profile-drop-user {
  padding:16px 16px 14px; border-bottom:.5px solid var(--border);
  display:flex; gap:12px; align-items:center;
}
.profile-drop-logout {
  width:100%; padding:14px 16px; border:none; background:none;
  display:flex; align-items:center; gap:10px; text-align:left;
  font-size:.88rem; font-weight:600; color:var(--red); cursor:pointer;
}
.profile-drop-logout:hover { background:rgba(255,59,48,.07); }

/* BOTTOM NAV */
.bottom-nav {
  position:fixed; bottom:0; left:0; right:0; z-index:100;
  background:rgba(255,255,255,.9); backdrop-filter:blur(20px) saturate(180%);
  -webkit-backdrop-filter:blur(20px) saturate(180%);
  border-top:0.5px solid var(--border);
  display:flex; justify-content:space-around; align-items:flex-end;
  padding:6px 0 calc(8px + env(safe-area-inset-bottom));
}
.nb {
  display:flex; flex-direction:column; align-items:center; gap:2px;
  background:none; border:none; color:var(--muted); cursor:pointer;
  font-size:.62rem; font-weight:500; padding:6px 8px 4px; border-radius:10px;
  transition:color .15s; min-width:48px; position:relative;
}
.nb svg { width:22px; height:22px; stroke-width:1.8; transition:transform .2s; }
.nb.active { color:var(--blue); }
.nb.active svg { transform:scale(1.08); }
.nb.active::before {
  content:''; position:absolute; top:0; left:50%; transform:translateX(-50%);
  width:28px; height:3px; border-radius:0 0 4px 4px; background:var(--blue);
}
.nb .bdot {
  position:absolute; top:2px; right:8px; width:8px; height:8px;
  border-radius:50%; background:var(--red); border:2px solid white; display:none;
}
.nb .bdot.show { display:block; }

/* MAIN */
.main { padding:14px 0 calc(76px + env(safe-area-inset-bottom)); max-width:560px; margin:0 auto; }
.page { display:none; padding:0 16px; }
.page.active { display:block; animation:fadeUp .22s ease; }

/* ══════════════════════════════════
   COMPONENTS
══════════════════════════════════ */

/* Section titles */
.sec-hd {
  display:flex; align-items:center; justify-content:space-between;
  margin:20px 0 10px;
}
.sec-title { font-size:.72rem; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.8px; }
.sec-action { font-size:.8rem; font-weight:500; color:var(--blue); background:none; border:none; cursor:pointer; }
.sec-hd:first-child { margin-top:0; }

/* Cards */
.card {
  background:var(--surface); border-radius:var(--r-lg);
  box-shadow:var(--shadow); overflow:hidden; margin-bottom:10px;
}
.card-pad { padding:16px; }

/* Stats row */
.stats-row { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:10px; }
.stats-row-4 { grid-template-columns:repeat(2,1fr); }
.stat-card {
  background:var(--surface); border-radius:var(--r-lg);
  padding:14px; box-shadow:var(--shadow);
  display:flex; flex-direction:column; gap:4px;
}
.stat-icon { width:32px; height:32px; border-radius:9px; display:flex; align-items:center; justify-content:center; margin-bottom:4px; font-size:1rem; }
.stat-val  { font-size:1.55rem; font-weight:700; letter-spacing:-.5px; line-height:1; }
.stat-lbl  { font-size:.68rem; font-weight:500; color:var(--muted); }

/* Buttons */
.btn-primary {
  width:100%; padding:14px; background:var(--blue); color:#fff;
  border:none; border-radius:var(--r-lg); font-size:.92rem; font-weight:600;
  cursor:pointer; transition:opacity .18s, transform .12s;
  box-shadow:0 2px 8px rgba(0,122,255,.3);
}
.btn-primary:active { opacity:.88; transform:scale(.98); }
.btn-secondary {
  width:100%; padding:13px; background:var(--blue-l); color:var(--blue);
  border:none; border-radius:var(--r-lg); font-size:.9rem; font-weight:600;
  cursor:pointer; transition:opacity .18s;
}
.btn-danger { background:var(--red-l); color:var(--red); }

/* Row item */
.row-item {
  display:flex; align-items:center; gap:12px;
  padding:13px 16px; background:var(--surface);
  border-bottom:0.5px solid var(--border); cursor:pointer;
  transition:background .12s;
}
.row-item:last-child { border-bottom:none; }
.row-item:active { background:var(--bg2); }
.row-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1rem; flex-shrink:0; }
.row-info { flex:1; min-width:0; }
.row-title { font-size:.9rem; font-weight:500; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row-sub   { font-size:.75rem; color:var(--muted); }
.row-right { text-align:right; flex-shrink:0; }
.row-val   { font-size:.9rem; font-weight:600; }
.row-meta  { font-size:.72rem; color:var(--muted); margin-top:2px; }
.row-chevron { color:var(--muted2); font-size:.8rem; }

/* Status badges */
.badge {
  display:inline-flex; align-items:center; gap:3px;
  font-size:.68rem; font-weight:600; padding:3px 8px;
  border-radius:20px; white-space:nowrap;
}
.badge-blue   { background:var(--blue-l);   color:var(--blue);   }
.badge-green  { background:var(--green-l);  color:var(--green);  }
.badge-red    { background:var(--red-l);    color:var(--red);    }
.badge-orange { background:var(--orange-l); color:var(--orange); }
.badge-purple { background:var(--purple-l); color:var(--purple); }
.badge-gray   { background:var(--bg2);      color:var(--muted);  }

/* Tags */
.tag {
  display:inline-block; font-size:.7rem; font-weight:500;
  padding:3px 9px; border-radius:6px; background:var(--bg2); color:var(--text2);
}

/* Form */
.form-group { margin-bottom:14px; }
.form-label { font-size:.72rem; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.4px; margin-bottom:6px; display:block; }
.form-input, .form-select, .form-textarea {
  width:100%; background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--r); padding:11px 13px; color:var(--text);
  font-size:.9rem; outline:none; transition:border-color .18s;
  -webkit-appearance:none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color:var(--blue); background:var(--surface); }
.form-input::placeholder, .form-textarea::placeholder { color:var(--muted2); }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.form-textarea { resize:vertical; min-height:72px; }

/* Divider */
.divider { height:.5px; background:var(--border); margin:4px 0; }

/* Empty state */
.empty-state { text-align:center; padding:48px 20px; }
.empty-icon  { font-size:2.8rem; margin-bottom:12px; opacity:.5; }
.empty-title { font-size:.98rem; font-weight:600; margin-bottom:4px; }
.empty-sub   { font-size:.82rem; color:var(--muted); }

/* ── MODAL ── */
.overlay {
  display:none; position:fixed; inset:0; z-index:200;
  background:rgba(0,0,0,.4); backdrop-filter:blur(4px);
  align-items:flex-end; justify-content:center;
}
.overlay.open { display:flex; animation:fadeIn .2s ease; }
.modal {
  background:var(--surface); border-radius:20px 20px 0 0;
  padding:20px 16px calc(24px + env(safe-area-inset-bottom));
  width:100%; max-width:560px; max-height:92vh; overflow-y:auto;
  animation:slideUp .28s cubic-bezier(.34,1.3,.64,1);
}
.modal-handle { width:36px; height:4px; background:var(--muted2); border-radius:2px; margin:0 auto 16px; }
.modal-title  { font-size:1.05rem; font-weight:700; margin-bottom:16px; }
.modal-close  {
  background:var(--bg2); border:none; width:28px; height:28px;
  border-radius:50%; cursor:pointer; display:flex; align-items:center;
  justify-content:center; font-size:.82rem; color:var(--muted);
}

/* ── TOAST ── */
.toast {
  position:fixed; top:62px; left:50%; transform:translateX(-50%) translateY(-6px);
  background:rgba(28,28,30,.92); backdrop-filter:blur(10px);
  color:#fff; padding:9px 18px; border-radius:20px;
  font-size:.8rem; font-weight:500; z-index:500;
  opacity:0; transition:all .22s; pointer-events:none; white-space:nowrap;
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.toast.ok     { background:rgba(52,199,89,.92); }
.toast.warn   { background:rgba(255,149,0,.92); color:#fff; }
.toast.info   { background:rgba(0,122,255,.92); }

/* ── SELECTION BAR ── */
.sel-bar {
  position:sticky; top:52px; z-index:50;
  background:var(--blue); color:#fff;
  padding:10px 16px; margin:0 -16px;
  display:none; align-items:center; gap:8px;
  box-shadow:0 2px 12px rgba(0,122,255,.3);
}
.sel-bar.show { display:flex; animation:fadeIn .2s ease; }
.sel-count    { font-size:.85rem; font-weight:600; flex:1; }
.sel-action   { background:rgba(255,255,255,.2); border:none; color:#fff; border-radius:8px; padding:5px 10px; font-size:.72rem; font-weight:600; cursor:pointer; white-space:nowrap; }
.sel-cancel   { background:none; border:none; color:rgba(255,255,255,.7); cursor:pointer; font-size:.9rem; padding:4px; }

/* Checkbox */
.check {
  width:22px; height:22px; border-radius:50%; border:1.5px solid var(--muted2);
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:all .15s; background:var(--surface);
}
.check.on { background:var(--blue); border-color:var(--blue); }
.check.on::after { content:''; width:5px; height:9px; border:2px solid #fff; border-top:none; border-left:none; transform:rotate(45deg) translate(-1px,-1px); display:block; }

/* ══════════════════════════════════
   DASHBOARD
══════════════════════════════════ */
.greeting-block { padding:20px 16px 0; margin:0 -16px; }
.greeting-date  { font-size:.75rem; font-weight:500; color:var(--muted); text-transform:capitalize; margin-bottom:2px; }
.greeting-name  { font-size:1.5rem; font-weight:700; letter-spacing:-.3px; }
.greeting-name span { color:var(--blue); }

/* Big metric card */
.hero-card {
  background:linear-gradient(135deg, var(--blue) 0%, #0A84FF 100%);
  border-radius:var(--r-xl); padding:20px; color:#fff; margin-bottom:10px;
  box-shadow:0 8px 24px rgba(0,122,255,.3); position:relative; overflow:hidden;
}
.hero-card::after {
  content:''; position:absolute; top:-40px; right:-40px;
  width:160px; height:160px; border-radius:50%;
  background:rgba(255,255,255,.08);
}
.hero-label { font-size:.75rem; font-weight:500; opacity:.8; margin-bottom:6px; }
.hero-amount { font-size:clamp(1.7rem,5vw,2.4rem); font-weight:700; letter-spacing:-.5px; }
.hero-sub { font-size:.78rem; opacity:.7; margin-top:4px; }
.hero-pills { display:flex; gap:8px; margin-top:14px; flex-wrap:wrap; }
.hero-pill {
  background:rgba(255,255,255,.15); border-radius:20px;
  padding:5px 11px; font-size:.72rem; font-weight:500; white-space:nowrap;
}

/* Chart card */
.chart-card {
  background:var(--surface); border-radius:var(--r-xl);
  padding:16px; box-shadow:var(--shadow); margin-bottom:10px;
}
.chart-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.chart-title  { font-size:.9rem; font-weight:600; }
.chart-tabs   { display:flex; gap:2px; background:var(--bg2); border-radius:8px; padding:2px; }
.chart-tab    { padding:4px 10px; border-radius:6px; font-size:.72rem; font-weight:500; color:var(--muted); cursor:pointer; border:none; background:none; transition:all .15s; }
.chart-tab.active { background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }
canvas        { display:block; }

/* Team status */
.team-card { background:var(--surface); border-radius:var(--r-xl); box-shadow:var(--shadow); overflow:hidden; margin-bottom:10px; }
.team-header { padding:14px 16px 10px; display:flex; align-items:center; justify-content:space-between; }
.team-title  { font-size:.9rem; font-weight:600; }
.team-live   { display:flex; align-items:center; gap:5px; font-size:.72rem; font-weight:500; color:var(--green); }
.live-dot    { width:7px; height:7px; border-radius:50%; background:var(--green); animation:pulse 1.5s infinite; }
.tech-row    {
  display:flex; align-items:center; gap:11px;
  padding:10px 16px; border-top:.5px solid var(--border);
  cursor:pointer; transition:background .12s;
}
.tech-row:active { background:var(--bg2); }
.tech-av2    { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:.82rem; flex-shrink:0; }
.tech-info   { flex:1; }
.tech-name2  { font-size:.87rem; font-weight:500; margin-bottom:1px; }
.tech-status-txt { font-size:.73rem; color:var(--muted); }
.tech-progress { display:flex; align-items:center; gap:6px; }
.progress-bar { flex:1; height:4px; background:var(--bg2); border-radius:2px; overflow:hidden; min-width:60px; }
.progress-fill { height:100%; border-radius:2px; background:var(--green); transition:width .5s ease; }
.progress-txt  { font-size:.72rem; font-weight:600; color:var(--muted); white-space:nowrap; }

/* ══════════════════════════════════
   MAP
══════════════════════════════════ */
#mapContainer {
  height:260px; border-radius:var(--r-xl); overflow:hidden;
  box-shadow:var(--shadow); margin-bottom:10px; background:var(--bg2);
  position:relative;
}
.map-placeholder {
  position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:8px;
}
.map-tech-marker {
  position:absolute; transform:translate(-50%,-100%);
  display:flex; flex-direction:column; align-items:center; cursor:pointer;
}
.map-marker-pin {
  width:36px; height:36px; border-radius:50%; border:3px solid #fff;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:.78rem; color:#fff;
  box-shadow:0 2px 8px rgba(0,0,0,.25);
}
.map-marker-label {
  background:rgba(0,0,0,.7); color:#fff; font-size:.64rem; font-weight:600;
  padding:2px 7px; border-radius:10px; margin-top:3px; white-space:nowrap;
}
.map-controls {
  position:absolute; top:10px; right:10px; display:flex; flex-direction:column; gap:6px;
}
.map-btn {
  width:32px; height:32px; background:var(--surface); border:none;
  border-radius:8px; box-shadow:var(--shadow); cursor:pointer;
  display:flex; align-items:center; justify-content:center; font-size:.85rem;
}

/* ══════════════════════════════════
   AGENDA (Mes/Semana/Día)
══════════════════════════════════ */
.agenda-nav {
  background:var(--surface); border-radius:var(--r-xl);
  padding:12px; box-shadow:var(--shadow); margin-bottom:10px;
}
.agenda-nav-top {
  display:flex; align-items:center; gap:8px; margin-bottom:10px;
}
.nav-arrow {
  width:32px; height:32px; background:var(--bg2); border:none;
  border-radius:9px; cursor:pointer; font-size:1rem; color:var(--text2);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.nav-arrow:active { background:var(--blue-l); color:var(--blue); }
.agenda-period { flex:1; text-align:center; font-size:.95rem; font-weight:600; letter-spacing:-.2px; }
.view-switch { display:flex; background:var(--bg2); border-radius:9px; padding:2px; }
.view-btn {
  flex:1; padding:6px; border-radius:7px; border:none; cursor:pointer;
  font-size:.73rem; font-weight:600; color:var(--muted); background:none;
  transition:all .15s;
}
.view-btn.active { background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }
.today-btn {
  background:var(--blue-l); border:none; color:var(--blue);
  border-radius:8px; padding:6px 12px; font-size:.73rem; font-weight:600;
  cursor:pointer; white-space:nowrap;
}

.agenda-summary {
  display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin-bottom:10px;
}
.ag-sum-item { background:var(--surface); border-radius:10px; padding:10px 8px; text-align:center; box-shadow:var(--shadow-sm); }
.ag-sum-val  { font-size:1.15rem; font-weight:700; }
.ag-sum-lbl  { font-size:.62rem; color:var(--muted); margin-top:2px; }

.day-group { margin-bottom:14px; }
.day-hd {
  display:flex; align-items:center; justify-content:space-between;
  padding:7px 12px; border-radius:10px; margin-bottom:6px;
}
.day-hd.today    { background:linear-gradient(135deg,#1C1C1E,#3A3A3C); }
.day-hd.past     { background:var(--bg2); }
.day-hd.future   { background:var(--surface); border:.5px solid var(--border); box-shadow:var(--shadow-sm); }
.day-hd-left { display:flex; align-items:center; gap:7px; }
.day-hd-name { font-size:.82rem; font-weight:700; }
.day-hd.today .day-hd-name { color:#fff; }
.day-hd-right { font-size:.78rem; font-weight:700; }
.day-hd.today .day-hd-right { color:rgba(255,255,255,.8); }

.svc-item {
  background:var(--surface); border-radius:var(--r-lg);
  margin-bottom:8px; overflow:hidden; box-shadow:var(--shadow-sm);
  border:.5px solid var(--border);
}
.svc-item.cancelled { opacity:.5; }
.svc-item-head {
  display:flex; align-items:center; gap:0; cursor:pointer;
  transition:background .12s;
}
.svc-item-head:active { background:var(--bg2); }
.svc-color-bar { width:3px; align-self:stretch; flex-shrink:0; }
.svc-main { flex:1; display:flex; align-items:center; gap:10px; padding:12px 12px 12px 10px; min-width:0; }
.svc-client-name { font-size:.88rem; font-weight:600; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.svc-service-lbl { font-size:.73rem; color:var(--muted); }
.svc-right { text-align:right; flex-shrink:0; }
.svc-time-lbl { font-size:.85rem; font-weight:600; color:var(--blue); }
.svc-body { padding:12px 14px; border-top:.5px solid var(--border); }
.svc-detail-row { display:flex; gap:7px; font-size:.8rem; color:var(--text2); margin-bottom:5px; align-items:flex-start; }
.svc-detail-row .ico { flex-shrink:0; opacity:.6; }
.svc-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-top:10px; }
.svc-btn {
  padding:9px 4px; border-radius:9px; border:none; cursor:pointer;
  font-size:.72rem; font-weight:600; text-align:center;
  display:flex; align-items:center; justify-content:center; gap:3px;
  transition:opacity .15s;
}
.svc-btn:active { opacity:.7; }
.sb-edit   { background:var(--purple-l); color:var(--purple); }
.sb-done   { background:var(--green-l);  color:var(--green);  }
.sb-paid   { background:var(--orange-l); color:var(--orange); }
.sb-call   { background:var(--green-l);  color:var(--green);  }
.sb-wa     { background:var(--green-l);  color:var(--green);  }
.sb-ticket { background:var(--blue-l);   color:var(--blue);   }
.sb-maps   { background:var(--teal-l);   color:var(--teal);   }

/* ══════════════════════════════════
   REPORTES
══════════════════════════════════ */
.report-tabs { display:flex; background:var(--bg2); border-radius:10px; padding:2px; margin-bottom:14px; }
.rtab {
  flex:1; padding:8px; border-radius:8px; border:none; cursor:pointer;
  font-size:.78rem; font-weight:600; color:var(--muted); background:none;
  transition:all .15s;
}
.rtab.active { background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }
.report-section { background:var(--surface); border-radius:var(--r-xl); margin-bottom:10px; overflow:hidden; box-shadow:var(--shadow); }
.report-row { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:.5px solid var(--border); }
.report-row:last-child { border-bottom:none; }
.report-lbl { font-size:.85rem; color:var(--text2); }
.report-val { font-size:.88rem; font-weight:600; }
.bar-item { padding:10px 16px; border-bottom:.5px solid var(--border); }
.bar-item:last-child { border-bottom:none; }
.bar-row { display:flex; justify-content:space-between; font-size:.78rem; margin-bottom:5px; }
.bar-bg   { background:var(--bg2); border-radius:3px; height:5px; overflow:hidden; }
.bar-fill { height:100%; border-radius:3px; transition:width .6s cubic-bezier(.4,0,.2,1); }
.export-row { display:flex; gap:8px; margin-bottom:14px; }
.export-btn {
  flex:1; padding:11px; background:var(--surface); border:.5px solid var(--border);
  border-radius:var(--r-lg); font-size:.78rem; font-weight:600; cursor:pointer;
  display:flex; align-items:center; justify-content:center; gap:5px;
  color:var(--text2); box-shadow:var(--shadow-sm); transition:all .15s;
}
.export-btn:active { background:var(--bg2); }

/* ══════════════════════════════════
   CHAT
══════════════════════════════════ */
.chat-page { display:flex; flex-direction:column; height:calc(100vh - 134px); padding:0; }
.chat-header { padding:12px 16px; background:var(--surface); border-bottom:.5px solid var(--border); }
.chat-title  { font-size:.9rem; font-weight:600; }
.chat-online { font-size:.72rem; color:var(--green); margin-top:1px; }
.chat-messages { flex:1; overflow-y:auto; padding:12px 16px; }
.chat-day-sep { text-align:center; margin:10px 0; }
.chat-day-sep span { font-size:.68rem; color:var(--muted); background:var(--bg); padding:3px 10px; border-radius:20px; }
.chat-msg { margin-bottom:10px; display:flex; flex-direction:column; }
.chat-msg.me    { align-items:flex-end; }
.chat-msg.other { align-items:flex-start; }
.chat-msg.sys   { align-items:center; }
.msg-sender { font-size:.67rem; font-weight:600; margin-bottom:3px; padding:0 4px; }
.msg-bubble {
  max-width:78%; padding:9px 13px; font-size:.84rem; line-height:1.45; border-radius:16px;
}
.chat-msg.me    .msg-bubble { background:var(--blue); color:#fff; border-bottom-right-radius:4px; }
.chat-msg.other .msg-bubble { background:var(--surface); border:.5px solid var(--border); border-bottom-left-radius:4px; box-shadow:var(--shadow-sm); }
.chat-msg.sys   .msg-bubble { background:var(--bg2); color:var(--muted); font-size:.74rem; text-align:center; border-radius:20px; padding:4px 12px; }
.msg-time { font-size:.62rem; color:var(--muted); margin-top:3px; padding:0 4px; }
.chat-input-row {
  display:flex; gap:8px; padding:10px 16px calc(10px + env(safe-area-inset-bottom));
  background:var(--surface); border-top:.5px solid var(--border);
}
.chat-input {
  flex:1; background:var(--bg2); border:none; border-radius:22px;
  padding:10px 15px; font-size:.88rem; color:var(--text); outline:none;
}
.chat-input::placeholder { color:var(--muted2); }
.chat-send {
  width:38px; height:38px; border-radius:50%; background:var(--blue); border:none;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  box-shadow:0 2px 8px rgba(0,122,255,.3); flex-shrink:0;
}
.chat-send svg { width:16px; height:16px; color:#fff; stroke-width:2.5; }

/* Notification bell */
.notif-btn {
  position:relative; background:none; border:none; cursor:pointer;
  width:32px; height:32px; border-radius:8px; display:flex;
  align-items:center; justify-content:center;
}
.notif-btn svg { width:20px; height:20px; color:var(--text2); }
.notif-badge {
  position:absolute; top:3px; right:3px; width:9px; height:9px;
  border-radius:50%; background:var(--red); border:2px solid white; display:none;
}
.notif-badge.show { display:block; }

/* ══════════════════════════════════
   CONFIG
══════════════════════════════════ */
.config-section { background:var(--surface); border-radius:var(--r-xl); overflow:hidden; box-shadow:var(--shadow); margin-bottom:14px; }
.config-section-title { padding:14px 16px 10px; font-size:.72rem; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.6px; }
.config-row {
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 16px; border-top:.5px solid var(--border);
}
.config-row-left { flex:1; }
.config-row-title { font-size:.9rem; font-weight:500; margin-bottom:1px; }
.config-row-sub   { font-size:.74rem; color:var(--muted); }
.config-row-right { flex-shrink:0; margin-left:12px; }
.config-badge { font-size:.72rem; font-weight:600; padding:3px 9px; border-radius:6px; }

/* Danger zone */
.danger-btn {
  width:100%; padding:13px; background:var(--red-l); color:var(--red);
  border:none; border-radius:var(--r-lg); font-size:.88rem; font-weight:600;
  cursor:pointer; transition:opacity .18s;
}
.danger-btn:active { opacity:.8; }

/* ══════════════════════════════════
   TECH VIEW
══════════════════════════════════ */
.tech-status-bar {
  background:linear-gradient(135deg,#1C1C1E,#3A3A3C);
  border-radius:var(--r-xl); padding:18px; color:#fff;
  margin-bottom:12px; box-shadow:var(--shadow-lg);
}
.tsb-greeting { font-size:1.1rem; font-weight:600; margin-bottom:2px; }
.tsb-sub { font-size:.78rem; opacity:.6; margin-bottom:14px; }
.tsb-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.tsb-stat { background:rgba(255,255,255,.08); border-radius:10px; padding:10px 8px; text-align:center; }
.tsb-stat-val { font-size:1.3rem; font-weight:700; }
.tsb-stat-lbl { font-size:.64rem; opacity:.6; margin-top:2px; }

.week-day-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 12px; border-radius:10px; margin:12px 0 6px; cursor:pointer;
}
.wdh-today  { background:linear-gradient(135deg,#1C1C1E,#3A3A3C); color:#fff; }
.wdh-past   { background:var(--bg2); color:var(--muted); }
.wdh-future { background:var(--surface); border:.5px solid var(--border); box-shadow:var(--shadow-sm); }
.wdh-left   { display:flex; align-items:center; gap:8px; }
.wdh-name   { font-size:.82rem; font-weight:700; }
.wdh-arrow  { font-size:.75rem; transition:transform .2s; }

/* ══════════════════════════════════
   COTIZACIONES / QUOTES
══════════════════════════════════ */
.quote-card { background:var(--surface); border-radius:var(--r-xl); box-shadow:var(--shadow); margin-bottom:10px; overflow:hidden; cursor:pointer; }
.quote-card:active { background:var(--bg2); }
.quote-header { padding:14px 16px; display:flex; align-items:flex-start; justify-content:space-between; }
.quote-client { font-size:.92rem; font-weight:600; margin-bottom:2px; }
.quote-date   { font-size:.73rem; color:var(--muted); }
.quote-amount { font-size:1.5rem; font-weight:700; letter-spacing:-.3px; color:var(--blue); }
.quote-services { display:flex; flex-wrap:wrap; gap:5px; padding:0 16px 14px; }

/* ══════════════════════════════════
   NOTIF DROPDOWN
══════════════════════════════════ */
.notif-dropdown {
  position:fixed; top:58px; right:12px; z-index:150;
  background:var(--surface); border-radius:var(--r-xl);
  box-shadow:var(--shadow-lg); width:300px; max-height:400px;
  overflow-y:auto; border:.5px solid var(--border);
  animation:scaleIn .18s ease;
  transform-origin:top right;
}
.notif-item { padding:12px 14px; border-bottom:.5px solid var(--border); cursor:pointer; }
.notif-item:last-child { border-bottom:none; }
.notif-item:active { background:var(--bg2); }
.notif-item-title { font-size:.83rem; font-weight:500; margin-bottom:3px; }
.notif-item-sub   { font-size:.73rem; color:var(--muted); }
.notif-item.unread .notif-item-title::before { content:'● '; color:var(--blue); font-size:.6rem; }

/* ══════════════════════════════════
   PWA INSTALL BANNER
══════════════════════════════════ */
.install-banner {
  position:fixed; bottom:88px; left:12px; right:12px; z-index:150;
  background:linear-gradient(135deg,#1C1C1E,#3A3A3C); color:#fff;
  border-radius:var(--r-xl); padding:14px 16px;
  display:flex; align-items:center; gap:12px;
  box-shadow:0 8px 32px rgba(0,0,0,.3);
  animation:slideUp .3s ease;
}
.ib-icon  { font-size:1.6rem; flex-shrink:0; }
.ib-info  { flex:1; }
.ib-title { font-size:.87rem; font-weight:600; margin-bottom:2px; }
.ib-sub   { font-size:.72rem; opacity:.65; }
.ib-btn   { background:var(--blue); color:#fff; border:none; border-radius:10px; padding:8px 14px; font-size:.78rem; font-weight:600; cursor:pointer; white-space:nowrap; }
.ib-close { background:rgba(255,255,255,.12); border:none; color:#fff; border-radius:8px; width:28px; height:28px; cursor:pointer; font-size:.85rem; display:flex; align-items:center; justify-content:center; }

/* ══════════════════════════════════
   SPINNER
══════════════════════════════════ */
.spinner { width:18px; height:18px; border:2px solid var(--border); border-top-color:var(--blue); border-radius:50%; animation:spin .7s linear infinite; }


/* ══════════════════════════════════════════════════
   RESPONSIVE — SIDEBAR + DESKTOP + TABLET
══════════════════════════════════════════════════ */

/* Sidebar: oculto por defecto (mobile) */
.sidebar { display: none; }

/* ── TABLET (768px – 1023px) ── */
@media (min-width: 640px) {
  .stats-row-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
  .main { max-width: 700px; }
  .modal { max-width: 560px; margin: 0 auto; }
  .rep-sec-title { font-size: .82rem; }
}

/* ── Mobile: oculta sidebar derecho del dashboard ── */
.dash-side { display: none; }

/* ── DESKTOP (≥ 1024px) ── */
@media (min-width: 1024px) {

  /* ─ Sidebar ─ */
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    background: #111827;
    border-right: none;
    z-index: 101;
    overflow: hidden;
    transition: width .22s ease;
  }
  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px 0 18px;
    height: 58px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
  }
  .sidebar-collapse-btn {
    margin-left: auto;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.35);
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s;
  }
  .sidebar-collapse-btn:hover { color: rgba(255,255,255,.8); }
  .sidebar-collapse-btn svg { transition: transform .22s ease; }
  .sidebar-logo .nav-icon {
    background: var(--blue);
    box-shadow: 0 0 12px rgba(0,122,255,.4);
  }
  .sidebar-logo .nav-name {
    color: rgba(255,255,255,.95);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -.4px;
  }

  #sideNav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  /* Sidebar nav buttons */
  .snb {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 13px;
    border-radius: 10px;
    border: none;
    background: none;
    color: rgba(255,255,255,.5);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background .13s, color .13s;
    position: relative;
    white-space: nowrap;
  }
  .snb svg {
    width: 18px; height: 18px;
    stroke-width: 1.8;
    flex-shrink: 0;
  }
  .snb:hover  { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); }
  .snb.active {
    background: rgba(0,122,255,.18);
    color: #60a5fa;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--blue);
  }
  .snb .bdot {
    position: absolute; top: 8px; left: 28px;
    width: 8px; height: 8px;
    border-radius: 50%; background: var(--red);
    border: 2px solid #111827; display: none;
  }
  .snb .bdot.show { display: block; }

  /* ─ Sidebar footer (user + logout) ─ */
  .sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
  }
  .sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 13px;
    border-radius: 10px;
    border: none;
    background: none;
    color: rgba(255,255,255,.38);
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background .13s, color .13s;
  }
  .sidebar-logout:hover { background: rgba(255,59,48,.12); color: #ff6b6b; }

  /* ─ Hide bottom nav on desktop ─ */
  .bottom-nav { display: none !important; }
  .profile-dropdown { left: 268px; right: auto; top: auto; bottom: 56px; }
  .sel-bar { left: 260px; }
  .notif-dropdown { left: 268px; right: auto; top: auto; bottom: 108px; transform-origin: bottom left; }
  .toast { left: calc(50% + 130px); }

  /* ─ Main layout ─ */
  .main {
    padding-left: 260px;
    max-width: none;
    padding-top: 20px;
    padding-bottom: 40px;
  }
  .page { padding: 0 32px; }

  /* ─ Modales: centrados en desktop ─ */
  .overlay { align-items: center; }
  .modal {
    border-radius: var(--r-xl);
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 24px 28px;
    animation: scaleIn .22s ease;
  }
  .modal-handle { display: none; }

  /* ─ Dashboard 2 columnas ─ */
  .dash-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
  }
  .dash-main { min-width: 0; }
  .dash-side  { min-width: 0; display: block; }
  /* En mobile dash-side se oculta (ya queda debajo y duplica info) */

  /* ─ Reportes: tabs en fila sin scroll ─ */
  .rtab { font-size: .8rem; }

  /* ─ Agenda: más espacio ─ */
  .svc-actions { grid-template-columns: repeat(4, 1fr); }

  /* ─ Secciones de reporte: 2 col en finanzas ─ */
  .rep-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .rep-cols > * { margin-bottom: 0; }

  /* ─ Sidebar collapsed ─ */
  body.sidebar-collapsed .sidebar { width: 64px; }
  body.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
  body.sidebar-collapsed .snb-label { display: none !important; }
  body.sidebar-collapsed .snb { justify-content: center; padding: 10px; }
  body.sidebar-collapsed .sidebar-user { gap: 0; justify-content: center; padding: 6px 0; }
  body.sidebar-collapsed .sidebar-logout { justify-content: center; padding: 10px; }
  body.sidebar-collapsed .nav-name { display: none; }
  body.sidebar-collapsed .sidebar-collapse-btn { margin-left: 0; }
  body.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 0; gap: 0; }
  body.sidebar-collapsed .main { padding-left: 64px; }
  body.sidebar-collapsed .sel-bar { left: 64px; }
  body.sidebar-collapsed .toast { left: calc(50% + 32px); }
  body.sidebar-collapsed .notif-dropdown { left: 72px; }
  body.sidebar-collapsed .profile-dropdown { left: 72px; }

  /* ─ Trial banner: desktop offset ─ */
  #trialBanner { left: 260px; }
  body.sidebar-collapsed #trialBanner { left: 64px; }
  body.has-trial-banner .main { padding-top: 62px !important; }
}

/* ══════════════════════════════════
   TRIAL BANNER
══════════════════════════════════ */
#trialBanner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 95;
  display: none; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 16px;
  font-size: .8rem; font-weight: 500; line-height: 1.3; text-align: center;
}
#trialBanner.show { display: flex; }
#trialBanner.warn    { background: #fef9c3; color: #854d0e; border-bottom: 1px solid #fde68a; }
#trialBanner.urgent  { background: #ffedd5; color: #9a3412; border-bottom: 1px solid #fed7aa; }
#trialBanner.expired { background: #fee2e2; color: #991b1b; border-bottom: 1px solid #fecaca; }
.trial-upgrade-btn {
  flex-shrink: 0; background: rgba(0,0,0,.09); border: none; border-radius: 20px;
  padding: 4px 13px; font-size: .75rem; font-weight: 700; cursor: pointer; color: inherit;
  white-space: nowrap; transition: background .14s;
}
.trial-upgrade-btn:hover { background: rgba(0,0,0,.17); }
body.has-trial-banner .main { padding-top: 50px; }
