/* ===========================
   SALEMAN DOCS — style.css
   =========================== */

:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --brand-mid: #6366f1;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-w: 280px;
  --header-h: 60px;
  --radius: 10px;
  --shadow: 0 2px 16px rgba(79,70,229,.08);
  --code-bg: #1e293b;
  --tag-bg: #ede9fe;
  --tag-text: #5b21b6;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo .logo-mark {
  width: 38px; height: 38px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: #fff;
  flex-shrink: 0;
}

.sidebar-logo .logo-text { color: #fff; font-size: 17px; font-weight: 700; line-height: 1.2; }
.sidebar-logo .logo-ver { color: #64748b; font-size: 11px; }

.sidebar-search {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-search input {
  width: 100%;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  color: #fff;
  font-size: 13px;
  outline: none;
  position: relative;
}

.sidebar-search input::placeholder { color: #475569; }

.sidebar-search .search-icon {
  position: absolute;
  left: 28px;
  margin-top: -28px;
  color: #475569;
  font-size: 13px;
  pointer-events: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 40px;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.nav-group { margin-bottom: 6px; }

.nav-group-label {
  color: #475569;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 20px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0;
  transition: all .18s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-link:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.nav-link.active { color: #a5b4fc; background: rgba(99,102,241,.14); border-left-color: #6366f1; }
.nav-link i { width: 17px; text-align: center; flex-shrink: 0; font-size: 13px; }

.nav-sub { padding-left: 28px; }
.nav-sub .nav-link { padding: 7px 20px 7px 12px; font-size: 13px; }

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOP HEADER ── */
.top-bar {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: rgba(248,250,252,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 50;
}

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-muted); }
.breadcrumb a { color: var(--brand); text-decoration: none; }
.breadcrumb .sep { color: #cbd5e1; }

.top-bar-right { display: flex; align-items: center; gap: 12px; }

.badge-version {
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid #c7d2fe;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.btn-launch {
  background: var(--brand);
  color: #fff;
  padding: 7px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background .18s;
}
.btn-launch:hover { background: var(--brand-dark); }

/* ── PAGE CONTENT ── */
.content {
  padding: 48px 48px 80px;
  max-width: 1100px;
}

section[id] { scroll-margin-top: 80px; }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, #818cf8 100%);
  border-radius: 18px;
  padding: 52px 56px;
  color: #fff;
  margin-bottom: 52px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  pointer-events: none;
}
.hero h1 { font-size: 2.4rem; font-weight: 900; margin-bottom: 12px; line-height: 1.2; }
.hero p  { font-size: 1.05rem; color: rgba(255,255,255,.82); max-width: 560px; line-height: 1.6; }
.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-tag {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* ── SECTION HEADINGS ── */
.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title i { color: var(--brand); font-size: 1.2rem; }

.section-desc { color: var(--text-muted); font-size: 14.5px; margin-bottom: 28px; line-height: 1.65; }

.doc-section { margin-bottom: 64px; }

/* ── FEATURE GRID ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.feature-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: box-shadow .2s, transform .2s;
}
.feature-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.feature-card .fc-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--brand);
  margin-bottom: 14px;
}
.feature-card h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; }
.feature-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

/* ── TABLE ── */
.doc-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); margin-bottom: 20px; }
.doc-table th { background: var(--brand-light); color: var(--brand-dark); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: 12px 16px; text-align: left; }
.doc-table td { padding: 12px 16px; font-size: 13.5px; border-top: 1px solid var(--border); vertical-align: top; }
.doc-table tr:hover td { background: #fafafe; }

/* ── CODE BLOCK ── */
.code-block {
  background: var(--code-bg);
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 18px 22px;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  margin-bottom: 20px;
  position: relative;
}
.code-label {
  font-size: 11px;
  background: #334155;
  color: #94a3b8;
  padding: 2px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.code-block .hlk { color: #818cf8; }
.code-block .hls { color: #34d399; }
.code-block .hlc { color: #fbbf24; }
.code-block .hlr { color: #f87171; }

/* ── CALLOUT ── */
.callout {
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.6;
}
.callout i { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.callout.info  { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.callout.info i { color: #3b82f6; }
.callout.warn  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.callout.warn i { color: #f59e0b; }
.callout.tip   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.callout.tip i { color: #22c55e; }
.callout.rbac  { background: #fdf4ff; border: 1px solid #e9d5ff; color: #6b21a8; }
.callout.rbac i { color: #a855f7; }

/* ── SCREENSHOT PLACEHOLDER ── */
.screenshot-box {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f1f5f9;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #94a3b8;
  margin: 20px 0;
  font-size: 14px;
}
.screenshot-box i { font-size: 36px; color: #cbd5e1; }
.screenshot-box .ss-label {
  font-weight: 700;
  color: #64748b;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .7px;
}
.screenshot-box .ss-note {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  max-width: 360px;
  line-height: 1.5;
}

.screenshot-box.tall { min-height: 420px; }
.screenshot-box.wide { min-height: 240px; }

/* ── STEPS ── */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 18px; margin-bottom: 20px; }
.step-item { display: flex; gap: 18px; align-items: flex-start; }
.step-num {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.step-body { flex: 1; padding-top: 6px; }
.step-body h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.step-body p  { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }

/* ── PILL TAG ── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pill.manager   { background: #dbeafe; color: #1d4ed8; }
.pill.worker    { background: #dcfce7; color: #15803d; }
.pill.finance   { background: #ffedd5; color: #c2410c; }
.pill.logistics { background: #fce7f3; color: #9d174d; }
.pill.rbac-all  { background: var(--tag-bg); color: var(--tag-text); }

/* ── FUNCTION LIST ── */
.fn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.fn-chip {
  background: var(--code-bg);
  color: #a5b4fc;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12.5px;
  border: 1px solid #334155;
}
.fn-chip .fn-type { color: #94a3b8; font-size: 11px; display: block; margin-bottom: 2px; }

/* ── API ENDPOINT ── */
.endpoint {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.endpoint .method {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  flex-shrink: 0;
  text-transform: uppercase;
}
.method.get { background: #dcfce7; color: #15803d; }
.method.post{ background: #dbeafe; color: #1d4ed8; }
.endpoint .ep-path { font-family: monospace; font-size: 13px; font-weight: 700; color: var(--text); }
.endpoint .ep-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ── DIVIDER ── */
.doc-divider { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

/* ── TOC FLOATING ── */
.toc-sidebar {
  position: fixed;
  right: 32px;
  top: 80px;
  width: 200px;
  display: none;
}

@media (min-width: 1500px) {
  .toc-sidebar { display: block; }
  .content { max-width: 900px; }
}

.toc-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }
.toc-link { display: block; padding: 4px 0; font-size: 12.5px; color: var(--text-muted); text-decoration: none; transition: color .18s; }
.toc-link:hover, .toc-link.active { color: var(--brand); }

/* ── ROLE MATRIX ── */
.role-matrix td { text-align: center; }
.role-matrix td:first-child { text-align: left; }
.check { color: var(--success); }
.cross { color: #cbd5e1; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 28px 20px 60px; }
  .hero { padding: 32px 28px; }
  .hero h1 { font-size: 1.7rem; }
  .feature-grid { grid-template-columns: 1fr; }
}
