:root {
  --ink: #0B1020;
  --muted: #737C91;
  --blue: #1786FF;
  --blue-soft: #E8F2FF;
  --surface: #F8FAFF;
  --card: #FFFFFF;
  --line: #E4E9F2;
  --danger: #D64545;
  --ok: #2F855A;
  --radius: 14px;
  font-family: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; min-height: 100dvh; }
body { background: var(--surface); color: var(--ink); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-weight: 600; margin: 0 0 .5rem; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 15px; }
a { color: var(--blue); }

.app { display: flex; min-height: 100dvh; }

/* --- navegación --- */
.sidebar {
  width: 220px; flex-shrink: 0; padding: 24px 14px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; background: var(--card);
}
.brand { font-weight: 300; font-size: 20px; padding: 0 10px 18px; letter-spacing: .3px; }
.brand b { color: var(--blue); font-weight: 600; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: none;
  border-radius: 10px; font-size: 15px; color: var(--muted); text-align: left; width: 100%;
}
.nav-btn.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav-btn:hover { background: var(--surface); }
.nav-spacer { flex: 1; }

.main { flex: 1; padding: 28px clamp(16px, 4vw, 48px) 90px; max-width: 980px; width: 100%; margin: 0 auto; }

.bottom-nav { display: none; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 18px 14px 84px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card);
    border-top: 1px solid var(--line); z-index: 50; padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav button {
    flex: 1; border: none; background: none; padding: 9px 2px 7px; font-size: 10.5px; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
  }
  .bottom-nav button.active { color: var(--blue); font-weight: 600; }
  .bottom-nav .ico { font-size: 19px; }
}

/* --- tarjetas --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); font-size: 13.5px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.btn {
  background: var(--blue); color: #fff; border: none; border-radius: 10px; padding: 9px 16px;
  font-size: 14px; font-weight: 600; text-decoration: none; display: inline-block;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: none; color: var(--blue); border: 1px solid var(--line); font-weight: 400; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { background: none; color: var(--danger); border: none; padding: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], textarea, select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
textarea { resize: vertical; min-height: 90px; }
label { font-size: 13px; color: var(--muted); display: block; margin: 10px 0 4px; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* --- avisos de Hoy --- */
.hero { margin-bottom: 22px; }
.hero h1 { font-size: clamp(22px, 4vw, 30px); font-weight: 300; }
.hero h1 b { font-weight: 600; }
.hero .date { color: var(--muted); text-transform: capitalize; }

.alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; align-items: baseline; }
.alert.red { background: #FDF0F0; color: #8f2f2f; }
.alert.amber { background: #FCF6EA; color: #7a5310; }
.alert.blue { background: var(--blue-soft); color: #14539c; }
.alert.green { background: #EDF7F1; color: #276148; }
.alert .flex1 { flex: 1; }

.brief { background: linear-gradient(135deg, #0B1020, #14224d); color: #EAF1FF; border: none; }
.brief h2 { color: #9CC5FF; }
.brief p { margin: 0; white-space: pre-wrap; }
.brief .muted { color: #8fa3c8; }
.brief .btn.ghost { color: #9CC5FF; border-color: #2a3a66; }

/* --- tareas --- */
.task { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task input[type="checkbox"] { width: 19px; height: 19px; margin-top: 2px; accent-color: var(--blue); }
.task .t-title { flex: 1; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.chip { font-size: 11.5px; padding: 2px 9px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.trabajo { background: #F3EDFC; color: #6b46c1; border-color: #E4D8F8; }
.chip.dunia { background: #EDF7F1; color: var(--ok); border-color: #D4EBDD; }
.chip.late { background: #FDF0F0; color: var(--danger); border-color: #F5D6D6; }

/* --- chat --- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 130px); min-height: 420px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; margin-bottom: 10px; white-space: pre-wrap; width: fit-content; }
.msg.user { background: var(--blue); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.assistant { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.msg .actions span { font-size: 12px; background: var(--blue-soft); color: #14539c; padding: 2px 9px; border-radius: 99px; }
.chat-input { display: flex; gap: 8px; padding-top: 10px; }
.chat-input textarea { flex: 1; min-height: 46px; max-height: 140px; }
.mic { border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 46px; font-size: 19px; }
.mic.rec { background: #FDF0F0; border-color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* --- diario --- */
.mood-row { display: flex; gap: 6px; }
.mood-row button { font-size: 22px; background: none; border: 2px solid transparent; border-radius: 10px; padding: 4px 7px; filter: grayscale(1); }
.mood-row button.sel { border-color: var(--blue); filter: none; background: var(--blue-soft); }
.entry { border-left: 3px solid var(--blue-soft); padding-left: 14px; margin-bottom: 18px; }
.entry .muted { text-transform: capitalize; }
.entry p { white-space: pre-wrap; margin: 4px 0 0; }

/* --- gráfica --- */
.chart-svg { width: 100%; height: 240px; display: block; }

/* --- login --- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-brand { text-align: center; font-weight: 300; font-size: 30px; margin-bottom: 20px; }
.login-brand b { color: var(--blue); font-weight: 600; }

.error { color: var(--danger); font-size: 13.5px; margin-top: 8px; }
.success { color: var(--ok); font-size: 13.5px; margin-top: 8px; }
.footer-mark { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0; }
.footer-mark b { color: var(--blue); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.empty .big { font-size: 30px; margin-bottom: 6px; }

.code { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, monospace; font-size: 12.5px; word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
