:root {
  --ink: #1f2c29;
  --muted: #71807b;
  --paper: #f6f3ed;
  --card: #fffcf7;
  --line: #e6e0d6;
  --forest: #223c35;
  --forest-2: #315a4e;
  --mint: #dce9de;
  --coral: #e67855;
  --gold: #f2c36b;
  --blue: #6b8fa4;
  --shadow: 0 18px 50px rgba(43, 54, 49, 0.08);
  --radius: 22px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, label.file-label { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(230, 120, 85, .25); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20; width: 238px; padding: 26px 18px;
  display: flex; flex-direction: column; background: var(--forest); color: #f7f0e5;
}
.brand { border: 0; background: transparent; color: inherit; display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; text-align: left; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--forest); background: var(--gold); font-size: 22px; }
.brand strong { display: block; font-family: var(--serif); font-size: 23px; letter-spacing: .2px; }
.brand small { display: block; margin-top: -2px; color: #aebeb7; font-size: 11px; }
.nav-list { display: grid; gap: 8px; }
.nav-item { width: 100%; border: 0; border-radius: 13px; background: transparent; color: #bcc9c4; padding: 12px 14px; display: flex; gap: 12px; align-items: center; text-align: left; font-weight: 600; }
.nav-item span { width: 22px; text-align: center; font-size: 18px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.is-active { color: #fff; background: rgba(255,255,255,.11); box-shadow: inset 3px 0 var(--gold); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 16px; }
.privacy-note { padding: 13px 14px; border-top: 1px solid rgba(255,255,255,.1); color: #91a39c; font-size: 11px; }
.privacy-note span { color: #82c38c; margin-right: 6px; }

.main-content { margin-left: 238px; min-height: 100vh; padding: 34px clamp(22px, 4vw, 58px) 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.topbar h1 { margin: 4px 0 0; font: 600 clamp(29px, 3vw, 42px)/1.05 var(--serif); }
.eyebrow, .card-kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 700; color: var(--muted); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.65); display: grid; place-items: center; font-size: 19px; }
.icon-button:hover { background: #fff; transform: translateY(-1px); }
.icon-button.compact { width: 34px; height: 34px; flex: 0 0 auto; }
.avatar { width: 43px; height: 43px; border: 0; border-radius: 50%; background: var(--coral); color: white; font-weight: 700; }
.notification-button.is-on::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #5aa466; transform: translate(10px,-10px); }

.view { display: none; animation: fade-in .22s ease; }
.view.is-active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 20px; }
.daily-brief-card { position: relative; min-height: 250px; padding: 30px 34px; overflow: hidden; background: var(--forest); color: #f8f1e5; border-color: var(--forest); }
.daily-brief-card .card-kicker { color: #b7c6bf; }
.daily-brief-card h2 { position: relative; z-index: 2; margin: 26px 0 8px; font: 600 clamp(32px, 4vw, 52px)/.98 var(--serif); }
.brief-copy { position: relative; z-index: 2; max-width: 65%; margin: 0; color: #c9d3ce; line-height: 1.55; }
.brief-actions { position: relative; z-index: 2; display: flex; align-items: center; gap: 18px; margin-top: 26px; }
.daily-brief-card .text-button { color: #e8e2d8; }
.pulse-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #86c88f; box-shadow: 0 0 0 6px rgba(134,200,143,.12); }
.sun-orbit { position: absolute; width: 270px; height: 270px; right: -45px; top: -20px; border: 1px solid rgba(242,195,107,.18); border-radius: 50%; }
.sun-orbit::before, .sun-orbit::after { content: ""; position: absolute; border: 1px solid rgba(242,195,107,.12); border-radius: 50%; inset: 28px; }
.sun-orbit::after { inset: 64px; }
.sun-orbit span { position: absolute; width: 82px; height: 82px; top: 94px; left: 94px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe4a4, var(--gold)); box-shadow: 0 0 58px rgba(242,195,107,.22); }

.progress-card { padding: 27px; }
.card-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.card-header h3 { margin: 5px 0 0; font: 600 24px/1.1 var(--serif); }
.status-chip { background: var(--mint); color: var(--forest-2); border-radius: 99px; padding: 6px 9px; font-size: 11px; font-weight: 700; }
.progress-body { display: flex; align-items: center; gap: 26px; margin-top: 28px; }
.progress-ring { --progress: 0deg; width: 118px; aspect-ratio: 1; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--coral) var(--progress), #eee9e1 0); position: relative; }
.progress-ring::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--card); }
.progress-ring strong { position: relative; z-index: 1; font: 600 24px var(--serif); }
.progress-legend { display: grid; gap: 11px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.dot.done { background: var(--coral); }.dot.pending { background: #d9d6ce; }.dot.event { background: var(--blue); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 20px; margin-top: 20px; }
.quick-actions-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.quick-action { display: grid; grid-template-columns: auto 1fr; gap: 13px; align-items: center; min-height: 94px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); color: var(--ink); padding: 16px; text-align: left; box-shadow: var(--shadow); }
.quick-action:hover { transform: translateY(-2px); border-color: rgba(24,59,53,.24); background: #fffdf8; }
.quick-action.is-primary { background: linear-gradient(135deg, var(--forest), var(--forest-2)); color: #fff7e8; border-color: transparent; }
.quick-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 16px; background: #eef4ed; color: var(--forest); font-size: 22px; }
.quick-action.is-primary .quick-icon { background: var(--gold); color: var(--forest); }
.quick-action strong { display: block; font-size: 16px; line-height: 1.15; }
.quick-action small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.35; font-size: 12px; }
.quick-action.is-primary small { color: rgba(255,247,232,.78); }
.tasks-card, .timeline-card, .checkin-card { padding: 27px; min-height: 265px; }
.small-button, .secondary-button, .primary-button, .danger-button, .text-button { border: 0; border-radius: 12px; font-weight: 700; transition: .18s ease; }
.small-button { background: #f2eee7; color: var(--forest); padding: 8px 11px; font-size: 12px; }
.primary-button { background: var(--coral); color: #fff; padding: 11px 17px; box-shadow: 0 7px 18px rgba(230,120,85,.22); }
.primary-button:hover { background: #d96848; transform: translateY(-1px); }
.secondary-button { background: #edf1eb; color: var(--forest); padding: 11px 16px; }
.secondary-button:hover { background: #e1e9e0; }
.danger-button { color: #a84f3a; background: #f8e9e3; padding: 11px 16px; }
.text-button { background: transparent; padding: 8px 0; color: var(--forest); }
.wide { width: 100%; }

.task-list { display: grid; gap: 8px; margin-top: 20px; }
.task-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 13px; }
.task-item:hover { background: #f8f5ef; }
.task-check { appearance: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid #bfc6c2; border-radius: 7px; display: grid; place-items: center; }
.task-check:checked { background: var(--forest-2); border-color: var(--forest-2); }
.task-check:checked::after { content: "✓"; color: white; font-size: 12px; }
.task-title { font-size: 14px; font-weight: 600; }
.task-title.is-done { color: #9aa29e; text-decoration: line-through; }
.task-meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.task-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.task-edit-button, .task-delete-button { min-height: 30px; padding: 6px 9px; border-radius: 10px; font-size: 10px; }
.area-pill { border-radius: 99px; padding: 5px 8px; font-size: 10px; font-weight: 700; text-transform: capitalize; background: #eee; }
.area-pill.salud { background: #e1ece6; color: #356150; }.area-pill.trabajo { background: #e4ebef; color: #4b6c7d; }.area-pill.familia { background: #f7e8df; color: #a35c45; }.area-pill.religioso { background: #eee7f3; color: #725685; }.area-pill.hogar { background: #f2ebd7; color: #8b722e; }.area-pill.tramites { background: #ece6f2; color: #6d5580; }.area-pill.personal { background: #e8e8e3; color: #62675f; }
.empty-state { min-height: 120px; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

.timeline { margin-top: 21px; display: grid; gap: 2px; }
.timeline-item { display: grid; grid-template-columns: 52px 1fr; gap: 12px; position: relative; padding-bottom: 18px; }
.timeline-item::after { content: ""; position: absolute; left: 56px; top: 20px; bottom: -2px; width: 1px; background: var(--line); }
.timeline-item:last-child::after { display: none; }
.timeline-time { font-size: 11px; color: var(--muted); padding-top: 3px; }
.timeline-info { padding-left: 14px; position: relative; }
.timeline-info::before { content: ""; position: absolute; left: -1px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); z-index: 1; }
.timeline-info strong { display: block; font-size: 13px; }
.timeline-info small { color: var(--muted); }

.mood-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 22px 0 14px; }
.mood-options button { min-height: 62px; border: 1px solid var(--line); border-radius: 14px; background: #faf7f1; color: #7d8984; font-size: 20px; }
.mood-options button small { display: block; margin-top: 5px; font-size: 9px; }
.mood-options button:hover, .mood-options button.is-selected { border-color: var(--coral); color: var(--coral); background: #fff5ef; }
textarea, input, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fffefa; color: var(--ink); padding: 11px 12px; resize: none; font-size: 16px; line-height: 1.35; }
.checkin-card textarea { margin-bottom: 11px; }
.insight-card { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 20px 24px; background: #eaf0e9; }
.insight-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 14px; background: var(--forest); color: var(--gold); }
.insight-card p:last-child { margin: 5px 0 0; font-size: 14px; }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.segmented-control { background: #eae6df; border-radius: 13px; padding: 4px; display: flex; }
.segmented-control button { border: 0; background: transparent; padding: 8px 13px; border-radius: 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.segmented-control button.is-active { background: #fff; color: var(--ink); box-shadow: 0 3px 12px rgba(0,0,0,.06); }
.toolbar-actions { display: flex; gap: 9px; }
.agenda-layout { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; }
.agenda-layout > .card { padding: 28px; min-height: 560px; }
.event-list { margin-top: 20px; display: grid; gap: 12px; }
.event-card { display: grid; grid-template-columns: 54px 1fr auto; gap: 13px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 15px; }
.event-date { text-align: center; border-right: 1px solid var(--line); padding-right: 12px; }
.event-date strong { display: block; font: 600 24px var(--serif); }.event-date small { color: var(--muted); text-transform: uppercase; }
.event-card h4 { margin: 0; font-size: 13px; }.event-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.event-notes { max-height: 62px; overflow: auto; white-space: pre-wrap; }
.event-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.event-actions .secondary-button, .file-chip { max-width: 210px; padding: 7px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; text-decoration: none; }
.event-card-actions { display: grid; gap: 6px; justify-items: end; }
.edit-event-button, .delete-event-button { padding: 7px 10px; font-size: 10px; }
.priority-pill { display: inline-block; margin-top: 7px; padding: 5px 8px; border-radius: 999px; background: #edf1eb; color: var(--forest); font-size: 10px; font-weight: 800; text-transform: capitalize; }
.priority-pill.alta { background: #ffe9df; color: #b2563d; }.priority-pill.media { background: #fff4d8; color: #8a6b23; }.priority-pill.baja { background: #e9f1e8; color: #4f876d; }
.agenda-task-card { background: #fffaf2; }
.delete-button { border: 0; background: transparent; color: #a7ada9; font-size: 18px; }
.delete-button:hover { color: var(--coral); }

.area-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.area-card { position: relative; min-height: 160px; padding: 23px; text-align: left; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.area-card:hover, .area-card.is-active { transform: translateY(-2px); border-color: var(--area-color); }
.area-card-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--area-color) 18%, white); color: var(--area-color); font-size: 20px; }
.area-card h3 { margin: 18px 0 3px; font: 600 24px var(--serif); }.area-card p { margin: 0; color: var(--muted); font-size: 11px; }
.area-card-count { position: absolute; top: 22px; right: 20px; font: 600 26px var(--serif); color: var(--area-color); }
.area-detail-card { margin-top: 18px; min-height: 270px; padding: 28px; }
.area-detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
.area-detail-list > div { background: #f8f5ef; border-radius: 15px; padding: 16px; }
.area-detail-list h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
.health-journal { display: grid; gap: 18px; margin-top: 20px; }
.health-summary-row { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 12px; align-items: center; padding: 16px; border-radius: 16px; background: #edf3ee; }
.health-summary-row > div { display: grid; }
.health-summary-row strong { font: 600 27px var(--serif); }
.health-summary-row small { color: var(--muted); }
.health-actions { display: flex !important; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }.health-actions button { white-space: nowrap; }
.health-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.health-metrics > div { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.health-metrics small, .health-metrics span { color: var(--muted); font-size: 10px; }.health-metrics strong { font-size: 18px; }
.health-columns { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; }
.health-columns > section { min-width: 0; padding: 16px; border-radius: 16px; background: #f8f5ef; }
.health-columns h4 { margin: 0 0 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.health-record-list { display: grid; gap: 12px; }
.health-record { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.health-record-head { display: flex; justify-content: space-between; gap: 12px; }.health-record-head span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.health-record h5 { margin: 4px 0 0; font-size: 14px; }.health-record > p { margin: 10px 0; color: var(--muted); line-height: 1.5; font-size: 12px; white-space: pre-wrap; }
.health-value { display: inline-grid; margin: 7px 0; padding: 8px 11px; border-radius: 10px; background: #e8f0e9; }.health-value small { color: var(--muted); font-size: 9px; }.health-value strong { margin-top: 2px; }
.health-ai-summary { margin-top: 10px; padding: 11px; border-left: 3px solid var(--gold); background: #fffaf0; }.health-ai-summary small { color: var(--muted); font-weight: 700; }.health-ai-summary p { margin: 5px 0 0; max-height: 150px; overflow: auto; font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.health-files { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }.health-files button { max-width: 220px; padding: 7px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.health-analyze { display: block; margin-top: 8px; font-size: 11px; }.health-event { padding: 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.health-file-picker input { padding: 8px; }.health-file-picker small { font-weight: 400; }.medical-inline-note { margin: 16px 0 0; padding: 10px 12px; border-radius: 11px; background: #fff5ed; color: #8a6758; font-size: 10px; line-height: 1.45; }
.recipe-list { display: grid; gap: 10px; }.recipe-record { margin-bottom: 0; }.recipe-detail { margin: 10px 0; padding: 10px 11px; border-radius: 11px; background: #f8f5ef; }.recipe-detail small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }.recipe-detail p { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.5; white-space: pre-wrap; }.section-gap { margin-top: 20px !important; }
.files-layout { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); gap: 20px; align-items: start; }
.file-drop-card, .file-inbox-card { padding: 28px; }
.file-drop-zone { display: grid; place-items: center; gap: 8px; min-height: 220px; margin-top: 20px; border: 1.5px dashed #cfc8bb; border-radius: 22px; background: #fffaf2; text-align: center; cursor: pointer; }
.file-drop-zone:hover { border-color: var(--coral); background: #fff6ed; }
.file-drop-zone span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 19px; background: var(--forest); color: var(--gold); font-size: 30px; }
.file-drop-zone strong { font: 600 24px var(--serif); }
.file-drop-zone small, .file-safety-note { max-width: 330px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.file-safety-note { margin-top: 15px; padding: 12px 13px; border-radius: 13px; background: #edf3ee; }
.file-inbox-list { display: grid; gap: 13px; margin-top: 20px; }
.inbox-file-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: #fffdf8; }
.inbox-file-main { display: grid; grid-template-columns: auto 1fr; gap: 13px; align-items: start; }
.file-type-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: #edf1eb; color: var(--forest); font-size: 13px; font-weight: 900; }
.inbox-file-card h4 { margin: 0; font-size: 15px; }
.inbox-file-card p { margin: 4px 0 3px; color: var(--muted); font-size: 11px; }
.inbox-file-card small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.inbox-file-card label { font-size: 11px; color: var(--muted); font-weight: 700; }
.inbox-file-card label input, .inbox-file-card label select, .inbox-file-card label textarea { margin-top: 6px; }
.area-file-record { margin-top: 10px; }

.assistant-layout { min-height: calc(100vh - 170px); display: grid; grid-template-columns: .72fr 1.28fr; gap: 22px; }
.assistant-intro { align-self: center; padding: 30px; }
.assistant-orb { width: 74px; height: 74px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 24px; background: var(--forest); color: var(--gold); font-size: 32px; box-shadow: 0 20px 45px rgba(34,60,53,.2); }
.assistant-intro h2 { margin: 8px 0 10px; font: 600 clamp(35px, 5vw, 58px)/.98 var(--serif); }
.assistant-intro > p:not(.card-kicker) { max-width: 450px; color: var(--muted); line-height: 1.6; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 25px; }
.prompt-chips button { border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.6); padding: 9px 12px; font-size: 11px; }
.prompt-chips button:hover { border-color: var(--coral); color: var(--coral); }
.chat-card { display: flex; flex-direction: column; overflow: hidden; min-height: 580px; }
.chat-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 12px 16px; }
.chat-toolbar > div:first-child { display: grid; min-width: 0; }.chat-toolbar small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }.chat-toolbar strong { max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.chat-toolbar > div:last-child { display: flex; gap: 7px; }.chat-toolbar button { padding: 8px 10px; font-size: 10px; }
.conversation-drawer { max-height: 220px; overflow-y: auto; border-bottom: 1px solid var(--line); padding: 10px; background: #f8f5ef; }
.conversation-drawer > div { display: grid; gap: 6px; }.conversation-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; width: 100%; border: 1px solid transparent; border-radius: 11px; padding: 9px 10px; background: transparent; text-align: left; }
.conversation-item:hover, .conversation-item.is-active { border-color: var(--line); background: white; }.conversation-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }.conversation-item small { color: var(--muted); font-size: 9px; }
.chat-messages { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.chat-message { max-width: 82%; border-radius: 18px; padding: 12px 15px; line-height: 1.55; font-size: 13px; white-space: pre-wrap; }
.chat-message.assistant { align-self: flex-start; background: #edf1eb; border-bottom-left-radius: 5px; }
.chat-message.user { align-self: flex-end; background: var(--forest); color: #fff; border-bottom-right-radius: 5px; }
.chat-message .message-meta { display: block; margin-top: 6px; opacity: .6; font-size: 9px; }
.chat-message.is-typing::after { content: "•••"; animation: blink 1s infinite; letter-spacing: 3px; }
@keyframes blink { 50% { opacity: .35; } }
.chat-composer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: end; border-top: 1px solid var(--line); padding: 14px; }
.chat-composer textarea { max-height: 110px; background: #faf8f3; }
.attachment-button { display: grid; margin: 0 !important; cursor: pointer; font-size: 20px; }
.attachment-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 0; border-top: 1px solid var(--line); background: #faf8f3; }
.attachment-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 230px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-size: 10px; }
.attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip button { border: 0; padding: 0; background: transparent; color: var(--coral); font-size: 15px; }
.message-attachments { display: block; margin-top: 7px; font-size: 10px; opacity: .78; }
.send-button { width: 42px; height: 42px; border: 0; border-radius: 13px; background: var(--coral); color: #fff; font-size: 19px; }
.voice-listening { color: white !important; background: var(--coral) !important; animation: breathe 1.2s infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 8px rgba(230,120,85,.15); } }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card { padding: 28px; }
.settings-card label { display: grid; gap: 7px; margin-top: 18px; color: var(--muted); font-size: 11px; font-weight: 700; }
.settings-card button { margin-top: 18px; }
.toggle-row { grid-template-columns: 1fr auto !important; align-items: center; }
.toggle-row small { display: block; margin-top: 4px; font-weight: 400; }
.toggle-row input { width: 42px; height: 22px; accent-color: var(--forest); }
.settings-copy { color: var(--muted); line-height: 1.55; font-size: 13px; }
.stacked-actions { display: flex; flex-wrap: wrap; gap: 8px; }.stacked-actions button, .stacked-actions .file-label { margin-top: 10px; }
.file-label { display: inline-flex !important; margin-top: 10px !important; }
.medical-note { background: #fff6ef; border-color: #f1d8c9; }
.connection-dot { width: 10px; height: 10px; border-radius: 50%; background: #bbb; box-shadow: 0 0 0 4px rgba(0,0,0,.04); }
.connection-dot.is-connected { background: #5aa466; }
.outlook-preview { display: grid; gap: 8px; margin-top: 14px; }
.outlook-mail { padding: 10px 12px; border-radius: 12px; background: #f6f7f4; font-size: 11px; }
.outlook-mail strong, .outlook-mail small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outlook-mail small { margin-top: 3px; color: var(--muted); }
.privacy-fineprint { display: block; margin-top: 14px; color: var(--muted); line-height: 1.45; }
.feature-request-list { display: grid; gap: 9px; margin-top: 14px; }
.feature-request { position: relative; padding: 11px 34px 11px 12px; border-radius: 12px; background: #f6f7f4; font-size: 11px; }
.feature-request strong, .feature-request small { display: block; }
.feature-request small { margin-top: 3px; color: var(--muted); text-transform: capitalize; }
.feature-request p { margin: 8px 0 0; color: var(--muted); line-height: 1.45; white-space: pre-wrap; }
.feature-request .delete-button { position: absolute; top: 7px; right: 8px; }

.app-dialog { width: min(520px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 30px 100px rgba(22,35,31,.28); }
.app-dialog::backdrop { background: rgba(19,31,28,.5); backdrop-filter: blur(5px); }
.app-dialog form { padding: 27px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.dialog-header h3 { margin: 4px 0 0; font: 600 29px var(--serif); }
.app-dialog label { display: grid; gap: 7px; margin-top: 15px; color: var(--muted); font-size: 11px; font-weight: 700; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 16px; margin-top: 24px; }
.onboarding-dialog { text-align: center; }
.onboarding-dialog form { padding: 38px; }
.onboarding-dialog h2 { margin: 10px 0; font: 600 40px/1 var(--serif); }
.onboarding-dialog p:not(.card-kicker) { color: var(--muted); line-height: 1.55; }
.onboarding-dialog label { text-align: left; margin: 24px 0 14px; }
.onboarding-mark { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 20px; background: var(--forest); color: var(--gold); font-size: 27px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 25px); opacity: 0; pointer-events: none; background: var(--forest); color: white; border-radius: 13px; padding: 11px 16px; font-size: 12px; box-shadow: 0 12px 38px rgba(0,0,0,.25); transition: .25s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }

.login-page { min-height: 100vh; background: var(--forest); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, .85fr) minmax(440px, 1.15fr); }
.login-brand-panel { position: relative; overflow: hidden; padding: clamp(38px, 7vw, 90px); color: #f8f1e5; display: flex; flex-direction: column; justify-content: center; }
.login-brand-panel::before, .login-brand-panel::after { content: ""; position: absolute; width: 420px; height: 420px; right: -230px; top: -120px; border: 1px solid rgba(242,195,107,.16); border-radius: 50%; }
.login-brand-panel::after { width: 270px; height: 270px; right: -110px; top: -10px; }
.login-brand-mark { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 34px; border-radius: 19px; background: var(--gold); color: var(--forest); font-size: 28px; }
.login-brand-panel .card-kicker { color: #aabdb5; }
.login-brand-panel h1 { max-width: 560px; margin: 12px 0 18px; font: 600 clamp(46px, 6vw, 80px)/.92 var(--serif); }
.login-brand-panel > p:not(.card-kicker) { max-width: 440px; color: #becbc5; line-height: 1.65; }
.login-security-note { margin-top: 46px; color: #9fb2aa; font-size: 11px; }.login-security-note::first-letter { color: #82c38c; }
.login-form-panel { display: grid; place-items: center; padding: 28px; background: var(--paper); border-radius: 34px 0 0 34px; }
.login-form-wrap { width: min(390px, 100%); }
.login-form-wrap h2 { margin: 7px 0 28px; font: 600 42px/1 var(--serif); }
.login-form-wrap form { display: grid; gap: 16px; }
.login-form-wrap label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.login-form-wrap form button { margin-top: 5px; }
.login-form-wrap > small { display: block; margin-top: 22px; color: var(--muted); line-height: 1.5; }
.login-error { padding: 11px 13px; border: 1px solid #efc8ba; border-radius: 12px; background: #fff0e9; color: #a84f3a; font-size: 12px; }

@media (max-width: 1050px) {
  .sidebar { width: 84px; padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }.brand > span:last-child, .nav-item:not(.is-active) { font-size: 0; }.nav-item { justify-content: center; gap: 0; }.nav-item.is-active { font-size: 0; }.nav-item span { font-size: 19px; }
  .privacy-note { display: none; }.main-content { margin-left: 84px; }
  .brief-copy { max-width: 75%; }.area-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 760px) {
  body { padding-bottom: 72px; }
  .sidebar { display: none; }.main-content { margin-left: 0; padding: 23px 16px 36px; }
  .topbar { margin-bottom: 20px; }.topbar h1 { font-size: 31px; }.topbar-actions .notification-button { display: none; }
  .hero-grid, .dashboard-grid, .agenda-layout, .assistant-layout, .settings-grid { grid-template-columns: 1fr; }
  .daily-brief-card { min-height: 280px; padding: 26px; }.brief-copy { max-width: 84%; }.sun-orbit { opacity: .6; right: -105px; }
  .progress-card { display: none; }.insight-card { grid-column: auto; }
  .agenda-layout > .card { min-height: auto; }.section-toolbar { align-items: stretch; flex-direction: column; }.toolbar-actions > * { flex: 1; }
  .area-grid { grid-template-columns: 1fr 1fr; }.area-card { min-height: 135px; padding: 18px; }.area-card h3 { font-size: 20px; }.area-detail-list, .health-columns { grid-template-columns: 1fr; }.health-summary-row { grid-template-columns: 1fr 1fr; }.health-actions { grid-column: 1 / -1; justify-content: stretch; }.health-actions button { flex: 1; }.health-metrics { grid-template-columns: 1fr; }
  .assistant-layout { min-height: auto; }.assistant-intro { padding: 16px 8px 8px; }.assistant-intro h2 { font-size: 40px; }.chat-card { min-height: 520px; }
  .chat-message { max-width: 90%; }.form-row { grid-template-columns: 1fr; }.chat-toolbar strong { max-width: 130px; }.chat-toolbar button { padding: 7px 8px; }
  .mobile-nav { position: fixed; display: grid; grid-template-columns: repeat(5,1fr); z-index: 40; inset: auto 0 0; min-height: 68px; background: rgba(255,252,247,.95); border-top: 1px solid var(--line); backdrop-filter: blur(15px); padding: 6px 8px max(6px, env(safe-area-inset-bottom)); }
  .mobile-nav button { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; gap: 1px; font-size: 18px; }.mobile-nav button small { font-size: 9px; }.mobile-nav button.is-active { color: var(--forest); }
  .mobile-nav .mobile-assistant span { width: 39px; height: 39px; display: grid; place-items: center; margin-top: -22px; border-radius: 15px; background: var(--forest); color: var(--gold); box-shadow: 0 8px 24px rgba(34,60,53,.25); }
  .toast { bottom: 82px; width: calc(100% - 32px); text-align: center; }
  .login-page { padding-bottom: 0; }.login-shell { grid-template-columns: 1fr; }.login-brand-panel { min-height: 310px; padding: 42px 28px; justify-content: flex-start; }.login-brand-panel h1 { font-size: 46px; }.login-brand-panel > p:not(.card-kicker) { display: none; }.login-security-note { margin-top: 20px; }.login-form-panel { min-height: calc(100vh - 280px); margin-top: -28px; padding: 45px 25px; border-radius: 28px 28px 0 0; align-items: start; }.login-form-wrap h2 { font-size: 36px; }
}

@media (max-width: 420px) {
  .area-grid { grid-template-columns: 1fr; }.mood-options button small { display: none; }.mood-options button { min-height: 48px; }.brief-actions { align-items: flex-start; flex-direction: column; gap: 7px; }
}

/* Muestra visual moderna: más clara, táctil y amable para uso diario */
:root {
  --ink: #182522;
  --muted: #66746f;
  --paper: #f5f1e9;
  --card: rgba(255, 253, 248, .94);
  --line: #e7ded1;
  --forest: #143d37;
  --forest-2: #28685d;
  --mint: #e7f1ea;
  --coral: #c96b4e;
  --gold: #e4b95f;
  --blue: #496f82;
  --shadow: 0 22px 60px rgba(44, 50, 45, .10);
  --radius: 28px;
}

html { background: radial-gradient(circle at top left, #fff9ec 0, var(--paper) 42%, #ece9df 100%); }
body { font-size: 16px; -webkit-font-smoothing: antialiased; }
button { min-height: 44px; }
.card { border-color: rgba(82, 72, 58, .10); box-shadow: var(--shadow); backdrop-filter: blur(18px); }

.sidebar {
  width: 256px;
  padding: 24px 18px;
  background: linear-gradient(180deg, #183b35 0%, #102c27 100%);
  box-shadow: 16px 0 42px rgba(24, 59, 53, .16);
}
.brand { padding-bottom: 34px; border-radius: 20px; }
.brand-mark { width: 52px; height: 52px; border-radius: 18px; font-size: 26px; box-shadow: 0 14px 30px rgba(238, 190, 100, .18); }
.brand strong { font-size: 28px; }
.brand small { margin-top: 1px; font-size: 13px; color: #cbd8d2; }
.nav-list { gap: 11px; }
.nav-item { min-height: 54px; border-radius: 18px; padding: 14px 16px; font-size: 16px; }
.nav-item span { width: 28px; font-size: 21px; }
.nav-item.is-active { background: rgba(255,255,255,.14); box-shadow: inset 4px 0 var(--gold), 0 12px 30px rgba(0,0,0,.08); }
.privacy-note { font-size: 12px; line-height: 1.5; }

.main-content { margin-left: 256px; padding: 36px clamp(24px, 4.5vw, 70px) 70px; }
.topbar { margin-bottom: 32px; }
.topbar h1 { font: 650 clamp(34px, 3.2vw, 50px)/1.02 var(--serif); letter-spacing: -.02em; }
.eyebrow, .card-kicker { font-size: 12px; letter-spacing: .10em; }
.icon-button, .avatar { width: 50px; height: 50px; border-radius: 18px; font-size: 21px; }
.avatar { background: linear-gradient(135deg, var(--coral), #bf5e42); box-shadow: 0 14px 28px rgba(216, 111, 77, .20); }

.hero-grid { grid-template-columns: minmax(0, 1.45fr) minmax(310px, .78fr); gap: 24px; }
.daily-brief-card {
  min-height: 310px;
  padding: clamp(30px, 4vw, 46px);
  border-radius: 34px;
  background:
    radial-gradient(circle at 78% 28%, rgba(238, 190, 100, .26), transparent 30%),
    linear-gradient(135deg, #183b35 0%, #24554c 100%);
}
.daily-brief-card::before {
  content: "Trabajo · Iglesia · Salud · Familia";
  position: absolute;
  right: 34px;
  bottom: 28px;
  z-index: 2;
  max-width: 260px;
  color: rgba(255,255,255,.68);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.daily-brief-card h2 { margin-top: 34px; font-size: clamp(42px, 5vw, 66px); letter-spacing: -.03em; }
.brief-copy { max-width: 72%; font-size: 18px; line-height: 1.65; color: #e3ebe6; }
.brief-actions { gap: 14px; margin-top: 32px; }
.sun-orbit { width: 320px; height: 320px; opacity: .72; }

.progress-card, .tasks-card, .timeline-card, .checkin-card, .settings-card, .agenda-layout > .card, .area-detail-card { padding: 30px; border-radius: 30px; }
.card-header h3 { font-size: 29px; letter-spacing: -.01em; }
.status-chip { padding: 8px 12px; font-size: 13px; }
.progress-ring { width: 136px; }
.progress-ring strong { font-size: 29px; }
.progress-legend { font-size: 15px; }

.dashboard-grid { gap: 24px; margin-top: 24px; }
.quick-actions-grid { gap: 16px; margin-top: 24px; }
.quick-action { min-height: 108px; border-radius: 28px; padding: 18px; }
.quick-icon { width: 50px; height: 50px; border-radius: 18px; }
.quick-action strong { font-size: 17px; }
.quick-action small { font-size: 13px; }
.small-button, .secondary-button, .primary-button, .danger-button {
  border-radius: 16px;
  padding: 13px 18px;
  font-size: 15px;
}
.primary-button { background: linear-gradient(135deg, var(--coral), #bd5c3f); box-shadow: 0 12px 28px rgba(216,111,77,.24); }
.secondary-button { background: #eef4ed; }
.task-list, .event-list, .health-record-list { gap: 12px; }
.task-item { padding: 15px 12px; border: 1px solid transparent; border-radius: 18px; }
.task-item:hover { border-color: var(--line); background: #fffdfa; }
.task-check { width: 24px; height: 24px; border-radius: 9px; }
.task-title { font-size: 17px; }
.task-meta, .timeline-info small { font-size: 13px; }
.area-pill { padding: 7px 11px; font-size: 12px; }
.empty-state { min-height: 136px; border: 1px dashed #d8d0c4; border-radius: 22px; background: rgba(255,255,255,.42); font-size: 16px; }

.timeline-item { grid-template-columns: 76px 1fr; gap: 18px; padding-bottom: 22px; }
.timeline-item::after { left: 82px; }
.timeline-time { font-size: 14px; line-height: 1.35; }
.timeline-info { padding-left: 18px; }
.timeline-info::before { width: 10px; height: 10px; top: 6px; }
.timeline-info strong { font-size: 17px; }

.mood-options { gap: 10px; }
.mood-options button { min-height: 76px; border-radius: 20px; font-size: 24px; }
.mood-options button small { font-size: 12px; }
textarea, input, select { min-height: 48px; border-radius: 17px; padding: 14px 15px; font-size: 16px; background: #fffdfa; }
textarea { line-height: 1.55; }
.insight-card { border-radius: 30px; padding: 24px 28px; }
.insight-card p:last-child { font-size: 17px; line-height: 1.5; }
.insight-icon { width: 54px; height: 54px; border-radius: 18px; font-size: 22px; }

.section-toolbar { margin-bottom: 22px; }
.segmented-control { padding: 6px; border-radius: 18px; }
.segmented-control button { min-height: 42px; padding: 9px 16px; border-radius: 14px; font-size: 14px; }
.event-card { grid-template-columns: 70px 1fr auto; gap: 18px; padding: 18px; border-radius: 22px; background: #fffdfa; }
.event-date strong { font-size: 32px; }
.event-date small { font-size: 13px; }
.event-card h4 { font-size: 18px; }
.event-card p { font-size: 14px; line-height: 1.48; }
.event-actions .secondary-button, .file-chip { max-width: 260px; font-size: 13px; }

.area-grid { gap: 18px; }
.area-card { min-height: 178px; padding: 26px; border-radius: 28px; }
.area-card-icon { width: 50px; height: 50px; border-radius: 17px; font-size: 24px; }
.area-card h3 { font-size: 29px; }
.area-card p { font-size: 14px; }
.area-card-count { font-size: 34px; }
.health-summary-row { border-radius: 24px; padding: 20px; background: linear-gradient(135deg, #edf7ef, #f8f7ef); }
.health-summary-row strong { font-size: 32px; }
.health-summary-row small { font-size: 13px; }
.health-columns > section, .area-detail-list > div { border-radius: 22px; }
.health-columns h4, .area-detail-list h4 { font-size: 13px; }
.health-record { border-radius: 22px; padding: 18px; }
.health-record h5 { font-size: 18px; }
.health-record > p, .health-event { font-size: 14px; line-height: 1.55; }

.assistant-layout { grid-template-columns: .65fr 1.35fr; gap: 26px; }
.assistant-intro { padding: 34px; }
.assistant-orb { width: 88px; height: 88px; border-radius: 28px; font-size: 38px; }
.assistant-intro h2 { font-size: clamp(44px, 5vw, 66px); }
.assistant-intro > p:not(.card-kicker) { font-size: 17px; }
.prompt-chips button { min-height: 42px; padding: 11px 15px; font-size: 14px; background: #fffdfa; }
.assistant-intro {
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255,253,248,.72), rgba(255,253,248,.28));
}
.assistant-intro .card-kicker::after {
  content: " · agenda, decisiones y seguimiento";
  color: var(--coral);
}
.chat-card { min-height: 650px; border-radius: 32px; }
.chat-toolbar { padding: 16px 18px; }
.chat-toolbar strong { font-size: 16px; }
.chat-toolbar small { font-size: 11px; }
.chat-messages { padding: 28px; gap: 16px; }
.chat-message { max-width: 86%; border-radius: 22px; padding: 15px 18px; font-size: 16px; line-height: 1.62; }
.chat-message.assistant { background: #eef4ed; }
.chat-composer { grid-template-columns: 52px 1fr 52px 52px; gap: 11px; padding: 16px; }
.chat-composer textarea { min-height: 52px; max-height: 150px; }
.send-button { width: 52px; height: 52px; border-radius: 18px; font-size: 22px; }

.settings-grid { gap: 24px; }
.settings-card label, .app-dialog label, .login-form-wrap label { font-size: 13px; }
.settings-copy, .privacy-fineprint { font-size: 15px; }
.outlook-mail, .feature-request { font-size: 14px; }

.app-dialog { width: min(590px, calc(100vw - 28px)); border-radius: 32px; }
.app-dialog form { padding: 32px; }
.dialog-header h3 { font-size: 34px; }
.dialog-actions { gap: 12px; }

.login-shell { grid-template-columns: minmax(360px, .86fr) minmax(460px, 1.14fr); }
.login-brand-panel h1 { letter-spacing: -.04em; }
.login-form-panel { background: radial-gradient(circle at top right, #fff9ec, var(--paper) 48%); }
.login-form-wrap { width: min(430px, 100%); }
.login-form-wrap h2 { font-size: 48px; }

@media (max-width: 1050px) {
  .sidebar { width: 96px; }
  .main-content { margin-left: 96px; }
}

@media (max-width: 760px) {
  body { padding-bottom: 92px; }
  .main-content { padding: 18px 14px 38px; }
  .topbar { align-items: flex-start; gap: 12px; }
  .topbar h1 { font-size: 34px; }
  .topbar-actions { gap: 8px; }
  .icon-button, .avatar { width: 46px; height: 46px; border-radius: 17px; }
  .daily-brief-card { min-height: 300px; padding: 28px 24px; border-radius: 32px; }
  .daily-brief-card::before { left: 24px; right: auto; bottom: 22px; font-size: 11px; }
  .daily-brief-card h2 { font-size: 44px; }
  .brief-copy { max-width: 100%; font-size: 17px; }
  .brief-actions { align-items: stretch; flex-direction: column; }
  .brief-actions .primary-button, .brief-actions .text-button { width: 100%; justify-content: center; }
  .quick-actions-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
  .quick-action { min-height: 76px; border-radius: 20px; padding: 13px 14px; }
  .quick-icon { width: 42px; height: 42px; border-radius: 15px; font-size: 20px; }
  .quick-action strong { font-size: 15px; }
  .quick-action small { font-size: 12px; }
  .dashboard-grid { gap: 16px; }
  .progress-card { display: block; }
  .progress-body { align-items: center; }
  .progress-ring { width: 112px; }
  .tasks-card, .timeline-card, .checkin-card, .agenda-layout > .card, .area-detail-card, .settings-card { padding: 22px; }
  .card-header h3 { font-size: 25px; }
  .task-item { grid-template-columns: auto 1fr; }
  .task-item .area-pill { grid-column: 2; width: fit-content; }
  .section-toolbar { gap: 12px; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .event-card { grid-template-columns: 58px 1fr; }
  .event-card .delete-button { grid-column: 2; width: fit-content; justify-self: end; }
  .area-grid { grid-template-columns: 1fr; }
  .health-summary-row { grid-template-columns: 1fr 1fr; }
  .health-summary-row > div:nth-child(3) { grid-column: 1 / -1; }
  .assistant-intro { padding: 10px 4px 4px; }
  .assistant-orb { width: 68px; height: 68px; border-radius: 22px; font-size: 30px; }
  .assistant-intro h2 { font-size: 40px; }
  .prompt-chips { gap: 7px; }
  .chat-card { min-height: calc(100vh - 260px); border-radius: 28px; }
  .chat-toolbar { align-items: flex-start; flex-direction: column; }
  .chat-toolbar > div:last-child { width: 100%; }
  .chat-toolbar button { flex: 1; font-size: 13px; }
  .chat-messages { padding: 18px; }
  .chat-message { max-width: 94%; font-size: 15px; }
  .chat-composer { grid-template-columns: 48px 1fr 48px 48px; padding: 12px; gap: 8px; }
  .mobile-nav { min-height: 84px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; box-shadow: 0 -16px 40px rgba(43, 54, 49, .14); }
  .mobile-nav button { font-size: 22px; }
  .mobile-nav button small { font-size: 11px; }
  .mobile-nav .mobile-assistant span { width: 48px; height: 48px; border-radius: 18px; }
  .toast { bottom: 100px; }
  .login-brand-panel { min-height: 290px; }
  .login-form-panel { padding: 38px 22px; }
}

@media (max-width: 420px) {
  .mood-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mood-options button { min-height: 58px; }
  .mood-options button small { display: none; }
  .chat-composer { grid-template-columns: 46px 1fr 46px 46px; }
}

/* Corrección móvil compacta: orden, respiración y botones sin encimarse */
@media (max-width: 760px) {
  html, body, .app-shell { width: 100%; max-width: 100%; overflow-x: hidden; }
  body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); font-size: 15px; }
  .sidebar { display: none !important; }
  .main-content { width: 100%; max-width: 100%; margin-left: 0 !important; padding: 16px 12px 28px; overflow-x: hidden; }
  .topbar { display: block; margin-bottom: 16px; }
  .topbar h1 { max-width: 100%; font-size: 28px; line-height: 1.03; }
  .eyebrow, .card-kicker { font-size: 10px; }
  .topbar-actions { display: none; }
  .topbar-actions .icon-button, .topbar-actions .avatar { width: 42px; height: 42px; min-height: 42px; border-radius: 15px; }

  .hero-grid, .dashboard-grid, .agenda-layout, .assistant-layout, .settings-grid, .files-layout, .health-columns, .area-detail-list { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .quick-actions-grid { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hero-grid > *, .dashboard-grid > *, .agenda-layout > *, .assistant-layout > *, .settings-grid > *, .files-layout > * { min-width: 0; }
  .card { width: 100%; max-width: 100%; border-radius: 24px; }
  .daily-brief-card { min-width: 0; min-height: auto; padding: 22px; border-radius: 26px; overflow: hidden; }
  .daily-brief-card::before { position: static; display: block; margin-top: 18px; max-width: none; font-size: 10px; }
  .daily-brief-card h2 { max-width: 100%; margin: 22px 0 10px; font-size: 31px; overflow-wrap: anywhere; }
  .brief-copy { max-width: 100%; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
  .brief-actions { margin-top: 20px; }
  .sun-orbit { width: 210px; height: 210px; right: -120px; top: -70px; opacity: .36; }

  .progress-card { display: none; }
  .tasks-card, .timeline-card, .checkin-card, .agenda-layout > .card, .area-detail-card, .settings-card, .file-drop-card, .file-inbox-card, .insight-card { padding: 18px; border-radius: 24px; }
  .card-header { align-items: start; gap: 10px; }
  .card-header h3 { font-size: 22px; }
  .small-button, .primary-button, .secondary-button, .danger-button { min-height: 44px; padding: 11px 14px; border-radius: 14px; font-size: 14px; }
  .task-item { grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 13px 8px; }
  .task-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 30px; }
  .task-title { font-size: 15px; }
  .task-meta { font-size: 12px; }
  .area-pill { font-size: 11px; }
  .timeline-item { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
  .timeline-item::after { left: 69px; }
  .timeline-time { font-size: 12px; }
  .timeline-info strong { font-size: 15px; }
  .mood-options { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .mood-options button { min-width: 0; min-height: 54px; border-radius: 16px; font-size: 22px; padding: 0; }

  .section-toolbar { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .segmented-control { width: 100%; overflow-x: auto; }
  .segmented-control button { white-space: nowrap; font-size: 13px; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .event-card { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 14px; border-radius: 20px; }
  .event-date { padding-right: 9px; }
  .event-date strong { font-size: 24px; }
  .event-date small { font-size: 11px; }
  .event-card h4 { font-size: 16px; }
  .event-card p { font-size: 13px; }
  .event-actions { gap: 6px; }
  .event-actions .secondary-button, .file-chip { max-width: 100%; }
  .event-card-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-start; }

  .area-grid { grid-template-columns: 1fr; gap: 12px; }
  .area-card { min-height: 112px; padding: 18px; border-radius: 22px; }
  .area-card h3 { margin-top: 12px; font-size: 23px; }
  .area-card-icon { width: 44px; height: 44px; }
  .area-card-count { top: 16px; right: 18px; font-size: 28px; }
  .health-summary-row { grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
  .health-summary-row strong { font-size: 25px; }
  .health-actions { grid-column: 1 / -1; display: grid !important; grid-template-columns: 1fr; }
  .health-record { padding: 14px; border-radius: 18px; }
  .health-record h5 { font-size: 16px; }
  .file-drop-zone { min-height: 170px; border-radius: 22px; }
  .file-drop-zone strong { font-size: 22px; }
  .file-inbox-list { gap: 12px; }
  .inbox-file-card { border-radius: 20px; padding: 14px; }
  .inbox-file-main { grid-template-columns: 44px minmax(0, 1fr); }
  .file-type-icon { width: 44px; height: 44px; }
  .inbox-file-card .dialog-actions { display: grid; grid-template-columns: 1fr; }

  .assistant-intro { padding: 18px; border-radius: 24px; }
  .assistant-orb { width: 58px; height: 58px; border-radius: 18px; font-size: 26px; margin-bottom: 14px; }
  .assistant-intro h2 { font-size: 30px; line-height: 1.02; }
  .assistant-intro > p:not(.card-kicker) { font-size: 15px; line-height: 1.5; }
  .assistant-intro .card-kicker::after { content: ""; }
  .prompt-chips { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }
  .prompt-chips button { width: 100%; min-height: 44px; text-align: left; border-radius: 16px; font-size: 13px; }
  .chat-card { min-height: 560px; border-radius: 24px; }
  .chat-toolbar { padding: 12px; gap: 10px; }
  .chat-toolbar > div:first-child, .chat-toolbar strong { max-width: 100%; }
  .chat-toolbar > div:last-child { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .chat-messages { padding: 14px; gap: 12px; }
  .chat-message { max-width: 96%; padding: 12px 14px; border-radius: 18px; font-size: 14px; }
  .chat-composer { grid-template-columns: 44px minmax(0, 1fr) 44px 44px; gap: 7px; padding: 10px; align-items: end; }
  .chat-composer textarea { min-height: 46px; border-radius: 16px; }
  .chat-composer .icon-button, .send-button { width: 44px; height: 44px; min-height: 44px; border-radius: 15px; }
  .attachment-tray { padding: 8px 10px 0; }

  .settings-card label, .app-dialog label, .login-form-wrap label { font-size: 12px; }
  .settings-copy, .privacy-fineprint { font-size: 14px; }
  .app-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); overflow: auto; border-radius: 24px; }
  .app-dialog form { padding: 20px; }
  .dialog-header h3 { font-size: 27px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr; }
  .dialog-actions button { width: 100%; }
  .form-row { grid-template-columns: 1fr; }

  .mobile-nav { min-height: 72px; border-radius: 18px 18px 0 0; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); }
  .mobile-nav button { min-width: 0; min-height: 52px; font-size: 19px; }
  .mobile-nav button small { font-size: 10px; }
  .mobile-nav .mobile-assistant span { width: 42px; height: 42px; margin-top: -17px; border-radius: 16px; }
  .toast { bottom: 86px; }
}

@media (max-width: 380px) {
  .topbar h1 { max-width: 100%; font-size: 25px; }
  .topbar-actions .icon-button, .topbar-actions .avatar { width: 38px; height: 38px; min-height: 38px; }
  .chat-composer { grid-template-columns: 40px minmax(0, 1fr) 40px 40px; gap: 6px; }
  .chat-composer .icon-button, .send-button { width: 40px; height: 40px; min-height: 40px; }
}

/* v23 · Móvil usable de verdad: evita zoom de iPhone, barras encimadas y botones difíciles */
@media (max-width: 760px) {
  html {
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body {
    min-height: 100dvh;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overscroll-behavior-y: contain;
  }

  input,
  textarea,
  select,
  button {
    font-size: 16px;
  }

  .main-content {
    min-height: 100dvh;
    padding: 14px 12px calc(118px + env(safe-area-inset-bottom));
  }

  .view {
    min-width: 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .assistant-view.is-active {
    display: block;
  }

  .assistant-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .assistant-intro {
    padding: 14px 16px;
  }

  .assistant-intro .assistant-orb,
  .assistant-intro .prompt-chips,
  .assistant-intro .card-kicker,
  .assistant-intro > p:not(.card-kicker) {
    display: none;
  }

  .assistant-intro h2 {
    margin: 0;
    font-size: 25px;
    line-height: 1.06;
  }

  .chat-card {
    min-height: calc(100dvh - 166px);
    margin-bottom: calc(18px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .chat-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    background: var(--card);
    border-bottom: 1px solid var(--line);
  }

  .chat-toolbar > div:last-child {
    grid-template-columns: 1fr 1fr;
  }

  .chat-messages {
    min-height: 320px;
    max-height: calc(100dvh - 330px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 18px;
  }

  .chat-composer {
    position: sticky;
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 35;
    grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
    gap: 6px;
    padding: 10px;
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -14px 28px rgba(43, 54, 49, .09);
  }

  .chat-composer textarea {
    min-height: 44px;
    max-height: 116px;
    font-size: 16px;
    line-height: 1.35;
  }

  .chat-composer .icon-button,
  .send-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 15px;
    flex: 0 0 auto;
  }

  .mobile-nav {
    z-index: 80;
    min-height: 82px;
    padding: 7px 6px max(9px, env(safe-area-inset-bottom));
    background: rgba(255, 252, 247, .98);
  }

  .mobile-nav button,
  .quick-action,
  .event-card,
  .task-item,
  .area-card,
  .inbox-file-card,
  .health-record {
    touch-action: manipulation;
  }

  .mobile-nav button {
    min-height: 58px;
  }

  .event-card,
  .task-item,
  .quick-action,
  .health-record,
  .inbox-file-card {
    scroll-margin-bottom: calc(108px + env(safe-area-inset-bottom));
  }

  .event-card-actions,
  .task-actions,
  .dialog-actions,
  .health-actions,
  .inbox-file-card .dialog-actions {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .event-card-actions button,
  .task-actions button,
  .dialog-actions button,
  .health-actions button,
  .inbox-file-card .dialog-actions button {
    width: 100%;
    min-height: 46px;
  }

  .app-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: 8px;
  }

  .app-dialog form {
    padding-bottom: calc(34px + env(safe-area-inset-bottom));
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(96px + env(safe-area-inset-bottom));
    width: auto;
  }
}

@media (max-width: 420px) {
  .chat-card {
    min-height: calc(100dvh - 154px);
  }

  .chat-messages {
    max-height: calc(100dvh - 310px);
  }

  .chat-composer {
    bottom: calc(80px + env(safe-area-inset-bottom));
    grid-template-columns: 40px minmax(0, 1fr) 40px 40px;
    gap: 5px;
  }

  .chat-composer .icon-button,
  .send-button {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }
}

/* v24 · El chat móvil se comporta como app: escribir siempre queda arriba de la barra inferior */
@media (max-width: 760px) {
  .assistant-view.is-active {
    padding-bottom: calc(168px + env(safe-area-inset-bottom));
  }

  .assistant-view.is-active .chat-card {
    min-height: calc(100dvh - 170px);
    margin-bottom: calc(126px + env(safe-area-inset-bottom));
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .assistant-view.is-active .chat-messages {
    max-height: calc(100dvh - 320px);
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .assistant-view.is-active .chat-composer {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(90px + env(safe-area-inset-bottom));
    width: auto;
    max-width: calc(100vw - 24px);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 16px 38px rgba(43, 54, 49, .20);
  }
}

@media (max-width: 420px) {
  .assistant-view.is-active .chat-composer {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

/* v25 · Compensa barras de Safari/Chrome en iPhone cuando la app no está en pantalla completa */
@media (max-width: 760px) {
  .assistant-view.is-active .chat-composer {
    bottom: calc(152px + env(safe-area-inset-bottom));
  }

  .assistant-view.is-active .chat-card {
    margin-bottom: calc(190px + env(safe-area-inset-bottom));
    padding-bottom: calc(150px + env(safe-area-inset-bottom));
  }
}

/* v26 · Empuje visual de seguridad para navegadores móviles con viewport inestable */
@media (max-width: 760px) {
  .assistant-view.is-active .chat-composer {
    transform: translateY(-76px) !important;
  }
}

/* v27 · Login móvil: una sola columna, sin pantalla partida ni scroll horizontal */
@media (max-width: 760px) {
  body.login-page {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    padding: 0 !important;
    overflow-x: hidden !important;
    background: var(--paper);
  }

  body.login-page .login-shell {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    display: flex !important;
    flex-direction: column;
    grid-template-columns: none !important;
    overflow-x: hidden;
  }

  body.login-page .login-brand-panel {
    width: 100%;
    min-height: 176px !important;
    padding: calc(24px + env(safe-area-inset-top)) 22px 24px !important;
    border-radius: 0 0 30px 30px;
    justify-content: flex-end !important;
    box-sizing: border-box;
  }

  body.login-page .login-brand-panel::before {
    width: 260px;
    height: 260px;
    right: -150px;
    top: -90px;
  }

  body.login-page .login-brand-panel::after {
    width: 170px;
    height: 170px;
    right: -70px;
    top: -22px;
  }

  body.login-page .login-brand-mark {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    border-radius: 16px;
    font-size: 22px;
  }

  body.login-page .login-brand-panel .card-kicker {
    font-size: 10px;
  }

  body.login-page .login-brand-panel h1 {
    max-width: 320px;
    margin: 8px 0 0;
    font-size: 32px !important;
    line-height: .98;
    letter-spacing: -.03em;
  }

  body.login-page .login-brand-panel > p:not(.card-kicker),
  body.login-page .login-security-note {
    display: none !important;
  }

  body.login-page .login-form-panel {
    width: 100%;
    flex: 1;
    min-height: auto !important;
    margin: 0 !important;
    padding: 28px 20px calc(36px + env(safe-area-inset-bottom)) !important;
    display: block;
    border-radius: 0 !important;
    box-sizing: border-box;
    background: radial-gradient(circle at top right, #fff9ec, var(--paper) 54%);
  }

  body.login-page .login-form-wrap {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
  }

  body.login-page .login-form-wrap h2 {
    margin: 6px 0 22px;
    font-size: 36px !important;
    line-height: 1.02;
    overflow-wrap: anywhere;
  }

  body.login-page .login-form-wrap form {
    gap: 15px;
  }

  body.login-page .login-form-wrap label {
    font-size: 13px !important;
  }

  body.login-page input,
  body.login-page button {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  body.login-page .primary-button.wide {
    min-height: 58px;
    white-space: normal;
    text-align: center;
  }

  body.login-page .login-form-wrap > small {
    font-size: 14px;
    line-height: 1.45;
  }
}

@media (max-width: 390px) {
  body.login-page .login-brand-panel {
    min-height: 154px !important;
    padding-inline: 18px !important;
  }

  body.login-page .login-brand-mark {
    width: 42px;
    height: 42px;
    margin-bottom: 10px;
  }

  body.login-page .login-brand-panel h1,
  body.login-page .login-form-wrap h2 {
    font-size: 30px !important;
  }

  body.login-page .login-form-panel {
    padding-inline: 16px !important;
  }
}

/* v29 · Chat web estable: historial scrolleable y caja de escribir siempre visible */
@media (min-width: 761px) {
  .assistant-view.is-active .assistant-layout {
    align-items: stretch;
  }

  .assistant-view.is-active .chat-card {
    height: min(760px, calc(100vh - 170px));
    min-height: 650px;
    max-height: 760px;
  }

  .assistant-view.is-active .chat-messages {
    min-height: 0;
    overflow-y: auto;
  }

  .assistant-view.is-active .chat-composer {
    flex: 0 0 auto;
  }
}

