:root {
  /* Light navy + white SaaS palette */
  --rx-ink: #0f1c2e;
  --rx-ink-soft: #4a5d73;
  --rx-paper: #f7f9fc;
  --rx-surface: #ffffff;
  --rx-line: #d4dde8;
  --rx-primary: #2c4a6e;
  --rx-accent: #2c4a6e;
  --rx-accent-hover: #1e3a5f;
  --rx-accent-2: #5a7a9a;
  --rx-accent-soft: #e8eef5;
  --rx-warn: #b45309;
  --rx-danger: #b42318;
  --rx-sidebar: #152238;
  --rx-sidebar-text: #c5d0dc;
  --rx-radius: 14px;
  --rx-shadow: 0 10px 30px rgba(15, 28, 46, 0.08);
  --font-display: "Instrument Sans", "Segoe UI", sans-serif;
  --font-body: "DM Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--rx-ink);
  background: var(--rx-paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--rx-accent); text-decoration: none; }
a:hover { color: var(--rx-accent-hover); }

/* Marketing / public layout */
.public-body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(44, 74, 110, 0.14), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(90, 122, 154, 0.10), transparent 50%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
  min-height: 100vh;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 4vw;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(247, 250, 252, 0.8);
  border-bottom: 1px solid rgba(215, 224, 234, 0.7);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--rx-accent), var(--rx-accent-hover));
  box-shadow: 0 8px 20px rgba(44, 74, 110, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-display); font-size: 1.15rem; }
.brand-text small { color: var(--rx-ink-soft); font-size: 0.75rem; }

.nav-actions { display: flex; gap: 0.6rem; align-items: center; }

.btn-primary-rx {
  background: var(--rx-accent);
  border: none;
  color: #fff;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn-primary-rx:hover {
  background: var(--rx-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(44, 74, 110, 0.28);
}
.btn-primary-rx:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(44, 74, 110, 0.35);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--rx-line);
  color: var(--rx-ink);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-weight: 500;
}
.btn-ghost:hover { background: #fff; color: var(--rx-ink); }

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  align-items: center;
  padding: 4rem 4vw 3rem;
  min-height: calc(100vh - 80px);
}
.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}
.hero-copy .tagline {
  font-size: 1.25rem;
  color: var(--rx-ink-soft);
  max-width: 34rem;
  margin-bottom: 1.75rem;
}
.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-visual {
  position: relative;
  min-height: 420px;
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(15, 28, 46, 0.94), rgba(44, 74, 110, 0.88)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  box-shadow: var(--rx-shadow);
  color: #fff;
  padding: 2rem;
  animation: floatIn .8s ease both;
}
.hero-visual h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.metric-card {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 1rem;
  backdrop-filter: blur(6px);
}
.metric-card strong { display: block; font-size: 1.4rem; }
.metric-card span { opacity: 0.8; font-size: 0.85rem; }

.section { padding: 3.5rem 4vw; }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.section-sub { color: var(--rx-ink-soft); margin-bottom: 2rem; max-width: 40rem; }

.industry-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.industry-pill {
  background: #fff;
  border: 1px solid var(--rx-line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  color: var(--rx-ink-soft);
  transition: border-color .2s, color .2s, transform .2s;
}
.industry-pill:hover {
  border-color: var(--rx-accent);
  color: var(--rx-accent);
  transform: translateY(-1px);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}
.plan-card {
  background: var(--rx-surface);
  border: 1px solid var(--rx-line);
  border-radius: 20px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  transition: transform .25s ease, box-shadow .25s ease;
}
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--rx-shadow); }
.plan-card.popular {
  border-color: var(--rx-accent);
  box-shadow: 0 16px 40px rgba(44, 74, 110, 0.14);
}
.plan-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--rx-accent-soft);
  color: var(--rx-accent);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}
.plan-card h3 { font-family: var(--font-display); margin: 0; }
.plan-price { font-size: 1.8rem; font-weight: 700; }
.plan-price small { font-size: 0.85rem; font-weight: 500; color: var(--rx-ink-soft); }
.plan-features { list-style: none; padding: 0; margin: 0; flex: 1; }
.plan-features li {
  padding: 0.35rem 0;
  color: var(--rx-ink-soft);
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
}
.plan-features li i { color: var(--rx-accent); margin-top: 0.15rem; }

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.feature-tile {
  background: #fff;
  border: 1px solid var(--rx-line);
  border-radius: 16px;
  padding: 1.2rem;
}
.feature-tile i {
  font-size: 1.4rem;
  color: var(--rx-accent);
  margin-bottom: 0.6rem;
}
.feature-tile h4 { font-family: var(--font-display); margin: 0 0 0.35rem; }
.feature-tile p { margin: 0; color: var(--rx-ink-soft); font-size: 0.95rem; }

.site-footer {
  padding: 2rem 4vw;
  border-top: 1px solid var(--rx-line);
  color: var(--rx-ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 280px;
  background: var(--rx-sidebar);
  color: var(--rx-sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: margin-left .25s ease;
}
.app-sidebar .brand-text strong { color: #fff; }
.app-sidebar .brand-text small { color: #8fa0b3; }
.sidebar-brand { padding: 1.2rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-nav { padding: 1rem 0.75rem; overflow-y: auto; flex: 1; }
.nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7d8fa3;
  padding: 0.75rem 0.85rem 0.35rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--rx-sidebar-text);
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 0.15rem;
  transition: background .15s, color .15s;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.user-chip {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.user-chip .avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--rx-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.user-chip strong { display: block; color: #fff; font-size: 0.9rem; }
.user-chip small { color: #8fa0b3; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rx-line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
}
.topbar-title p { margin: 0; color: var(--rx-ink-soft); font-size: 0.85rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 220px;
  max-width: 320px;
}
.topbar-search > .bi-search { color: var(--rx-ink-soft); }
.topbar-search input { border-radius: 10px; }
.topbar-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--rx-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  z-index: 40;
  max-height: 320px;
  overflow: auto;
  padding: 0.35rem;
}
.topbar-search-results a {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}
.topbar-search-results a:hover { background: #f1f5f9; }
.topbar-search-results .sku { color: var(--rx-ink-soft); font-size: 0.8rem; }
.topbar-search-results .actions { display: flex; gap: 0.35rem; margin-top: 0.25rem; }
.topbar-search-results .empty { padding: 0.75rem; color: var(--rx-ink-soft); font-size: 0.9rem; }
.pos-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.pos-shortcuts kbd {
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--rx-line);
  border-radius: 4px;
  background: #f8fafc;
}
.stat-card-link {
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  cursor: pointer;
}
.stat-card-link:hover {
  border-color: var(--rx-accent, #2c4a6e);
  box-shadow: 0 8px 20px rgba(44, 74, 110, 0.12);
  transform: translateY(-1px);
}
.stat-card-alert {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 70%);
}
.sidebar-toggle {
  display: none;
  border: 1px solid var(--rx-line);
  background: #fff;
  border-radius: 10px;
  width: 40px;
  height: 40px;
}
.app-content { padding: 1.5rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--rx-line);
  border-radius: var(--rx-radius);
  padding: 1.1rem 1.2rem;
  animation: rise .5s ease both;
}
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.stat-card .label { color: var(--rx-ink-soft); font-size: 0.85rem; }
.stat-card .value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  margin-top: 0.25rem;
}
.panel {
  background: #fff;
  border: 1px solid var(--rx-line);
  border-radius: var(--rx-radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.panel-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0;
}

.table-rx {
  width: 100%;
  border-collapse: collapse;
}
.table-rx th, .table-rx td {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--rx-line);
  text-align: left;
  font-size: 0.92rem;
}
.table-rx th { color: var(--rx-ink-soft); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

.badge-rx {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #e8f7f0; color: #0f7a4c; }
.badge-warning { background: #fff4e5; color: #9a6700; }
.badge-danger { background: #fdeceb; color: #b42318; }
.badge-info { background: var(--rx-accent-soft); color: var(--rx-accent); }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--rx-line);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--rx-shadow);
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 0.35rem;
}
.form-label { font-weight: 600; font-size: 0.88rem; }
.form-control, .form-select {
  border-radius: 10px;
  border-color: var(--rx-line);
  padding: 0.65rem 0.8rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--rx-accent);
  box-shadow: 0 0 0 3px rgba(44, 74, 110, 0.18);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
}
.module-tile {
  border: 1px solid var(--rx-line);
  border-radius: 14px;
  padding: 1rem;
  background: linear-gradient(180deg, #fff, #f8fbfd);
  transition: transform .2s, border-color .2s;
  color: inherit;
}
.module-tile:hover {
  transform: translateY(-2px);
  border-color: var(--rx-accent);
  color: inherit;
}
.module-tile i { color: var(--rx-accent); font-size: 1.3rem; }
.module-tile strong { display: block; margin-top: 0.5rem; font-size: 0.95rem; }

@keyframes floatIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1100px) {
  .plan-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .platform-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 2rem; }
  .app-sidebar {
    position: fixed;
    z-index: 40;
    margin-left: -280px;
  }
  .app-shell.sidebar-open .app-sidebar { margin-left: 0; }
  .sidebar-toggle { display: inline-grid; place-items: center; }
}
@media (max-width: 640px) {
  .plan-grid, .platform-grid, .stat-grid { grid-template-columns: 1fr; }
  .site-nav, .section, .hero { padding-left: 1.25rem; padding-right: 1.25rem; }
}

/* Phase 5 — print-friendly invoice / ledger */
@media print {
  .app-sidebar,
  .app-topbar,
  .no-print,
  .sidebar-toggle,
  .topbar-actions {
    display: none !important;
  }
  .app-main, .app-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .print-area {
    box-shadow: none !important;
    border: none !important;
  }
  .panel { break-inside: avoid; }
}

