/* Shared styles for the SensorBrain public pages (no external fonts or scripts). */
:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --text: #1d2026;
  --muted: #5a6370;
  --border: #e2e5ea;
  --accent: #2c63d6;
  --accent-text: #ffffff;
  --brand: #4f0012;
  --brand-2: #d06e00;
  --todo-bg: #fff1b8;
  --todo-text: #5a4300;
  --warn-bg: #fff4e5;
  --warn-border: #f0b35a;
  --ok-bg: #e9f7ef;
  --ok-border: #5bb381;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121418;
    --surface: #1b1e24;
    --text: #e6e9ed;
    --muted: #a2abb6;
    --border: #2b3038;
    --accent: #7ea6ff;
    --accent-text: #0d1220;
    --todo-bg: #4d3d00;
    --todo-text: #ffe48a;
    --warn-bg: #2f2410;
    --warn-border: #a8761f;
    --ok-bg: #12291c;
    --ok-border: #3f8a5f;
  }
}
:root[data-theme="dark"] {
  --bg: #121418;
  --surface: #1b1e24;
  --text: #e6e9ed;
  --muted: #a2abb6;
  --border: #2b3038;
  --accent: #7ea6ff;
  --accent-text: #0d1220;
  --todo-bg: #4d3d00;
  --todo-text: #ffe48a;
  --warn-bg: #2f2410;
  --warn-border: #a8761f;
  --ok-bg: #12291c;
  --ok-border: #3f8a5f;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }

/* Top bar shared by every page */
.topbar { border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.topnav { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 0.92rem; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--accent); }

header.page { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 24px; }
h1 { font-size: 1.75rem; line-height: 1.3; margin: 8px 0; }
h2 { font-size: 1.2rem; margin: 40px 0 12px; padding-top: 8px; scroll-margin-top: 16px; }
h3 { font-size: 1.02rem; margin: 24px 0 8px; }
p, ul, ol { margin: 0 0 12px; }
ul, ol { padding-left: 1.3em; }
li { margin: 4px 0; }
a { color: var(--accent); }
.meta { color: var(--muted); font-size: 0.92rem; margin: 0; }
.lede { font-size: 1.05rem; color: var(--muted); }
.lang { display: flex; gap: 8px; margin-top: 16px; }
.lang a {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--border);
  border-radius: 999px; text-decoration: none; color: var(--text); font-size: 0.9rem;
}
.lang a:hover { border-color: var(--accent); }
nav.toc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin: 24px 0; }
nav.toc h2 { margin: 0 0 8px; padding: 0; font-size: 1rem; }
nav.toc ol { margin: 0; }
.note { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 6px; padding: 12px 16px; margin: 16px 0; }
.note.ok { background: var(--ok-bg); border-left-color: var(--ok-border); }
.note.warn { background: var(--warn-bg); border-left-color: var(--warn-border); }
.table-wrap { overflow-x: auto; margin: 12px 0 16px; border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; min-width: 560px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { background: var(--surface); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
mark.todo { background: var(--todo-bg); color: var(--todo-text); padding: 0 4px; border-radius: 4px; }
#todo-banner {
  display: none; background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; font-size: 0.93rem;
}
.lang-section + .lang-section { margin-top: 64px; padding-top: 32px; border-top: 2px solid var(--border); }
footer { margin-top: 48px; color: var(--muted); font-size: 0.88rem; }

/* Cards (home page) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 20px 0; }
.card {
  display: block; padding: 16px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card strong { display: block; margin-bottom: 4px; }
.card span { color: var(--muted); font-size: 0.92rem; }

/* Steps */
ol.steps { counter-reset: step; list-style: none; padding: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 40px; margin: 12px 0; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; justify-content: center;
}

/* Forms */
form.request { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 16px 0; }
.field { margin: 0 0 14px; }
.field label, .field legend { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.field .hint { color: var(--muted); font-size: 0.85rem; margin: 2px 0 0; }
fieldset.field { border: 0; padding: 0; }
input[type="text"], input[type="email"], textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 6px 0; }
.choice input { margin-top: 6px; }
button.primary {
  appearance: none; border: 0; border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-text); cursor: pointer;
}
button.primary:hover { filter: brightness(1.05); }
.form-result { margin-top: 12px; font-size: 0.93rem; }
.form-result pre {
  white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 0.85rem; margin: 8px 0;
}

/* Narrow screens: multi-column tables become one card per row (labels from the header). */
@media (max-width: 600px) {
  table.stack { min-width: 0; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 3px 0; }
  table.stack td::before {
    content: attr(data-label); display: block; font-size: 0.8rem;
    font-weight: 600; color: var(--muted);
  }
}
@media print {
  .lang, #todo-banner, .topbar { display: none !important; }
  a { color: inherit; }
}
