/* MISAC eBilling Lite - User Guide stylesheet (self-contained, no external deps) */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #1f2733;
  --ink-soft: #475467;
  --ink-faint: #6b7787;
  --line: #e3e8ef;
  --line-strong: #cdd5df;
  --brand: #2570af;
  --brand-2: #ab217f;
  --brand-ink: #1a4e7b;
  --accent: #c5462f;
  --sidebar-bg: #0e2233;
  --sidebar-ink: #b9c6d4;
  --sidebar-ink-soft: #7f93a6;
  --sidebar-active: #1f4d70;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 286px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Shell layout ---------- */
#app-shell { display: flex; min-height: 100vh; }

.gd-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  padding: 0 0 40px;
  scrollbar-width: thin;
  scrollbar-color: #2c4862 transparent;
}
.gd-sidebar::-webkit-scrollbar { width: 8px; }
.gd-sidebar::-webkit-scrollbar-thumb { background: #2c4862; border-radius: 8px; }

.gd-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 22px 18px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #0e2233 70%, rgba(14, 34, 51, .0));
  z-index: 2;
}
.gd-brand .gd-logo {
  width: 40px; height: 40px; border-radius: 9px;
  background: #fff;
  display: grid; place-items: center;
  overflow: hidden; padding: 3px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .28);
  flex: 0 0 40px;
}
.gd-brand .gd-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gd-brand .gd-title { line-height: 1.15; }
.gd-brand .gd-title strong { color: #fff; font-size: 15px; display: block; font-weight: 700; }
.gd-brand .gd-title span { color: var(--sidebar-ink-soft); font-size: 11.5px; letter-spacing: .3px; }

.gd-search {
  margin: 4px 16px 12px;
  position: relative;
}
.gd-search input {
  width: 100%;
  background: #0a1a28;
  border: 1px solid #23415a;
  color: #e7eef4;
  border-radius: 8px;
  padding: 9px 12px 9px 32px;
  font-size: 13.5px;
  outline: none;
}
.gd-search input::placeholder { color: #5e7387; }
.gd-search input:focus { border-color: var(--brand-2); }
.gd-search::before {
  content: "";
  position: absolute; left: 11px; top: 50%; width: 13px; height: 13px;
  transform: translateY(-50%);
  border: 1.6px solid #61788c; border-radius: 50%;
}
.gd-search::after {
  content: ""; position: absolute; left: 21px; top: 22px; width: 6px; height: 1.6px;
  background: #61788c; transform: rotate(45deg);
}

.gd-nav { padding: 4px 12px; }
.gd-nav-group { margin-bottom: 4px; }
.gd-nav-group > .gd-nav-head {
  color: var(--sidebar-ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: 14px 12px 6px;
}
.gd-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-ink);
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.3;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.gd-nav a .gd-ic { width: 16px; text-align: center; opacity: .7; font-size: 13px; flex: 0 0 16px; }
.gd-nav a:hover { background: #16344c; color: #fff; text-decoration: none; }
.gd-nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-2);
}
.gd-nav a.active .gd-ic { opacity: 1; color: #ec8fc8; }

/* ---------- Main column ---------- */
.gd-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.gd-topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 11px 30px;
}
.gd-burger {
  display: none;
  width: 38px; height: 36px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: #fff; cursor: pointer;
  align-items: center; justify-content: center; flex-direction: column; gap: 3px;
}
.gd-burger span { width: 17px; height: 2px; background: var(--ink-soft); border-radius: 2px; }
.gd-crumb { color: var(--ink-faint); font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.gd-crumb b { color: var(--ink); font-weight: 600; }
.gd-crumb .sep { color: var(--line-strong); }
.gd-topbar .gd-spacer { flex: 1; }
.gd-topbar .gd-home {
  font-size: 13px; color: var(--ink-soft); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 7px; background: #fff;
}
.gd-topbar .gd-home:hover { background: var(--surface-2); text-decoration: none; }

.content {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 38px 38px 90px;
}

/* ---------- Typography ---------- */
.content h1 {
  font-size: 31px; line-height: 1.2; margin: 0 0 6px;
  letter-spacing: -.02em; color: var(--brand-ink);
}
.content .lede { font-size: 17px; color: var(--ink-soft); margin: 0 0 26px; }
.content h2 {
  font-size: 22px; margin: 42px 0 12px; padding-top: 8px;
  letter-spacing: -.01em; color: var(--brand-ink);
  border-top: 1px solid var(--line);
}
.content h2:first-of-type { border-top: 0; }
.content h3 { font-size: 17.5px; margin: 28px 0 8px; color: var(--ink); }
.content h4 { font-size: 15px; margin: 20px 0 6px; color: var(--ink); text-transform: none; }
.content p { margin: 11px 0; }
.content ul, .content ol { margin: 11px 0; padding-left: 24px; }
.content li { margin: 5px 0; }
.content strong { font-weight: 650; color: #16202c; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

.anchor { scroll-margin-top: 72px; }

/* ---------- Page meta header ---------- */
.page-head {
  display: flex; align-items: flex-start; gap: 16px; margin-bottom: 8px;
}
.page-head .ph-icon {
  flex: 0 0 54px; width: 54px; height: 54px; border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), var(--brand-ink));
  color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 700;
  box-shadow: var(--shadow);
}
.page-head .ph-icon.alt { background: linear-gradient(135deg, var(--brand-2), #7d1a5c); }
.page-head .ph-icon.warm { background: linear-gradient(135deg, #c5462f, #8f2c1c); }
.page-head .ph-icon.logo { background: #fff; padding: 7px; box-shadow: var(--shadow); }
.page-head .ph-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 24px; }

/* ---------- Pills / tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 10px; border-radius: 20px;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line);
}
.pill.brand { background: #e7f0f7; color: var(--brand-ink); border-color: #c5dcec; }
.pill.green { background: #e4f6f1; color: #0b6a60; border-color: #bce6dc; }
.pill.amber { background: #fef3e2; color: #92580a; border-color: #f6dcae; }
.pill.red   { background: #fdecea; color: #a3331f; border-color: #f5c9c1; }
.pill.violet{ background: #efeafc; color: #5b3bb3; border-color: #d8cdf4; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Callouts ---------- */
.callout {
  position: relative;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 13px 16px 13px 16px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.callout .co-title {
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
  text-transform: uppercase; margin-bottom: 4px; color: var(--brand);
  display: flex; align-items: center; gap: 7px;
}
.callout p:first-of-type { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout.note  { border-left-color: #2563eb; background: #f5f8ff; }
.callout.note  .co-title { color: #1d4ed8; }
.callout.tip   { border-left-color: #0f8a7e; background: #f1fbf8; }
.callout.tip   .co-title { color: #0b6a60; }
.callout.warn  { border-left-color: #d98a08; background: #fffaf0; }
.callout.warn  .co-title { color: #92580a; }
.callout.danger{ border-left-color: #dc2626; background: #fff5f4; }
.callout.danger .co-title { color: #b21f12; }
.callout.ird   { border-left-color: #6d3bd4; background: #f8f5ff; }
.callout.ird   .co-title { color: #5b3bb3; }

/* ---------- Field tables ---------- */
.field-table-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
table.field-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
table.field-table thead th {
  background: var(--surface-2);
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-faint); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.field-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.field-table tr:last-child td { border-bottom: 0; }
table.field-table tbody tr:hover { background: #fafcfe; }
table.field-table td.f-name { white-space: nowrap; font-weight: 600; color: #16202c; }
table.field-table td.f-name code { font-size: 12.5px; }
table.field-table .req { color: #c5462f; font-weight: 700; }
table.field-table .opt { color: var(--ink-faint); }
.f-type {
  display: inline-block; font-size: 11px; font-weight: 600; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 7px; white-space: nowrap;
}

/* generic doc table */
table.doc-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.doc-table th { background: var(--surface-2); text-align: left; padding: 10px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); border-bottom: 1px solid var(--line); }
table.doc-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.doc-table tr:last-child td { border-bottom: 0; }

/* ---------- Steps ---------- */
ol.steps { list-style: none; counter-reset: step; padding-left: 0; margin: 18px 0; }
ol.steps > li {
  position: relative; padding: 2px 0 16px 46px; margin: 0;
  border-left: 2px solid var(--line); margin-left: 15px;
}
ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: -16px; top: -2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
  display: grid; place-items: center; box-shadow: 0 0 0 4px var(--bg);
}
ol.steps > li .s-title { font-weight: 650; color: #16202c; display: block; margin-bottom: 2px; }

/* ---------- Inline bits ---------- */
code:not(pre code) {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px; color: #9333a8; white-space: nowrap;
}
.kbd {
  font-family: var(--mono); font-size: 12px; background: #fff;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 6px; color: var(--ink);
}
.path { font-family: var(--mono); font-size: 13px; color: var(--brand-ink); background: #eef4f9; padding: 2px 7px; border-radius: 5px; border: 1px solid #d4e3ee; }

/* ---------- Cards (index) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 16px; margin: 22px 0; }
.gcard {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s; color: inherit;
}
.gcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); text-decoration: none; }
.gcard .gc-ic {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-ink));
}
.gcard.alt .gc-ic { background: linear-gradient(135deg, var(--brand-2), #7d1a5c); }
.gcard.warm .gc-ic { background: linear-gradient(135deg, #c5462f, #8f2c1c); }
.gcard.violet .gc-ic { background: linear-gradient(135deg, #6d3bd4, #4a2596); }
.gcard h3 { margin: 0 0 4px; font-size: 16px; color: var(--brand-ink); }
.gcard p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin: 30px 0 0; }

/* ---------- Prev / next ---------- */
.page-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); }
.page-nav a {
  flex: 1 1 0; min-width: 0; display: block; padding: 13px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.page-nav a:hover { border-color: var(--brand-2); text-decoration: none; }
.page-nav a.next { text-align: right; }
.page-nav .pn-dir { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; }
.page-nav .pn-ttl { font-size: 15px; font-weight: 600; color: var(--brand-ink); }
.page-nav a.disabled { visibility: hidden; }

/* ---------- "On this page" floating TOC ---------- */
.content-toc {
  display: none;
}

/* ---------- Definition list ---------- */
dl.defs { margin: 14px 0; }
dl.defs dt { font-weight: 650; color: #16202c; margin-top: 12px; }
dl.defs dd { margin: 2px 0 0 0; color: var(--ink-soft); }

.muted { color: var(--ink-faint); }
.small { font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  :root { --sidebar-w: 260px; }
  .gd-sidebar {
    position: fixed; left: 0; top: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .gd-sidebar { transform: translateX(0); }
  body.nav-open .gd-scrim { display: block; }
  .gd-scrim { display: none; position: fixed; inset: 0; background: rgba(8, 16, 24, .42); z-index: 30; }
  .gd-burger { display: flex; }
  .content { padding: 26px 20px 80px; }
}
@media (max-width: 560px) {
  .page-head .ph-icon { flex-basis: 46px; width: 46px; height: 46px; font-size: 20px; }
  .content h1 { font-size: 25px; }
  .page-nav { flex-direction: column; }
}

/* ---------- Print ---------- */
@media print {
  .gd-sidebar, .gd-topbar, .page-nav, .gd-scrim { display: none !important; }
  #app-shell { display: block; }
  .content { max-width: none; padding: 0; }
  .callout, .gcard, .field-table-wrap { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
