:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #1b1f23;
  --panel-2: #242a30;
  --text: #f3f5f7;
  --muted: #aab3bd;
  --line: #343b43;
  --accent: #67d391;
  --warn: #f2b84b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
}

.topbar,
.section-head,
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 8px 0 14px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.hero {
  display: grid;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--warn);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0;
}

.tab,
.text-button,
.primary,
.secondary {
  border: 0;
  cursor: pointer;
}

.tab {
  min-height: 40px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.tab.is-active {
  background: var(--accent);
  color: #0c1a12;
  font-weight: 800;
}

.view {
  display: grid;
  gap: 12px;
}

.hidden {
  display: none;
}

.stack {
  display: grid;
  gap: 10px;
}

.library-card {
  display: grid;
  gap: 8px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101214;
  color: var(--text);
  padding: 12px;
}

textarea {
  resize: vertical;
}

.primary {
  min-height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #0c1a12;
  font-weight: 800;
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary {
  min-height: 40px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.text-button {
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.operator-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.ordered {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  display: block;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--panel-2);
  position: relative;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + span::after {
  transform: translateX(20px);
  background: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: min(390px, calc(100% - 28px));
  transform: translate(-50%, 16px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
  color: var(--text);
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
