/* Random Tuesday HQ — same family as randomtuesday.nl, tuned for working in. */
:root {
  --bg: #e9e8dc;
  --panel: #fbfaf5;
  --cream: #f4f2e6;
  --line: #dcdacd;
  --ink: #121212;
  --muted: #6f6e66;
  --purple: #7b2ff7;
  --lime: #d4f53c;
  --red: #d8443a;
  --green: #2fa36b;
  --font: "Space Grotesk", system-ui, sans-serif;
  --pxf: "Silkscreen", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.px { font-family: var(--pxf); text-transform: uppercase; font-size: 11px; letter-spacing: .02em; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--panel); border-radius: 999px;
  padding: 8px 16px; font-weight: 700; font-size: 14px; white-space: nowrap;
}
.btn:hover { background: var(--lime); }
.btn.primary { background: var(--ink); color: var(--lime); }
.btn.primary:hover { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn:disabled { opacity: .45; cursor: not-allowed; background: var(--panel); }
.link { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--muted); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 12px; font-size: 14px; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 72px; resize: vertical; }
.form { display: grid; gap: 12px; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--panel); border-radius: 28px; padding: 40px; width: min(420px, 100%); display: flex; flex-direction: column; }
.login-card .px { margin-bottom: 16px; }
.login-card h1 { font-size: 56px; letter-spacing: -.04em; line-height: .9; margin-bottom: 14px; }
.login-card > .muted { margin-bottom: 28px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card label { gap: 8px; font-size: 13px; color: var(--ink); }
.login-card input { padding: 12px 16px; font-size: 15px; border-radius: 999px; }
.login-card form .btn { justify-content: center; padding: 12px 20px; font-size: 15px; }
.login-card > .btn { align-self: flex-start; }
.login-msg { font-size: 14px; margin-top: 16px; }
.login-msg:empty { display: none; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; gap: 12px; padding: 12px; }
.nav { background: var(--panel); border-radius: 24px; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 12px; height: calc(100vh - 24px); }
.brand { text-decoration: none; display: flex; flex-direction: column; padding: 0 8px; }
.brand strong { font-size: 34px; letter-spacing: -.04em; line-height: 1; }
.nav nav { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav nav a { text-decoration: none; padding: 7px 10px; border-radius: 10px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.nav nav a:hover { background: var(--cream); }
.nav nav a.active { background: var(--ink); color: var(--lime); }
.nav-label { color: var(--muted); padding: 12px 10px 4px; font-size: 10px; }
.badge { background: var(--purple); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.me { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 0 8px; font-size: 13px; word-break: break-all; }
.role { color: var(--purple); }
.main { background: var(--panel); border-radius: 24px; padding: 28px 32px 48px; min-width: 0; outline: none; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { font-size: 34px; letter-spacing: -.03em; line-height: 1; }
.head p { margin-top: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { min-width: 240px; }

/* ---------- dashboard ---------- */
.app-block { border-top: 2px solid var(--ink); padding-top: 14px; margin-top: 26px; }
.app-block:first-of-type { margin-top: 0; }
.app-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.app-title h2 { font-size: 22px; letter-spacing: -.02em; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.chip { font-family: var(--pxf); font-size: 10px; text-transform: uppercase; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 8px; background: #fff; }
.chip.live { background: var(--lime); }
.chip.beta { background: #cfc4ff; }
.chip.concept { background: var(--cream); }
.chip.err { background: var(--red); color: #fff; border-color: var(--red); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi.big { border-color: var(--ink); }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .delta { font-size: 12px; font-weight: 700; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.kpi svg { width: 100%; height: 30px; margin-top: 4px; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 16px; }
.as-of { font-size: 12px; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 16px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--cream); }
.status { font-family: var(--pxf); font-size: 10px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--cream); white-space: nowrap; }
.status.new { background: var(--lime); }
.status.contacted { background: #cfc4ff; }
.status.matched, .status.won { background: #b9e8cf; }
.status.rejected, .status.lost { background: #f3c2bd; }

/* ---------- pipeline ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--cream); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.col h3 { font-size: 13px; display: flex; justify-content: space-between; padding: 2px 4px; }
.deal { background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; display: grid; gap: 4px; }
.deal:hover { border-color: var(--ink); }
.deal strong { font-size: 14px; }
.deal .meta { font-size: 12px; color: var(--muted); }

/* ---------- content & settings ---------- */
.group { margin-top: 24px; }
.group > h2 { font-size: 13px; font-family: var(--pxf); text-transform: uppercase; margin-bottom: 10px; color: var(--muted); }
.entry { border: 2px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; display: grid; gap: 10px; margin-bottom: 10px; }
.entry.changed { border-color: var(--purple); }
.entry-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.entry-key { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.entry .langs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.entry .default { font-size: 12px; color: var(--muted); }
.saved { font-size: 12px; color: var(--green); font-weight: 700; }
.saved.err { color: var(--red); }

/* ---------- drawer ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(18,18,18,.35); z-index: 40; }
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100% - 24px));
  background: var(--panel); border-radius: 24px; z-index: 41; padding: 28px; overflow-y: auto;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.35);
}
.drawer h2 { font-size: 26px; letter-spacing: -.02em; margin-bottom: 4px; padding-right: 40px; }
.drawer-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); background: var(--panel); font-size: 20px; cursor: pointer; }
.drawer section { margin-top: 22px; }
.drawer section > h3 { font-size: 12px; font-family: var(--pxf); text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
.timeline { display: grid; gap: 8px; }
.note { background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; }
.note .when { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; white-space: normal; }
.note.sys { background: var(--cream); border-style: dashed; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--lime); padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 60; }
.toast.err { background: var(--red); color: #fff; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; }
  .nav nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label { display: none; }
  .main { padding: 20px; }
  .entry .langs, .form .row2 { grid-template-columns: 1fr; }
}

/* ---------- blog ---------- */
.status.draft { background: var(--cream); }
.status.scheduled { background: #cfc4ff; }
.status.published { background: #b9e8cf; }
.back { font-size: 13px; text-decoration: none; display: inline-block; margin-bottom: 6px; }
.post-form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }
.form .row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.file-btn { color: var(--ink); flex-direction: row; }
.cover { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px; }
.cover-preview { aspect-ratio: 16 / 9; border-radius: 10px; background: var(--cream); display: grid; place-items: center; overflow: hidden; font-size: 13px; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fields { display: grid; gap: 10px; }
.lang-tabs { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; padding: 2px; gap: 2px; justify-self: start; margin-top: 6px; }
.lang-tabs button { border: 0; background: none; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.lang-tabs button[aria-selected="true"] { background: var(--ink); color: var(--lime); }
.pe-lang { display: grid; gap: 10px; }
.md-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.md-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.md-input { min-height: 460px; font: 14px/1.6 ui-monospace, "Space Mono", monospace; }
.md-preview { border: 2px dashed var(--line); border-radius: 12px; padding: 14px 18px; background: #fff; min-height: 460px; max-height: 70vh; overflow: auto; }
.pe-actions { position: sticky; bottom: 0; background: var(--panel); padding: 12px 0 4px; border-top: 2px solid var(--line); margin-top: 6px; }

/* Rendered Markdown: keep in step with .prose in randomtuesday.nl styles.css */
.prose { font-size: 16px; line-height: 1.6; }
.prose > * + * { margin-top: .8em; }
.prose h2 { font-size: 24px; letter-spacing: -.02em; line-height: 1.15; margin-top: 1.3em; }
.prose h3 { font-size: 19px; margin-top: 1.2em; }
.prose h4 { font-size: 16px; }
.prose img { max-width: 100%; height: auto; border-radius: 14px; display: block; }
.prose blockquote { margin-left: 0; padding-left: 14px; border-left: 4px solid var(--purple); }
.prose code { font-family: ui-monospace, monospace; font-size: .9em; background: var(--cream); padding: 1px 5px; border-radius: 5px; }
.prose pre { background: var(--ink); color: var(--cream); padding: 12px 14px; border-radius: 12px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose hr { border: 0; border-top: 2px solid var(--line); }
.prose a { color: var(--purple); }
.prose ul, .prose ol { padding-left: 1.3em; }

@media (max-width: 1100px) {
  .md-split { grid-template-columns: 1fr; }
  .md-input, .md-preview { min-height: 280px; }
}
@media (max-width: 860px) {
  .form .row3, .cover { grid-template-columns: 1fr; }
}
