/* Module landing page · LIGHT theme (primary) with optional dark-mode support
 * Used by /sales, /finance, /inventory, /procurement, /projects, /quality,
 * /manufacturing, /vendor, /lifecycle, /admin.
 *
 * Light is the default. Dark activates only for users with
 * prefers-color-scheme: dark in their OS.
 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* === Light mode tokens (default) === */
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --panel: #ffffff;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 1px 3px rgba(15,23,42,0.06);
  --shadow-lg: 0 6px 18px rgba(15,23,42,0.10);
  --m-top-bg: #ffffff;
  --m-top-fg: var(--text-muted);
  --hero-bg: linear-gradient(180deg, #ffffff 0%, var(--surface-2) 100%);
}

/* === Optional dark mode (only when user OS prefers dark) === */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c18;
    --surface: #14141f;
    --surface-2: #1a1a2a;
    --panel: #14141f;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.18);
    --text: #f0ebe0;
    --text-2: #e2e2da;
    --text-muted: #94a0ad;
    --text-faint: #6b7280;
    --accent: #4ea8ff;
    --accent-hover: #6db8ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow:    0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --m-top-bg: rgba(0,0,0,0.4);
    --hero-bg: linear-gradient(135deg, #07070d 0%, #0c0c18 100%);
  }
}

/* Body — high specificity to win over enterprise-shell.css */
body.module-page,
body.module-page[data-system="enterprise"] {
  font-family: "Inter", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding: 0 0 80px;
  -webkit-font-smoothing: antialiased;
}

/* Hide W2 shell on module-landing pages — they have their own .m-top */
body.module-page[data-system="enterprise"] .shell-header,
body.module-page[data-system="enterprise"] .shell-rail,
body.module-page[data-system="enterprise"] .shell-footer { display: none !important; }

.module-page a { color: var(--accent); text-decoration: none; }
.module-page a:hover { color: var(--accent-hover); }

/* === Top bar === */
.m-top {
  background: var(--m-top-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex; align-items: center; gap: 18px;
  font-size: 12.5px;
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(6px);
}
.m-top a { color: var(--text-muted); text-decoration: none; }
.m-top a:hover { color: var(--text); }
.m-top .title {
  font-size: 14px; font-weight: 700; letter-spacing: -0.005em;
  color: var(--text);
}
.m-top .subtitle { color: var(--text-muted); }

/* Module accent colors — applied to the title text only */
.module-page[data-module="sales"]         .m-top .title { color: #0070d2; }
.module-page[data-module="finance"]       .m-top .title { color: #059669; }
.module-page[data-module="inventory"]     .m-top .title { color: #d97706; }
.module-page[data-module="procurement"]   .m-top .title { color: #d97706; }
.module-page[data-module="projects"]      .m-top .title { color: #7c3aed; }
.module-page[data-module="quality"]       .m-top .title { color: #00803e; }
.module-page[data-module="manufacturing"] .m-top .title { color: #7c3aed; }
.module-page[data-module="vendor"]        .m-top .title { color: #b45309; }
.module-page[data-module="lifecycle"]     .m-top .title { color: var(--accent); }
.module-page[data-module="admin"]         .m-top .title { color: var(--text-muted); }

/* === Hero === */
.m-hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 28px 22px;
  background: var(--hero-bg);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 720px) {
  .m-hero {
    max-width: none;
    padding-left: max(28px, calc((100vw - 1180px) / 2));
    padding-right: max(28px, calc((100vw - 1180px) / 2));
  }
}
.m-hero .eyebrow {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 12px;
}
.m-hero h1 {
  font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.015em;
  margin-bottom: 10px; color: var(--text);
}
.m-hero h1 strong { font-weight: 800; color: var(--accent); }
.m-hero .lead {
  font-size: 14.5px; color: var(--text-muted); max-width: 820px;
  line-height: 1.55;
}

/* === Stat row === */
.m-stat-row {
  max-width: 1180px;
  margin: 24px auto 8px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.m-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.m-stat .lbl {
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700;
}
.m-stat .val {
  font-size: 22px; font-family: "Fira Code", ui-monospace, monospace;
  font-weight: 700; color: var(--text); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* === Card grid === */
.m-grid {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 28px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  display: flex; flex-direction: column;
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
  min-height: 180px;
  box-shadow: var(--shadow-sm);
}
.m-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.m-card .ic { font-size: 24px; margin-bottom: 8px; line-height: 1; }
.m-card .ttl {
  font-size: 16px; font-weight: 700; letter-spacing: -0.005em;
  color: var(--text); margin-bottom: 4px;
}
.m-card .dsc {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.55;
  flex: 1; margin-bottom: 12px;
}
.m-card .row {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.m-card .cta {
  font-size: 12px; font-weight: 700; color: var(--accent);
  letter-spacing: 0.04em;
}
.m-card:hover .cta { color: var(--accent-hover); }
.m-card .live-pill {
  font-size: 10px; padding: 3px 8px; border-radius: 3px;
  background: #ecfdf5; color: #059669;
  border: 1px solid #a7f3d0;
  font-weight: 700; letter-spacing: 0.04em;
}
@media (prefers-color-scheme: dark) {
  .m-card .live-pill {
    background: rgba(16,185,129,0.10); color: #6ee7b7;
    border-color: rgba(16,185,129,0.25);
  }
}

/* === Footer === */
.m-footer {
  max-width: 1180px;
  margin: 24px auto 0;
  padding: 18px 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11.5px;
  border-top: 1px solid var(--border);
}
.m-footer a { text-decoration: none; }
.m-footer a:hover { text-decoration: underline; }

/* === Mobile === */
@media (max-width: 768px) {
  .m-top { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .m-top .subtitle { display: none; }
  .m-hero { padding: 24px 16px 16px; }
  .m-hero h1 { font-size: 22px; }
  .m-hero .lead { font-size: 13px; }
  .m-stat-row { padding: 0 16px; gap: 8px; }
  .m-stat { padding: 10px 12px; }
  .m-stat .val { font-size: 18px; }
  .m-grid { padding: 12px 16px 40px; gap: 10px; grid-template-columns: 1fr; }
  .m-card { min-height: auto; padding: 14px 16px; }
}
@media (max-width: 420px) {
  .m-hero h1 { font-size: 20px; }
  .m-top { padding: 8px 12px; }
}
