@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700;800;900&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

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

:root {
  --bg:                #070B14;
  --bg-card:           #0B1220;
  --bg-card2:          #0D1625;
  --border:            #151E30;
  --border2:           #1A2540;
  --brand:             #00E5A0;
  --brand-dim:         rgba(0,229,160,0.1);
  --brand-border:      rgba(0,229,160,0.3);
  --brand-dark:        #071F14;
  --brand-dark2:       #061610;
  --brand-border-dark: #0D3028;
  --brand-text:        #1A6A4A;
  --secondary:         #4D9EFF;
  --tertiary:          #B66DFF;
  --nav-bg:            #060A12;
  --nav-border:        #0D1625;
  --text:              #E0FFF5;
}

body {
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: #E0FFF5;
  min-height: 100vh;
}

#app {
  max-width: 390px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

body.nav-lateral #app {
  margin: 0 auto;
  padding-right: 56px;
}

/* ── HEADER ── */
.header {
  padding: 14px 18px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--nav-border);
  background: var(--bg);
}
.header-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 900;
  color: #E0FFF5;
}
.header-brand .k { color: var(--brand); }
.header-date {
  font-size: 12px;
  color: var(--brand-text);
  font-weight: 700;
}

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  padding: 12px 16px 10px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 10px 8px;
  border: 1px solid var(--border);
  text-align: center;
  min-height: 70px;
display: flex;
flex-direction: column;
justify-content: center;
}

.stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: var(--brand);
}
.stat-val.blue   { color: var(--secondary); }
.stat-val.purple { color: var(--tertiary); }
.stat-val.amber  { color: #FFB800; }
.stat-label {
  font-size: 8px;
  color: var(--brand-text);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 2px;
}

/* ── SECTION ROW ── */
.section-row {
  padding: 0 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #E0FFF5;
}
.section-add {
  background: var(--brand);
  border: none;
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 800;
  color: #0A1628;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  box-shadow: 0 2px 8px rgba(0,229,160,0.3);
}

/* ── LISTA AGENDA ── */
.agenda-lista {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 90px;
}
.agenda-row {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: border-color .15s;
  animation: slideUp .15s ease both;
}
.agenda-row:hover { border-color: var(--border2); }
.agenda-hora {
  font-size: 10px;
  color: var(--secondary);
  font-weight: 700;
  min-width: 36px;
  flex-shrink: 0;
}
.agenda-nombre {
  font-size: 12px;
  font-weight: 700;
  color: #E0FFF5;
  flex: 1;
}
.agenda-monto {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}
.agenda-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}
.agenda-dot.pend     { background: #FFB800; }
.agenda-dot.anulado  { background: #FF3B5C; }
.agenda-dot.solicitud { background: #4D9EFF; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* ── CLIENTE CARD ── */
.clientes-lista {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 90px;
}
.cliente-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s;
  animation: slideUp .15s ease both;
}
.cliente-card:hover { border-color: var(--brand); }
.cliente-av {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 11px; color: #0A1628;
  flex-shrink: 0;
}
.cliente-info { flex: 1; min-width: 0; }
.cliente-nombre {
  font-size: 12px; font-weight: 700; color: #E0FFF5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cliente-meta { font-size: 9px; color: var(--brand-text); margin-top: 1px; }
.cliente-monto {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700;
  color: var(--brand); white-space: nowrap;
}

/* ── TOTAL CARD ── */
.total-card {
  margin: 0 16px 10px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-dark2));
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--brand-border-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.total-label {
  font-size: 9px; color: var(--brand-text);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 3px;
}
.total-amount {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px; font-weight: 900;
  color: var(--brand); letter-spacing: -0.5px;
}
.total-sub { font-size: 9px; color: var(--brand-text); margin-top: 2px; }

/* ── CALENDARIO ── */
.cal-card {
  margin: 0 16px 10px;
  background: var(--bg-card);
  border-radius: 14px; padding: 14px;
  border: 1px solid var(--border);
}
.cal-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-month { font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 800; color: #E0FFF5; }
.cal-nav { display: flex; gap: 8px; }
.cal-btn {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--bg-card2); border: 1px solid var(--border2);
  color: var(--secondary); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cal-days-hdr { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 5px; }
.cdn { text-align: center; font-size: 8px; font-weight: 800; color: #1A3040; text-transform: uppercase; padding: 3px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cd {
  aspect-ratio: 1; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.cd:hover { background: var(--bg-card2); }
.cd.empty { cursor: default; }
.cd.today {
  background: linear-gradient(135deg, var(--brand), var(--secondary));
  box-shadow: 0 3px 8px var(--brand-border);
}
.cd.selected { background: var(--bg-card2); border: 1.5px solid var(--brand); }
.cd-num { font-family: 'Space Grotesk', sans-serif; font-size: 11px; font-weight: 700; color: #2A4A60; }
.cd.today .cd-num    { color: #0A1628; }
.cd.selected .cd-num { color: var(--brand); }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%); width: 390px;
  background: var(--nav-bg); border-top: 1px solid var(--nav-border);
  display: flex; justify-content: space-around;
  padding: 10px 0 16px; z-index: 100;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.nav-icon { font-size: 18px; }
.nav-label { font-size: 8px; color: #1A3040; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.nav-item.active .nav-label { color: var(--brand); }

/* ── RESPONSIVE MÓVIL ── */
@media (max-width: 480px) {
  #app {
    max-width: 100%;
    padding-right: 0 !important;
  }
  .lateral-nav { display: none !important; }
  .fab-nav {
    bottom: 80px;
    left: auto;
    right: 16px;
    transform: none;
  }
  .bottom-nav {
    width: 100%;
    left: 0;
    transform: none;
  }
  .stats-grid { padding: 8px 12px 6px; gap: 6px; }
  .stat-val { font-size: 15px; }
  .stat-label { font-size: 7px; }

  /* Calendario compacto */
  .cal-card { margin: 0 12px 6px; padding: 6px 8px; }
  .cal-top { margin-bottom: 4px; }
  .cal-month { font-size: 10px; }
  .cal-btn { width: 18px; height: 18px; font-size: 9px; border-radius: 4px; }
  .cdn { font-size: 5px; padding: 1px 0; }
  .cal-grid { gap: 1px; }
  .cd { border-radius: 4px; padding: 2px 0; }
  .cd-num { font-size: 8px; line-height: 1.2; }
  .cal-days-hdr { gap: 1px; margin-bottom: 2px; }

  .agenda-lista { padding: 0 12px; }
  .clientes-lista { padding: 0 12px; }
  .section-row { padding: 0 12px; }
  .total-card { margin: 0 12px 8px; }

  /* Tarjetas agenda más compactas */
  .agenda-row { padding: 8px 10px; }
  .agenda-nombre { font-size: 11px; }
  .agenda-monto { font-size: 10px; }
  .agenda-hora { font-size: 9px; min-width: 30px; }

  /* Cliente cards */
  .cliente-card { padding: 9px 11px; }
  .cliente-av { width: 30px; height: 30px; font-size: 10px; }
  .cliente-nombre { font-size: 11px; }
  .cliente-meta { font-size: 8px; }
  .cliente-monto { font-size: 10px; }
}

/* ── ANIMACIONES ── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes menuIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── CONTEXT MENU ── */
#context-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; border: none; background: transparent;
  cursor: pointer; font-size: 14px; color: #222;
  text-align: left; transition: background 0.1s;
}
#context-menu button:hover { background: #f5f5f5; }
#context-menu button.danger { color: #e53935; }
#context-menu .menu-divider { height: 1px; background: #eee; margin: 4px 0; }

/* ── NAV LATERAL ── */
.lateral-nav {
  position: fixed;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 100;
  background: rgba(6,10,18,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 8px;
}
.lateral-nav .nav-item {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background .15s;
}
.lateral-nav .nav-item:hover { background: var(--bg-card); }
.lateral-nav .nav-item.active { background: var(--brand-dim); }
.lateral-nav .nav-icon { font-size: 20px; }
.lateral-nav .nav-label { display: none; }
.lateral-nav .nav-tooltip {
  display: none;
  position: absolute;
  right: calc(100% + 8px);
  background: var(--bg-card);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #E0FFF5;
  white-space: nowrap;
  pointer-events: none;
}
.lateral-nav .nav-item:hover .nav-tooltip { display: block; }

/* Móvil — nav lateral pegado al borde */
@media (max-width: 480px) {
  .lateral-nav {
    right: 4px;
    padding: 8px 5px;
    gap: 4px;
  }
  .lateral-nav .nav-item {
    width: 36px;
    height: 36px;
  }
  .lateral-nav .nav-icon { font-size: 17px; }
  body.nav-lateral #app { padding-right: 48px; }
  .fab-nav { right: 10px; bottom: 20px; }
}

/* ── NAV FAB ── */
.fab-nav {
  position: fixed;
  bottom: 24px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
}
.fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--secondary));
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #0A1628;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--brand-border);
  z-index: 201;
  flex-shrink: 0;
}
.fab-menu {
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}
.fab-item {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  animation: fabItemIn .2s ease both;
  transition: border-color .15s;
  flex-shrink: 0;
}
.fab-item:hover { border-color: var(--brand); }
@keyframes fabItemIn {
  from { opacity: 0; transform: scale(0.7) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── CONFIG SECCIONES COLAPSABLES ── */
.cfg-seccion {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.cfg-sec-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.cfg-sec-header:hover { background: var(--bg-card2); }
.cfg-sec-titulo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #E0FFF5;
  flex: 1;
}
.cfg-sec-chevron {
  font-size: 18px;
  color: #4A5568;
  font-weight: 700;
  transition: transform .2s;
}
.cfg-sec-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}


/* ══════════════════════════════════════
   TEMAS VISUALES DE EMPRESA
   ══════════════════════════════════════ */

/* ── TEMA AZUL CLARO ── */
body.tema-azul {
  --brand:             #247BD6;
  --brand-2:           #1A5FA8;
  --brand-dim:         rgba(36,123,214,0.1);
  --brand-border:      rgba(36,123,214,0.3);
  --brand-dark:        #071428;
  --brand-dark2:       #060F1E;
  --brand-border-dark: #0D2045;
  --brand-text:        #1A4A8A;
  --secondary:         #5BA8FF;
  --tertiary:          #B66DFF;
}

/* ── TEMA VERDE SUAVE ── */
body.tema-verde {
  --brand:             #2F9E58;
  --brand-2:           #1E6B3A;
  --brand-dim:         rgba(47,158,88,0.1);
  --brand-border:      rgba(47,158,88,0.3);
  --brand-dark:        #071408;
  --brand-dark2:       #060E06;
  --brand-border-dark: #0D2812;
  --brand-text:        #1A5A2A;
  --secondary:         #5BD68A;
  --tertiary:          #B66DFF;
}

/* ── TEMA OSCURO MODERNO ── */
body.tema-oscuro {
  --brand:             #7B55D9;
  --brand-2:           #5A3AB0;
  --brand-dim:         rgba(123,85,217,0.1);
  --brand-border:      rgba(123,85,217,0.3);
  --brand-dark:        #0E0818;
  --brand-dark2:       #080510;
  --brand-border-dark: #1A0D30;
  --brand-text:        #5A3AB0;
  --secondary:         #B9A3FF;
  --tertiary:          #FF6B9D;
}

/* ── TEMA ÁMBAR CÁLIDO ── */
body.tema-ambar {
  --brand:             #FF7A1A;
  --brand-2:           #CC5F0E;
  --brand-dim:         rgba(255,122,26,0.1);
  --brand-border:      rgba(255,122,26,0.3);
  --brand-dark:        #1A0A00;
  --brand-dark2:       #120700;
  --brand-border-dark: #2A1200;
  --brand-text:        #8A4010;
  --secondary:         #FFC45C;
  --tertiary:          #FF6B6B;
}

/* ── TEMA CLARO ── */
body.tema-claro {
  --text:      #1A202C;
  --bg:        #F0F4F8;
  --bg-card:   #FFFFFF;
  --bg-card2:  #F7FAFC;
  --border:    #E2E8F0;
  --border2:   #CBD5E0;
  --secondary: #4A5568;
  --brand:     #00A878;
  --brand-text:#00A878;
  --brand-dim: rgba(0,168,120,0.1);
  --brand-border-dark: rgba(0,168,120,0.3);
  background:  #F0F4F8 !important;
  color:       #1A202C;
}
body.tema-claro,
body.tema-claro #app {
  background: #F0F4F8 !important;
}
body.tema-claro .header { background: #FFFFFF; border-bottom: 1px solid #E2E8F0; }
body.tema-claro .header-brand { color: #1A202C; }
body.tema-claro .header-date { color: #4A5568; }
body.tema-claro .bottom-nav { background: #FFFFFF; border-top: 1px solid #E2E8F0; }
body.tema-claro .nav-item { color: #718096; }
body.tema-claro .nav-item.active { color: #00A878; }
body.tema-claro .stat-card { background: #FFFFFF; border: 1px solid #E2E8F0; }
body.tema-claro .cal-card { background: #FFFFFF; border: 1px solid #E2E8F0; }
body.tema-claro .cd { background: #F7FAFC; color: #4A5568; }
body.tema-claro .cd.hoy { background: linear-gradient(135deg, #00A878, #0088CC); color: white; }
body.tema-claro .cd.sel { border: 2px solid #00A878; }
body.tema-claro .agenda-row { background: #FFFFFF; border: 1px solid #E2E8F0; color: #1A202C; }
body.tema-claro .agenda-row:hover { border-color: #00A878; }
body.tema-claro .agenda-hora { color: #4A5568; }
body.tema-claro .agenda-nombre { color: #1A202C; }
body.tema-claro .agenda-monto { color: #2D3748; }
body.tema-claro .cliente-card { background: #FFFFFF; border: 1px solid #E2E8F0; }
body.tema-claro .cliente-nombre { color: #1A202C; }
body.tema-claro .cfg-sec { background: #FFFFFF; border: 1px solid #E2E8F0; }
body.tema-claro .cfg-sec-hdr { color: #1A202C; }
body.tema-claro .cfg-sec-body { color: #1A202C; }
body.tema-claro .cfg-sec-body div { color: #1A202C; }
body.tema-claro .cfg-sec-body span { color: #4A5568; }
body.tema-claro .cfg-sec-titulo { color: #1A202C !important; }
body.tema-claro .cfg-seccion { background: #FFFFFF; border: 1px solid #E2E8F0; }
body.tema-claro .cfg-sec-header { background: #FFFFFF; }
body.tema-claro .cfg-sec-header:hover { background: #F7FAFC; }
body.tema-claro .section-title { color: #1A202C; }
body.tema-claro .header-brand { color: #1A202C; }
body.tema-claro .header-date { color: #2D3748; }
body.tema-claro .modal-overlay { background: rgba(0,0,0,0.4); }
body.tema-claro .modal-box { background: #FFFFFF; border: 1px solid #E2E8F0; color: #1A202C; }
body.tema-claro input, body.tema-claro select, body.tema-claro textarea {
  background: #F7FAFC; border: 1px solid #CBD5E0; color: #1A202C;
}
body.tema-claro input:focus, body.tema-claro select:focus { border-color: #00A878; }
body.tema-claro .fab-btn { background: linear-gradient(135deg, #00A878, #0088CC); }
body.tema-claro #kiwi-link-card { background: #FFFFFF; border: 1px solid #E2E8F0; }
body.tema-claro .total-card { background: #FFFFFF; border: 1px solid #E2E8F0; }

/* Login en tema claro */
body.tema-claro #app { background: #F0F4F8; }
body.tema-claro .login-box { background: #FFFFFF; border: 1px solid #E2E8F0; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
body.tema-claro .login-title { color: #1A202C; }
body.tema-claro .login-sub { color: #4A5568; }
body.tema-claro .login-label { color: #4A5568; }
body.tema-claro .login-input { background: #F7FAFC; border: 1px solid #CBD5E0; color: #1A202C; }
body.tema-claro .login-input:focus { border-color: var(--brand); }
body.tema-claro .login-input::placeholder { color: #A0AEC0; }

/* Texto general en tema claro */
body.tema-claro { color: #1A202C; }
body.tema-claro p, body.tema-claro div, body.tema-claro span { color: inherit; }
body.tema-claro .muted { color: #718096; }
.dashboard-hoy {
  margin: 12px 16px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-dark), var(--bg-card));
  border: 1px solid var(--brand-border-dark);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.dashboard-hoy-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 900;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.dashboard-hoy-main {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 900;
  color: #E0FFF5;
}

.dashboard-hoy-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--brand-text);
}

.dashboard-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.dashboard-mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}

.dashboard-mini-card b {
  display: block;
  font-size: 15px;
  color: var(--brand);
}

.dashboard-mini-card span {
  font-size: 8px;
  color: var(--brand-text);
  text-transform: uppercase;
}

.btn-sonido {
  margin: 8px 16px;
  width: calc(100% - 32px);
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: var(--brand);
  color: #0A1628;
  font-weight: 900;
  cursor: pointer;
}
.cal-mini-day {
  margin-top: 8px;
  padding: 8px 0;
  cursor: pointer;
}

.cal-mini-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}