:root {
  --bg: #f6f7f9; --card: #fff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #1d4ed8; --accent-ink: #fff; --good: #15803d; --warn: #b45309; --bad: #b91c1c;
  --good-bg: #dcfce7; --warn-bg: #fef3c7; --bad-bg: #fee2e2;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b21; --ink: #e5e7eb; --muted: #9ca3af; --line: #2a2f38;
    --accent: #60a5fa; --accent-ink: #0b1220; --good: #4ade80; --warn: #fbbf24; --bad: #f87171;
    --good-bg: #12301d; --warn-bg: #3a2c0b; --bad-bg: #3b1515;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.35rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .7rem 16px; padding-top: max(.7rem, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: .55rem; }
.brand img { display: block; border-radius: 7px; }
.auth-logo { display: block; margin: 0 auto .6rem; }
.ws, .switcher summary { color: var(--muted); font-size: .9rem; cursor: pointer; }
.switcher { position: relative; }
.switcher .menu { position: absolute; right: 0; top: 1.8rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .4rem; min-width: 12rem; }
.switcher .menu .current { font-weight: 700; }
.top-right { display: flex; align-items: center; gap: .8rem; position: relative; z-index: 7; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: .45rem; cursor: pointer; color: var(--muted); font-size: .9rem; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: .8rem; letter-spacing: .02em; flex: none; }
.avatar.lg { width: 3rem; height: 3rem; font-size: 1.1rem; }
.usermenu .menu { position: absolute; right: 0; top: 2.6rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: .4rem; min-width: 15rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: flex; flex-direction: column; }
.usermenu .menu-head { padding: .5rem .6rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; overflow-wrap: anywhere; }
.usermenu .menu a, .usermenu .menu .signout { display: block; width: 100%; text-align: left; padding: .5rem .6rem; border-radius: 8px; color: var(--ink); font-size: .92rem; }
.usermenu .menu a:hover, .usermenu .menu .signout:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.usermenu .menu form { margin: 0; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
.profile-head { display: flex; align-items: center; gap: .8rem; overflow-wrap: anywhere; }
@media (max-width: 600px) { .usermenu .uname { display: none; } }

.page { max-width: 760px; margin: 0 auto; padding: 1rem 16px 6.5rem; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; text-align: center; padding: .45rem 0 .5rem; color: var(--muted); font-size: .75rem; }
.tabs a .i { display: block; font-size: 1.25rem; line-height: 1.3; }
.tabs a.on { color: var(--accent); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .8rem; }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--good-bg); }
.flash.error { background: var(--bad-bg); }
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--warn-bg); }
.alert.bad { background: var(--bad-bg); }
.alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }

.dayhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.dayhead h1 { margin: 0; text-align: center; }
.dayhead a { padding: .3rem .6rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; }
.stat b { display: block; font-size: 1.15rem; }
.stat span { color: var(--muted); font-size: .78rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.block { display: flex; gap: .75rem; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c, var(--accent));
  border-radius: 10px; padding: .65rem .8rem; margin-bottom: .5rem; align-items: center; }
.block .time { min-width: 3.4rem; font-variant-numeric: tabular-nums; font-size: .9rem; }
.block .time small { display: block; color: var(--muted); }
.block .body { flex: 1; min-width: 0; }
.block .title { font-weight: 600; overflow-wrap: anywhere; color: var(--ink); }
.block.event { background: color-mix(in srgb, var(--c) 9%, var(--card)); }
.tag { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent);
  color: var(--ink); margin-right: .3rem; white-space: nowrap; }
.pill { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; white-space: nowrap; }
.pill.p1 { background: var(--bad-bg); color: var(--bad); }
.pill.p2 { background: var(--warn-bg); color: var(--warn); }
.pill.late { background: var(--bad-bg); color: var(--bad); }
.pill.done { background: var(--good-bg); color: var(--good); }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: .7rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c, var(--line));
  border-radius: 10px; padding: .6rem .8rem; margin-bottom: .45rem; }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.row .meta { font-size: .8rem; color: var(--muted); }
.row.done .title { text-decoration: line-through; color: var(--muted); }
.row.cancelled .title { text-decoration: line-through; color: var(--muted); }

.check { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 2px solid var(--line); background: transparent; color: var(--good); font-size: 1rem; cursor: pointer; flex: none; }
.check:hover { border-color: var(--good); }

form p, .field { margin: 0 0 .85rem; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; font: inherit; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
input[type=color] { width: 3.5rem; height: 2.4rem; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; vertical-align: middle; }
.helptext { display: block; color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.errorlist { color: var(--bad); margin: .2rem 0; padding-left: 1rem; font-size: .85rem; }
.checks > div { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.checks > div label { font-weight: 400; display: inline-flex; gap: .35rem; align-items: center; margin: 0; font-size: .95rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .7rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 .7rem; }

.btn, button.btn { display: inline-block; font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: .65rem 1.1rem;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-align: center; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.block { display: block; width: 100%; }
.btn.sm { padding: .35rem .7rem; font-size: .85rem; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: .3rem .4rem; display: block; width: 100%; text-align: left; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.toolbar select, .toolbar input { width: auto; flex: 1; min-width: 8rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg a { padding: .4rem .75rem; color: var(--muted); font-size: .9rem; }
.seg a.on { background: var(--accent); color: var(--accent-ink); }

.quick summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.quick form { margin-top: .8rem; }
.fab { position: fixed; right: 16px; bottom: calc(4.6rem + env(safe-area-inset-bottom)); width: 3.4rem; height: 3.4rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 1.8rem; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 4; }

table.bal { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.bal th, table.bal td { padding: .45rem .3rem; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
table.bal th:first-child, table.bal td:first-child { text-align: left; }
.scroll { overflow-x: auto; }
.bar { height: .55rem; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: .25rem; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; background: var(--c); vertical-align: -1px; margin-right: .35rem; }

.auth { max-width: 420px; margin: 2rem auto; }
.auth h1 { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 1rem; }
.bad { color: var(--bad); }

/* AI and the day */
.ai-badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #2563eb); color: #fff; vertical-align: 1px; }
.btn.whatsapp { background: #1f9d55; color: #fff; }
.wa-tag { color: #1f9d55; font-weight: 600; }
.btn.ai { background: linear-gradient(90deg, #7c3aed, #2563eb); color: #fff; }
.btn.ai[disabled] { opacity: .7; cursor: progress; }
.summary { background: color-mix(in srgb, #7c3aed 8%, var(--card)); border-radius: 10px; padding: .7rem .85rem; margin: .4rem 0 .9rem; }
.planmeta { margin: -.2rem 0 .5rem; text-align: center; }
.why { font-size: .8rem; color: var(--muted); font-style: italic; margin-top: .15rem; }
.why.bad { color: var(--bad); font-style: normal; }
.block.done { opacity: .6; }
.block.done .title { text-decoration: line-through; }
.block.clash { border-color: var(--bad); }
.advice { margin: 0 0 1rem; padding-left: 1.2rem; }
.advice li { margin-bottom: .35rem; }
.plan-form details { margin-bottom: .6rem; }
.plan-form summary { cursor: pointer; color: var(--accent); margin-bottom: .4rem; }

/* Dashboard */
.myday .head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.myday h1, .myday .dayhead-title { margin: 0; font-size: 1.15rem; color: var(--ink); }
.myday h2 { margin: .9rem 0 .5rem; font-size: .95rem; color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.titlebar { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; margin-bottom: .6rem; }
.titlebar h1 { margin: 0 0 .2rem; }
.titlebar .swatch { width: 1rem; height: 1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.cards .card { margin: 0; }
.acard { border-top: 5px solid var(--c); display: flex; flex-direction: column; gap: .55rem; }
.acard .name { font-weight: 700; font-size: 1.08rem; color: var(--ink); }
.acard .nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; text-align: center; }
.acard .nums div { background: var(--bg); border-radius: 8px; padding: .35rem .2rem; }
.acard .nums b { display: block; font-size: 1rem; }
.acard .nums span { font-size: .68rem; color: var(--muted); }
.acard .nums .bad b { color: var(--bad); }
.acard .projects, .acard .next { list-style: none; margin: 0; padding: 0; }
.acard .projects li { margin-bottom: .45rem; }
.acard .prow { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.acard .prow a { color: var(--ink); font-weight: 600; }
.acard .projects .bar i { background: var(--c); }
.acard .next { border-top: 1px solid var(--line); padding-top: .45rem; }
.acard .next li { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; padding: .15rem 0; }
.acard .next a { color: var(--ink); overflow-wrap: anywhere; }
.acard footer { margin-top: auto; }
.list.compact .row { padding: .45rem .7rem; }

/* Planned and actual */
.pva { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); margin-top: .3rem; flex-wrap: wrap; }
.pva b { color: var(--ink); font-weight: 600; }
.over { color: var(--warn); font-weight: 600; }
.under { color: var(--good); font-weight: 600; }
.pva-actions { display: flex; gap: .4rem; align-items: flex-start; flex-wrap: wrap; margin-top: .4rem; }
.pva-actions form { margin: 0; }
.logtime > summary { list-style: none; display: inline-block; }
.logtime > summary::-webkit-details-marker { display: none; }
.logtime[open] form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-top: .45rem; }
.logtime label { font-size: .8rem; font-weight: 600; margin: 0; }
.logtime input[type=number] { width: 6rem; display: block; margin-top: .2rem; }
label.inline { display: inline-flex; gap: .35rem; align-items: center; font-weight: 400; }
.btn.stop { background: var(--bad); color: #fff; }
.block.live { box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 45%, transparent); }
.live-dot { color: var(--bad); }
.live-dot::before { content: "●"; margin-right: .25rem; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.timerbar { position: sticky; top: 3.1rem; z-index: 4; display: flex; align-items: center; gap: .6rem; padding: .45rem 16px;
  background: color-mix(in srgb, var(--c) 12%, var(--card)); border-bottom: 1px solid var(--line); font-size: .9rem; }
.timerbar .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.timerbar .elapsed { font-variant-numeric: tabular-nums; }
.timerbar form { margin: 0; }
table.bal tr.total td { font-weight: 700; border-bottom: 0; }

/* Detail pages: the form or details on the left, actions and related things on the right (wide screens) */
.split-side .card { margin-bottom: .8rem; }
.side-actions { display: flex; flex-direction: column; gap: .45rem; }
.meeting-notes { margin-top: 1rem; }
.meeting-notes h2 .muted { font-weight: 400; margin-left: .4rem; }
.meeting-files li { flex-wrap: wrap; }
.meeting-files audio { width: 100%; height: 2.2rem; }
.voice-recorder { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .2rem 0 .8rem; }
.voice-recorder [data-record].recording { color: var(--bad, #d33); border-color: currentColor; }
.notes-actions { flex-wrap: wrap; }
.followups .fu-row { display: grid; grid-template-columns: auto 1fr 10rem; gap: .6rem; align-items: start; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.followups .fu-row input[type=text] { font-weight: 600; }
.followups .fu-row .why { margin-top: .25rem; white-space: pre-line; }
@media (max-width: 640px) { .followups .fu-row { grid-template-columns: auto 1fr; } .followups .fu-row .fu-date { grid-column: 2; } }
.attend-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .45rem; }
.attendance button.link { width: auto; padding-left: 0; margin-top: .3rem; }
.side-actions form { margin: 0; }
.side-actions .btn, .side-actions button.btn { width: 100%; text-align: left; }
.side-h { margin: 0 0 .5rem; font-size: .95rem; }
.side-h2 { font-size: .95rem; margin: 1rem 0 .5rem; }
.guests { list-style: none; margin: 0; padding: 0; }
.guests li { padding: .25rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.guests li:last-child { border-bottom: 0; }
.notes { overflow-wrap: anywhere; }
.link-task select { width: 100%; }
.link-task .mt { margin-top: .7rem; }
@media (min-width: 1100px) {
  .page.medium { max-width: 1240px; padding-left: 24px; padding-right: 24px; }
  .split > .split-main:only-child { grid-column: 1 / -1; }  /* nothing beside it yet (a new task): the whole width */
  .split > .split-main:only-child .grid2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 1.4rem; align-items: start; }
  .split-side { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow-y: auto; }
  .split-side .side-h2:first-child, .split-side > .card:first-child { margin-top: 0; }
}

/* Settings: a tile for each area */
.setting-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem; margin-bottom: .5rem; }
.setting-tiles .tile { display: flex; flex-direction: column; gap: .25rem; margin: 0; color: var(--ink); text-decoration: none; }
.setting-tiles .tile b { color: var(--accent); }
.setting-tiles .tile:hover { border-color: var(--accent); }

/* Month: a row per week (Monday first) and a summary column; each day shows how full it is */
.mo { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; margin-bottom: 1rem; }
.mo-head, .mo-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 9.5rem; }
.mo-head span { padding: .4rem; font-size: .8rem; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.mo-row + .mo-row { border-top: 1px solid var(--line); }
.mo-day { display: flex; flex-direction: column; gap: .2rem; min-height: 6.4rem; padding: .35rem .4rem; border-right: 1px solid var(--line);
  color: var(--ink); font-size: .75rem; overflow: hidden; text-decoration: none; }
.mo-day:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.mo-day.out { opacity: .45; }
.mo-day.past .mo-n { color: var(--muted); }
.mo-n { font-weight: 700; font-size: .85rem; }
.mo-day.today .mo-n { align-self: flex-start; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .45rem; }
.mo-bar { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; }
.mo-bar i { display: block; height: 100%; border-radius: 3px; background: var(--lvl, #93c5fd); }
.mo-day.light { --lvl: #93c5fd; } .mo-day.busy { --lvl: #6366f1; } .mo-day.full { --lvl: #f59e0b; } .mo-day.over { --lvl: #dc2626; }
.wk-key .lvl { display: inline-block; width: .9rem; height: .5rem; border-radius: 3px; margin: 0 .25rem 0 .5rem; }
.lvl.light { background: #93c5fd; } .lvl.busy { background: #6366f1; } .lvl.full { background: #f59e0b; } .lvl.over { background: #dc2626; }
.mo-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; padding: 0 .3rem;
  background: color-mix(in srgb, var(--c, var(--muted)) 22%, transparent); }
.mo-tag.holiday { font-style: italic; }
.mo-line { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-due { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.mo-due.late { color: var(--bad); font-weight: 600; }
.mo-wk { display: flex; flex-direction: column; gap: .1rem; padding: .4rem .5rem; font-size: .75rem; color: var(--muted);
  background: color-mix(in srgb, var(--muted) 6%, transparent); }
.mo-wk b { color: var(--ink); font-size: .95rem; }
.mo-wk .bad { color: var(--bad); font-weight: 600; }
.forecast .fc-when { white-space: nowrap; font-size: .85rem; color: var(--muted); align-self: center; }
.forecast .fc-when.ok { color: var(--good, #16a34a); }
.forecast .fc-when.late { color: var(--bad); font-weight: 600; }
@media (max-width: 700px) {
  .mo-head, .mo-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .mo-wk, .mo-wk-h { display: none; }
  .mo-day { min-height: 3.4rem; padding: .25rem; }
  .mo-day .mo-tag, .mo-day .mo-line, .mo-day .mo-due { display: none; }
  .mo-day:has(.mo-due.late)::after { content: "⚑"; color: var(--bad); font-size: .8rem; }
}

/* Say or type what to add */
.capture { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin: 0 0 1rem; padding: .45rem .5rem .45rem .9rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; }
.capture textarea { flex: 1; min-width: 0; border: 0; background: transparent; padding: .55rem 0; font: inherit; font-size: .95rem;
  line-height: 1.4; resize: none; box-shadow: none; color: var(--ink); max-height: 260px; overflow-y: auto; }
.capture textarea:focus { outline: none; }
.capture-hint { flex-basis: 100%; margin: 0; font-size: .8rem; color: var(--muted); }
.capture-hint:empty { display: none; }
.capture:focus-within { border-color: var(--accent); }
.mic { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 999px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.mic.listening { background: #dc2626; color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
.mic .i-stop { display: none; }
.mic.listening .i-mic { display: none; }
.mic.listening .i-stop { display: block; }
.dictate { position: relative; }
.dictate textarea { padding-right: 3rem; }
.dictate-mic { position: absolute; right: .4rem; top: .4rem; width: 2.2rem; height: 2.2rem; }
.dictate-note { display: block; font-size: .8rem; color: var(--muted); }
.dictate-note:empty { display: none; }
.capture .btn { border-radius: 999px; }
.capture.sending { opacity: .7; }
.capture.mic-error .mic { background: var(--bad-bg); color: var(--bad); }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); } 50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); } }
@media (prefers-reduced-motion: reduce) { .mic.listening { animation: none; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.capture-note { overflow-wrap: anywhere; }
.btn.join { background: #16a34a; color: #fff; margin-top: .35rem; }
.join-link { color: #16a34a; font-weight: 600; }
.link-tools { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: -.3rem 0 .9rem; }
.invite-draft { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: -.3rem 0 .9rem; }

/* Holidays */
.holiday-note { background: color-mix(in srgb, var(--muted) 14%, transparent); border-radius: 10px; padding: .55rem .8rem; margin: .4rem 0 .8rem; }
.wk-pill.holiday { --c: var(--muted); font-style: italic; }
table.holidays { width: 100%; border-collapse: collapse; }
table.holidays td { padding: .4rem .3rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.holidays tr.past td { opacity: .55; }
table.holidays td.date { white-space: nowrap; width: 8.5rem; }
table.holidays td.act { text-align: right; width: 1%; white-space: nowrap; }
@media (min-width: 1100px) { .holidays-page { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 1.4rem; align-items: start; } }

/* Task files and actions */
.files { list-style: none; margin: 0 0 .7rem; padding: 0; }
.files li { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; border-bottom: 1px solid var(--line); }
.files li a { overflow-wrap: anywhere; }
button.inline-btn { display: inline; width: auto; padding: 0 .3rem; color: var(--muted); }
.task-actions { margin: .2rem 0 1rem; }
.task-actions form { margin: 0; }
.link-task select { width: auto; flex: 1; min-width: 12rem; }

/* Quick emails */
.email-actions { margin: .2rem 0 1rem; }
.draft-extras { background: var(--bg); border-radius: 10px; padding: .7rem .8rem; margin-bottom: .85rem; }
.ai-draft { background: color-mix(in srgb, #7c3aed 6%, var(--card)); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .85rem; }
.ai-draft summary { cursor: pointer; font-weight: 600; }
.ai-draft[open] summary { margin-bottom: .6rem; }
.sent-body { background: var(--bg); border-radius: 8px; padding: .5rem .7rem; margin-top: .3rem; color: var(--ink); }

/* Repeat */
.repeat { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-top: .7rem; margin-bottom: .85rem; }

/* Save and Cancel */
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .4rem; }
.back { margin: -.4rem 0 .4rem; }

/* Date and time side by side */
.dt-split { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem; gap: .4rem; }

/* All-day entries */
.pill.allday { background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--card)); color: var(--ink); font-weight: 600; }
.allday-banner { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; padding: .6rem .8rem; margin-bottom: .5rem;
  border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--c) 60%, var(--line));
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, var(--card)) 0 10px, var(--card) 10px 20px); }
.allday-banner .title { font-weight: 600; color: var(--ink); }
[hidden] { display: none !important; }

/* Working hours by day */
table.hours { border-collapse: collapse; margin-bottom: .4rem; }
table.hours td { padding: .25rem .4rem .25rem 0; vertical-align: middle; }
table.hours td:first-child { width: 5.5rem; }
table.hours select { width: 6.5rem; }

/* Week grid */
.wk-nav { gap: .6rem; }
.wk-key { margin-left: auto; }
.wk-key i { display: inline-block; width: .9rem; height: .7rem; border-radius: 3px; vertical-align: -1px; margin: 0 .25rem 0 .5rem; }
.key-work { background: color-mix(in srgb, var(--accent) 9%, var(--card)); border: 1px solid var(--line); }
.key-task { border: 1px dashed var(--muted); }
.wk { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 1rem; }
.wk-head, .wk-allday, .wk-body { display: grid; grid-template-columns: 3.2rem repeat(7, minmax(6.4rem, 1fr)); min-width: calc(3.2rem + 7 * 6.4rem); }
.wk-gutter { position: sticky; left: 0; z-index: 2; background: var(--card); border-right: 1px solid var(--line); }
.wk-head { border-bottom: 1px solid var(--line); }
.wk-day { padding: .45rem .4rem; text-align: center; color: var(--muted); font-size: .85rem; border-left: 1px solid var(--line); }
.wk-day b { color: var(--ink); font-size: 1rem; }
.wk-load { display: block; font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-plan { display: inline; margin: 0 0 0 auto; }
.wk-day.today { color: var(--accent); }
.wk-day.today b { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .4rem; }
.wk-allday { border-bottom: 1px solid var(--line); }
.wk-allday .wk-gutter { font-size: .7rem; padding: .3rem .2rem; text-align: right; }
.wk-cell { border-left: 1px solid var(--line); padding: .2rem; display: flex; flex-direction: column; gap: .15rem; min-height: 1.6rem; }
.wk-pill { display: block; font-size: .72rem; font-weight: 600; color: var(--ink); padding: .1rem .35rem; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 22%, var(--card)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-body { height: var(--grid); }
.wk-times { position: sticky; height: var(--grid); }
.wk-times span { position: absolute; right: .3rem; transform: translateY(-50%); font-size: .7rem; color: var(--muted); }
.wk-times span:first-child { transform: none; }
.wk-col { position: relative; height: var(--grid); border-left: 1px solid var(--line); cursor: copy; }
.wk-col.today { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.wk-work { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.wk-line { position: absolute; left: 0; right: 0; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.wk-box { position: absolute; box-sizing: border-box; padding: .15rem .3rem; font-size: .72rem; line-height: 1.25; overflow: hidden;
  border-radius: 6px; border: 1px solid var(--card); border-left: 3px solid var(--c); color: var(--ink); z-index: 1; }
.wk-box.event { background: color-mix(in srgb, var(--c) 26%, var(--card)); font-weight: 600; }
.wk-box.task { background: color-mix(in srgb, var(--c) 8%, transparent); border: 1px dashed color-mix(in srgb, var(--c) 70%, var(--line));
  border-left: 3px solid color-mix(in srgb, var(--c) 60%, transparent); color: var(--muted); }
.wk-box .t { font-weight: 400; color: var(--muted); }
.wk-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 2; }
.wk-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* Weekly allocation */
table.alloc { width: 100%; border-collapse: collapse; margin-bottom: .8rem; }
table.alloc td { padding: .5rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.alloc label { margin: 0; font-size: .95rem; }
table.alloc .swatch { background: var(--c); }
table.alloc .hours { text-align: right; white-space: nowrap; width: 7.5rem; }
table.alloc .hours input { width: 4.8rem; text-align: right; }
table.alloc tr.total td { border-bottom: 0; }
.alloc-bar { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.alloc-bar.over b { color: var(--warn); }
@media (max-width: 480px) { .grid2, .grid3 { grid-template-columns: 1fr; } .cards { grid-template-columns: 1fr; } }

/* Home layout. Phones: one column (cards, then deadlines and My day, then quick add). */
.home { display: flex; flex-direction: column; }
.home-main, .home-side { display: contents; }
.home .quick { order: 2; }

/* Wide screens: use the width. The tabs move into the top bar; the home page puts the assignment cards on the left
   and My day in a column on the right that stays in view while the cards scroll. */
@media (min-width: 1100px) {
  .page { padding-bottom: 2rem; }
  .page.wide { max-width: 1840px; padding-left: 24px; padding-right: 24px; }
  .top { padding-left: 24px; padding-right: 24px; }
  .tabs { top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); background: transparent;
    border-top: 0; padding-bottom: 0; z-index: 6; }
  .tabs a { flex: none; display: flex; align-items: center; gap: .4rem; padding: .85rem 1rem; font-size: .9rem; }
  .tabs a .i { display: inline; font-size: 1rem; line-height: 1; }
  .tabs a.on { box-shadow: inset 0 -2px 0 var(--accent); }
  .fab { bottom: 1.5rem; }
  .timerbar { top: 3.15rem; }

  .home { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 1.4rem; align-items: start; }
  .home-main, .home-side { display: block; }
  .home-side { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow-y: auto; overscroll-behavior: contain; }
  .home-side .myday { margin: 0; }
  .home .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (min-width: 1600px) {
  .home { grid-template-columns: minmax(0, 1fr) 460px; }
}


/* Sign-in pages (sign in, create an account, forgotten password): their own full-page layout, always light. A white
   card on indigo with rings; the form on the left, the assistant at work on the right. Tablets drop the picture;
   phones show the mascot on indigo and the form on a white sheet. */
.auth-page { color-scheme: light; margin: 0; min-height: 100vh; min-height: 100dvh; background: #4338ca; color: #111827;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative; overflow-x: hidden; }
.auth-rings { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.auth-page a { color: #4338ca; font-weight: 700; text-decoration: none; }
.auth-page a:hover { color: #312e81; }
.auth-hero { display: none; }
.auth-card { position: relative; width: min(1160px, calc(100% - 64px)); min-height: 620px; margin: 32px 0; background: #fff;
  border-radius: 28px; display: flex; overflow: hidden; box-shadow: 0 30px 80px rgba(17, 24, 39, .28); }
.auth-main { width: 520px; flex: none; box-sizing: border-box; padding: 56px 64px; display: flex; flex-direction: column;
  justify-content: center; gap: 24px; }
.auth-brand { display: inline-flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; color: #1e1b4b !important; }
.auth-brand img { border-radius: 9px; display: block; }
.auth-intro h1 { margin: 0; font-size: 36px; line-height: 1.15; font-weight: 800; color: #1e1b4b; }
.auth-lead { margin: 10px 0 0; font-size: 15px; line-height: 1.6; color: #4b5563; }
.narrow-only { display: none; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field { margin: 0; }
.auth-form label { font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 6px; }
.auth-form input[type=email], .auth-form input[type=password], .auth-form input[type=text] { width: 100%; height: 48px;
  box-sizing: border-box; border: 1.5px solid #e5e7eb; border-radius: 12px; padding: 0 14px; font: inherit; font-size: 15px;
  color: #111827; background: #fff; }
.auth-form input[type=email]:focus, .auth-form input[type=password]:focus, .auth-form input[type=text]:focus {
  outline: none; border-color: #6366f1; background: #f8f9ff; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.auth-form .helptext { display: block; margin-top: 6px; font-size: 12px; color: #6b7280; }
.auth-form .helptext ul { margin: 0; padding-left: 1rem; }
.auth-page .errorlist { color: #b91c1c; font-size: 13px; }
.auth-page .flash { background: #ecfdf5; color: #065f46; }
.auth-page .flash.error { background: #fef2f2; color: #991b1b; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.auth-row label.inline { margin: 0; font-weight: 500; color: #374151; min-height: 44px; }
.auth-row input[type=checkbox] { accent-color: #4338ca; width: 18px; height: 18px; }
.auth-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 50px; border: 0; border-radius: 12px;
  background: #4338ca; color: #fff !important; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.auth-btn:hover { background: #3730a3; }
.auth-foot { margin: 0; font-size: 14px; color: #4b5563; }
.auth-video { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 14px; border-radius: 12px; background: #eef0ff;
  color: #3730a3; font-size: 14px; font-weight: 600; text-decoration: none; }
.auth-video span { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  background: #fbbf24; color: #1e1b4b; font-size: 12px; }
.auth-video:hover { background: #e0e7ff; }
.auth-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

.auth-art { flex: 1; position: relative; min-height: 620px; background: #eef0ff; overflow: hidden; }
.auth-art-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art-mascot { position: absolute; left: 51.5%; top: 53%; transform: translate(-50%, -50%); }
.auth-art-mascot svg { display: block; }
.auth-float { position: absolute; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff;
  border-radius: 16px; box-shadow: 0 12px 30px rgba(67, 56, 202, .16); }
.auth-float b { display: block; font-size: 14px; color: #1e1b4b; }
.auth-float small { display: block; font-size: 12px; color: #6b7280; }
.auth-float.day { left: 9%; top: 70px; width: 250px; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 18px; }
.auth-float.day b { font-size: 15px; }
.auth-float .kicker { font-size: 12px; font-weight: 700; color: #6366f1; text-transform: uppercase; letter-spacing: .03em; }
.auth-float .bars { display: flex; gap: 4px; margin-top: 4px; }
.auth-float .bars i { display: block; height: 8px; border-radius: 4px; }
.auth-float.meeting { right: 6%; top: 210px; width: 230px; }
.auth-float.email { left: 11%; bottom: 70px; width: 260px; }
.auth-float .badge { width: 40px; height: 40px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.auth-float .badge.time { background: #fef3c7; color: #b45309; font-weight: 800; font-size: 13px; }
.auth-float .badge.mail { background: #e0e7ff; color: #4338ca; }
.auth-pill { position: absolute; right: 9%; bottom: 120px; display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-radius: 999px; background: #1e1b4b; color: #fff; font-size: 13px; font-weight: 700; }

@media (max-width: 1000px) {
  .auth-art { display: none; }
  .auth-card { width: min(560px, calc(100% - 32px)); min-height: 0; }
  .auth-main { width: 100%; padding: 48px 48px; }
}
@media (max-width: 600px) {
  .auth-page { justify-content: flex-start; }
  .auth-hero { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 24px 28px;
    padding-top: max(36px, env(safe-area-inset-top)); color: #fff; text-align: center; }
  .auth-hero p { margin: 0; }
  .auth-hero-title { font-size: 24px; font-weight: 800; line-height: 1.2; }
  .auth-hero-lead { font-size: 14px; color: #e0e7ff; }
  .auth-card { width: 100%; flex: 1; margin: 0; border-radius: 28px 28px 0 0; box-shadow: none; }
  .auth-main { justify-content: flex-start; padding: 28px 24px 40px; padding-bottom: max(40px, env(safe-area-inset-bottom)); gap: 18px; }
  .auth-brand, .wide-only { display: none; }
  .narrow-only { display: inline; }
  .auth-intro h1 { font-size: 22px; }
  .auth-pair { grid-template-columns: minmax(0, 1fr); }
  .auth-form input[type=email], .auth-form input[type=password], .auth-form input[type=text] { height: 50px; font-size: 16px; }
  .auth-btn { height: 52px; }
}

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1000; }

/* An assignment's side panel: its numbers, what comes next, what was finished. */
.side-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; text-align: center; margin-bottom: .7rem; }
.side-nums div { background: var(--bg); border-radius: 8px; padding: .45rem .2rem; }
.side-nums b { display: block; font-size: 1.1rem; }
.side-nums span { font-size: .72rem; color: var(--muted); }
.side-nums .bad b { color: var(--bad); }
.split-side .bar i { background: var(--c, var(--accent)); }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; flex-direction: column; gap: .1rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.side-list li:first-child { border-top: 0; padding-top: 0; }
.side-list li > a:first-child { font-weight: 600; }

/* What's new: the banner at the top of Home and the list page. */
.news { display: flex; gap: .8rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid #fbbf24; border-radius: 12px; padding: .75rem .9rem; margin-bottom: 1rem; }
.news-body { flex: 1; min-width: 0; }
.news-body p { margin: 0 0 .35rem; }
.news-tag { display: inline-block; background: #fbbf24; color: #1e1b4b; font-size: .7rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; padding: .15rem .5rem; border-radius: 999px; flex: none; margin-top: .1rem; }
.news-close { background: none; border: 0; color: var(--muted); font-size: 1rem; cursor: pointer; padding: .2rem .4rem; min-width: 44px; min-height: 44px; margin: -.6rem -.6rem 0 0; }
.news-close:hover { color: var(--ink); }

/* The bell: notifications kept until read. */
.bell { position: relative; display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 999px; color: var(--muted); }
.bell:hover, .bell.has { color: var(--ink); }
.bell-count { position: absolute; top: .1rem; right: .05rem; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: .68rem; font-weight: 800; line-height: 1.15rem; text-align: center; box-sizing: border-box; }
.menu-count { display: inline-block; min-width: 1.2rem; padding: 0 .35rem; border-radius: 999px; background: #ef4444; color: #fff;
  font-size: .7rem; font-weight: 800; text-align: center; margin-left: .3rem; }
.alerts .row { align-items: flex-start; }
.alerts .row .body { display: flex; flex-direction: column; gap: .15rem; color: inherit; text-decoration: none; }
.alerts .row .title { font-weight: 500; }
.alerts .row.unread .title { font-weight: 800; }
.alert-dot { flex: none; width: .55rem; height: .55rem; border-radius: 999px; margin-top: .45rem; background: transparent; }
.alerts .row.unread .alert-dot { background: var(--accent); }
.titlebar form .btn { white-space: nowrap; }

/* AI costs */
.cost-stats { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .cost-stats { grid-template-columns: repeat(2, 1fr); } }
.table-wrap { overflow-x: auto; }
.cost-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.cost-table th, .cost-table td { padding: .5rem .45rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.cost-table thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .78rem; }
.cost-table .num { text-align: right; white-space: nowrap; }

/* Reschedule */
.shortcuts { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.shortcuts .btn.on { border-color: var(--accent); color: var(--accent); }
/* Pictures on a task: pasted ones before saving, kept ones after */
.file-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); vertical-align: middle; }
.files.pasted:empty { display: none; }
.files.pasted li { display: flex; align-items: center; gap: .4rem; margin: .3rem 0; }
