/* TJM Labs brand. Light: the TJM Hub palette (tjm-brand.css). Dark: TJM Brain's dashboard
   palette. Primary purple #5c288f, lavender #e9dffc / #BBA2FE, charcoal #2e2e2e. */
:root {
  --bg: #f7f8fc;
  --panel: #ffffff;
  --text: #2e2e2e;
  --muted: #6b6878;
  --border: #e7e3f0;
  --accent: #5c288f;          /* links, selected tab, labels */
  --button: #5c288f;
  --button-hover: #461e6e;
  --button-text: #ffffff;
  --ok: #1f7a4d;
  --warn: #9a6200;
  --bad: #b3261e;
  --code: #f3edff;            /* TJM lavender light */
  --guide: #d9cdf5;
  --glow: rgb(92 40 143 / 7%);
  --shadow: 0 1px 3px rgb(0 0 0 / 4%), 0 1px 2px rgb(0 0 0 / 6%);
  --radius: 12px;
  font-family: "Inter", "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a; --panel: #141414; --text: #ececec; --muted: #8f8f8f;
    --border: #2a2a2a; --accent: #bba2fe; --button: #7c3aed; --button-hover: #6d28d9;
    --button-text: #ffffff; --ok: #4ade80; --warn: #f0bf68; --bad: #f27d7d;
    --code: #1d1a24; --guide: #3b3350; --glow: rgb(124 58 237 / 16%);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* elements with display rules (main, rows) must still hide */
body {
  margin: 0; color: var(--text);
  background: radial-gradient(circle at 12% -10%, var(--glow), transparent 34rem), var(--bg);
  background-attachment: fixed;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
code, pre, textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code); padding: 10px; border-radius: var(--radius); overflow: auto; margin: 6px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px 0; }

button {
  background: var(--button); color: var(--button-text); border: 0; border-radius: 8px;
  padding: 7px 12px; font: inherit; font-weight: 500; cursor: pointer; transition: background .15s;
}
button:hover:not(:disabled) { background: var(--button-hover); }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.secondary:hover:not(:disabled) { background: var(--code); }
button.danger { background: var(--bad); color: #fff; }
button.small { padding: 4px 9px; font-size: 13px; }
button.link { background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
textarea { width: 100%; resize: vertical; }
textarea.code { min-height: 260px; }
label { display: block; margin: 10px 0 4px; color: var(--muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 32px; height: 34px; }
.brand-label {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
}
.brand-title { margin: 2px 0 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: block; } }
.key-form { display: flex; gap: 8px; }
.key-form input { width: 340px; }

main { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 57px); }
.sidebar { border-right: 1px solid var(--border); padding: 16px; background: var(--panel); }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.project-list { list-style: none; margin: 0; padding: 0; }
.project-list button {
  width: 100%; text-align: left; background: none; color: var(--text);
  padding: 8px 10px; border-radius: 6px;
}
.project-list button[aria-current="true"] { background: var(--code); font-weight: 600; }
.project-list .meta { display: block; color: var(--muted); font-size: 12px; }

.content { padding: 20px 28px; max-width: 1200px; }
.content-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button {
  background: none; color: var(--muted); border-radius: 0; padding: 8px 12px;
  border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--code); }
td.setting-input input[type=text], td.setting-input input[type=number] { width: 100%; }
td.setting-input textarea { min-height: 60px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.badge.muted { color: var(--muted); }
.source-clone { color: var(--accent); font-weight: 500; }

.diff .from { color: var(--bad); text-decoration: line-through; }
.diff .to { color: var(--ok); }

.toast {
  position: fixed; bottom: 20px; right: 20px; max-width: 520px; z-index: 10;
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--ok);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.12);
}
.toast.error { border-left-color: var(--bad); }
.toast ul { margin: 6px 0 0; padding-left: 18px; }

.welcome { max-width: 560px; margin: 60px auto; padding: 0 20px; line-height: 1.55; }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: var(--text); width: min(720px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.warnbox { border-left: 3px solid var(--warn); padding: 6px 10px; margin: 8px 0; }
.badbox { border-left: 3px solid var(--bad); padding: 6px 10px; margin: 8px 0; }

.setting-name { font-weight: 500; }
.description { color: var(--muted); margin-top: 3px; max-width: 46ch; line-height: 1.4; }
.rule { font-size: 12px; margin-top: 2px; }
tr.group-row td { background-color: var(--code); padding-top: 9px; padding-bottom: 9px; }
.group-mark { color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.help-link { color: var(--accent); font-weight: 500; text-decoration: none; }
.help-link:hover { text-decoration: underline; }
a { color: var(--accent); }

.help { max-width: 860px; margin: 0 auto; padding: 24px 28px 60px; line-height: 1.6; }
.help h2 { font-size: 22px; letter-spacing: -.01em; margin: 8px 0 6px; }
.help h3 { font-size: 16px; margin: 34px 0 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.help section { scroll-margin-top: 16px; }
.help .lead { font-size: 15px; color: var(--muted); max-width: 70ch; }
.help table { margin: 10px 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.help td, .help th { padding: 8px 10px; }
.help tr:last-child td { border-bottom: 0; }
.help ul, .help ol { padding-left: 22px; }
.help li { margin: 4px 0; }
.help .note { border-left: 3px solid var(--accent); background: var(--code); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 16px 0 4px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.toc a { text-decoration: none; font-size: 13.5px; }
.toc a:hover { text-decoration: underline; }
.access-tag { font-size: 11px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
