:root {
  --bg: #fff;
  --bg2: #f7f7f5;
  --line: #e8e8e4;
  --text: #111;
  --muted: #666;
  --accent: #7a613f;
  --onec: #1565c0;
  --onec-bg: #e8f1fb;
  --ok: #1b7a3d;
  --slide-pad: 20px 28px;
  --bar-h: 48px;
  --footer-h: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button, textarea, input { font: inherit; }

.deck {
  display: grid;
  grid-template-rows: var(--bar-h) 1fr var(--footer-h);
  height: 100vh;
}

/* ── top bar ── */
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.bar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.logo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.bar__sep { color: var(--muted); }
.bar__topic { font-size: 13px; color: var(--muted); white-space: nowrap; }

.dots {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
}

.dot.active { background: var(--accent); transform: scale(1.25); }
.dot.done { background: var(--ok); }

.bar__right {
  display: flex;
  gap: 6px;
  min-width: 140px;
  justify-content: flex-end;
}

.btn {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  line-height: 1;
}

.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { filter: brightness(0.97); }

/* ── drawer ── */
.drawer[hidden] { display: none; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.25);
}

.drawer__panel {
  width: min(300px, 90vw);
  height: 100%;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.drawer__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.drawer__list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.drawer__item {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.drawer__item:hover { background: var(--bg2); }
.drawer__item.active { background: var(--bg2); font-weight: 600; }
.drawer__item.done .drawer__num { background: var(--ok); color: #fff; }

.drawer__num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--line);
  display: grid;
  place-items: center;
  font-size: 11px;
  flex-shrink: 0;
}

.drawer__reset { margin: 8px; }

/* ── slide ── */
.slide {
  padding: var(--slide-pad);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slide__head { flex-shrink: 0; }

.slide__title {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.slide__lead {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.slide__flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chip {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
}

.chip.onec { background: var(--onec-bg); border-color: #c5daf0; color: var(--onec); }
.chip-arrow { color: var(--muted); font-size: 12px; }

.slide__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 700px;
  gap: 16px;
}

@media (max-width: 900px) {
  .slide__body { grid-template-columns: 1fr; overflow: auto; }
  html, body { overflow: auto; }
  .deck { height: auto; min-height: 100vh; }
}

/* ── visual pane ── */
.visual {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.tab {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
}

.tab.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.visual__panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  padding: 14px;
}

/* entity diagram */
.diagram {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.entity {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 200px;
  max-width: 280px;
  flex: 1;
}

.entity__name {
  padding: 8px 10px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.entity__path {
  font-weight: 400;
  font-size: 10px;
  color: var(--muted);
}

.entity__fields { padding: 4px 0; }

.field {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  font-size: 12px;
  border-left: 3px solid transparent;
}

.field.onec {
  border-left-color: var(--onec);
  background: var(--onec-bg);
}

.field__name { font-family: ui-monospace, monospace; font-size: 11px; }
.field__type { color: var(--muted); font-size: 11px; text-align: right; }
.field__note {
  padding: 0 10px 4px 13px;
  font-size: 11px;
  color: var(--muted);
}

.diagram__arrow {
  align-self: center;
  color: var(--muted);
  font-size: 20px;
  padding: 0 4px;
}

/* status pipeline */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.pipe-step {
  padding: 4px 8px;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.pipe-step::after {
  content: "→";
  margin-left: 6px;
  color: var(--muted);
}

.pipe-step:last-child::after { content: ""; margin: 0; }

/* mapping cards */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.map-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.map-card__site {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--onec);
}

.map-card__label { font-size: 12px; margin: 2px 0 6px; }

.map-card input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
}

/* json sample */
.json-block {
  margin-top: 10px;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow: auto;
  max-height: 180px;
}

.json-block .k { color: #9cdcfe; }
.json-block .s { color: #ce9178; }
.json-block .n { color: #b5cea8; }
.json-block .c { color: #6a9955; }

.json-toggle {
  font-size: 11px;
  color: var(--onec);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-top: 6px;
}

/* glossary / mvp compact */
.mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-item {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}

.mini-item strong { display: block; margin-bottom: 2px; }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--bg2);
  margin-left: 6px;
}

.tag.mvp { background: #e6f4ea; color: var(--ok); }

.empty-visual {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.visual__panel--center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.env-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 720px;
}

@media (max-width: 700px) {
  .env-board { grid-template-columns: 1fr; }
}

.env-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.env-col__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.env-link {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s, background 0.12s;
}

.env-link:hover {
  border-color: var(--onec);
  background: var(--onec-bg);
}

.env-link__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--onec);
}

.env-link__url {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.access-box {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.access-box__title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.access-box__note {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

.access-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 12px;
  margin-top: 4px;
}

.access-row__key {
  width: 52px;
  flex-shrink: 0;
  color: var(--muted);
}

.access-row__val {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── discuss pane ── */
.discuss {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.discuss__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-add-q {
  padding: 4px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--onec);
  cursor: pointer;
}

.btn-add-q:hover {
  border-color: var(--onec);
  background: var(--onec-bg);
}

.discuss__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.q-acc--custom { border-style: dashed; }

.q-acc__badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.q-acc__edit {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  color: inherit;
}

.q-acc__edit:focus { outline: none; }

.q-acc__del {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.q-acc__del:hover { color: #b33; }

.q-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.q-acc {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}

.q-acc.open { border-color: #d8d8d3; }

.q-acc.has-note:not(.done) { border-left: 2px solid var(--onec); }

.q-acc.done {
  border-color: #b8dfc4;
  background: #eef8f1;
}

.q-acc.done.has-note { border-left: 2px solid var(--ok); }

.q-acc__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
}

.q-acc__head:hover { background: var(--bg2); }

.q-acc.done .q-acc__text {
  color: var(--ok);
  font-weight: 500;
}

.q-acc__check {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--ok);
  cursor: pointer;
}

.q-acc__text { display: block; }

.q-acc__main { flex: 1; min-width: 0; }

.q-acc__explain {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  font-weight: 400;
}

.q-acc.done .q-acc__explain { color: #3d8b55; }

.q-acc__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.q-acc__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--onec);
}

.q-acc__chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.15s;
}

.q-acc.open .q-acc__chevron { transform: rotate(180deg); }

.q-acc__body {
  display: none;
  padding: 0 10px 8px 28px;
  border: none;
  background: transparent;
}

.q-acc.open .q-acc__body { display: block; }

.q-acc__note {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
  padding: 6px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  resize: vertical;
  font-size: 12px;
  line-height: 1.4;
  background: transparent;
}

.q-acc__note::placeholder { color: #aaa; }

.q-acc__note:focus {
  outline: none;
  border-bottom-color: var(--onec);
}

.q-acc__autosave {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}

.decision {
  flex-shrink: 0;
}

.decision textarea {
  width: 100%;
  height: 48px;
  padding: 6px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  resize: vertical;
  font-size: 12px;
  background: transparent;
}

.decision textarea:focus {
  outline: none;
  border-bottom-color: var(--onec);
}

/* ── footer hints ── */
.hints {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
  background: var(--bg2);
}

.toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  background: var(--text);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}

.toast.show { opacity: 1; }
