:root {
  --display: "Gabarito", "Hanken Grotesk", system-ui, sans-serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-size: 15px;
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --ease: cubic-bezier(.2, .75, .25, 1);
  --spring: cubic-bezier(.34, 1.3, .4, 1);
  --fast: 130ms;
  --med: 240ms;
  --slow: 380ms;
  --bar-h: 58px;
  --dock-h: 66px;
  --ok: #1e9e5a;
  --warn: #e38a00;
  --danger: #e5484d;
  --s-red: #e5484d;
  --s-orange: #f2743a;
  --s-yellow: #d9a400;
  --s-green: #22a06b;
  --s-teal: #12a594;
  --s-sky: #0ea5e9;
  --s-blue: #2f6bff;
  --s-pink: #d6479a;
  --s-brown: #a0623c;
  --s-slate: #64748b;
}

[data-theme="light"] {
  color-scheme: light;
  --canvas: #eceef3;
  --panel: #ffffff;
  --panel-2: #f5f6f9;
  --inset: #eaecf1;
  --ink: #141821;
  --ink-2: #586071;
  --ink-3: #8a93a6;
  --line: #e2e5ec;
  --line-2: #cdd2dc;
  --hover: rgba(20, 24, 33, .05);
  --press: rgba(20, 24, 33, .09);
  --scrim: rgba(20, 24, 33, .45);
  --accent: #f5b301;
  --accent-text: #8f6100;
  --accent-soft: #fff1c2;
  --accent-ink: #141821;
  --primary: #141821;
  --primary-ink: #ffffff;
  --shadow-1: 0 1px 2px rgba(20, 24, 33, .05), 0 6px 20px -12px rgba(20, 24, 33, .18);
  --shadow-2: 0 2px 6px rgba(20, 24, 33, .06), 0 18px 40px -16px rgba(20, 24, 33, .26);
  --shadow-3: 0 24px 60px -20px rgba(20, 24, 33, .4), 0 4px 12px rgba(20, 24, 33, .08);
  --sub-mix: black;
  --sub-mix-amt: 74%;
}

[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0e1016;
  --panel: #171a22;
  --panel-2: #1d212b;
  --inset: #12151c;
  --ink: #eef0f4;
  --ink-2: #a5acbb;
  --ink-3: #6f7789;
  --line: #262b36;
  --line-2: #363c49;
  --hover: rgba(238, 240, 244, .06);
  --press: rgba(238, 240, 244, .1);
  --scrim: rgba(0, 0, 0, .6);
  --accent: #ffc533;
  --accent-text: #ffd466;
  --accent-soft: rgba(255, 197, 51, .14);
  --accent-ink: #141821;
  --primary: #eef0f4;
  --primary-ink: #141821;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px -12px rgba(0, 0, 0, .5);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 40px -16px rgba(0, 0, 0, .6);
  --shadow-3: 0 24px 60px -20px rgba(0, 0, 0, .75), 0 4px 12px rgba(0, 0, 0, .35);
  --sub-mix: white;
  --sub-mix-amt: 70%;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--body);
  font-size: var(--text-size);
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, .display { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; line-height: 1.12; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { background: var(--accent-soft); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ib {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: var(--ink-2);
  flex: 0 0 auto;
  transition: background var(--fast), color var(--fast), transform var(--fast);
}
.ib:hover { background: var(--hover); color: var(--ink); }
.ib:active { background: var(--press); transform: scale(.96); }
.ib svg { width: 18px; height: 18px; }
.ib.sm { width: 30px; height: 30px; border-radius: 8px; }
.ib.sm svg { width: 15px; height: 15px; }
.ib.on { color: var(--accent-text); background: var(--accent-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--fast), color var(--fast), border-color var(--fast), transform var(--fast), box-shadow var(--fast);
}
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .45); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.04); }
.btn-soft { background: var(--panel-2); color: var(--ink); border-color: var(--line); }
.btn-soft:hover { background: var(--inset); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: color-mix(in oklab, var(--danger) 12%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: default; }

.field { display: grid; gap: 6px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.input, .select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.input::placeholder { color: var(--ink-3); }
.input:focus-visible, .select:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 44px; line-height: 1.45; }
.input.quiet { background: var(--panel-2); border-color: transparent; }
.input.quiet:hover { border-color: var(--line-2); }

.switch { position: relative; width: 42px; height: 26px; border-radius: 13px; background: var(--line-2); transition: background var(--fast); flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform var(--fast) var(--ease); }
input:checked + .switch { background: var(--ok); }
input:checked + .switch::after { transform: translateX(16px); }
.row-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; }
.row-toggle + .row-toggle { border-top: 1px solid var(--line); }
.row-toggle .t { display: grid; gap: 2px; }
.row-toggle .t small { font-size: 13px; color: var(--ink-3); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--inset); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { height: 32px; border-radius: 999px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); transition: background var(--fast), color var(--fast), box-shadow var(--fast); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; }
.chip svg { width: 12px; height: 12px; }
.sub { --sc: var(--s-slate); background: color-mix(in oklab, var(--sc) 14%, transparent); color: color-mix(in oklab, var(--sc) var(--sub-mix-amt), var(--sub-mix)); }
.sub::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sc); flex: 0 0 auto; }
.sub.plain { background: none; padding: 0; }
.cat { --cc: var(--ink-3); background: color-mix(in oklab, var(--cc) 14%, transparent); color: color-mix(in oklab, var(--cc) var(--sub-mix-amt), var(--sub-mix)); }
[data-cat="homework"] { --cc: var(--s-yellow); }
[data-cat="assessment"] { --cc: var(--s-red); }
[data-cat="announcement"] { --cc: var(--s-blue); }
[data-cat="resource"] { --cc: var(--s-green); }
[data-cat="livelecture"] { --cc: var(--s-orange); }
[data-cat="activity"] { --cc: var(--s-pink); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--primary); color: var(--primary-ink); }
.count.soft { background: var(--inset); color: var(--ink-2); }
.count.acc { background: var(--accent); color: var(--accent-ink); }
.count:empty { display: none; }

.card { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow-1); border: 1px solid var(--line); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 18px; }
.card-head .right { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.card-title-link { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.card-title-link:hover { color: var(--ink); }

.menu { position: absolute; z-index: 60; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px; box-shadow: var(--shadow-3); animation: pop var(--fast) var(--ease); display: grid; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink); text-align: left; width: 100%; white-space: nowrap; }
.menu-item svg { width: 15px; height: 15px; color: var(--ink-2); flex: 0 0 auto; }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-item .kbd { margin-left: auto; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-label { font-size: 11.5px; font-weight: 700; color: var(--ink-3); padding: 8px 10px 4px; }

.kbd { font: 600 11.5px var(--body); min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--inset); border: 1px solid var(--line-2); display: inline-grid; place-items: center; color: var(--ink-2); }

.empty { padding: 40px 24px; text-align: center; display: grid; gap: 8px; justify-items: center; color: var(--ink-2); }
.empty .art { width: 56px; height: 56px; border-radius: 18px; background: var(--panel-2); display: grid; place-items: center; color: var(--ink-3); margin-bottom: 6px; }
.empty .art svg { width: 26px; height: 26px; }
.empty h3 { font-size: 18px; color: var(--ink); }
.empty p { max-width: 38ch; font-size: 14px; }
.empty .btn { margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; padding: 11px 16px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-3); animation: drop var(--med) var(--spring); max-width: calc(100% - 32px); display: flex; align-items: center; gap: 14px; }
.toast-action { color: var(--accent); font-weight: 800; white-space: nowrap; }
.toast-action:hover { text-decoration: underline; text-underline-offset: 3px; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, 10px); } }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; opacity: 0; pointer-events: none; transition: opacity var(--med); }
body.has-scrim .scrim { opacity: 1; pointer-events: all; }

.sheet { position: fixed; top: var(--bar-h); right: 0; bottom: 0; width: min(440px, 100%); background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; transform: translateX(104%); transition: transform var(--slow) var(--ease), visibility 0s linear var(--slow); z-index: 55; visibility: hidden; box-shadow: var(--shadow-3); }
.sheet.open { transform: none; visibility: visible; transition: transform var(--slow) var(--ease); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 18px; }
.sheet-head .sub-t { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.sheet-head .right { margin-left: auto; display: flex; gap: 2px; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; padding: 18px 20px 24px; min-height: 0; }
.grab { display: none; }

.dialog { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity var(--fast); }
.dialog.open { opacity: 1; pointer-events: all; }
.dialog-box { width: min(560px, 100%); max-height: min(86dvh, 760px); background: var(--panel); border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: var(--shadow-3); display: flex; flex-direction: column; transform: translateY(10px) scale(.98); transition: transform var(--med) var(--spring); overflow: hidden; }
.dialog.open .dialog-box { transform: none; }
.dialog .sheet-body { padding: 8px 22px 22px; }

.skeleton { border-radius: var(--r-md); background: linear-gradient(100deg, var(--panel) 30%, var(--hover) 50%, var(--panel) 70%); background-size: 300% 100%; animation: shimmer 1.3s infinite linear; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -300% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }

.check { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2); display: grid; place-items: center; color: #fff; flex: 0 0 auto; transition: background var(--fast), border-color var(--fast), transform var(--fast); cursor: pointer; }
.check svg { width: 13px; height: 13px; opacity: 0; }
.check:hover { border-color: var(--ink-3); }
.check.on { background: var(--ok); border-color: var(--ok); }
.check.on svg { opacity: 1; }
.check.on:active { transform: scale(.9); }

.prose { line-height: 1.6; overflow-wrap: anywhere; }
.prose p { margin: 0 0 .7em; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: .3em 0 .8em; padding-left: 1.4em; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: .6em 0; }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.prose table { border-collapse: collapse; max-width: 100%; font-size: .93em; }
.prose td, .prose th { border: 1px solid var(--line-2); padding: 4px 8px; }
.prose blockquote { margin: .6em 0; padding: .2em 0 .2em 1em; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.prose code { font-family: var(--mono); font-size: .92em; background: var(--inset); padding: 1px 5px; border-radius: 5px; }
.prose pre { background: var(--inset); padding: 12px 14px; border-radius: 10px; overflow: auto; font-family: var(--mono); font-size: .9em; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line-2); margin: 1em 0; }
.prose h1 { font-size: 1.7em; margin: .9em 0 .35em; }
.prose h2 { font-size: 1.35em; margin: .9em 0 .35em; }
.prose h3 { font-size: 1.12em; margin: .8em 0 .3em; }
.prose mark { background: var(--accent-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
.prose .todo { display: flex; align-items: flex-start; gap: 8px; margin: .2em 0; }
.prose .todo::before { content: ""; width: 16px; height: 16px; margin-top: 3px; border-radius: 5px; border: 2px solid var(--line-2); flex: 0 0 auto; cursor: pointer; }
.prose .todo[data-done="1"] { color: var(--ink-3); text-decoration: line-through; }
.prose .todo[data-done="1"]::before { background: var(--ok); border-color: var(--ok); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 7'/%3E%3C/svg%3E"); background-size: 12px; background-position: center; background-repeat: no-repeat; }

@media (max-width: 880px) {
  .sheet { top: auto; left: 0; right: 0; width: 100%; height: min(90dvh, 780px); border-left: 0; border-top: 1px solid var(--line); border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(104%); }
  .grab { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 10px auto -4px; }
  .sheet-head { padding-top: 12px; }
  .dialog { padding: 0; align-items: end; }
  .dialog-box { width: 100%; max-height: 90dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 0; }
  .toast { bottom: calc(var(--dock-h) + 16px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
