/* Pasteurized -- one stylesheet, no framework.
   Dark is the default; [data-theme="light"] swaps the palette. app.js resolves "auto". */

:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #14161b;
  --panel-2: #1a1d24;
  --panel-3: #20242c;
  --line: #272b34;
  --text: #e9e7e3;
  --dim: #9ba1ac;
  --dim-2: #6f7681;
  --accent: #ffcf4a;
  --accent-ink: #1b1603;
  --accent-soft: rgba(255, 207, 74, 0.14);
  --good: #7ddc9a;
  --bad: #ff7b72;
  --warn: #ffb86b;
  --code-bg: #0e1014;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --s-kw: #ff7b72;
  --s-str: #a5d6ff;
  --s-num: #79c0ff;
  --s-com: #8b949e;
  --s-fn: #d2a8ff;
  --s-typ: #ffa657;
  --s-attr: #7ee787;
  --s-tag: #7ee787;
  --s-op: #c9d1d9;
  --s-var: #79c0ff;
  --s-ins: #7ee787;
  --s-del: #ff7b72;
  --s-meta: #ffa657;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f4ee;
  --panel: #ffffff;
  --panel-2: #f2eee6;
  --panel-3: #e9e4da;
  --line: #dfd9cd;
  --text: #1c1d20;
  --dim: #6b6f76;
  --dim-2: #8b8f96;
  --accent: #ffc300;
  --accent-ink: #221c00;
  --accent-soft: rgba(255, 195, 0, 0.18);
  --good: #1a7f37;
  --bad: #cf222e;
  --warn: #9a6700;
  --code-bg: #fbfaf7;
  --shadow: 0 14px 34px rgba(60, 50, 20, 0.12);
  --s-kw: #cf222e;
  --s-str: #0a3069;
  --s-num: #0550ae;
  --s-com: #6e7781;
  --s-fn: #8250df;
  --s-typ: #953800;
  --s-attr: #116329;
  --s-tag: #116329;
  --s-op: #24292f;
  --s-var: #0550ae;
  --s-ins: #116329;
  --s-del: #cf222e;
  --s-meta: #953800;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 0.4rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.8rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
code, pre, .mono { font-family: var(--mono); }
small { font-size: 0.82rem; }
::selection { background: var(--accent-soft); }

/* ---------------------------------------------------------------- boot + standalone */

#boot, .standalone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 70vh;
  text-align: center;
  padding: 2rem 1.4rem;
}
.boot-mark, .brand-mark {
  font-weight: 700;
  letter-spacing: -0.02em;
}
.boot-mark { font-size: 1.6rem; }
.boot-note { color: var(--dim); }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.95rem;
}
.brand-mark.big { width: 56px; height: 56px; font-size: 1.9rem; border-radius: 16px; margin-bottom: 0.6rem; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 650; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 1.02rem; }
.nav { display: flex; align-items: center; gap: 0.15rem; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--dim);
  white-space: nowrap;
  font-size: 0.92rem;
}
.nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--panel-2); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.menu { position: relative; }
.menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: var(--accent); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 260px;
  max-width: min(360px, 92vw);
  max-height: 70vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  z-index: 60;
}
.menu-panel a, .menu-panel button.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 0;
  background: none;
  color: var(--text);
  border-radius: var(--radius-sm);
  font: inherit;
  cursor: pointer;
}
.menu-panel a:hover, .menu-panel button.menu-item:hover { background: var(--panel-2); text-decoration: none; }
.menu-head { padding: 0.4rem 0.55rem; color: var(--dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.bell-count {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.notif-item { border-bottom: 1px solid var(--line); padding: 0.5rem 0.55rem; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: var(--accent-soft); }
.notif-meta { color: var(--dim); font-size: 0.78rem; }

/* ---------------------------------------------------------------- layout */

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.2rem 1rem 3rem; flex: 1 1 auto; }
.page-head { display: flex; align-items: flex-end; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .grow { flex: 1 1 auto; }
.page-sub { color: var(--dim); font-size: 0.9rem; }
.footer {
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.82rem;
  padding: 1rem;
  text-align: center;
}
.footer a { color: var(--dim); text-decoration: underline; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel + .panel { margin-top: 1rem; }
.panel-title { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.panel-title h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.muted { color: var(--dim); }
.tiny { font-size: 0.8rem; }
.right { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 0.7rem; }
.row-inline { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--dim); }

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.42rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 620; }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.btn-sm { padding: 0.28rem 0.55rem; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

label.field { display: block; }
.field > span.label { display: block; font-size: 0.82rem; color: var(--dim); margin-bottom: 0.25rem; }
.input, .select, .textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.6rem;
}
.textarea { font-family: var(--mono); font-size: 13px; line-height: 1.5; min-height: 320px; resize: vertical; tab-size: 2; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--dim); }
.check input { accent-color: var(--accent); }
.form-row { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.form-row > * { flex: 1 1 160px; min-width: 0; }
.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.9rem; }
.toolbar .input { flex: 1 1 220px; }
.toolbar .select { flex: 0 0 auto; width: auto; }

.chips { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 0.78rem;
  color: var(--dim);
  white-space: nowrap;
}
.chip.mono { font-family: var(--mono); }
.chip-accent { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--accent); }
.chip-private { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.chip-burn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.chip-locked { color: var(--accent); }
a.chip:hover { color: var(--text); text-decoration: none; }

/* ---------------------------------------------------------------- lists */

.list { display: flex; flex-direction: column; }
.item {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--panel-2); }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-title a:hover { text-decoration: underline; }
.item-sub { color: var(--dim); font-size: 0.84rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.2rem; }
.excerpt {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim-2);
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.25rem;
  max-height: 1.2rem;
}
.item-side { text-align: right; color: var(--dim); font-size: 0.78rem; white-space: nowrap; }

/* ---------------------------------------------------------------- paste view */

.paste-head { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.9rem; }
.paste-title { font-size: 1.4rem; font-weight: 680; letter-spacing: -0.02em; word-break: break-word; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.2rem 0 0.9rem; }
.code {
  display: flex;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 72vh;
}
.gutter {
  flex: 0 0 auto;
  text-align: right;
  color: var(--dim-2);
  border-right: 1px solid var(--line);
  padding: 0.6rem 0;
  user-select: none;
  position: sticky;
  left: 0;
  background: var(--code-bg);
}
.gutter .ln { padding: 0 0.6rem 0 0.8rem; }
.body-col { flex: 1 1 auto; padding: 0.6rem 0; min-width: 0; }
.body-col .cl { padding: 0 1rem; white-space: pre; }
.body-col .cl:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.code.wrap .body-col .cl { white-space: pre-wrap; overflow-wrap: anywhere; }
.code.wrap .gutter { display: none; }
.code.no-gutter .gutter { display: none; }
.s-kw { color: var(--s-kw); }
.s-str { color: var(--s-str); }
.s-num { color: var(--s-num); }
.s-com { color: var(--s-com); font-style: italic; }
.s-fn { color: var(--s-fn); }
.s-typ { color: var(--s-typ); }
.s-attr { color: var(--s-attr); }
.s-tag { color: var(--s-tag); }
.s-op { color: var(--s-op); }
.s-var { color: var(--s-var); }
.s-ins { color: var(--s-ins); }
.s-del { color: var(--s-del); }
.s-meta { color: var(--s-meta); }

.diff { font-family: var(--mono); font-size: 13px; line-height: 1.5; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 72vh; }
.diff-row { display: flex; white-space: pre; }
.diff-no { flex: 0 0 3.4rem; text-align: right; padding-right: 0.6rem; color: var(--dim-2); user-select: none; }
.diff-sign { flex: 0 0 1rem; user-select: none; }
.diff-text { flex: 1 1 auto; padding-right: 1rem; }
.diff-row.add { background: color-mix(in srgb, var(--good) 14%, transparent); }
.diff-row.del { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.diff-row.add .diff-sign, .diff-row.add .diff-no { color: var(--good); }
.diff-row.del .diff-sign, .diff-row.del .diff-no { color: var(--bad); }
.diff-stats { display: flex; gap: 0.6rem; }

/* ---------------------------------------------------------------- comments */

.comment { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; align-items: center; gap: 0.5rem; color: var(--dim); font-size: 0.82rem; margin-bottom: 0.3rem; }
.comment-author { color: var(--text); font-weight: 600; }
.comment-body { word-wrap: break-word; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-body .md-code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; overflow: auto; font-size: 0.85rem; }
.comment-body code { background: var(--panel-2); padding: 0.05rem 0.3rem; border-radius: 4px; font-size: 0.88em; }
.comment-body blockquote { margin: 0.4rem 0; padding-left: 0.7rem; border-left: 3px solid var(--line); color: var(--dim); }
.composer { margin-top: 0.8rem; }
.composer textarea { min-height: 92px; }
.composer-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }

/* ---------------------------------------------------------------- tables, auth, misc */

table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.scroll-x { overflow-x: auto; }

.auth-shell { display: flex; justify-content: center; padding: 6vh 1rem 3rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); }
.auth-head { text-align: center; margin-bottom: 1.1rem; }
.auth-head .brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.auth-tag { color: var(--dim); font-size: 0.88rem; margin-top: 0.2rem; }
.tabs { display: flex; gap: 0.3rem; background: var(--panel-2); padding: 0.25rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.tabs a { flex: 1 1 0; text-align: center; padding: 0.4rem; border-radius: var(--radius-sm); color: var(--dim); font-size: 0.9rem; }
.tabs a.active { background: var(--panel); color: var(--text); font-weight: 600; }
.tabs a:hover { text-decoration: none; }
.form-error { color: var(--bad); font-size: 0.86rem; min-height: 1.2rem; }

.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.4rem; z-index: 90; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel-3);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  max-width: 90vw;
}
.toast.good { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }

.token-reveal { background: var(--panel-2); border: 1px dashed var(--accent); border-radius: var(--radius-sm); padding: 0.7rem; margin-top: 0.6rem; }
.token-reveal code { word-break: break-all; font-size: 0.85rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.9rem; font-size: 0.88rem; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }
.loading { color: var(--dim); padding: 1.5rem; text-align: center; }
.drop-active::after {
  content: "Drop a file to start a paste";
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border: 3px dashed var(--accent);
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 600;
  z-index: 100;
  pointer-events: none;
}
pre.api-doc { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; overflow: auto; font-size: 0.83rem; line-height: 1.5; }

@media (max-width: 720px) {
  .wrap { padding: 0.9rem 0.7rem 3rem; }
  .nav a { padding: 0.3rem 0.45rem; font-size: 0.86rem; }
  .brand-name { display: none; }
  .paste-title { font-size: 1.15rem; }
  .item-side { display: none; }
  .textarea { min-height: 240px; }
  .nav-right .btn span.btn-text { display: none; }
}
