:root {
  --bg: #ffffff;
  --side: #fafafa;
  --surface: #f5f5f5;
  --raised: #f5f5f5;
  --hover: #e5e5e5;
  --chip: #ffffff;
  --panel: #ffffff;
  --fg: #0a0a0a;
  --text: #404040;
  --muted: #6b6b6b;
  --faint: #a3a3a3;
  --line: #e5e5e5;
  --accent: #0a0a0a;
  --accent-fg: #ffffff;
  --bubble: #f5f5f5;
  --bubble-fg: #0a0a0a;
  --band-bg: #fffbeb;
  --band-fg: #92400e;
  --alert: #dc2626;
  --focus: #3b82f6;
  --ring: #0000001a;
  --shadow: #00000040;
  --scrim: #00000033;
  color-scheme: light dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171717;
    --side: #121212;
    --surface: #262626;
    --raised: #262626;
    --hover: #404040;
    --chip: #404040;
    --panel: #262626;
    --fg: #fafafa;
    --text: #d4d4d4;
    --muted: #a3a3a3;
    --faint: #737373;
    --line: #333333;
    --accent: #fafafa;
    --accent-fg: #0a0a0a;
    --bubble: #404040;
    --bubble-fg: #ffffff;
    --band-bg: #451a03;
    --band-fg: #fcd34d;
    --alert: #f87171;
    --focus: #60a5fa;
    --ring: #ffffff1a;
    --shadow: #00000080;
    --scrim: #00000080;
  }
}

:root[data-theme="dark"] {
  --bg: #171717;
  --side: #121212;
  --surface: #262626;
  --raised: #262626;
  --hover: #404040;
  --chip: #404040;
  --panel: #262626;
  --fg: #fafafa;
  --text: #d4d4d4;
  --muted: #a3a3a3;
  --faint: #737373;
  --line: #333333;
  --accent: #fafafa;
  --accent-fg: #0a0a0a;
  --bubble: #404040;
  --bubble-fg: #ffffff;
  --band-bg: #451a03;
  --band-fg: #fcd34d;
  --alert: #f87171;
  --focus: #60a5fa;
  --ring: #ffffff1a;
  --shadow: #00000080;
  --scrim: #00000080;
}

[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
:root[data-size="s"] { font-size: 15px; }
:root[data-size="m"] { font-size: 17px; }
:root[data-size="l"] { font-size: 20px; }
:root[data-size="xl"] { font-size: 23px; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
p { margin: .75rem 0; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .5rem 1.25rem;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--raised);
  color: var(--fg);
  font: inherit;
  font-size: .875rem;
  font-weight: 400;
  line-height: 1.25;
  cursor: pointer;
  max-width: 100%;
  transition: background-color .15s;
}
button[disabled] { opacity: .4; cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.primary { max-width: 15rem; background: var(--accent); color: var(--accent-fg); }
.danger { color: var(--alert); }
[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.inline {
  min-height: 0;
  padding: 0;
  border-radius: .2rem;
  background: transparent;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  flex: none;
}
svg.ic { width: 1.25rem; height: 1.25rem; flex: none; display: block; stroke-width: 1.75; }
.icon svg.ic { width: 1.25rem; height: 1.25rem; }
header h1, .welcome h1, .gate h1, .sheet h2, .brand {
  font-family: "SF Pro Rounded", ui-rounded, ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-weight: 500;
}
.block { display: flex; width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.card {
  background: var(--raised);
  border: 0;
  border-radius: 1rem;
  padding: .75rem 1rem;
  margin: .75rem auto;
  width: calc(100% - max(.75rem, env(safe-area-inset-right)) - max(.75rem, env(safe-area-inset-left)));
  max-width: 40rem;
  box-shadow: none;
}
.list h2, .card h2, .sheet h3 { font-size: .75rem; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
.card h2 { margin: .5rem 0 .25rem; }
.card p { font-size: .875rem; color: var(--muted); }
.card button { min-height: 2.25rem; padding: 0 1rem; background: var(--chip); font-size: .875rem; }
.card .primary, .card [aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.card .inline { min-height: 0; padding: 0; background: transparent; }
.banners { display: flex; flex-direction: column; gap: .5rem; }
.banners > p { margin: 0; }
.banners > button { align-self: flex-end; }
.notice.card { font-size: .875rem; }
.band {
  margin: .5rem max(1rem, env(safe-area-inset-right)) .5rem max(1rem, env(safe-area-inset-left));
  padding: .5rem .875rem;
  border-radius: .75rem;
  background: var(--band-bg);
  color: var(--band-fg);
  font-size: .875rem;
}
[role="alert"] { color: var(--alert); }
.loading { text-align: center; color: var(--muted); margin: 40vh 0 0; margin: 40dvh 0 0; }
.reload { text-align: center; visibility: hidden; animation: reveal 0.2s 8s forwards; }
@keyframes reveal { to { visibility: visible; } }
.reload a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .5rem 1.25rem;
  border-radius: 999px;
  background: var(--raised);
  font-size: .875rem;
  font-weight: 400;
  text-decoration: none;
}
noscript { display: block; padding: 1rem; }

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .25rem;
  min-height: 3.25rem;
  padding: max(.25rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right)) .25rem max(.5rem, env(safe-area-inset-left));
  background: var(--bg);
  border: 0;
  box-shadow: none;
  flex: none;
}
header h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 .5rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list { min-width: 0; margin: 0; padding: 0 max(.75rem, env(safe-area-inset-right)) 0 max(.75rem, env(safe-area-inset-left)); }
.list h2 { margin: 1rem 0 .125rem; padding: .25rem .5rem; }
.list ul { list-style: none; padding: 0; margin: 0; }
.list li { margin: .125rem 0 0; }
.list p { margin: .25rem 0; padding: .25rem .5rem; font-size: .8125rem; color: var(--muted); }
.list p[role="alert"] { color: var(--alert); }
.row {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  justify-content: flex-start;
  gap: .75rem;
  min-height: 2.75rem;
  padding: .5rem;
  border-radius: .5rem;
  background: transparent;
  color: var(--text);
  font-size: .9375rem;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Plain-text rows need a block formatting context for ellipsis. */
.row:not(:has(> svg)) { display: block; }
.row svg.ic { width: 1.25rem; height: 1.25rem; }
.row[aria-current="page"] { background: var(--raised); color: var(--fg); }

.thread {
  flex: 1 0 auto;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: .5rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
}
.msg { margin: 2rem 0 0; }
.msg.cont { margin-top: .5rem; }
.msg p { margin: .25rem 0; }
.msg.mine { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; max-width: min(28rem, 85%); }
.msg.mine > p:first-child {
  margin: 0;
  padding: .5rem 1rem;
  border-radius: 1.5rem;
  background: var(--bubble);
  color: var(--bubble-fg);
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg.mine > p:first-child:empty { display: none; }
.msg.bot { width: 100%; }
.msg.bot .md { color: var(--text); font-size: 1rem; line-height: 1.75; }
.msg.notice { color: var(--muted); font-size: .875rem; }
.divider { display: flex; align-items: center; gap: .75rem; margin: 2rem 0 .5rem; color: var(--muted); font-size: .75rem; text-align: center; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.msg .status { font-size: .8125rem; color: var(--muted); margin: .25rem .25rem 0; }
.msg .status.failed { color: var(--alert); }
.file { background: var(--raised); border-radius: 1rem; padding: .75rem; margin: .5rem 0 0; max-width: 22rem; }
.file > p:first-child { font-size: .875rem; font-weight: 500; color: var(--fg); margin: 0 0 .5rem; }
.file img, .file video { display: block; max-width: 100%; max-height: 30rem; border-radius: .75rem; }
.file a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .5rem 1.25rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--fg);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 400;
}
.file button { background: var(--chip); }
.files { color: var(--muted); font-size: .875rem; }
.taskprogress { min-width: 0; padding: 1rem; border-radius: 1rem; background: var(--raised); color: var(--text); }
.taskprogress .tasktitle { color: var(--fg); font-size: 1rem; font-weight: 600; }
.taskprogress .activity, .tasknotes { color: var(--muted); font-size: .875rem; }
.taskprogress .actions { margin-top: .75rem; }
.taskprogress button { background: var(--chip); }
.plan { list-style: none; margin: .75rem 0; padding: 0; }
.plan li { display: flex; align-items: flex-start; gap: .5rem; margin: .5rem 0; min-width: 0; }
.plan li > span, .plan li > strong { min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.plan svg.ic { width: 1rem; height: 1rem; margin-top: .25em; }
.plan .completed { color: var(--muted); }
.plan .inprogress { color: var(--accent); }
.plan .pending svg.ic { color: var(--muted); }
.taskfooter { margin-top: 1rem; padding-top: .5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }
.taskfooter summary { min-height: 2.75rem; padding: .625rem 0; cursor: pointer; }
.taskfooter .plan { font-size: .875rem; }
.taskfooter button { margin-top: .5rem; }
.workspacefiles { list-style: none; margin: 1rem 0; padding: 0; }
.workspacefiles li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .75rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.workspacefiles p { min-width: 0; margin: 0; }
.workspacefiles .path { overflow-wrap: anywhere; word-break: normal; }
.workspacefiles .folder, .workspacehint, .filemeta, .filestatus { color: var(--muted); font-size: .8125rem; }
.workspacefiles strong { color: var(--fg); font-weight: 600; }
.workspacefiles button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.workspacefiles .filestatus { grid-column: 1 / -1; margin-top: .5rem; }
.empty { text-align: center; color: var(--muted); margin: 30vh 0 0; margin: 30dvh 0 0; font-size: .875rem; }
.thread.fresh { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1 0 auto; padding-bottom: 1.5rem; }
.thread.fresh .empty { margin: .75rem 0 0; }

.commands {
  flex: none;
  width: 100%;
  max-width: 49.5rem;
  margin: 0 auto;
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .25rem max(.75rem, env(safe-area-inset-right)) .5rem max(.75rem, env(safe-area-inset-left));
  scrollbar-width: none;
}
.commands::-webkit-scrollbar { display: none; }
.commands > button:not(.scrim) {
  flex: none;
  min-height: 2.25rem;
  padding: 0 .875rem;
  border-radius: 999px;
  background: var(--raised);
  box-shadow: none;
  color: var(--text);
  font-size: .875rem;
  font-weight: 400;
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: var(--scrim);
  color: transparent;
  font-size: 0;
}
.sheet {
  --raised: var(--bubble);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  max-height: 75vh;
  max-height: 75dvh;
  overflow-y: auto;
  margin: 0;
  padding: .75rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: var(--panel);
  border-radius: 1rem 1rem 0 0;
  box-shadow: 0 0 0 1px var(--ring), 0 1.5rem 3rem -.75rem var(--shadow);
  animation: sheet .2s ease-out;
}
.sheet::before { display: block; content: ""; width: 2.25rem; height: .25rem; margin: 0 auto .75rem; border-radius: 999px; background: var(--line); }
.sheet h2 { font-size: 1.125rem; font-weight: 500; color: var(--fg); margin: 0 .5rem .5rem; }
.sheet h3 { margin: 1rem .5rem .25rem; }
.sheet .block { margin-top: .75rem; }
@keyframes sheet { from { transform: translateY(1.5rem); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.composer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  flex: none;
  background: linear-gradient(to bottom, transparent, var(--bg) 1rem);
  padding: 1rem max(.75rem, env(safe-area-inset-right)) max(.75rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
  border: 0;
  box-shadow: none;
}
.composer.fresh { flex: 1 0 auto; position: static; }
.pill {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 1.5rem;
  padding: .75rem 0 .5rem;
  min-height: 5.5rem;
  box-shadow: none;
  border: 0;
}
.composer textarea {
  display: block;
  width: 100%;
  min-height: 2rem;
  max-height: 40vh;
  max-height: 40dvh;
  field-sizing: content;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5rem;
  padding: .25rem 1.25rem;
}
.composer textarea::placeholder { color: var(--faint); }
.composer textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 1.25rem; }
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; padding: .5rem .75rem 0; }
.tasktoggle { min-width: 0; min-height: 2.25rem; padding: .5rem .75rem; gap: .375rem; background: var(--chip); color: var(--muted); font-size: .8125rem; }
.tasktoggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.tasktoggle svg.ic { width: 1.125rem; height: 1.125rem; }
.taskhint { max-width: 48rem; margin: .5rem auto 0; color: var(--muted); font-size: .75rem; }
.attach { position: relative; width: 2.25rem; height: 2.25rem; min-height: 2.25rem; border-radius: 999px; background: var(--chip); color: var(--muted); cursor: pointer; }
.attach svg.ic { width: 1.125rem; height: 1.125rem; stroke-width: 2; }
.attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attach:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.send { margin-left: 0; width: 2.25rem; height: 2.25rem; min-height: 2.25rem; padding: 0; border-radius: 999px; background: var(--accent); color: var(--accent-fg); }
.send svg.ic { width: 1rem; height: 1rem; stroke-width: 2.5; }
.send[disabled] { opacity: .12; }
.chips { display: flex; flex-wrap: nowrap; gap: .5rem; overflow-x: auto; padding: 0 .75rem .75rem; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: .5rem; flex: none; padding: .375rem .375rem .375rem .75rem; border-radius: .5rem; background: var(--chip); color: var(--text); font-size: .875rem; }
.chip .icon { width: 2rem; height: 2rem; min-height: 2rem; border-radius: 999px; background: transparent; color: var(--muted); }
.count { margin: .375rem 0 0; text-align: center; font-size: .75rem; color: var(--muted); }

.card ul { list-style: none; padding: 0; margin: 0; }
.card li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3rem; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.card li:first-child { border-top: 0; }
.devices li > span { color: var(--fg); font-weight: 500; }
.devices .danger { flex: none; }
.part { white-space: nowrap; }
.seg { display: flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border-radius: 1.6rem; background: var(--chip); }
.seg button { flex: 1 0 auto; min-height: 2.25rem; padding: .375rem .875rem; border-radius: 999px; background: transparent; color: var(--text); font-size: .875rem; white-space: nowrap; }
.seg [aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
button.block[data-action="logout"] {
  margin: 1.5rem auto 2rem;
  width: calc(100% - max(.75rem, env(safe-area-inset-right)) - max(.75rem, env(safe-area-inset-left)));
  max-width: 40rem;
  background: var(--raised);
}
/* Keep destructive text above 4.5:1 on raised and chip fills. */
.card .danger, button.block[data-action="logout"] { color: color-mix(in srgb, var(--alert) 80%, var(--fg)); }

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem max(1.5rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  text-align: center;
}
.gate h1 { margin: .5rem 0 0; font-size: 1.5rem; font-weight: 500; line-height: 2rem; }
.gate p { margin: .75rem 0 0; max-width: 24rem; font-size: .875rem; line-height: 1.5rem; color: var(--muted); }
.gate p[role="alert"] { color: var(--alert); }
.gate .band { padding: .5rem .875rem; background: var(--band-bg); color: var(--band-fg); }
.logo { display: flex; align-items: center; justify-content: center; background: transparent; color: var(--fg); flex: none; }
.logo svg.ic { width: 3.5rem; height: 3.5rem; }
.gate .primary.block, .gate .secondary.block { width: 100%; max-width: 15rem; min-height: 2.75rem; font-size: .875rem; font-weight: 400; margin: 1.5rem auto 0; }
.gate .secondary.block { background: var(--bg); color: var(--fg); border: 1px solid var(--fg); margin: .75rem auto 0; }
.gate p.hint { font-size: .75rem; color: var(--muted); text-align: center; margin-top: .375rem; }
.gate p.url { display: block; width: 100%; max-width: 20.625rem; min-height: 3rem; line-height: 3rem; padding: 0 1rem; border-radius: 999px; background: var(--raised); color: var(--fg); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: all; }
.gate > a { display: inline-flex; align-items: center; min-height: 2.6rem; margin-top: .75rem; padding: 0 .75rem; background: transparent; color: var(--text); font-size: .875rem; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.gate ol { width: 100%; margin: .75rem 0 0; padding: 1rem 1rem 1rem 2.25rem; background: var(--raised); border-radius: 1rem; text-align: left; font-size: .875rem; }
.gate li { margin: .375rem 0; }
.spinner { width: 1.75rem; height: 1.75rem; border-radius: 50%; border: .1875rem solid var(--line); border-top-color: var(--fg); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.md { min-width: 0; }
.md p { margin: 0 0 1.25em; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { color: var(--fg); font-weight: 600; line-height: 1.4; margin: 1.5em 0 .5em; }
.md h1 { font-size: 1.25em; }
.md h2 { font-size: 1.125em; }
.md h3, .md h4, .md h5, .md h6 { font-size: 1em; }
.md strong, .md b { color: var(--fg); font-weight: 600; }
.md ul, .md ol { margin: 0 0 1.25em; padding-left: 1.625em; }
.md li { margin: .5em 0; }
.md li::marker { color: var(--text); }
.md pre, .md .table { max-width: 100%; overflow-x: auto; }
.md pre { padding: 1rem; margin: 1.5rem 0; border-radius: 1rem; background: var(--raised); font-size: .875rem; line-height: 1.6; white-space: pre; word-break: normal; overflow-wrap: normal; }
.md code { padding: .125rem .375rem; border-radius: .375rem; background: var(--raised); font-family: ui-monospace, monospace; font-size: .9em; }
.md pre code { padding: 0; border-radius: 0; background: transparent; font-size: inherit; }
.md .table { border: 1px solid var(--line); border-radius: .5rem; margin: 1.5rem 0; }
.md table { width: 100%; border-collapse: collapse; }
.md th, .md td { min-width: 5rem; padding: .5rem .75rem; border-right: 1px solid var(--line); overflow-wrap: normal; }
.md th:last-child, .md td:last-child { border-right: 0; }
.md tr { border-bottom: 1px solid var(--line); }
.md tbody tr:last-child { border-bottom: 0; }
.md th { color: var(--fg); font-weight: 600; text-align: left; }
.md blockquote { margin: 0 0 1.25em; padding-left: 1em; border-left: .25rem solid var(--line); color: var(--muted); }
.md a { color: var(--fg); text-decoration: underline; text-underline-offset: .2em; }
.md hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }

@media (hover: hover) {
  button:enabled:hover, .reload a:hover, .file a:hover, .attach:hover { background: var(--hover); }
  .card button:enabled:hover, .seg button:enabled:hover,
  .commands > button:not(.scrim):enabled:hover, .start:enabled:hover { background: var(--hover); }
  .row:enabled:hover, .icon:enabled:hover { background: var(--raised); }
  .primary:enabled:hover, .card .primary:enabled:hover, .send:enabled:hover,
  button[aria-pressed="true"]:enabled:hover { background: var(--accent); color: var(--accent-fg); opacity: .88; }
  .inline:enabled:hover, .card .inline:enabled:hover, .gate > a:hover { background: transparent; }
  .scrim:enabled:hover { background: var(--scrim); }
}

@media (pointer: fine) {
  .icon { width: 2.25rem; height: 2.25rem; min-height: 2.25rem; }
  .row { min-height: 2.25rem; font-size: .875rem; }
}

@media (pointer: coarse) {
  .attach, .send { width: 2.6rem; height: 2.6rem; min-height: 2.6rem; }
  .tasktoggle { min-height: 2.6rem; }
  .card button, .seg button, .commands > button:not(.scrim) { min-height: 2.6rem; }
  .card .inline { min-height: 0; }
}

@media (min-width: 900px) {
  .side {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 16rem;
    overflow-y: auto;
    background: var(--side);
    padding: 0 1rem 1rem;
    box-shadow: inset -1px 0 0 var(--line);
    scrollbar-width: thin;
  }
  .side .top { height: 3.25rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .5rem; }
  .brand { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 500; font-size: 1rem; }
  .brand svg.ic { width: 1.25rem; height: 1.25rem; color: var(--fg); }
  .side .list { padding: 0; }
  .pane { display: flex; flex-direction: column; margin-left: 16rem; min-width: 0; min-height: 100vh; min-height: 100dvh; }
  .pane header { padding: .25rem 1rem; }
  .pane > .card, .pane > button.block[data-action="logout"] { width: calc(100% - 3rem); }
  .thread { padding-left: max(1.5rem, env(safe-area-inset-left)); padding-right: max(1.5rem, env(safe-area-inset-right)); }
  .welcome {
    flex: 1 0 auto;
    min-height: calc(100vh - 2rem);
    min-height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 1.5rem 20vh;
    text-align: center;
  }
  .welcome h1 { margin: 0; font-size: 1.5rem; font-weight: 500; }
  .starts { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
  .start { min-height: 2.75rem; padding: 0 1.25rem; background: var(--raised); font-size: .875rem; font-weight: 400; }
  .start svg.ic { width: 1.125rem; height: 1.125rem; }
  .sheet {
    left: calc(50% + 8rem);
    right: auto;
    bottom: 50%;
    width: min(28rem, calc(100vw - 18rem));
    max-width: 28rem;
    transform: translate(-50%, 50%);
    border-radius: 1rem;
    max-height: 80vh;
    max-height: 80dvh;
    animation: panel .2s ease-out;
  }
  .sheet::before { display: none; }
  @keyframes panel { from { opacity: 0; transform: translate(-50%, calc(50% + .5rem)); } to { opacity: 1; transform: translate(-50%, 50%); } }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  .sheet, .spinner { animation: none; }
}
