:root{
  --bg:#f4f7fb;--panel:#fff;--ink:#111827;--muted:#667085;--line:#e4e7ec;--primary:#3157e5;--primary2:#6e48e6;
  --success:#067647;--warn:#b54708;--danger:#b42318;--shadow:0 12px 34px rgba(16,24,40,.08);--radius:22px
}
*{box-sizing:border-box}html{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);background:var(--bg)}
body{margin:0;min-height:100vh;background:radial-gradient(circle at 15% -10%,#e8edff 0,transparent 32%),var(--bg)}a{color:inherit;text-decoration:none}button,input,select,textarea{font:inherit}button{cursor:pointer}
.topbar{position:sticky;top:0;z-index:30;height:76px;padding:0 max(22px,calc((100vw - 1280px)/2));display:flex;align-items:center;justify-content:space-between;background:rgba(244,247,251,.88);backdrop-filter:blur(18px);border-bottom:1px solid rgba(228,231,236,.9)}
.brand{display:flex;gap:12px;align-items:center}.brand-mark{display:grid;place-items:center;width:42px;height:42px;border-radius:14px;background:linear-gradient(135deg,var(--primary),var(--primary2));color:white;font-weight:900;box-shadow:0 8px 18px rgba(49,87,229,.25)}.brand-mark.big{width:62px;height:62px;border-radius:19px;font-size:28px;margin:auto}.brand span:last-child{display:flex;flex-direction:column}.brand small{color:var(--muted);font-size:12px;margin-top:2px}.top-actions{display:flex;align-items:center;gap:10px}.ai-chip{font-size:12px;border:1px solid var(--line);padding:8px 10px;border-radius:999px;background:#fff;color:#475467}.icon-btn{border:0;background:linear-gradient(135deg,var(--primary),var(--primary2));color:white;width:44px;height:44px;border-radius:15px;font-size:19px}
.page{max-width:1280px;margin:0 auto;padding:28px 22px 110px}.bottom-nav{display:none}
.hero-card{border-radius:30px;padding:38px;display:flex;align-items:flex-end;justify-content:space-between;gap:30px;color:white;background:linear-gradient(120deg,#172554,#243ca6 58%,#6e48e6);box-shadow:0 24px 55px rgba(49,87,229,.18);overflow:hidden;position:relative}.hero-card:after{content:"";position:absolute;width:320px;height:320px;border:50px solid rgba(255,255,255,.07);border-radius:50%;right:-110px;top:-120px}.hero-card>div{position:relative;z-index:1}.hero-card h1{font-size:clamp(30px,4vw,51px);line-height:1.02;margin:10px 0 12px;max-width:780px}.hero-card p{max-width:730px;color:#dbe4ff;margin:0;font-size:17px}.hero-actions{display:flex;gap:10px;flex-wrap:wrap}.eyebrow{font-size:11px;letter-spacing:.15em;font-weight:800;color:#6b7fcc}.hero-card .eyebrow{color:#c8d4ff}
.btn{border:1px solid transparent;border-radius:13px;padding:11px 16px;font-weight:760;display:inline-flex;align-items:center;justify-content:center;gap:7px}.btn.primary{background:var(--primary);color:white}.hero-card .btn.primary{background:white;color:#243ca6}.btn.secondary{background:#fff;border-color:var(--line);color:#344054}.btn.glass{background:rgba(255,255,255,.13);border-color:rgba(255,255,255,.2);color:white;backdrop-filter:blur(10px)}.btn.danger{background:#fff1f0;border-color:#fecaca;color:var(--danger)}.btn.tiny{padding:7px 10px;font-size:12px}.btn.wide{width:100%}
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:15px;margin:18px 0}.stat{background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:18px 20px;box-shadow:0 4px 14px rgba(16,24,40,.035)}.stat span,.stat small{display:block;color:var(--muted);font-size:12px}.stat strong{display:block;font-size:30px;margin:7px 0 2px}
.two-col{display:grid;grid-template-columns:1.25fr .75fr;gap:18px}.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:22px;box-shadow:0 5px 18px rgba(16,24,40,.04)}.section-head,.page-head{display:flex;align-items:center;justify-content:space-between;gap:20px}.section-head h2,.page-head h1{margin:4px 0}.section-head>a{font-size:13px;color:var(--primary);font-weight:700}.page-head{margin-bottom:18px}.page-head h1{font-size:34px}.page-head p{color:var(--muted);margin:5px 0 0}.head-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.event-list{display:flex;flex-direction:column}.event-row{display:flex;align-items:center;gap:12px;padding:13px 0;border-bottom:1px solid #f0f2f5}.event-row:last-child{border-bottom:0}.date-badge{width:44px;height:48px;border-radius:13px;background:#f2f4ff;display:grid;place-content:center;text-align:center}.date-badge strong{font-size:17px}.date-badge span{font-size:10px;color:#667085}.event-copy{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.event-copy strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.event-copy span{font-size:12px;color:var(--muted)}.pill{font-size:11px;font-weight:750;border-radius:999px;padding:6px 9px;background:#f2f4f7;color:#475467}.pill.confirmed{background:#ecfdf3;color:var(--success)}.pill.tentative{background:#fff7ed;color:var(--warn)}.pill.cancelled{background:#fef3f2;color:var(--danger)}.source-list{display:flex;flex-direction:column;gap:14px;margin:8px 0 20px}.source-row{display:flex;align-items:center;gap:11px}.source-row>div{display:flex;flex:1;min-width:0;flex-direction:column}.source-row small{color:var(--muted);font-size:11px}.source-dot{width:10px;height:10px;border-radius:50%;background:#12b76a;box-shadow:0 0 0 4px #ecfdf3}.empty{padding:25px 10px;color:var(--muted);text-align:center}.muted{color:var(--muted)}.small{font-size:12px}
label{display:flex;flex-direction:column;gap:7px;font-size:12px;font-weight:750;color:#475467}input,select,textarea{width:100%;border:1px solid #d0d5dd;background:#fff;border-radius:12px;padding:11px 12px;color:var(--ink);outline:none}input:focus,select:focus,textarea:focus{border-color:#7f98f5;box-shadow:0 0 0 3px #eef1ff}textarea{resize:vertical}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.form-grid .span2,.span2{grid-column:span 2}.check-label{flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;align-self:end;padding:8px 0}.check-label input{width:auto}.stack-form{display:flex;flex-direction:column;gap:10px}.hint{margin-top:13px;padding:11px 13px;border-radius:12px;background:#f8f9fc;color:#667085;font-size:12px;line-height:1.45}.alert{border-radius:14px;padding:14px 16px;margin-bottom:16px}.alert.danger{background:#fff1f0;color:#912018;border:1px solid #fecdca}.alert.warning{background:#fffaeb;border:1px solid #fedf89;color:#93370d}.alert ul{margin:8px 0 0;padding-left:20px}
.upload-card form{display:flex;flex-direction:column;gap:14px}.dropzone{min-height:350px;border:2px dashed #c8cfe0;background:#fafbff;border-radius:20px;display:grid;place-content:center;text-align:center;gap:8px;cursor:pointer}.dropzone input{display:none}.dropzone .drop-icon{font-size:48px;color:var(--primary)}.dropzone small{font-weight:500;color:var(--muted)}.feature-list{display:flex;flex-direction:column;gap:20px;margin-top:20px}.feature-list>div{display:flex;gap:13px;align-items:flex-start}.feature-list>div>span{display:grid;place-items:center;min-width:36px;height:36px;border-radius:11px;background:#eef1ff;color:var(--primary);font-weight:900}.feature-list p{display:flex;flex-direction:column;margin:0}.feature-list small{color:var(--muted);margin-top:4px;font-weight:400}.scan-layout{grid-template-columns:1fr 1fr}
.review-list{display:flex;flex-direction:column;gap:14px}.review-card{display:grid;grid-template-columns:40px 1fr;background:#fff;border:1px solid var(--line);border-radius:18px;padding:18px;box-shadow:0 4px 15px rgba(16,24,40,.035)}.review-card.tentative-card{border-left:5px solid #f79009}.review-select{padding-top:24px}.review-select input{width:20px;height:20px}.confidence{margin-top:8px;font-size:11px;color:var(--muted)}.sticky-actions{position:sticky;bottom:20px;z-index:20;margin-top:18px;padding:12px;background:rgba(255,255,255,.9);backdrop-filter:blur(14px);border:1px solid var(--line);border-radius:16px;display:flex;justify-content:flex-end;gap:9px;box-shadow:var(--shadow)}
.calendar-shell{background:#fff;border:1px solid var(--line);border-radius:22px;overflow:hidden;box-shadow:0 6px 20px rgba(16,24,40,.05)}.calendar-weekdays,.month-grid{display:grid;grid-template-columns:repeat(7,1fr)}.calendar-weekdays span{padding:10px;text-align:center;color:#667085;font-size:11px;font-weight:800;background:#f9fafb;border-bottom:1px solid var(--line)}.day-cell{min-height:135px;border-right:1px solid #eef0f3;border-bottom:1px solid #eef0f3;padding:8px;overflow:hidden}.day-cell:nth-child(7n){border-right:0}.day-cell.outside{background:#fafafa;color:#b3b8c2}.day-number{width:28px;height:28px;display:grid;place-items:center;border-radius:50%;font-size:12px;font-weight:750}.day-cell.today .day-number{background:var(--primary);color:#fff}.cal-event{display:block;margin-top:5px;padding:5px 6px;border-radius:7px;background:#eef1ff;border-left:3px solid var(--primary);font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cal-event.tentative{background:#fff7ed;border-left-color:#f79009}.cal-event.school_closed{background:#fef3f2;border-left-color:#f04438}.cal-event.sports{background:#ecfdf3;border-left-color:#12b76a}.mobile-agenda{display:none;margin-top:16px}
.form-dialog,.voice-dialog{border:0;border-radius:24px;box-shadow:0 30px 80px rgba(16,24,40,.25);width:min(680px,calc(100vw - 26px));padding:24px}.form-dialog::backdrop,.voice-dialog::backdrop{background:rgba(17,24,39,.5);backdrop-filter:blur(5px)}.dialog-close{float:right;border:0;background:#f2f4f7;width:34px;height:34px;border-radius:11px;font-size:20px}.voice-dialog{text-align:center;max-width:560px}.voice-orb{width:82px;height:82px;margin:8px auto 15px;border-radius:50%;display:grid;place-items:center;font-size:30px;color:#fff;background:linear-gradient(135deg,var(--primary),var(--primary2));box-shadow:0 15px 30px rgba(49,87,229,.25)}.voice-orb.listening{animation:pulse 1s infinite alternate}.voice-actions{display:flex;gap:9px;justify-content:center;margin-top:12px}.status-line{min-height:22px;font-size:12px;color:var(--muted);margin-top:10px}@keyframes pulse{to{transform:scale(1.08);box-shadow:0 20px 45px rgba(49,87,229,.42)}}
.settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.settings-grid .card{display:flex;flex-direction:column;gap:12px}.settings-grid h2{margin:0 0 4px}.connection-row,.copy-row{display:flex;gap:9px;align-items:center}.copy-row input{flex:1}.danger-zone{margin-top:20px;padding:15px;border:1px dashed #fda29b;border-radius:16px}.feed-list{display:flex;flex-direction:column}.feed-row{display:flex;gap:20px;align-items:center;justify-content:space-between;padding:15px 0;border-bottom:1px solid #eef0f3}.feed-row>div:first-child{display:flex;flex-direction:column;gap:3px;min-width:0}.feed-row small{font-size:11px;color:var(--muted);word-break:break-all}.row-actions{display:flex;gap:6px;align-items:center}.error-text{color:var(--danger)!important}.feed-table-card{margin-top:18px}hr{border:0;border-top:1px solid var(--line);margin:18px 0}
.login-body{display:grid;place-items:center;min-height:100vh;padding:20px}.login-card{width:min(430px,100%);padding:34px;background:#fff;border:1px solid var(--line);border-radius:28px;box-shadow:var(--shadow);text-align:center}.login-card h1{margin-bottom:3px}.login-card label{text-align:left;margin:25px 0 14px}
@media(max-width:850px){.page{padding:20px 14px 100px}.topbar{height:66px;padding:0 14px}.brand small,.ai-chip{display:none}.hero-card{padding:26px 22px;display:block}.hero-actions{margin-top:20px}.stats-grid{grid-template-columns:repeat(2,1fr)}.two-col,.scan-layout,.settings-grid{grid-template-columns:1fr}.settings-grid .span2{grid-column:auto}.page-head{align-items:flex-start;flex-direction:column}.calendar-head{gap:10px}.day-cell{min-height:74px;padding:4px}.cal-event{font-size:0;height:6px;padding:0;border:0;border-radius:8px}.calendar-weekdays span{padding:8px 2px}.mobile-agenda{display:block}.form-grid{grid-template-columns:1fr}.form-grid .span2{grid-column:auto}.review-card{grid-template-columns:30px 1fr;padding:12px}.feed-row{align-items:flex-start;flex-direction:column}.row-actions{width:100%;flex-wrap:wrap}.bottom-nav{position:fixed;display:grid;grid-template-columns:repeat(5,1fr);bottom:0;left:0;right:0;z-index:40;background:rgba(255,255,255,.94);backdrop-filter:blur(18px);border-top:1px solid var(--line);padding:7px 5px max(7px,env(safe-area-inset-bottom))}.bottom-nav a{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:9px;color:#667085}.bottom-nav a span{font-size:21px}.bottom-nav a.active{color:var(--primary);font-weight:800}.copy-row{align-items:stretch;flex-direction:column}.sticky-actions{bottom:78px}.dropzone{min-height:260px}}

/* Scan UX: selected-file preview + asynchronous Ollama progress */
#scanEmptyState{display:grid;place-items:center;gap:8px}.scan-selected{width:min(100%,430px);display:grid;place-items:center;gap:8px}.scan-selected[hidden]{display:none}.scan-selected img{width:100%;max-height:280px;object-fit:contain;border-radius:14px;background:#fff;border:1px solid var(--line);box-shadow:0 8px 24px rgba(16,24,40,.08)}.scan-file-icon{font-size:54px;color:var(--primary)}.scan-change{font-size:11px;color:var(--primary);font-weight:750}.scan-status{border:1px solid #c7d7fe;background:#f5f8ff;border-radius:14px;padding:13px 14px}.scan-status[hidden]{display:none}.scan-status-head{display:flex;justify-content:space-between;gap:10px;align-items:center}.scan-status-head span{font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}.scan-status p{margin:9px 0 5px;color:#344054;font-size:13px}.scan-status small{display:block;color:var(--muted);font-weight:500;line-height:1.4}.scan-progress{height:8px;border-radius:999px;background:#e5eaf5;overflow:hidden;margin-top:10px}.scan-progress span{display:block;width:0;height:100%;border-radius:999px;background:linear-gradient(90deg,var(--primary),var(--primary2));transition:width .35s ease}.btn:disabled{opacity:.65;cursor:wait}
/* Scan UI 1.0.2: visible JS readiness + drag target */
.scan-ui-state{font-size:11px;color:#667085;text-align:center;min-height:16px}.scan-ui-state.ready{color:#067647}.scan-ui-state.error{color:#b42318}.dropzone.dragging{border-color:var(--primary);background:#f0f4ff;box-shadow:0 0 0 4px #eef1ff}

/* Calendar UX 1.0.6: readable mobile events + event detail quick-action sheet */
.calendar-weekdays,.month-grid{grid-template-columns:repeat(7,minmax(0,1fr))}
.day-cell{min-width:0}.cal-event{width:100%;text-align:left;border-top:0;border-right:0;border-bottom:0;cursor:pointer;color:var(--ink)}
.cal-event-title{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cal-more{display:block;margin-top:4px;font-size:9px;font-weight:750;color:var(--muted)}
.event-row-button{width:100%;border:0;background:transparent;text-align:left;color:inherit;cursor:pointer}
.event-row-button:hover{background:#fafbff}
.month-nav{min-width:42px}
.event-dialog{border:0;border-radius:26px;width:min(650px,calc(100vw - 24px));max-height:min(88vh,820px);padding:0;overflow:auto;box-shadow:0 30px 90px rgba(16,24,40,.28)}
.event-dialog::backdrop{background:rgba(17,24,39,.52);backdrop-filter:blur(5px)}
.event-dialog-head{position:sticky;top:0;z-index:2;display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:22px 22px 14px;background:rgba(255,255,255,.96);backdrop-filter:blur(14px);border-bottom:1px solid var(--line)}
.event-dialog-head h2{margin:5px 0 0;font-size:24px;line-height:1.18}.event-category{display:inline-flex;font-size:10px;font-weight:850;letter-spacing:.08em;text-transform:uppercase;color:var(--primary)}
.event-dialog-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:18px 22px 4px}.event-meta-row{display:flex;gap:10px;min-width:0;padding:12px;border-radius:14px;background:#f8f9fc}.event-meta-row>span{font-size:18px}.event-meta-row>div{display:flex;flex-direction:column;gap:3px;min-width:0}.event-meta-row strong{font-size:13px;line-height:1.35}.event-meta-row small{font-size:11px;color:var(--muted);overflow-wrap:anywhere}
.event-description{margin:14px 22px 0;padding:14px;border-radius:14px;background:#f8f9fc;color:#344054;line-height:1.5;white-space:pre-wrap}.event-state-row{display:flex;gap:8px;padding:14px 22px 0}
.quick-actions{padding:18px 22px}.quick-actions h3{margin:0 0 10px;font-size:13px}.quick-action-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.quick-action{border:1px solid var(--line);background:#fff;border-radius:15px;padding:12px;text-align:left;display:flex;flex-direction:column;gap:3px;min-height:90px;color:inherit}.quick-action:hover{background:#f8f9ff;border-color:#cbd5ff}.quick-action>span{font-size:19px}.quick-action strong{font-size:12px}.quick-action small{font-size:10px;color:var(--muted)}.quick-status{min-height:18px;margin-top:9px;color:var(--primary);font-size:11px;font-weight:700}
.event-dialog-actions{position:sticky;bottom:0;display:flex;justify-content:flex-end;gap:9px;padding:14px 22px max(14px,env(safe-area-inset-bottom));background:rgba(255,255,255,.97);backdrop-filter:blur(14px);border-top:1px solid var(--line)}
@media(max-width:850px){
  .calendar-shell{border-radius:16px}.calendar-weekdays span{font-size:9px;padding:8px 0}.day-cell{min-height:104px;padding:4px 3px}.day-number{width:24px;height:24px;font-size:11px}
  .cal-event{font-size:8.5px;height:auto;min-height:20px;margin-top:3px;padding:4px 4px;border-left:2px solid var(--primary);border-radius:6px;line-height:1.15}.cal-event.tentative{border-left:2px solid #f79009}.cal-event.school_closed{border-left:2px solid #f04438}.cal-event.sports{border-left:2px solid #12b76a}
  .cal-event-title{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cal-more{font-size:8px;margin-left:2px}
  .event-dialog{width:100vw;max-width:none;max-height:88vh;margin:auto 0 0;border-radius:24px 24px 0 0}.event-dialog-head{padding:18px 18px 12px}.event-dialog-head h2{font-size:21px}.event-dialog-meta{grid-template-columns:1fr;padding:14px 18px 0;gap:8px}.event-description{margin:12px 18px 0}.event-state-row{padding:12px 18px 0}.quick-actions{padding:16px 18px}.quick-action-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.quick-action{min-height:82px}.event-dialog-actions{padding:12px 18px max(12px,env(safe-area-inset-bottom))}.event-dialog-actions .btn{flex:1;text-align:center}
}
@media(max-width:420px){.day-cell{min-height:96px}.cal-event{font-size:8px}.calendar-weekdays span{font-size:8px}.quick-action-grid{gap:7px}}
