:root {
  color-scheme: light;
  --ink: #101713;
  --muted: #5f6d63;
  --paper: #f6faf4;
  --panel: #ffffff;
  --line: #d7e1d4;
  --brand: #1f7a45;
  --accent: #f0c94c;
  --blue: #146bc8;
  --slate: #26363d;
  --soft: #edf7ec;
  --danger: #b44335;
  --shadow: 0 24px 70px rgba(31, 57, 43, .13);
}

body[data-product="business"] {
  --paper: #f7faf7;
  --brand: #185f4a;
  --accent: #b7ef2f;
  --blue: #255fc7;
  --slate: #243138;
  --soft: #eef6f2;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 23, 19, .038) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(135deg, var(--paper), #eef6f0 56%, #fff8df);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.public-shell { min-height: 100vh; width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 48px; }
.landing-nav, .topbar, .app-rail, .auth-card, .panel, .metric-card, .trade-board, .landing-grid article, .workflow-band {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px);
  border-radius: 8px;
}

.landing-nav {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px 12px 18px;
  position: sticky;
  top: 18px;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand img { width: 112px; height: 50px; object-fit: contain; object-position: left center; }
.brand strong { display: block; font-size: 16px; line-height: 1.08; }
.brand small { display: block; margin-top: 4px; color: var(--brand); font-size: 11px; font-weight: 950; text-transform: uppercase; letter-spacing: 0; }

.nav-links { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 850; }
.nav-links a { padding: 10px 11px; border-radius: 8px; }
.nav-links a:hover, .nav-links a:focus-visible { background: var(--soft); color: var(--ink); outline: none; }

.nav-cta, .button, .icon-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 950;
}
.nav-cta { color: #fff; background: var(--ink); border-color: var(--ink); padding: 0 16px; white-space: nowrap; }
.button { padding: 0 18px; }
.button.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.button.wide { width: 100%; }
.icon-button { width: 42px; padding: 0; }
.text-button { border: 0; background: transparent; min-height: 38px; color: var(--brand); padding: 0; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, .95fr);
  gap: 34px;
  align-items: center;
  padding: 72px 0 46px;
}
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 950; text-transform: uppercase; }
.hero h1 { max-width: 760px; margin: 16px 0 20px; font-size: clamp(48px, 7vw, 86px); line-height: .9; font-weight: 950; }
.lead { max-width: 670px; color: var(--muted); font-size: 21px; line-height: 1.48; font-weight: 650; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.trade-board { overflow: hidden; box-shadow: var(--shadow); }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); background: #fbfdf9; }
.board-head strong { display: block; font-size: 22px; }
.board-head small { display: block; color: var(--muted); font-weight: 750; }
.board-head b { padding: 8px 10px; border-radius: 8px; color: var(--brand); background: var(--soft); font-size: 12px; text-transform: uppercase; }
.board-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.board-row:last-child { border-bottom: 0; }
.board-row code { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 8px; color: #fff; background: var(--slate); font-weight: 950; }
.board-row:nth-child(3) code { background: var(--blue); }
.board-row:nth-child(4) code { background: var(--brand); }
.board-row strong { display: block; font-size: 17px; }
.board-row small { display: block; margin-top: 4px; color: var(--muted); font-weight: 720; line-height: 1.35; }
.board-row em { color: var(--brand); font-style: normal; font-weight: 950; }

.landing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.landing-grid article { padding: 22px; box-shadow: 0 16px 45px rgba(31, 57, 43, .08); }
.landing-grid i { color: var(--brand); margin-bottom: 22px; }
.landing-grid strong { display: block; font-size: 18px; }
.landing-grid span { display: block; margin-top: 8px; color: var(--muted); font-weight: 700; line-height: 1.4; }

.workflow-band { margin-top: 18px; padding: 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.workflow-band h2 { margin: 0; font-size: clamp(28px, 4vw, 52px); line-height: 1; max-width: 740px; }
.workflow-band div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.workflow-band span, .chip, .status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(470px, 100%); padding: 26px; box-shadow: var(--shadow); }
.auth-card img { width: 132px; height: 58px; object-fit: contain; object-position: left center; }
.auth-card h1 { margin: 8px 0 8px; font-size: 42px; line-height: 1; }
.auth-card p { color: var(--muted); font-weight: 700; line-height: 1.45; }
form { display: grid; gap: 12px; margin-top: 22px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 900; }
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.form-error { min-height: 20px; color: var(--danger) !important; font-size: 13px; }
.action-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  margin-top: 0;
}
.action-form .wide { grid-column: span 2; }
.action-form button { min-height: 46px; }

.product-app { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; gap: 18px; padding: 18px; }
.app-rail { min-height: calc(100vh - 36px); padding: 16px; display: flex; flex-direction: column; position: sticky; top: 18px; }
.app-brand { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
#app-nav { display: grid; gap: 8px; margin-top: 18px; }
#app-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  padding: 0 12px;
  font-weight: 900;
  text-align: left;
}
#app-nav button.active { color: #fff; background: var(--brand); }
button.primary, button.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 0 14px;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}
button.primary { color: #fff; background: var(--brand); }
button.ghost { color: var(--brand); background: #fff; }
button.mini { min-height: 32px; padding: 0 10px; font-size: 12px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.rail-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.rail-footer small { color: var(--muted); font-weight: 750; }
.rail-footer strong { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workspace { min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; position: sticky; top: 18px; z-index: 4; }
.topbar p { margin: 0 0 3px; color: var(--brand); font-size: 12px; font-weight: 950; text-transform: uppercase; }
.topbar h2 { margin: 0; font-size: 28px; line-height: 1.05; }
.product-switcher { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.product-switcher a { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 950; }
.product-switcher a.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.product-switcher a.locked { opacity: .58; }
.content { padding: 18px 0 42px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card { padding: 18px; min-height: 128px; }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 950; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 14px; font-size: 40px; line-height: .95; }
.metric-card small { display: block; margin-top: 8px; color: var(--muted); font-weight: 720; }

.panel { margin-top: 14px; padding: 18px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-header h3 { margin: 0; font-size: 23px; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-weight: 700; }
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 16px; }
.mini-card strong { display: block; font-size: 16px; }
.mini-card small, .mini-card p { color: var(--muted); font-weight: 700; line-height: 1.42; }
.mini-card p { margin: 8px 0 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td small { display: block; color: var(--muted); margin-top: 3px; font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.row-actions { min-width: 132px; }
.row-actions button + button { margin-left: 6px; }

.empty { display: grid; place-items: center; min-height: 220px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; background: rgba(255,255,255,.6); padding: 24px; }
.empty i { color: var(--brand); margin-bottom: 10px; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: #fff; border-radius: 8px; padding: 12px 14px; font-weight: 850; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-only { display: none; }

@media (max-width: 1050px) {
  .hero, .split { grid-template-columns: 1fr; }
  .landing-grid, .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .product-app { grid-template-columns: 1fr; }
  .app-rail { display: none; position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); z-index: 12; border-radius: 0; }
  .app-rail.open { display: flex; }
  .mobile-only { display: inline-flex; }
}

@media (max-width: 720px) {
  .public-shell { width: min(100% - 24px, 1320px); padding-top: 12px; }
  .landing-nav, .topbar { position: static; align-items: flex-start; }
  .landing-nav { flex-wrap: wrap; }
  .nav-links { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .hero { padding: 46px 0 28px; }
  .lead { font-size: 18px; }
  .board-row { grid-template-columns: 56px 1fr; }
  .board-row em { grid-column: 2; justify-self: start; }
  .landing-grid, .dashboard-grid, .cards { grid-template-columns: 1fr; }
  .action-form { grid-template-columns: 1fr; }
  .action-form .wide { grid-column: auto; }
  .workflow-band { align-items: flex-start; flex-direction: column; }
  .product-app { padding: 10px; }
  .topbar { flex-direction: column; }
  .product-switcher { justify-content: flex-start; width: 100%; }
}
