/* LUX Forms Bot dashboard — the LUX CAD visual language (dark #0d0f12 canvas, gradient cards,
   primary #62b9de, Inter + JetBrains Mono, Material Symbols). The values mirror LUX CAD's
   tailwind.config.js and its admin dashboard; the corner radii follow its halved scale. */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/JetBrainsMono-Medium.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --sidebar: rgba(20, 23, 28, .9);
  --card-top: #1a1d24;
  --card-bottom: #14171c;
  --panel: #14171c;
  --panel-2: rgba(0, 0, 0, .2);
  --panel-3: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .1);
  --line-soft: rgba(255, 255, 255, .05);
  --text: #e5e1e4;
  --text-strong: #ffffff;
  --muted: rgba(193, 198, 215, .7);
  --muted-2: rgba(193, 198, 215, .5);
  --primary: #62b9de;
  --primary-container: #1a6ecf;
  --on-primary-container: #00285c;
  --success: #008b74;
  --warning: #ffb874;
  --error: #ef4444;
  --radius-input: 4px;
  --radius-btn: 6px;
  --radius-card: 8px;
  --radius-dialog: 12px;
  --shadow: 0 20px 25px -5px rgba(0, 0, 0, .5), 0 8px 10px -6px rgba(0, 0, 0, .4);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  /* The Discord preview keeps Discord's own colours: it shows what people will see there. */
  --dc-bg: #313338;
  --dc-embed: #2b2d31;
  --dc-input: #1e1f22;
  --dc-blurple: #5865f2;
  --dc-grey: #4e5058;
  --dc-green: #248046;
  --dc-red: #da373c;
  --dc-muted: #949ba4;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: #8fd0ec; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: 0; color: var(--text-strong); }
h2 { font-size: 18px; margin: 0 0 8px; color: var(--text-strong); font-weight: 700; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--text-strong); font-weight: 700; }
code, .mono { font-family: var(--mono); }
code { background: var(--panel-3); border: 1px solid var(--line-soft); border-radius: 3px; padding: 1px 5px; font-size: 12px; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-input); padding: 10px; overflow: auto; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; color: var(--text-strong); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row > input[type=text], .row > input[type=search], .row > select { width: auto; flex: 1 1 120px; min-width: 0; }
.row > input.num { flex: none; width: 90px; }
.boot, .loading { padding: 48px; color: var(--muted); text-align: center; }
.caption { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--primary); }

/* ---------- icons (Material Symbols Outlined, as in LUX CAD) */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal;
  font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap;
  display: inline-block; direction: ltr; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  flex: none; user-select: none;
}
.btn .material-symbols-outlined { font-size: 16px; }
.btn.big .material-symbols-outlined { font-size: 20px; }
h3 .material-symbols-outlined { font-size: 18px; }
.link-icon { display: inline-flex; align-items: center; gap: 4px; }
.link-icon .material-symbols-outlined { font-size: 16px; }
.ok-icon { color: var(--success); font-size: 18px; }

/* ---------- layout */
#app { display: flex; min-height: 100vh; position: relative; }
#app::before {
  /* the soft primary glow in the top-right corner of LUX CAD's admin dashboard */
  content: ""; position: fixed; top: -10%; right: -5%; width: 40%; height: 40%; border-radius: 50%;
  background: rgba(98, 185, 222, .05); filter: blur(120px); pointer-events: none; z-index: 0;
}
.sidebar {
  width: 272px; flex: none; background: var(--sidebar); border-right: 1px solid var(--line);
  backdrop-filter: blur(24px); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 2;
}
.brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--line-soft); background: rgba(0, 0, 0, .2); display: flex; flex-direction: column; gap: 14px; }
.lockup { display: flex; align-items: center; gap: 10px; }
.lockup img { height: 24px; width: auto; flex: none; }
.lockup-rule { width: 1px; height: 24px; background: rgba(255, 255, 255, .15); flex: none; }
.lockup-name { font-weight: 700; font-size: 18px; line-height: 1; letter-spacing: .02em; text-transform: uppercase; color: rgba(255, 255, 255, .9); }
.lockup.big { justify-content: center; }
.lockup.big img, .lockup.big .lockup-rule { height: 34px; }
.lockup.big .lockup-name { font-size: 26px; }
.brand-server { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.guild-name { color: var(--text-strong); font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-select { font-weight: 600; }
.nav { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; color: rgba(193, 198, 215, .85);
  padding: 9px 12px 9px 14px; border-radius: var(--radius-btn); font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
}
.nav a .material-symbols-outlined { color: rgba(193, 198, 215, .55); transition: color .15s; }
.nav a:hover { background: var(--panel-3); color: var(--text-strong); }
.nav a:hover .material-symbols-outlined { color: var(--primary); }
.nav a.active { background: rgba(98, 185, 222, .1); color: var(--text-strong); }
.nav a.active .material-symbols-outlined { color: var(--primary); }
.nav-heading { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); padding: 14px 12px 4px; }
.nav-heading:first-child { padding-top: 4px; }
.user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line-soft); background: rgba(0, 0, 0, .2); }
.user img, .avatar-blank { width: 32px; height: 32px; border-radius: 50%; background: rgba(98, 185, 222, .2); border: 1px solid rgba(98, 185, 222, .3); display: grid; place-items: center; color: var(--primary); flex: none; }
.avatar-blank .material-symbols-outlined { font-size: 18px; }
.user-name { flex: 1; font-weight: 600; font-size: 13px; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { color: var(--muted); display: grid; place-items: center; padding: 6px; border-radius: var(--radius-btn); }
.logout:hover { color: var(--text-strong); background: var(--panel-3); }
.content { flex: 1; min-width: 0; padding: 32px 32px 120px; position: relative; z-index: 1; }
.page { max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 8px 0 0; color: rgba(193, 198, 215, .85); font-size: 14px; max-width: 720px; }
.with-side { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.side { position: sticky; top: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- cards */
.card, .results {
  background: linear-gradient(to bottom, var(--card-top), var(--card-bottom));
  border: 1px solid var(--line-soft); border-radius: var(--radius-card); box-shadow: var(--shadow);
}
.card { padding: 20px 24px; margin-bottom: 16px; }
.section { margin-bottom: 16px; }
.card.section { padding-bottom: 10px; }
.section-head { margin-bottom: 12px; }
.section-head p { margin: -4px 0 0; }
.error-card { border-color: rgba(239, 68, 68, .4); max-width: 640px; margin: 40px auto; }
.empty-state { text-align: center; color: var(--muted); padding: 40px; }
.warnings { background: rgba(255, 184, 116, .06); border-color: rgba(255, 184, 116, .3); }
.warnings h3 { color: var(--warning); }
.warnings ul { margin: 0; padding-left: 20px; }
.warnings li { margin: 3px 0; }
.ok { background: rgba(0, 139, 116, .08); border-color: rgba(0, 139, 116, .35); color: var(--text); font-weight: 500; }
.ok > .material-symbols-outlined { color: var(--success); }
.notice { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius-card); padding: 14px 18px; margin-bottom: 16px; border: 1px solid; max-width: 1280px; }
.notice p { margin: 2px 0 0; color: rgba(193, 198, 215, .9); font-size: 13px; }
.notice strong { color: var(--text-strong); }
.notice.warn { background: rgba(255, 184, 116, .06); border-color: rgba(255, 184, 116, .3); }
.notice.warn > .material-symbols-outlined { color: var(--warning); }
.notice.info { background: rgba(98, 185, 222, .06); border-color: rgba(98, 185, 222, .3); }
.notice.info > .material-symbols-outlined { color: var(--primary); }
/* read-only: no LUX CAD subscription. The server refuses every change; hide what would only fail. */
body.read-only .savebar, body.read-only .page-head .btn.primary, body.read-only .page-head .btn.danger { display: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { margin: 0; color: var(--text); display: block; transition: border-color .15s; }
.stat:hover { color: var(--text); border-color: rgba(98, 185, 222, .4); }
.stat-label { color: var(--muted-2); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
.stat-value { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--text-strong); margin: 6px 0 2px; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-btn);
  background: var(--panel-3); color: rgba(229, 225, 228, .9); padding: 9px 16px; font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: background .15s, filter .15s, transform .05s;
}
.btn:hover { background: rgba(255, 255, 255, .1); color: var(--text-strong); }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(to right, var(--primary), var(--primary-container)); color: var(--on-primary-container); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.1); color: var(--on-primary-container); }
.btn.danger { background: var(--error); border-color: transparent; color: #fff; }
.btn.danger.ghost { background: rgba(239, 68, 68, .08); color: #f87171; border: 1px solid rgba(239, 68, 68, .3); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.icon-only { padding: 5px 6px; }
.btn.big { padding: 12px 18px; font-size: 14px; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.danger-text { color: #f87171 !important; }

/* ---------- forms */
input[type=text], input[type=search], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; background: var(--panel-2); color: var(--text-strong); border: 1px solid var(--line); border-radius: var(--radius-input);
  padding: 10px 14px; font: inherit; font-size: 14px; transition: border-color .15s;
}
select { padding-right: 10px; }
select option { background: #14171c; color: var(--text); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input[type=date] { color-scheme: dark; }
input[type=color] { width: 44px; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-input); background: var(--panel-2); }
input.num { width: 90px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; min-width: 0; }
.field.wide, .note.wide { grid-column: 1 / -1; }
.label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; display: flex; flex-direction: column; gap: 6px; }
.help { color: var(--muted-2); font-size: 12px; }
.note { background: rgba(98, 185, 222, .05); border: 1px solid rgba(98, 185, 222, .15); border-left: 3px solid var(--primary); padding: 10px 14px; border-radius: var(--radius-input); color: rgba(193, 198, 215, .9); font-size: 13px; margin-bottom: 8px; }
.toggle-field { justify-content: center; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider { width: 40px; height: 22px; background: rgba(255, 255, 255, .12); border: 1px solid var(--line); border-radius: 22px; position: relative; flex: none; transition: background .15s; }
.slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #e5e1e4; transition: transform .15s, background .15s; }
.switch input:checked + .slider { background: rgba(98, 185, 222, .35); border-color: rgba(98, 185, 222, .6); }
.switch input:checked + .slider::after { transform: translateX(18px); background: var(--primary); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch-label { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-3); border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 13px; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.chip-x:hover { color: var(--text-strong); }
.add-select { width: auto; min-width: 160px; padding: 5px 10px; }
.template-preview { font-size: 13px; background: var(--panel-2); border: 1px solid var(--line-soft); padding: 6px 10px; border-radius: var(--radius-input); }
.vars { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.var { background: rgba(98, 185, 222, .08); color: var(--primary); border: 1px solid rgba(98, 185, 222, .2); border-radius: 3px; font: 11.5px var(--mono); padding: 2px 6px; cursor: pointer; }
.var:hover { border-color: var(--primary); }
.emoji-preview { min-width: 28px; font-size: 20px; text-align: center; }
.emoji { width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, 40px); gap: 4px; margin-bottom: 12px; }
.emoji-btn { width: 40px; height: 40px; border: 1px solid var(--line-soft); border-radius: var(--radius-btn); background: var(--panel-2); font-size: 20px; cursor: pointer; display: grid; place-items: center; }
.emoji-btn:hover { background: var(--panel-3); border-color: var(--line); }
.emoji-btn img { width: 28px; height: 28px; }
.image-field { display: flex; gap: 12px; align-items: flex-start; }
.image-preview { width: 140px; height: 90px; object-fit: cover; border-radius: var(--radius-input); border: 1px solid var(--line); background: var(--panel-2); flex: none; }
.image-preview.empty { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.image-controls { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.list { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.list-item { width: 100%; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius-btn); padding: 12px 14px 4px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.empty-list { padding: 4px 0; }
.questions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.question { width: 100%; margin: 0; }
.savebar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; background: rgba(20, 23, 28, .95); backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius-card); padding: 10px 12px 10px 18px;
  display: flex; gap: 24px; align-items: center; z-index: 20;
}

/* ---------- tables & filters */
.table-wrap { overflow-x: auto; }
/* a list page puts its table straight on the page: give it the same card as everything else */
.page > .table-wrap {
  background: linear-gradient(to bottom, var(--card-top), var(--card-bottom));
  border: 1px solid var(--line-soft); border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 6px 14px;
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
td .strong { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th { text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(255, 255, 255, .03); }
td.num, th.num { width: 70px; color: var(--muted); font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.filters .filter:first-child { grid-column: span 2; }
.filter { display: flex; flex-direction: column; gap: 6px; font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
.filter input, .filter select { text-transform: none; letter-spacing: normal; font-weight: 400; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 12px 0; }
.results { padding: 6px 14px; }
.user-cell { display: inline-flex; align-items: center; gap: 8px; }
.user-cell img { width: 24px; height: 24px; border-radius: 50%; }
.user-cell small { display: none; }
.badge {
  display: inline-block; border-radius: 3px; padding: 2px 8px; font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; background: var(--panel-3); border: 1px solid var(--line); color: var(--text);
}
.badge.green { background: rgba(0, 139, 116, .12); border-color: rgba(0, 139, 116, .4); color: #2bc4a6; }
.badge.yellow { background: rgba(255, 184, 116, .1); border-color: rgba(255, 184, 116, .35); color: var(--warning); }
.badge.red { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); color: #f87171; }
.badge.blue { background: rgba(98, 185, 222, .1); border-color: rgba(98, 185, 222, .35); color: var(--primary); }
.badge.grey { background: rgba(255, 255, 255, .04); border-color: var(--line); color: var(--muted); }
.stars { color: var(--warning); letter-spacing: 1px; }

/* ---------- detail pages */
dl.info { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; margin: 0; }
dl.info dt { color: var(--muted-2); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; padding-top: 3px; }
dl.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { margin: 0 0 10px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.answer { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.answer:last-child { border-bottom: 0; }
.letter { display: inline-block; min-width: 22px; text-align: center; background: rgba(98, 185, 222, .15); border: 1px solid rgba(98, 185, 222, .35); color: var(--primary); border-radius: 3px; font-family: var(--mono); font-weight: 700; font-size: 11px; padding: 0 4px; }
.quote { border-left: 3px solid rgba(98, 185, 222, .35); padding: 2px 10px; margin-top: 6px; color: var(--text); }
.pre { white-space: pre-wrap; }
iframe.transcript { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--dc-bg); }

/* ---------- Discord preview (Discord's colours on purpose) */
.side-preview h3 { margin-bottom: 12px; }
.thread-name { background: var(--panel-2); border: 1px solid var(--line-soft); padding: 8px 10px; border-radius: var(--radius-input); font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; flex-wrap: nowrap; }
.thread-name .material-symbols-outlined { color: var(--muted); font-size: 18px; }
.dp { display: flex; gap: 12px; background: var(--dc-bg); border-radius: var(--radius-btn); padding: 12px; font-family: "gg sans", "Segoe UI", Inter, sans-serif; color: #dbdee1; }
.dp-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--dc-blurple); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.dp-main { min-width: 0; flex: 1; }
.dp-head { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
.dp-tag { background: var(--dc-blurple); color: #fff; font-size: 10px; font-weight: 700; border-radius: 3px; padding: 0 4px; }
.dp-time { color: var(--dc-muted); font-size: 12px; }
.dp-content { margin-bottom: 4px; }
.dp-embed { display: flex; gap: 12px; background: var(--dc-embed); border-left: 4px solid; border-radius: 4px; padding: 10px 12px; margin-top: 4px; max-width: 520px; }
.dp-embed-body { flex: 1; min-width: 0; }
.dp-title { font-weight: 700; color: #f2f3f5; margin-bottom: 4px; }
.dp-desc { font-size: 13.5px; overflow-wrap: anywhere; }
.dp-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; font-size: 13px; }
.dp-field { flex: 1 1 100%; }
.dp-field.inline { flex: 1 1 100px; }
.dp-image { max-width: 100%; border-radius: 4px; margin-top: 8px; }
.dp-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }
.dp-footer { color: var(--dc-muted); font-size: 12px; margin-top: 8px; }
.dp-buttons { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dp-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 4px; font-weight: 600; font-size: 13.5px; background: var(--dc-grey); color: #fff; }
.dp-btn.primary { background: var(--dc-blurple); }
.dp-btn.success { background: var(--dc-green); }
.dp-btn.danger { background: var(--dc-red); }
.dp-select { display: flex; justify-content: space-between; background: var(--dc-input); border: 1px solid #1a1b1e; border-radius: 4px; padding: 9px 12px; margin-top: 8px; color: var(--dc-muted); max-width: 420px; }
.md .mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
.md-h1 { display: block; font-size: 20px; font-weight: 700; margin: 4px 0; }
.md-h2 { display: block; font-size: 17px; font-weight: 700; margin: 4px 0; }
.md-h3 { display: block; font-size: 15px; font-weight: 700; margin: 4px 0; }
.md-sub { display: block; font-size: 12px; color: var(--dc-muted); }
.md-quote { display: block; border-left: 4px solid var(--dc-grey); padding-left: 8px; }

/* ---------- dialogs & toasts */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog {
  background: linear-gradient(to bottom, var(--card-top), var(--card-bottom)); border: 1px solid var(--line);
  border-radius: var(--radius-dialog); padding: 22px 24px; width: min(520px, 100%); box-shadow: var(--shadow); max-height: 90vh; overflow: auto;
}
.dialog p { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.scroll { max-height: 60vh; overflow: auto; }
.toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: rgba(20, 23, 28, .95); backdrop-filter: blur(16px); border: 1px solid var(--line); border-left: 3px solid var(--success);
  padding: 10px 14px; border-radius: var(--radius-btn); box-shadow: var(--shadow); max-width: 380px; transition: opacity .4s, transform .4s;
}
.toast.error { border-left-color: var(--error); }
.toast.warn { border-left-color: var(--warning); }
.toast.gone { opacity: 0; transform: translateX(20px); }

/* ---------- login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; position: relative; overflow: hidden; }
body.login::before {
  content: ""; position: fixed; top: -15%; left: 50%; width: 60%; height: 50%; transform: translateX(-50%); border-radius: 50%;
  background: rgba(98, 185, 222, .06); filter: blur(120px); pointer-events: none;
}
.login-card {
  position: relative; background: linear-gradient(to bottom, var(--card-top), var(--card-bottom)); border: 1px solid var(--line-soft);
  border-radius: var(--radius-dialog); padding: 36px 32px; width: min(420px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px;
}
.login-card .caption { text-align: center; margin: -4px 0 8px; }
.login-card .pw { display: flex; flex-direction: column; gap: 10px; }
.login-card .pw label { display: flex; flex-direction: column; gap: 6px; font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.login-card .pw .btn { justify-content: center; }
.alert.error { background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .3); color: #fca5a5; border-radius: var(--radius-input); padding: 10px 12px; font-size: 13px; }

/* ---------- scrollbars (as LUX CAD's cad-scrollbar) */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .12) transparent; }

/* ---------- small screens */
@media (max-width: 1100px) {
  .with-side { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 760px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .nav-heading { display: none; }
  .content { padding: 16px 16px 120px; }
  h1 { font-size: 24px; }
  .grid, .two-col { grid-template-columns: 1fr; }
  .filters .filter:first-child { grid-column: auto; }
  dl.info { grid-template-columns: 1fr; }
  .savebar { left: 16px; right: 16px; transform: none; gap: 10px; flex-wrap: wrap; }
}
