@font-face { font-family:'Inter'; font-weight:400; font-display:swap; src:url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family:'Inter'; font-weight:500; font-display:swap; src:url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family:'Cormorant Garamond'; font-weight:400; font-display:swap; src:url(fonts/cormorant-garamond-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family:'Cormorant Garamond'; font-weight:600; font-display:swap; src:url(fonts/cormorant-garamond-latin-600-normal.woff2) format('woff2'); }

:root {
  --ink:#052E62; --accent:#074492; --green:#4A7C3F; --line-green:#5FA84F;
  --bg:#F3F5F8; --card:#FFFFFF; --text:#1E2B3C; --muted:#5F6E84; --line:#D9E0EA;
  --red:#B3261E; --amber:#8A5A00; --amber-bg:#FFF4DC; --red-bg:#FDECEA; --green-bg:#EAF3E7; --blue-bg:#E8F0FB;
  --display:"Cormorant Garamond", Georgia, serif; --body:"Inter", system-ui, -apple-system, sans-serif;
  --r:12px; --shadow:0 1px 2px rgba(5,46,98,.06), 0 6px 18px rgba(5,46,98,.06);
}
* { box-sizing:border-box; margin:0; padding:0; }
html, body { background:var(--bg); color:var(--text); font-family:var(--body); font-size:15px; line-height:1.5; }
a { color:var(--accent); }
button, input, select, textarea { font:inherit; color:inherit; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.boot { padding:40px; text-align:center; color:var(--muted); }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

/* login */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:16px; background:var(--ink); }
.login-card { width:100%; max-width:390px; background:#fff; border-radius:16px; padding:28px; box-shadow:0 20px 50px rgba(0,0,0,.25); }
.login-brand { display:flex; align-items:center; justify-content:center; gap:12px; margin-bottom:22px; }
.login-brand img { height:58px; width:auto; }
.login-brand-stack { display:flex; flex-direction:column; gap:4px; }
.login-brand strong { font-family:var(--display); font-size:32px; font-weight:600; color:var(--ink); line-height:1; }
.login-brand span { font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }
.stack { display:flex; flex-direction:column; gap:10px; }
.divider { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:12px; margin:8px 0; }
.divider::before, .divider::after { content:""; flex:1; height:1px; background:var(--line); }
.msg { font-size:13.5px; } .msg.err { color:var(--red); } .msg.ok { color:var(--green); }
.linkbtn { background:none; border:0; color:var(--accent); cursor:pointer; font-size:13.5px; padding:0; text-decoration:underline; }

/* inputs and buttons */
.input, select.input, textarea.input { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:#fff; font-size:15px; }
textarea.input { min-height:84px; resize:vertical; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 16px; border-radius:8px; border:1px solid transparent; font-weight:500; cursor:pointer; font-size:14px; }
.btn-primary { background:var(--accent); color:#fff; } .btn-primary:hover { background:var(--ink); }
.btn-ghost { background:#fff; border-color:var(--line); color:var(--ink); } .btn-ghost:hover { border-color:var(--accent); }
.btn-google { background:#fff; border-color:var(--line); color:var(--text); }
.btn-sm { padding:6px 10px; font-size:13px; }
.btn[disabled] { opacity:.55; cursor:default; }

/* shell */
.top { position:sticky; top:0; z-index:20; background:var(--ink); color:#fff; border-bottom:3px solid var(--line-green); }
.top-inner { max-width:1240px; margin:0 auto; padding:10px 20px; display:flex; align-items:center; gap:18px; }
.top-brand { display:flex; align-items:center; gap:10px; color:#fff; text-decoration:none; }
.top-brand img { height:32px; width:auto; } .top-brand strong { font-family:var(--display); font-size:22px; font-weight:600; }
.top-brand span { font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:#C7DCF2; }
.tabs { display:flex; gap:4px; margin-left:12px; }
.tabs a { color:#C7DCF2; text-decoration:none; padding:8px 12px; border-radius:8px; font-size:14px; }
.tabs a.on, .tabs a:hover { background:rgba(255,255,255,.12); color:#fff; }
.badge-count { display:inline-block; min-width:20px; padding:0 6px; margin-left:6px; border-radius:10px; background:#8FE07A; color:var(--ink); font-size:12px; font-weight:600; text-align:center; }
.who { margin-left:auto; display:flex; align-items:center; gap:10px; font-size:13px; color:#C7DCF2; }
.who button { background:none; border:1px solid rgba(255,255,255,.35); color:#fff; border-radius:8px; padding:5px 10px; cursor:pointer; font-size:13px; }
main { max-width:1240px; margin:0 auto; padding:22px 20px 100px; }
.bottom-tabs { display:none; }
@media (max-width:820px) {
  .tabs, .who .who-name { display:none; }
  .bottom-tabs { display:flex; position:fixed; left:0; right:0; bottom:0; z-index:30; background:var(--ink); border-top:2px solid var(--line-green); padding:6px 4px max(6px, env(safe-area-inset-bottom)); }
  .bottom-tabs a { flex:1; text-align:center; color:#C7DCF2; text-decoration:none; font-size:12px; padding:6px 2px; border-radius:8px; }
  .bottom-tabs a.on { color:#fff; background:rgba(255,255,255,.12); }
  main { padding:16px 12px 96px; }
}

/* page parts */
.page-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.page-head h1 { font-family:var(--display); font-weight:600; font-size:32px; color:var(--ink); line-height:1.1; }
.page-head p { color:var(--muted); font-size:14px; margin-top:2px; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap:14px; }
.card { background:var(--card); border-radius:var(--r); box-shadow:var(--shadow); padding:18px; }
.card h2 { font-size:13px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); font-weight:500; margin-bottom:10px; }
.empty { color:var(--muted); padding:18px; text-align:center; background:#fff; border-radius:var(--r); border:1px dashed var(--line); }
.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:12px; margin-bottom:18px; }
.stat { background:#fff; border-radius:var(--r); box-shadow:var(--shadow); padding:14px 16px; }
.stat b { display:block; font-size:26px; color:var(--ink); font-weight:500; } .stat span { font-size:13px; color:var(--muted); }
.stat.alert b { color:var(--red); }

.toolbar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.toolbar .input { width:auto; min-width:160px; flex:1; }
.list { display:flex; flex-direction:column; gap:8px; }
.row { display:flex; align-items:center; gap:14px; background:#fff; border-radius:10px; box-shadow:var(--shadow); padding:12px 14px; text-decoration:none; color:inherit; border:1px solid transparent; }
.row:hover { border-color:var(--accent); }
.row .main { flex:1; min-width:0; } .row .name { font-weight:500; color:var(--ink); }
.row .sub { font-size:13px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row .side { text-align:right; font-size:13px; color:var(--muted); flex-shrink:0; }
.pill { display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:500; background:var(--blue-bg); color:var(--accent); white-space:nowrap; }
.pill.hot { background:var(--red-bg); color:var(--red); } .pill.warm { background:var(--amber-bg); color:var(--amber); } .pill.cold { background:#EEF1F5; color:var(--muted); }
.pill.self { background:var(--green-bg); color:var(--green); } .pill.overdue { background:var(--red-bg); color:var(--red); } .pill.today { background:var(--amber-bg); color:var(--amber); }
.pill.off { background:#EEF1F5; color:var(--muted); }

/* contact detail */
.detail { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); gap:14px; }
@media (max-width:900px) { .detail { grid-template-columns:1fr; } }
.fields { display:grid; grid-template-columns:140px 1fr; gap:8px 12px; align-items:center; font-size:14px; }
.fields label { color:var(--muted); font-size:13px; }
@media (max-width:520px) { .fields { grid-template-columns:1fr; } }
.timeline { display:flex; flex-direction:column; gap:10px; margin-top:12px; }
.note { border-left:3px solid var(--line); padding:4px 0 4px 12px; font-size:14px; white-space:pre-wrap; }
.note .meta { font-size:12px; color:var(--muted); margin-bottom:2px; white-space:normal; }
.note.system { border-left-color:var(--line-green); }
.task { display:flex; align-items:flex-start; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); font-size:14px; }
.task:last-child { border-bottom:0; }
.task input[type=checkbox] { margin-top:4px; width:18px; height:18px; accent-color:var(--green); }
.task .t-title { flex:1; } .task .t-meta { font-size:12px; color:var(--muted); }
.task.done .t-title { text-decoration:line-through; color:var(--muted); }
.inline { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; } .inline .input { flex:1; min-width:140px; }
.back { display:inline-block; margin-bottom:10px; font-size:14px; text-decoration:none; }
.toast { position:fixed; left:50%; bottom:90px; transform:translateX(-50%); background:var(--ink); color:#fff; padding:10px 16px; border-radius:10px; font-size:14px; z-index:50; box-shadow:0 8px 24px rgba(0,0,0,.2); }
dialog.modal { border:0; border-radius:14px; padding:0; width:min(520px, calc(100vw - 24px)); margin:auto; box-shadow:0 24px 60px rgba(5,46,98,.35); }
dialog.modal::backdrop { background:rgba(5,46,98,.5); }
dialog.modal form { padding:22px; display:flex; flex-direction:column; gap:10px; }
dialog.modal h3 { font-family:var(--display); font-size:26px; font-weight:600; color:var(--ink); }
.modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:6px; }
.hint { font-size:12.5px; color:var(--muted); }
/* voice: mic on fields, Listen on notes */
.dictate { position:relative; display:flex; min-width:0; }
.dictate > .input { padding-right:44px; }
.inline .dictate { flex:1; min-width:140px; }
.mic-btn { position:absolute; right:6px; top:50%; transform:translateY(-50%); width:32px; height:32px; border-radius:50%; border:1px solid var(--line); background:#fff; color:var(--accent); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; }
.dictate.block .mic-btn { top:auto; bottom:10px; right:16px; transform:none; }
.mic-btn:hover { border-color:var(--accent); }
.mic-btn.on { background:var(--red-bg); border-color:var(--red); }
.rec-dot { width:10px; height:10px; border-radius:50%; background:var(--red); animation:pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity:.35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation:none; } }
.dictate.on .input { border-color:var(--red); }
.listen { background:none; border:1px solid var(--line); border-radius:14px; padding:1px 9px; font-size:12px; color:var(--accent); cursor:pointer; margin-left:6px; white-space:nowrap; }
.listen:hover { border-color:var(--accent); } .listen.on { color:var(--red); border-color:var(--red); }

.dir { display:inline-block; margin-left:6px; font-size:12.5px; font-weight:500; white-space:nowrap; }
.dir::before { content:"↗ "; }

/* Showing: Everyone / Mine / one person */
.scope { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:-4px 0 14px; }
.scope .hint { margin-right:2px; }
.chip { border:1px solid var(--line); background:#fff; color:var(--ink); border-radius:16px; padding:5px 12px; font-size:13px; cursor:pointer; }
.chip:hover { border-color:var(--accent); }
.chip.on { background:var(--ink); border-color:var(--ink); color:#fff; }

/* calendar */
.cal-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.cal-head h2 { font-family:var(--display); font-size:24px; font-weight:600; color:var(--ink); min-width:170px; letter-spacing:0; text-transform:none; margin:0; }
.cal-grid { display:grid; grid-template-columns:repeat(7, minmax(0, 1fr)); gap:1px; background:var(--line); border:1px solid var(--line); border-radius:var(--r); overflow:hidden; }
.cal-dow { background:#F8FAFC; font-size:12px; color:var(--muted); text-align:center; padding:6px 0; }
.cal-day { background:#fff; min-height:104px; padding:6px; display:flex; flex-direction:column; gap:3px; min-width:0; }
.cal-day .dnum { border-radius:12px; padding:0 7px; }
.cal-day .dnum:hover { background:var(--blue-bg); }
a.cal-item { text-decoration:none; }
button.cal-item { width:100%; border:0; cursor:pointer; font:inherit; font-size:12px; text-align:left; }
a.cal-item:hover, button.cal-item:hover { outline:1px solid var(--accent); }
.t-title .linkbtn { font-size:inherit; text-align:left; color:var(--ink); }
.cal-day.other { background:#F7F9FB; color:var(--muted); }
.cal-day .dnum { font-size:13px; font-weight:500; }
.cal-day.today .dnum { background:var(--accent); color:#fff !important; }
.cal-item { display:block; font-size:12px; line-height:1.3; padding:2px 5px; border-radius:5px; background:var(--blue-bg); color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-item.appt { background:var(--green-bg); color:#2F5A27; }
.cal-item.overdue { background:var(--red-bg); color:var(--red); }
.cal-item.done { text-decoration:line-through; opacity:.6; }
.cal-more { font-size:11.5px; color:var(--muted); }
.agenda { display:flex; flex-direction:column; gap:14px; }
.agenda .row .sub { white-space:normal; }
.agenda h3 { font-size:13px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); font-weight:500; margin-bottom:6px; }
.agenda h3.is-today { color:var(--accent); }
.time { font-variant-numeric:tabular-nums; color:var(--ink); font-weight:500; }
.kind { font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--green); font-weight:500; }
.legend { display:flex; gap:12px; font-size:12.5px; color:var(--muted); align-items:center; flex-wrap:wrap; }
.legend i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:5px; vertical-align:-1px; }
@media (max-width:820px) { .cal-grid-wrap { display:none; } }
@media (min-width:821px) { .agenda-phone-only { display:none; } }
.two { display:grid; grid-template-columns:1fr 1fr; gap:10px; } .two > div { display:flex; flex-direction:column; gap:4px; min-width:0; }
.three { display:grid; grid-template-columns:1.3fr 1fr 1fr; gap:10px; } .three > div { display:flex; flex-direction:column; gap:4px; min-width:0; }
@media (max-width:420px) { .three { grid-template-columns:1fr 1fr; } .three > div:first-child { grid-column:1/-1; } }

@media (max-width:600px) {
  .row { flex-wrap:wrap; } .row .side { width:100%; text-align:left; }
  .row .side .inline { justify-content:flex-start !important; }
  .row .side select.input { width:100% !important; min-width:0 !important; }
}
