/* GRAINSCO — Documentation styles */

:root {
  /* surfaces */
  --bg: #ffffff;
  --sidebar-bg: #f8fafc;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;

  /* text */
  --text: #334155;
  --text-strong: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* accent */
  --accent: #2563eb;
  --accent-soft: #eff6ff;

  /* status colors */
  --status-green: #10b981;
  --status-green-soft: #d1fae5;
  --status-yellow: #f59e0b;
  --status-yellow-soft: #fef3c7;
  --status-blue: #3b82f6;
  --status-blue-soft: #dbeafe;
  --status-red: #ef4444;
  --status-red-soft: #fee2e2;
  --status-grey: #94a3b8;
  --status-grey-soft: #f1f5f9;

  /* radii + shadow */
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04),
                 0 4px 12px rgba(15, 23, 42, .04);
  --shadow-hero: 0 4px 20px rgba(99, 102, 241, .14);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 28px; color: var(--text-strong); font-weight: 700; margin: 0 0 8px; }
h2 { font-size: 22px; color: var(--text-strong); font-weight: 700; margin: 0 0 4px; }
h3 { font-size: 16px; color: var(--text-strong); font-weight: 600; margin: 28px 0 8px; }
h4 { font-size: 14px; color: var(--text-strong); font-weight: 600; margin: 20px 0 6px; }
.section-meta { color: var(--text-muted); font-size: 13px; margin: 0 0 12px; }
.section-meta code {
  background: var(--border-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
}

ul { padding-left: 24px; margin: 8px 0 16px; }
li { margin-bottom: 6px; }

code {
  background: var(--border-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Icons ---------- */
.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }
.icon-inline {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 4px;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.sidebar-home:hover { color: var(--text-strong); background: var(--border-soft); text-decoration: none; }
.sidebar-title {
  font-size: 16px;
  margin: 0 8px 24px;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: background .12s, color .12s;
}
.nav-link:hover { background: var(--border-soft); color: var(--text-strong); text-decoration: none; }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.active .icon { stroke: var(--accent); }
.nav-link .icon { stroke: currentColor; }
.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-faint);
  margin: 24px 12px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.nav-module-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-strong);
  font-weight: 800;
  margin: 28px 0 10px;
  padding: 10px 12px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-module-label .icon { stroke: var(--accent); }
.nav-module-label.module-pc {
  background: #ccfbf1;
  border-left-color: #0d9488;
  color: #0f3a37;
}
.nav-module-label.module-pc .icon { stroke: #0d9488; }
.nav-module-label.module-soon {
  background: var(--border-soft);
  border-left-color: var(--text-faint);
  color: var(--text-muted);
}
.nav-module-label.module-soon .icon { stroke: var(--text-faint); }
.nav-link.coming-soon {
  color: var(--text-faint);
  cursor: default;
  font-style: italic;
}
.nav-link.coming-soon:hover { background: transparent; color: var(--text-faint); }

.main {
  padding: 40px 56px 64px;
  max-width: 920px;
}

/* ---------- Page hero ---------- */
.page-hero {
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #fff;
  padding: 32px 32px;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  box-shadow: var(--shadow-hero);
  display: flex;
  align-items: center;
  gap: 20px;
}
.page-hero-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.page-hero-icon .icon { width: 28px; height: 28px; stroke: #fff; stroke-width: 2; }
.page-hero h1 { color: #fff; font-size: 26px; margin: 0 0 4px; }
.page-hero p { margin: 0; color: rgba(255,255,255,.86); font-size: 14px; }

/* ---------- Section header (icon + title) ---------- */
.view-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-soft);
}
.view-section:last-child { border-bottom: none; }
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.section-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--icon-bg, var(--accent-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-icon .icon {
  width: 22px;
  height: 22px;
  stroke: var(--icon-color, var(--accent));
}
.section-header-text { flex: 1; min-width: 0; }
.section-header-text h2 { margin: 4px 0 2px; }

/* ---------- Inline pieces ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: middle;
}
.badge.green  { background: var(--status-green-soft);  color: #065f46; }
.badge.yellow { background: var(--status-yellow-soft); color: #92400e; }
.badge.blue   { background: var(--status-blue-soft);   color: #1e40af; }
.badge.red    { background: var(--status-red-soft);    color: #991b1b; }
.badge.grey   { background: var(--status-grey-soft);   color: #334155; }
.badge .icon { width: 12px; height: 12px; }

/* "Watch this part" callout */
.video-callout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 8px;
  transition: background .12s, transform .12s;
}
.video-callout:hover { text-decoration: none; background: #dbeafe; transform: translateY(-1px); }
.video-callout .icon { stroke: currentColor; }

/* Coming soon block */
.coming-soon-block {
  background: var(--sidebar-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  color: var(--text-muted);
  margin: 16px 0;
}
.coming-soon-block .icon {
  width: 28px; height: 28px;
  stroke: var(--text-faint);
  margin-bottom: 8px;
}
.coming-soon-block strong { color: var(--text-strong); display: block; margin-bottom: 4px; }
.coming-soon-block p { margin: 0; font-size: 13px; }

/* Pretty bullet lists with icon-marker (used selectively) */
.feature-list { list-style: none; padding-left: 0; }
.feature-list li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 10px;
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .8;
}

/* ---------- Landing page ---------- */
.landing { max-width: 880px; margin: 0 auto; padding: 80px 24px; }
.landing-header { margin-bottom: 40px; text-align: center; }
.landing-header .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  margin-bottom: 20px;
  box-shadow: var(--shadow-hero);
}
.landing-header .brand-mark .icon { width: 32px; height: 32px; stroke: #fff; }
.landing-header h1 { font-size: 38px; margin-bottom: 6px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  opacity: 0;
  transition: opacity .15s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  border-color: var(--accent);
  text-decoration: none;
}
.card:hover::before { opacity: 1; }
.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.card-icon .icon { width: 22px; height: 22px; stroke: var(--accent); }
.card.video .card-icon { background: #e0e7ff; }
.card.video .card-icon .icon { stroke: #6366f1; }
.card h3 {
  margin: 0 0 6px;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card h3 .arrow {
  font-size: 18px;
  color: var(--text-faint);
  transition: transform .15s, color .15s;
}
.card:hover h3 .arrow { color: var(--accent); transform: translateX(4px); }
.card p  { margin: 0; color: var(--text-muted); font-size: 14px; }
.landing-footer { margin-top: 48px; text-align: center; }

/* ---------- Workflow summary table ---------- */
.workflow-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.workflow-table thead { background: var(--sidebar-bg); }
.workflow-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.workflow-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
.workflow-table tbody tr:last-child td { border-bottom: none; }
.workflow-table td:first-child {
  font-weight: 700;
  color: var(--text-faint);
  width: 40px;
  text-align: center;
}
.workflow-table td:nth-child(2) { width: 130px; }

.role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.role::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.role-dispatcher { background: #dbeafe; color: #1e40af; }
.role-dispatcher::before { background: #2563eb; }
.role-driver { background: #fef3c7; color: #92400e; }
.role-driver::before { background: #d97706; }
.role-manager { background: #e0e7ff; color: #3730a3; }
.role-manager::before { background: #6366f1; }
.role-technician { background: #ccfbf1; color: #115e59; }
.role-technician::before { background: #0d9488; }
.role-system { background: #f1f5f9; color: #334155; }
.role-system::before { background: #64748b; }

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main { padding: 24px 20px; }
  .cards { grid-template-columns: 1fr; }
  .landing { padding: 40px 20px; }
  .page-hero { padding: 24px; flex-direction: column; align-items: flex-start; }
  .page-hero-icon { width: 48px; height: 48px; }
  .section-header { gap: 12px; }
  .section-icon { width: 38px; height: 38px; }
}
