@font-face { font-family: 'Bricolage'; src: url('/fonts/bricolage.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('/fonts/atkinson-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('/fonts/atkinson-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --ink: #1d2b3a; --ink-2: #4a5867; --ink-3: #7b8794; --line: #dde3e1; --line-2: #eaeeed;
  --paper: #f5f7f6; --surface: #ffffff; --wash: #eef3f1;
  --spruce: #1f6f5c; --spruce-dark: #17594a; --spruce-tint: #e3f1ec;
  --p1: #d1373f; --p1-tint: #fdecec; --p2: #e2850f; --p2-tint: #fdf3e3; --p3: #3a6fd8; --p3-tint: #eaf0fc; --p4: #8a94a3; --p4-tint: #f0f2f4;
  --sky: #e7f0ff; --violet: #7a4fd1;
  --display: 'Bricolage', 'Segoe UI', system-ui, sans-serif;
  --body: 'Atkinson', 'Segoe UI', system-ui, sans-serif;
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --shadow: 0 1px 2px rgba(29, 43, 58, .06), 0 4px 16px rgba(29, 43, 58, .06);
  --nav-w: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 650; }
h2 { font-size: 20px; font-weight: 620; }
h3 { font-size: 16px; font-weight: 620; }
p { margin: 0 0 .6em; }
a { color: var(--spruce); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--spruce) 55%, white); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons & form */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 13px; border-radius: var(--r-s); cursor: pointer; font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--spruce); border-color: var(--spruce); color: #fff; }
.btn.primary:hover { background: var(--spruce-dark); }
.btn.danger { color: var(--p1); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--wash); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn .ico { width: 16px; height: 16px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=tel], input[type=search], input[type=time], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--spruce); outline: none; box-shadow: 0 0 0 3px var(--spruce-tint); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.nav { background: var(--ink); color: #dfe7ee; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-family: var(--display); font-weight: 700; font-size: 18px; color: #fff; }
.brand svg { width: 28px; height: 28px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-s); color: #c5d0da; text-decoration: none; font-weight: 700; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 #7fd1b9; }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; background: var(--p1); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; min-width: 20px; text-align: center; }
.nav .badge.soft { background: rgba(255,255,255,.14); }
.nav-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; }
.family { display: flex; gap: 6px; padding: 0 8px 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.me .grow { min-width: 0; }
.me b { display: block; color: #fff; font-size: 14px; }
.me button { background: none; border: 0; color: #9fb0bf; cursor: pointer; padding: 0; font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; font-family: var(--display); }
.avatar.xs { width: 20px; height: 20px; font-size: 11px; }
.main { min-width: 0; padding: 28px 36px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.demo-banner { background: var(--p2-tint); color: #7a4708; border: 1px solid #f3d29f; padding: 8px 12px; border-radius: var(--r-s); margin-bottom: 18px; font-size: 14px; }

/* ---------- dashboard */
.today { margin: 4px 0 28px; max-width: 900px; }
.today .date { color: var(--ink-3); font-weight: 700; margin-bottom: 6px; }
.today .headline { font-family: var(--display); font-size: clamp(30px, 4.2vw, 50px); line-height: 1.05; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.today .headline .crit { color: var(--p1); }
.today .headline .calm { color: var(--ink-3); font-weight: 500; }
.today .sub { margin-top: 12px; color: var(--ink-2); font-size: 16px; max-width: 70ch; }
.dash { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 34px; align-items: start; }
.section { margin-bottom: 30px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin-right: auto; }
.section-head a { font-weight: 700; font-size: 14px; text-decoration: none; }

/* task rows: priority is the left rule */
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-left: 5px solid var(--pc, var(--p3)); border-radius: var(--r-m); padding: 12px 14px; }
.task.p1 { --pc: var(--p1); background: linear-gradient(90deg, var(--p1-tint), #fff 38%); }
.task.p2 { --pc: var(--p2); } .task.p3 { --pc: var(--p3); } .task.p4 { --pc: var(--p4); }
.task.done { opacity: .62; border-left-color: var(--line); background: var(--surface); }
.task .t-title { grid-row: 1; grid-column: 2; font-weight: 700; cursor: pointer; }
.task .t-title:hover { text-decoration: underline; }
.task .t-meta { grid-row: 2; grid-column: 2; display: flex; gap: 12px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; }
.task .t-actions { grid-row: 1 / span 2; grid-column: 3; display: flex; gap: 6px; }
.tick { width: 26px; height: 26px; border: 2px solid var(--pc, var(--p3)); border-radius: 50%; background: #fff; cursor: pointer; grid-row: 1 / span 2; display: grid; place-items: center; }
.tick:hover { background: var(--pc); }
.tick:hover svg { stroke: #fff; }
.tick svg { width: 14px; height: 14px; stroke: var(--pc); }
.task.done .tick { background: var(--ink-3); border-color: var(--ink-3); }
.task.done .tick svg { stroke: #fff; }
.due { font-weight: 700; font-family: var(--display); }
.due.over { color: var(--p1); }
.due.soon { color: #b5640a; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--wash); color: var(--ink-2); white-space: nowrap; }
.chip.p1 { background: var(--p1-tint); color: var(--p1); } .chip.p2 { background: var(--p2-tint); color: #a35f05; } .chip.p3 { background: var(--p3-tint); color: var(--p3); } .chip.p4 { background: var(--p4-tint); color: #5d6774; }
.chip.green { background: var(--spruce-tint); color: var(--spruce); }
.chip.violet { background: #efe9fb; color: var(--violet); }
.prio-group { margin-bottom: 22px; }
.prio-group h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.prio-group h3 .dot { width: 10px; height: 10px; border-radius: 50%; }

/* agenda */
.agenda { display: flex; flex-direction: column; }
.ag { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.ag:last-child { border-bottom: 0; }
.ag .day { text-align: center; line-height: 1.05; }
.ag .day b { display: block; font-family: var(--display); font-size: 22px; }
.ag .when, .mrow .date, .feed .muted { font-variant-numeric: tabular-nums; }
.ag .day span { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.ag .what { font-weight: 700; }
.ag .when { font-size: 13px; color: var(--ink-2); }
.kind-ico { display: inline-block; width: 18px; text-align: center; }

.panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-l); padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.stat-line { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-family: var(--display); font-size: 20px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; font-size: 14px; }
.agent-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #2fb58d; box-shadow: 0 0 0 3px #d7f2e9; }
.pulse.err { background: var(--p1); box-shadow: 0 0 0 3px var(--p1-tint); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; margin-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 11px; color: var(--ink-3); }
.bars .bar i { width: 100%; max-width: 34px; background: var(--spruce); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar.last i { background: var(--ink); }

/* ---------- mail */
.mail { display: grid; grid-template-columns: 200px minmax(300px, 420px) 1fr; height: calc(100vh - 120px); border: 1px solid var(--line-2); border-radius: var(--r-l); background: var(--surface); overflow: hidden; }
.mail-side { border-right: 1px solid var(--line-2); padding: 12px 8px; overflow: auto; background: #fbfcfc; }
.mail-side a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r-s); text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px; }
.mail-side a:hover { background: var(--wash); }
.mail-side a.active { background: var(--spruce-tint); color: var(--spruce-dark); }
.mail-side a .n { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.mail-side a.active .n { color: var(--spruce); }
.mail-side .sep { font-size: 12px; color: var(--ink-3); margin: 14px 10px 4px; font-weight: 700; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.mail-list { border-right: 1px solid var(--line-2); overflow: auto; display: flex; flex-direction: column; }
.mail-search { padding: 10px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: #fff; z-index: 1; }
.mrow { display: grid; grid-template-columns: 10px 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; }
.mrow:hover { background: #f7faf9; }
.mrow.active { background: var(--spruce-tint); }
.mrow .from { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow.unread .from, .mrow.unread .subj { font-weight: 700; }
.mrow .date { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.mrow .subj { grid-column: 2 / span 2; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .snip { grid-column: 2 / span 2; font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .tags { grid-column: 2 / span 2; display: flex; gap: 6px; margin-top: 3px; }
.mrow .acc { width: 6px; border-radius: 3px; grid-row: 1 / span 3; align-self: stretch; }
.reader { overflow: auto; display: flex; flex-direction: column; }
.reader-head { padding: 18px 22px 12px; border-bottom: 1px solid var(--line-2); }
.reader-head h2 { margin-bottom: 8px; }
#backList { display: none; }
.reader-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.reader-body { flex: 1; min-height: 320px; }
.reader-body iframe { width: 100%; height: 100%; min-height: 420px; border: 0; display: block; }
.reader-side { padding: 14px 22px; border-top: 1px solid var(--line-2); background: #fbfcfc; }
.empty { display: grid; place-items: center; text-align: center; color: var(--ink-3); padding: 48px 20px; }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; }
.note { display: flex; gap: 10px; padding: 8px 0; font-size: 14px; white-space: pre-wrap; }
.notice { padding: 10px 12px; border-radius: var(--r-s); background: var(--p2-tint); color: #7a4708; font-size: 14px; margin-bottom: 10px; }
.notice.red { background: var(--p1-tint); color: #8f1d24; }
.notice.green { background: var(--spruce-tint); color: var(--spruce-dark); }

/* ---------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line-2); border-radius: var(--r-l); overflow: hidden; background: var(--line-2); gap: 1px; }
.cal .dow { background: #fbfcfc; padding: 8px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-align: center; }
.cal .cell { background: #fff; min-height: 104px; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .cell.other { background: #fafbfb; color: var(--ink-3); }
.cal .cell.is-today .dn { background: var(--spruce); color: #fff; border-radius: 99px; padding: 0 7px; }
.cal .dn { font-family: var(--display); font-size: 13px; font-weight: 700; align-self: flex-start; }
.ev { font-size: 12px; padding: 2px 6px; border-radius: 4px; background: var(--sky); color: #1f437f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border: 0; text-align: left; font-weight: 700; }
.ev.flight { background: #e6f4fb; color: #0d5d84; } .ev.ticket { background: #efe9fb; color: var(--violet); } .ev.appointment { background: var(--spruce-tint); color: var(--spruce-dark); } .ev.travel { background: #fff1db; color: #8a5208; }
.ev.deadline { background: var(--p1-tint); color: var(--p1); }

/* ---------- tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .right { text-align: right; }
.tbl-wrap { overflow-x: auto; }
.reason { display: block; font-size: 13px; color: var(--ink-2); }

/* savings */
.saving { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.saving:last-child { border-bottom: 0; }
.saving .amt { font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--spruce); text-align: right; white-space: nowrap; }
.saving .amt small { display: block; font-family: var(--body); font-size: 12px; color: var(--ink-3); font-weight: 400; }
.saving .acts { grid-column: 1 / -1; display: flex; gap: 8px; }
.catbar { display: grid; grid-template-columns: 170px 1fr 90px; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; }
.catbar .track { background: var(--wash); border-radius: 99px; height: 10px; overflow: hidden; }
.catbar .track i { display: block; height: 100%; background: var(--spruce); border-radius: 99px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 14px; font-weight: 700; color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--spruce); }

/* ---------- modal & toast */
dialog { border: 0; border-radius: var(--r-l); padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(29,43,58,.3); }
dialog::backdrop { background: rgba(29,43,58,.42); }
.modal-head { display: flex; align-items: center; padding: 18px 20px 6px; }
.modal-head h2 { margin-right: auto; }
.modal-body { padding: 10px 20px; max-height: 70vh; overflow: auto; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--r-m); box-shadow: var(--shadow); max-width: 380px; font-size: 14px; animation: rise .2s ease-out; }
.toast.err { background: var(--p1); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--ink); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: clamp(34px, 4vw, 56px); font-weight: 700; letter-spacing: -0.03em; max-width: 12ch; line-height: 1.02; }
.auth-art h1 + p { margin-top: 18px; }
.auth-art p { color: #b9c6d2; max-width: 42ch; font-size: 17px; }
.auth-art .stack { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.auth-art .s { background: rgba(255,255,255,.07); border-left: 4px solid var(--c); border-radius: 8px; padding: 10px 14px; font-weight: 700; color: #eef3f7; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: min(380px, 100%); }
.auth-form h2 { font-size: 26px; margin-bottom: 6px; }

/* ---------- responsive */
.mobile-bar { display: none; }
@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
  .mail { grid-template-columns: 170px minmax(260px, 340px) 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: none; }
  .main { padding: 18px 16px 90px; }
  .mobile-bar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); z-index: 50; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-bar a { color: #b9c6d2; text-decoration: none; font-size: 11px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; position: relative; }
  .mobile-bar a.active { color: #fff; }
  .mobile-bar svg { width: 22px; height: 22px; }
  .mobile-bar .badge { position: absolute; top: 0; right: 2px; background: var(--p1); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
  h1 { font-size: 24px; }
  .mail { grid-template-columns: 1fr; height: auto; min-height: 60vh; }
  .mail-side { display: flex; gap: 4px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-2); padding: 8px; }
  .mail-side .sep, .mail-side .acc-link { display: none; }
  .mail-side a { white-space: nowrap; }
  .mail.reading .mail-list, .mail.reading .mail-side { display: none; }
  #backList { display: inline-flex; }
  .mail:not(.reading) .reader { display: none; }
  .cal .cell { min-height: 64px; padding: 3px; }
  .cal .ev { font-size: 10px; padding: 1px 3px; }
  .grid2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 22px; }
  .auth-art .stack { display: none; }
  .task { grid-template-columns: auto 1fr; }
  .task .t-actions { grid-row: 3; grid-column: 2; }
  .task .t-actions:empty { display: none; }
  .catbar { grid-template-columns: 110px 1fr 76px; font-size: 13px; }
  .tbl .hide-m { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
