/* DentLegal — document pages (PRD, flows, architecture, proposals) */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.doc { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.85; font-size: 15px; -webkit-font-smoothing: antialiased; overflow-x: clip; }
a { color: var(--teal-700); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* top nav */
.doc-top { position: sticky; top: 0; z-index: 30; background: var(--navy-950); color: #dbe9ec; }
.doc-top .in { max-width: 1240px; margin: 0 auto; padding: 0 20px; height: 58px; display: flex; align-items: center; gap: 18px; }
.doc-top .brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.doc-top .brand .mk { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(140deg, var(--teal-500), var(--navy-800)); display: grid; place-items: center; }
.doc-top .brand .mk svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 1.7; }
.doc-top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.doc-top nav::-webkit-scrollbar { display: none; }
.doc-top nav a { color: #b8d0d6; text-decoration: none; padding: 6px 11px; border-radius: 9px; font-size: 13.5px; white-space: nowrap; }
.doc-top nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.doc-top nav a.on { background: rgba(22,160,138,.25); color: #fff; }

/* hero */
.doc-hero { background: radial-gradient(900px 400px at 85% -30%, rgba(22,160,138,.3), transparent 60%), linear-gradient(160deg, var(--navy-950), var(--navy-800)); color: #fff; }
.doc-hero .in { max-width: 1240px; margin: 0 auto; padding: 44px 20px 40px; }
.doc-hero .kicker { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; color: #e9c98f; background: rgba(184,146,79,.16); border: 1px solid rgba(184,146,79,.35); padding: 3px 12px; border-radius: 999px; }
.doc-hero h1 { font-size: 36px; line-height: 1.35; margin: 14px 0 8px; }
.doc-hero p.lead { font-size: 17px; color: #b7cfd5; max-width: 820px; margin: 0; }
.doc-hero .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.doc-hero .meta span { font-size: 12.5px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); padding: 3px 11px; border-radius: 999px; color: #d6e7ea; }

/* layout */
.doc-wrap { max-width: 1240px; margin: 0 auto; padding: 28px 20px 60px; display: grid; grid-template-columns: 250px 1fr; gap: 32px; align-items: start; }
.toc { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.toc b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.toc a { display: block; padding: 5px 9px; border-radius: 8px; color: var(--ink-2); text-decoration: none; line-height: 1.5; }
.toc a:hover { background: var(--bg); }
.toc a.on { background: var(--teal-50); color: var(--teal-700); font-weight: 600; }
.doc-main { min-width: 0; }
.doc-main > section { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 30px; margin-bottom: 20px; }
.doc-main h2 { font-size: 23px; margin: 0 0 14px; line-height: 1.4; display: flex; align-items: center; gap: 10px; scroll-margin-top: 80px; }
.doc-main h2 .n { width: 34px; height: 34px; border-radius: 10px; background: var(--teal-50); color: var(--teal-700); display: grid; place-items: center; font-size: 15px; flex: none; }
.doc-main h3 { font-size: 17px; margin: 22px 0 8px; color: var(--navy-900); }
.doc-main h4 { font-size: 15px; margin: 16px 0 6px; }
.doc-main p { margin: 0 0 12px; }
.doc-main ul, .doc-main ol { margin: 0 0 12px; padding-right: 22px; }
.doc-main li { margin: 3px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* components */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.box { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); }
.box.tint { background: var(--teal-50); border-color: var(--teal-100); }
.box.gold { background: var(--gold-100); border-color: #ead9b8; }
.box.dark { background: var(--navy-900); color: #e3eef0; border-color: var(--navy-900); }
.box.dark h4 { color: #fff; }
.box h4 { margin: 0 0 6px; display: flex; gap: 8px; align-items: center; }
.box p:last-child, .box ul:last-child { margin-bottom: 0; }
.ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-700); margin-bottom: 10px; }
.ico svg { width: 22px; height: 22px; }
.stat { text-align: center; padding: 18px 10px; }
.stat b { display: block; font-size: 28px; color: var(--teal-700); line-height: 1.2; }
.stat span { font-size: 13px; color: var(--muted); }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--blue-50); color: #1d3f86; margin: 12px 0; font-size: 14px; }
.callout.warn { background: var(--amber-50); color: #6e4600; }
.callout.ok { background: var(--green-50); color: #14532d; }
.callout.teal { background: var(--teal-50); color: var(--teal-700); }
.callout svg { flex: none; margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-green { background: var(--green-50); color: var(--green-600); }
.b-amber { background: var(--amber-50); color: var(--amber-600); }
.b-red { background: var(--red-50); color: var(--red-600); }
.b-blue { background: var(--blue-50); color: var(--blue-600); }
.b-violet { background: var(--violet-50); color: var(--violet-600); }
.b-teal { background: var(--teal-50); color: var(--teal-700); }
.b-gold { background: var(--gold-100); color: var(--gold-600); }
.b-gray { background: var(--bg-2); color: var(--ink-2); }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 14px; }
table.t th { background: var(--bg); text-align: right; font-weight: 600; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.c, table.t th.c { text-align: center; }
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.tw table.t { margin: 0; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--bg); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }

/* flow diagrams */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin: 14px 0; row-gap: 14px; }
.fnode { background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 14px; padding: 10px 14px; min-width: 130px; max-width: 220px; font-size: 13.5px; line-height: 1.6; position: relative; }
.fnode b { display: block; font-size: 13.5px; }
.fnode span { color: var(--muted); font-size: 12px; }
.fnode.start { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.fnode.start span { color: #a9c3ca; }
.fnode.ai { border-color: #cdbdf0; background: var(--violet-50); }
.fnode.law { border-color: #e2cfa6; background: var(--gold-100); }
.fnode.ok { border-color: var(--teal-300); background: var(--teal-50); }
.fnode.dec { border-style: dashed; border-color: var(--amber-600); background: var(--amber-50); }
.farrow { width: 34px; display: grid; place-items: center; color: var(--faint); align-self: center; }
.farrow::before { content: "←"; font-size: 20px; }
.lanes { display: grid; grid-template-columns: 54px repeat(4, 1fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; font-size: 13px; }
.lanes .lh { background: var(--navy-900); color: #fff; padding: 10px; font-weight: 700; text-align: center; font-size: 13.5px; }
.lanes .ln { background: var(--bg); border-top: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.lanes .lc { border-top: 1px solid var(--line); border-right: 1px dashed var(--line); padding: 8px; min-height: 54px; }
.lanes .lc .fnode { max-width: none; min-width: 0; }
.lanes .lc.on::after { content: ""; }

/* timeline (gantt) */
.gantt { display: grid; grid-template-columns: 210px 1fr; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 13px; }
.gantt .gh { background: var(--bg); padding: 8px 12px; font-weight: 600; border-bottom: 1px solid var(--line); }
.gantt .weeks { display: grid; background: var(--bg); border-bottom: 1px solid var(--line); }
.gantt .weeks span { text-align: center; font-size: 11px; color: var(--muted); padding: 8px 0; border-right: 1px solid var(--line); }
.gantt .gl { padding: 9px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.gantt .gr { position: relative; border-bottom: 1px solid var(--line); display: grid; }
.gantt .bar { height: 22px; align-self: center; border-radius: 7px; background: var(--teal-500); color: #fff; font-size: 11px; display: grid; place-items: center; white-space: nowrap; overflow: hidden; }
.gantt .bar.navy { background: var(--navy-700); }
.gantt .bar.violet { background: #7d5cd1; }
.gantt .bar.gold { background: var(--gold-500); }
.gantt .bar.gray { background: #8a9aa1; }
.gantt .ms { width: 14px; height: 14px; background: var(--gold-500); transform: rotate(45deg); align-self: center; justify-self: center; border-radius: 3px; }

/* sign-off */
.sign { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 12px; }
.sign .s { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 16px; min-height: 130px; }
.sign .s div { border-bottom: 1px solid var(--line-2); height: 30px; margin-bottom: 8px; }
.check-list { list-style: none; padding: 0 !important; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.check-list li::before { content: ""; width: 16px; height: 16px; border: 2px solid var(--teal-500); border-radius: 4px; flex: none; margin-top: 5px; }

.doc-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 20px 40px; }

@media (max-width: 980px) {
  .doc-wrap { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
  .g3, .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .doc-hero h1 { font-size: 26px; }
  .doc-hero .in { padding: 30px 16px; }
  .doc-wrap { padding: 16px 12px 40px; }
  .doc-main > section { padding: 20px 16px; border-radius: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .lanes { grid-template-columns: 34px repeat(4, minmax(120px, 1fr)); overflow-x: auto; display: grid; }
  .lanes-wrap { overflow-x: auto; }
  .gantt { grid-template-columns: 130px 1fr; }
  .sign { grid-template-columns: 1fr; }
  .farrow { width: 100%; height: 22px; }
  .farrow::before { content: "↓"; }
  .flow { flex-direction: column; }
  .fnode { max-width: none; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  body.doc { background: #fff; font-size: 12.5px; }
  .doc-top, .toc { display: none; }
  .doc-wrap { display: block; padding: 0; }
  .doc-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-main > section { break-inside: auto; border: 0; padding: 10px 0; }
  .box, .fnode, table.t tr, .callout { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
