
:root {
  color-scheme: light;
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-2: #f7f2ea;
  --primary: #6b4f8a;
  --primary-light: #b8a4d4;
  --primary-dark: #4a3b6b;
  --accent: #d4a574;
  --text: #2d2438;
  --text-soft: #6b5e7a;
  --text-muted: #9b8fa8;
  --border: #ece4d6;
  --green: #5e8b6b;
  --amber: #c98e3a;
  --red: #b54b4b;
  --info: #4f7a99;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  /* Evita que Android Chrome infle el texto automáticamente (Bug 2: pantalla más grande al iniciar) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  min-height: 100vh;
  /* dvh = viewport real en Android incluyendo barra de URL */
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Landing más compacto en pantallas Android angostas */
@media (max-width: 420px) {
  .landing { padding: 24px 16px; min-height: 100dvh; }
  .brand-icon { width: 64px; height: 64px; font-size: 28px; margin-bottom: 16px; }
  .brand-name { font-size: 26px; }
  .brand-tagline { font-size: 14px; }
}

/* ===== LANDING ===== */
.landing {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 20px 48px;
  background: linear-gradient(160deg, #f0e9f5 0%, #faf6f0 50%, #f5e8dc 100%);
  position: relative;
}
.landing::before, .landing::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(184, 164, 212, 0.18);
  filter: blur(60px);
}
.landing::before { width: 280px; height: 280px; top: -80px; left: -80px; }
.landing::after { width: 320px; height: 320px; bottom: -120px; right: -100px; background: rgba(212, 165, 116, 0.18); }

.landing-inner {
  max-width: 540px;
  width: 100%;
  position: relative;
  z-index: 1;
  text-align: center;
}
.brand-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  /* background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); */
  /* border-radius: 50%; */
  display: flex;
  align-items: center;
  justify-content: center;
  /* color: white; */
  font-size: 36px;
  /* box-shadow: 0 12px 30px rgba(107, 79, 138, 0.3); */
}
.brand-name {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  font-family: Georgia, "Times New Roman", serif;
}
.brand-name em { color: var(--accent); font-style: italic; font-weight: 600; }
.brand-tagline {
  font-size: 15px;
  color: var(--text-soft);
  max-width: 380px;
  margin: 8px auto 28px;
  line-height: 1.6;
}

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 36px;
}
.chip {
  padding: 8px 14px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(184, 164, 212, 0.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 500;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 20px rgba(107, 79, 138, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.cta-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(107, 79, 138, 0.4); }
.cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--primary);
  border: none;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 10px;
  text-decoration: underline;
}

.landing-footnote {
  margin: 40px auto 0;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 380px;
  text-align: left;
  line-height: 1.7;
  padding: 0 18px;
  text-wrap: pretty;
}
.landing-author {
  margin: 24px auto 0;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 420px;
  text-align: center;
  line-height: 1.6;
  padding: 0 14px;
}
.landing-author strong { color: var(--text-soft); }

/* ===== ONBOARDING ===== */
.onboarding {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.onboarding-card {
  background: white;
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}
.onboarding-step { display: none; }
.onboarding-step.active { display: block; }
.step-indicator {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 24px;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.2s;
}
.step-dot.active { background: var(--primary); width: 28px; border-radius: 4px; }
.step-dot.done { background: var(--primary-light); }

.onb-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  text-align: center;
  font-family: Georgia, serif;
}
.onb-sub {
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.6;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.form-select, .form-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--text);
  transition: border-color 0.15s;
}
.form-select:focus, .form-input:focus {
  outline: none;
  border-color: var(--primary);
}
.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}
.onb-actions {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.btn-back, .btn-next {
  padding: 11px 22px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-back {
  background: var(--surface-2);
  color: var(--text-soft);
}
.btn-back:hover { background: var(--border); }
.btn-next {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  margin-left: auto;
  box-shadow: 0 4px 12px rgba(107, 79, 138, 0.25);
}
.btn-next:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(107, 79, 138, 0.35); }
.btn-next:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ===== APP MAIN ===== */
.app { display: none; min-height: 100vh; }
.app.active { display: flex; width: 100%; margin: 0 auto; overflow-x: hidden; }

aside.sidebar {
  width: 240px;
  background: var(--surface);
  padding: 24px 16px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo {
  text-align: center;
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.logo-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(107, 79, 138, 0.25);
}
.logo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  font-family: Georgia, serif;
}
.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

nav.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
  width: 100%;
}
.menu-btn:hover { background: var(--surface-2); color: var(--primary-dark); }
.menu-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(107, 79, 138, 0.25);
}
.menu-btn .ico { font-size: 16px; width: 20px; text-align: center; }

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 4px;
}
.menu-foot {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.menu-foot button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  margin-top: 4px;
}

main { flex: 1; padding: 24px 28px; min-width: 0; }
.page { display: none; animation: fadeIn 0.25s ease-out; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
  font-family: Georgia, serif;
}
.page-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: white;
  padding: 28px 24px;
  border-radius: 16px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.hero-stage {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.85;
}
.hero-title { font-size: 17px; font-weight: 500; margin: 6px 0 18px; }
.hero-count {
  font-size: 60px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
}
.hero-count-label { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.hero-deadline {
  margin-top: 14px;
  font-size: 12px;
  background: rgba(255,255,255,0.18);
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-block;
}
.hero.urgent { background: linear-gradient(135deg, #8a3030 0%, #b54b4b 60%, #d97070 100%); }
.hero.warning { background: linear-gradient(135deg, #8b5e1d 0%, #c98e3a 60%, #e0b074 100%); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--primary-dark); margin-top: 2px; }
.stat-detail { font-size: 11px; color: var(--text-soft); margin-top: 2px; }

.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary-light) 0%, var(--border) 100%);
}
.tl-event { position: relative; padding-bottom: 22px; }
.tl-event:last-child { padding-bottom: 0; }
.tl-event::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--primary-light);
}
.tl-event.done::before { background: var(--green); border-color: var(--green); }
.tl-event.current::before {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 0 6px rgba(201, 142, 58, 0.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(201, 142, 58, 0.18); }
  50% { box-shadow: 0 0 0 12px rgba(201, 142, 58, 0.05); }
}
.tl-date { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.tl-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 2px 0 4px; }
.tl-detail { font-size: 13px; color: var(--text-soft); }

.plazo-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  display: flex;
  gap: 14px;
  align-items: center;
}
.plazo-card.active { background: linear-gradient(135deg, #fef3e7 0%, #fce4c2 100%); border-color: var(--amber); }
.plazo-card.done { background: linear-gradient(135deg, #e8f3eb 0%, #d2e6d8 100%); border-color: var(--green); }
.plazo-num {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.plazo-card.active .plazo-num { background: var(--amber); }
.plazo-card.done .plazo-num { background: var(--green); }
.plazo-num-big { font-size: 18px; font-weight: 800; line-height: 1; }
.plazo-num-small { font-size: 9px; text-transform: uppercase; opacity: 0.85; }
.plazo-info { flex: 1; }
.plazo-stage { font-weight: 700; color: var(--text); }
.plazo-desc { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.plazo-status {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.plazo-status.done { background: var(--green); color: white; }
.plazo-status.active { background: var(--amber); color: white; }
.plazo-status.pending { background: var(--surface-2); color: var(--text-muted); }

.alert-card {
  background: linear-gradient(135deg, #fef3e7 0%, #fce4c2 100%);
  border-left: 4px solid var(--amber);
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.alert-card.green { background: linear-gradient(135deg, #e8f3eb 0%, #d2e6d8 100%); border-left-color: var(--green); }
.alert-card.info { background: linear-gradient(135deg, #e9f1f8 0%, #d2e3ee 100%); border-left-color: var(--info); }
.alert-title { font-weight: 700; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.alert-text { font-size: 13px; color: var(--text-soft); }

.fact-box {
  background: linear-gradient(135deg, #f0e9f5 0%, #e0d2ec 100%);
  border-radius: 12px;
  padding: 16px;
  margin: 14px 0;
  border-left: 4px solid var(--primary);
}
.fact-box-title { font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; font-size: 13px; }
.fact-box-text { color: var(--text-soft); font-size: 13px; }

.step-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 12px;
  margin-bottom: 10px;
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 13px;
}
.step-content h4 { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.step-content p { font-size: 13px; color: var(--text-soft); }

/* TABS (exámenes) */
.tab-buttons {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-buttons::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1;
  min-width: max-content;
  padding: 10px 14px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--primary-dark); }
.tab-btn.active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tab-btn .count {
  display: inline-block;
  background: var(--primary-light);
  color: white;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 700;
}
.tab-btn.active .count { background: var(--primary); }

/* EXAM TABLES (like personal app) */
.exam-row {
  display: grid;
  grid-template-columns: 1fr 110px 90px 60px;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}
.exam-row:last-child { border-bottom: none; }
.exam-row.header {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  border-radius: 8px 8px 0 0;
}
.exam-name { color: var(--text); }
.exam-value { font-weight: 600; text-align: right; color: var(--primary-dark); }
.exam-value.high { color: var(--amber); }
.exam-value.low { color: var(--info); }
.exam-value.alert { color: var(--red); }
.exam-ref { text-align: right; color: var(--text-muted); font-size: 12px; }
.exam-flag { text-align: center; font-size: 14px; font-weight: 700; }
.exam-flag.normal { color: var(--green); }
.exam-flag.high { color: var(--amber); }
.exam-flag.low { color: var(--info); }
.exam-flag.alert { color: var(--red); }
@media (max-width: 600px) {
  .exam-row { grid-template-columns: 1.4fr 90px 36px; }
  .exam-row .exam-ref { display: none; }
}

.exam-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.6;
}
.exam-note.success { background: #e8f3eb; }
.exam-note.warning { background: #fef3e7; border-left: 3px solid var(--amber); }

.exam-info-box {
  background: linear-gradient(135deg, #f0e9f5 0%, #e0d2ec 100%);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-soft);
  border-left: 4px solid var(--primary);
}
.exam-info-box strong { color: var(--primary-dark); }

/* AGENDA */
.appt-list { display: flex; flex-direction: column; gap: 10px; }
.appt-row {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  align-items: flex-start;
}
.appt-row.soon { background: linear-gradient(135deg, #fef3e7 0%, #fce4c2 100%); border-color: var(--amber); }
.appt-row.urgent { background: linear-gradient(135deg, #fde9e9 0%, #fbd5d5 100%); border-color: var(--red); }
.appt-row.past { opacity: 0.55; }
.appt-date-box {
  width: 56px;
  text-align: center;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  padding: 8px 4px;
  flex-shrink: 0;
}
.appt-row.soon .appt-date-box { background: var(--amber); }
.appt-row.urgent .appt-date-box { background: var(--red); }
.appt-row.past .appt-date-box { background: var(--text-muted); }
.appt-day { font-size: 20px; font-weight: 700; line-height: 1; }
.appt-mes { font-size: 9px; text-transform: uppercase; opacity: 0.9; margin-top: 3px; }
.appt-content { flex: 1; min-width: 0; }
.appt-title { font-weight: 600; color: var(--text); margin-bottom: 2px; font-size: 14px; }
.appt-meta { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.appt-notes { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.appt-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.appt-action {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
}
.appt-action:hover { background: var(--primary); color: white; }
.appt-action.delete { color: var(--red); border-color: var(--red); }
.appt-action.delete:hover { background: var(--red); color: white; }

textarea.form-input {
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

/* STAGES + FAQ */
.stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.stage-card {
  background: var(--surface-2);
  padding: 12px;
  border-radius: 10px;
  border-left: 4px solid var(--primary-light);
}
.stage-name { font-weight: 700; font-size: 13px; color: var(--primary-dark); }
.stage-desc { font-size: 12px; color: var(--text-soft); margin-top: 4px; line-height: 1.5; }

.accordion {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}
.accordion-header {
  padding: 12px 16px;
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 13px;
  user-select: none;
}
.accordion-header:hover { background: #efe6d4; }
.accordion-content {
  display: none;
  padding: 14px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}
.accordion.open .accordion-content { display: block; }
.accordion.open .arrow { transform: rotate(90deg); }
.arrow { transition: transform 0.2s; display: inline-block; font-size: 11px; }

/* DOCUMENTS */
.doc-upload {
  border: 2px dashed var(--primary-light);
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  margin-bottom: 16px;
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.2s;
}
.doc-upload:hover { border-color: var(--primary); background: #efe6d4; }
.doc-upload-icon { font-size: 36px; margin-bottom: 8px; }
.doc-upload-text { font-size: 14px; color: var(--text-soft); }
.doc-upload-text strong { color: var(--primary-dark); }

.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.15s;
}
.doc-card:hover { border-color: var(--primary-light); box-shadow: 0 4px 12px rgba(107, 79, 138, 0.08); }
.doc-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  flex-shrink: 0;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-meta { flex: 1; min-width: 0; }
.doc-meta .nm { font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.doc-meta .dt { font-size: 12px; color: var(--text-muted); }
.doc-check {
  color: var(--green);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  margin-right: 4px;
}
.doc-actions { display: flex; gap: 4px; }
.doc-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 16px;
  border-radius: 8px;
  transition: all 0.15s;
}
.doc-actions button:hover { background: var(--surface-2); color: var(--primary); }
.doc-actions button.del:hover { color: var(--red); }

/* SIDEBAR MOBILE */
@media (max-width: 768px) {
  aside.sidebar { width: 64px; padding: 16px 8px; }
  .logo-title, .logo-sub { display: none; }
  .logo-icon { width: 40px; height: 40px; font-size: 18px; }
  .logo { padding: 4px 0 14px; margin-bottom: 10px; }
  .menu-btn span:not(.ico) { display: none; }
  .menu-btn { justify-content: center; padding: 12px 8px; }
  .menu-btn .ico { font-size: 18px; width: auto; }
  .menu-foot { display: none; }
  main { padding: 16px 14px; }
  .hero-count { font-size: 48px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 20px; }
}
@media (max-width: 480px) {
  aside.sidebar { width: 56px; padding: 12px 6px; }
  .logo-icon { width: 36px; height: 36px; font-size: 16px; }
  .menu-btn { padding: 10px 6px; }
  main { padding: 12px 10px; }
}

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; }
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.ghost:hover { background: var(--primary); color: white; }

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(45, 36, 56, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-bg.active { display: flex; }
.modal {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
  width: 100%;
  padding: 24px;
}
.modal img { max-width: 100%; height: auto; border-radius: 8px; }
.modal-close {
  background: var(--surface-2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--text-soft);
}

/* ===== MENÚ COLAPSABLE + BOTÓN SUBIR ===== */
aside.sidebar {
  transition: width 0.3s ease, padding 0.3s ease;
}
.app.sidebar-hidden aside.sidebar {
  width: 0 !important;
  padding: 0 !important;
  border-right: none !important;
  overflow: hidden;
}
.app.sidebar-hidden aside.sidebar > * { opacity: 0; pointer-events: none; }

/* Botón hamburguesa flotante (siempre visible dentro del app) */
.menu-fab {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(107, 79, 138, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  font-family: inherit;
}
.app.active.sidebar-hidden .menu-fab { display: flex; }
.menu-fab:hover { transform: scale(1.06); background: var(--primary-dark); }
.menu-fab:active { transform: scale(0.94); }

/* Botón cerrar dentro del sidebar (visible solo cuando sidebar está abierto) */
.sidebar-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  z-index: 10;
}
.sidebar-close:hover {
  background: var(--surface-2);
  color: var(--primary);
}
.app.sidebar-hidden .sidebar-close { display: none; }
@media (max-width: 768px) {
  .sidebar-close { width: 26px; height: 26px; font-size: 12px; top: 6px; right: 6px; }
}


/* Botón "subir arriba" flotante */
.back-to-top {
  position: fixed;
  bottom: 40px; /* Posicionado abajo del botón de voz (80px) para no colisionar */
  right: 21px;  /* Centrado visualmente en el mismo eje del botón de voz */
  z-index: 100;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.2s, background 0.2s, bottom 0.2s; /* Añadido bottom a la transición */
  box-shadow: 0 4px 14px rgba(107, 79, 138, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: inherit;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover { transform: scale(1.06); background: var(--primary-dark); }

/* Padding extra en main para que el botón hamburguesa no tape el contenido */
main { padding-top: 60px; }

html, body{max-width: 100vw;
overflow-x: hidden;}

