:root {
  --bg: #070908;
  --bg-2: #0c100d;
  --sidebar: #080b09;
  --surface: #101612;
  --surface-2: #162018;
  --line: rgba(80, 255, 140, 0.14);
  --text: #d7f5df;
  --muted: #7f9a86;
  --faint: #4f6656;
  --accent: #2ee86a;
  --accent-2: #7dffa8;
  --gold: #d6c07a;
  --rose: #ff6b6b;
  --user: #12351c;
  --shadow: 0 0 0 1px rgba(46, 232, 106, 0.08), 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --sans: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --mono: "Cascadia Code", "SF Mono", "Consolas", "Liberation Mono", ui-monospace, monospace;
  --font-scale: 1;
  color-scheme: dark;
}

[data-theme="dusk"] {
  --bg: #100c07;
  --bg-2: #18110a;
  --sidebar: #120d08;
  --surface: #22180e;
  --surface-2: #2b1e12;
  --user: #3a2714;
  --accent: #ffb020;
  --accent-2: #ffd27a;
  --text: #f4e6c8;
  --muted: #a89068;
  --faint: #6d5a3c;
  --line: rgba(255, 176, 32, 0.16);
}

[data-theme="dawn"] {
  --bg: #f3f6f3;
  --bg-2: #ffffff;
  --sidebar: #e7eee8;
  --surface: #ffffff;
  --surface-2: #dfe8e1;
  --line: rgba(16, 40, 22, 0.12);
  --text: #132016;
  --muted: #4d6354;
  --faint: #7a8c7e;
  --accent: #128a3c;
  --accent-2: #0b6b2e;
  --user: #d7eadc;
  --shadow: 0 10px 28px rgba(16, 40, 22, 0.08);
  color-scheme: light;
}

[data-contrast="high"] {
  --line: currentColor;
  --muted: var(--text);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: calc(16px * var(--font-scale));
  line-height: 1.55;
}

body {
  overflow: hidden;
}

body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(46, 232, 106, 0.025) 1px, transparent 1px),
    radial-gradient(900px 420px at 12% -10%, rgba(46, 232, 106, 0.07), transparent 55%);
  background-size: 100% 4px, auto;
  z-index: 0;
  opacity: 0.7;
}

[data-motion="reduce"] *,
[data-motion="reduce"] *::before,
[data-motion="reduce"] *::after {
  animation: none !important;
  transition: none !important;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--accent);
  color: #041208;
  padding: 8px 12px;
  z-index: 20;
  font-family: var(--mono);
}
.skip:focus {
  left: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.is-hidden,
[hidden] {
  display: none !important;
}

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
  background:
    radial-gradient(700px 280px at 50% -8%, rgba(46, 232, 106, 0.12), transparent 60%),
    var(--bg);
}

.gate-card {
  width: min(440px, 100%);
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
}

.gate-logo {
  border-radius: 4px;
  display: block;
  image-rendering: auto;
  filter: saturate(1.1);
}

.eyebrow {
  margin: 16px 0 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  font-family: var(--mono);
}

.gate h1 {
  margin: 6px 0 10px;
  font-size: 40px;
  font-weight: 650;
  letter-spacing: -0.05em;
  font-family: var(--mono);
  color: var(--accent-2);
}

.lede,
.fine {
  color: var(--muted);
}

.lede {
  margin: 0 0 22px;
  max-width: 44ch;
}

.fine {
  font-size: 12px;
  margin: 14px 0 0;
  font-family: var(--mono);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}
.field em {
  font-style: normal;
  opacity: 0.65;
}

input,
textarea,
select,
button {
  font: inherit;
  color: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
  font-family: var(--mono);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.btn,
.ghost,
.chip,
.pill,
.send,
.icon-btn,
.icon-round {
  border: 0;
  cursor: pointer;
  background: transparent;
  color: inherit;
}

.btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.btn.primary {
  background: var(--accent);
  color: #041208;
  border-color: var(--accent);
  font-weight: 700;
}
.btn.wide {
  width: 100%;
}
.btn.tiny {
  padding: 6px 12px;
  font-size: 12px;
}
.btn.danger {
  background: transparent;
  color: var(--rose);
  border-color: color-mix(in srgb, var(--rose) 45%, transparent);
}

.ghost {
  color: var(--muted);
  padding: 8px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ghost:hover,
.chip:hover,
.icon-btn:hover,
.icon-round:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 268px 1fr;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.app > * {
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px 10px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  min-height: 0;
  overflow: hidden;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  text-align: left;
}
.brand img {
  border-radius: 4px;
}
.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.1;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brand small {
  color: var(--muted);
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search-wrap input {
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--bg);
  font-size: 13px;
}

.nav-label {
  margin: 6px 4px 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.chat-nav {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-radius: 6px;
}
.chat-item .pick {
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 8px 10px;
  cursor: pointer;
  min-width: 0;
}
.chat-item strong,
.chat-item small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item strong {
  font-weight: 550;
  font-size: 13.5px;
}
.chat-item small {
  color: var(--muted);
  font-size: 10px;
  font-family: var(--mono);
}
.chat-item.active,
.chat-item:hover {
  background: var(--surface);
}
.chat-item.active {
  box-shadow: inset 2px 0 0 var(--accent);
}
.chat-item .del {
  opacity: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
}
.chat-item:hover .del,
.chat-item:focus-within .del {
  opacity: 1;
}

.side-foot {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.chat-meta {
  flex: 1;
  min-width: 0;
}
.chat-meta h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
}
.chat-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chip {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.chip.hot {
  border-color: var(--accent);
  color: var(--accent-2);
}

.thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 20px 0 28px;
  position: relative;
  z-index: 0;
}
.thread-end {
  height: 8px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: min(52vh, 420px);
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 16px 16px;
  text-align: left;
}
.empty h3 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin: 0 0 6px;
  font-family: var(--mono);
  color: var(--accent-2);
}
.empty p {
  color: var(--muted);
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 13px;
}
.starter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.starter {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: inherit;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
}
.starter:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}
.starter::before {
  content: "> ";
  color: var(--accent);
}

.msg {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  width: min(760px, calc(100% - 40px));
  margin: 0 auto 20px;
}
.msg.user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}
.msg.user .avatar,
.msg.user .who,
.msg.user .msg-actions {
  display: none;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.bubble {
  min-width: 0;
}
.msg.user .bubble {
  background: var(--user);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  max-width: min(680px, 85%);
}
.bubble .who {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 2px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: lowercase;
}
.bubble .content {
  font-size: 15.5px;
}
.bubble .content > *:first-child {
  margin-top: 0;
}
.bubble .content > *:last-child {
  margin-bottom: 0;
}
.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4 {
  line-height: 1.25;
  font-family: var(--mono);
}
.bubble p {
  margin: 0.55em 0;
}
.bubble ul,
.bubble ol {
  padding-left: 1.2em;
}
.bubble a {
  color: var(--accent-2);
}
.bubble blockquote {
  margin: 10px 0;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.bubble th,
.bubble td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.codeblock {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #050806;
}
[data-theme="dawn"] .codeblock {
  background: #eef3ef;
}
.code-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
.code-bar button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
}
.bubble pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 13px;
}
.bubble code {
  font-family: var(--mono);
  font-size: 0.92em;
}
.bubble p code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

.thumb-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.thumb-row img {
  max-width: 180px;
  max-height: 140px;
  border-radius: 6px;
  object-fit: cover;
}

.msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  opacity: 0;
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 1;
}
.msg-actions button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 4px 7px;
  border-radius: 4px;
  font-family: var(--mono);
}
.msg-actions button:hover {
  background: var(--surface);
  color: var(--accent-2);
}

.think {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--faint);
  font-size: 12px;
  font-family: var(--mono);
}
.think summary {
  cursor: pointer;
  color: var(--muted);
}

.sources {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.typing {
  display: inline-flex;
  gap: 5px;
  height: 18px;
  align-items: center;
}
.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s infinite;
}
.typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.suggest {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: min(760px, calc(100% - 32px));
  margin: 0 auto 8px;
  flex-shrink: 0;
}
.suggest button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--mono);
}

.jump-latest {
  align-self: center;
  flex-shrink: 0;
  margin: 0 0 8px;
  background: var(--bg-2);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 2;
  font-family: var(--mono);
}

.dock {
  width: min(760px, calc(100% - 24px));
  margin: 0 auto;
  padding: 0 0 12px;
  flex-shrink: 0;
}

.composer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 8px 6px;
  box-shadow: var(--shadow);
}

.composer-main {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 4px;
  align-items: end;
}

#composer {
  resize: none;
  max-height: 180px;
  min-height: 44px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 11px 6px;
  line-height: 1.45;
  font-family: var(--sans);
}
#composer:focus {
  box-shadow: none;
}

.icon-round {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.icon-round.hot,
.icon-round[aria-pressed="true"] {
  color: var(--rose);
  background: color-mix(in srgb, var(--rose) 14%, transparent);
}

.send {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: #041208;
  display: grid;
  place-items: center;
}
.send:disabled {
  opacity: 0.45;
}
.send.stop {
  background: var(--text);
  color: var(--bg);
}

.composer-pills {
  display: flex;
  gap: 6px;
  padding: 2px 6px 4px 46px;
}
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}
.pill[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-2);
  border-color: var(--accent);
}

.disclaimer {
  text-align: center;
  color: var(--faint);
  font-size: 11px;
  margin: 8px 0 0;
  font-family: var(--mono);
}
.linkish {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.attach-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.attach {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}
.attach img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
}
.attach button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 5;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}
.drawer[hidden] {
  display: none !important;
}
.drawer-panel {
  width: min(460px, 100%);
  height: 100%;
  max-height: 100dvh;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  color: var(--text);
}
.drawer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--bg-2);
}
.drawer header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 36px;
  color: var(--text);
}
.stack {
  display: grid;
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px;
}
.card > b,
.card-title {
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 10px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}
.drawer-body .field span {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.drawer-body input,
.drawer-body textarea,
.drawer-body select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
}
.drawer-body .btn {
  margin-top: 8px;
  width: 100%;
}

.settings-form {
  display: grid;
  gap: 16px;
}
.settings-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.settings-section h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--mono);
  color: var(--accent-2);
}
.settings-section > .fine {
  margin: 0 0 14px;
}
.settings-section .field {
  margin-bottom: 14px;
}
.settings-section .row {
  border-top: 1px solid var(--line);
}
.settings-section .row:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.settings-section .btn {
  width: 100%;
}
.range-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.range-label em {
  font-style: normal;
  color: var(--accent-2);
  font-weight: 650;
}
.model-pick {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.model-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  color: inherit;
}
.model-option input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--accent);
}
.model-option strong,
.model-option span {
  display: block;
}
.model-option span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.model-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg));
}
.toggle-list .row span {
  color: var(--text);
  font-size: 14px;
  font-family: var(--sans);
}
.toggle-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.ops {
  display: grid;
  gap: 14px;
}
.ops-lede {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.ops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ops-tabs button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.ops-tabs button.on {
  border-color: var(--accent);
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.ops-panel h4 {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.ops-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.ops-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}
.ops-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.ops-item.done strong {
  text-decoration: line-through;
  color: var(--muted);
}
.ops-item label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.ops-actions {
  display: flex;
  gap: 8px;
}
.ops-actions .btn {
  margin-top: 0;
  width: auto;
  flex: 1;
}
.history-row {
  display: grid;
  grid-template-columns: 88px 52px 1fr;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mode-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: inherit;
  cursor: pointer;
}
.mode-card.active {
  border-color: var(--accent);
}
.mode-card b {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
}
.mode-card span {
  color: var(--muted);
  font-size: 12px;
}

.palette {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: start center;
  padding-top: 14vh;
}
.palette-panel {
  width: min(520px, 92vw);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.palette-panel ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 50vh;
  overflow: auto;
}
.palette-panel li button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 10px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
}
.palette-panel li button:hover,
.palette-panel li button.active {
  background: var(--surface);
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 12;
  display: grid;
  gap: 8px;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  min-width: 220px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-family: var(--mono);
}
.toast.bad {
  border-color: color-mix(in srgb, var(--rose) 50%, transparent);
}

.install {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px 8px 16px;
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: 12px;
}

.crisis {
  background: color-mix(in srgb, var(--rose) 10%, var(--surface));
}

.meter {
  display: flex;
  gap: 6px;
}
.meter button {
  flex: 1;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 6px;
  padding: 8px 0;
  cursor: pointer;
  font-family: var(--mono);
}
.meter button.on {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
  color: var(--accent-2);
}

.focus-ring {
  text-align: center;
  padding: 12px 0 4px;
}
.focus-time {
  font-size: 56px;
  font-weight: 650;
  letter-spacing: -0.06em;
  font-family: var(--mono);
  color: var(--accent-2);
}
.focus-presets {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}
.focus-presets button {
  flex: 1;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    z-index: 6;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .sidebar.open {
    transform: none;
  }
  .starter-list {
    max-width: 100%;
  }
  .composer-pills {
    padding-left: 8px;
  }
  .msg {
    width: calc(100% - 24px);
  }
  .drawer {
    align-items: flex-end;
    justify-content: stretch;
  }
  .drawer-panel {
    width: 100%;
    height: min(94dvh, 100%);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
  }
}

@media (min-width: 861px) {
  #open-sidebar,
  #close-sidebar {
    display: none;
  }
}
