/* ============================================================
   BuildReadyIQ Design System
   Palette derived from brand mark: charcoal + amber
   ============================================================ */

:root {
  /* Core palette */
  --ink: #232323;
  --ink-soft: #46453f;
  --muted: #6b6a66;
  --amber: #EF9F27;
  --amber-dark: #c9800f;
  --amber-soft: #fdf1de;

  /* Surfaces */
  --paper: #f7f5f1;
  --white: #ffffff;
  --line: #e6e2da;
  --line-soft: #efece5;

  /* Semantic */
  --success: #2f7d5b;
  --success-soft: #e7f3ec;
  --danger: #c0453a;
  --danger-soft: #fbeae8;
  --info: #2a6f76;
  --info-soft: #e8f1f2;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(35,35,35,0.04), 0 4px 16px rgba(35,35,35,0.05);

  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 12px;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; margin-top: 24px; }
h4 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 20px; }
p { line-height: 1.55; }
small, .muted { color: var(--muted); }
code { background: var(--line-soft); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
a.link, span.link { color: var(--info); cursor: pointer; text-decoration: underline; font-weight: 500; }
.sysconfig-tab.active, .detail-tab.active { color: var(--amber); font-weight: 700; text-decoration: none; }
.stat-clickable { cursor: pointer; transition: transform 0.1s ease, box-shadow 0.1s ease; }
.stat-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
a.link:hover, span.link:hover { color: var(--ink); }

/* ---------- App shell: sidebar + topbar + main ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink);
  color: #d9d7d1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { padding: 22px 20px 18px; display: block; }
.sidebar .brand img { height: 28px; display: block; }
.sidebar nav { flex: 1; padding: 8px 12px; }
.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #d9d7d1;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: rgba(239,159,39,0.12); color: var(--amber); border-left-color: var(--amber); }
.sidebar .sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.78rem; color: #9a9892; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.topbar .topbar-right { display: flex; align-items: center; gap: 16px; font-size: 0.88rem; color: var(--muted); }

.main-content { padding: 28px 32px 60px; max-width: 980px; }

/* ---------- Cards & sections ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin-bottom: 22px;
  scroll-margin-top: 84px;
}

/* Stat card with colored left accent - used for status summaries */
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card.accent-amber { border-left-color: var(--amber); }
.stat-card.accent-success { border-left-color: var(--success); }
.stat-card.accent-danger { border-left-color: var(--danger); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }

/* ---------- Forms ---------- */
label { display: block; margin: 14px 0 5px; font-weight: 600; font-size: 0.85rem; color: var(--ink-soft); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
  border-color: var(--amber);
}
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }

button {
  background: var(--amber);
  color: var(--ink);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.15s;
}
button:hover { background: var(--amber-dark); }
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover { background: var(--line-soft); border-color: var(--ink-soft); }

.error { color: var(--danger); margin-top: 10px; font-size: 0.9rem; }
.success { color: var(--success); margin-top: 10px; font-size: 0.9rem; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.92rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--amber-soft); color: var(--amber-dark); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: var(--line-soft); color: var(--muted); }

/* ---------- Auth pages (login/register/reset/etc) ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
}
.auth-brand-panel {
  flex: 1;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
}
.auth-brand-panel img { height: 40px; margin-bottom: 28px; }
.auth-brand-panel h1 { color: #fff; font-size: 2rem; max-width: 420px; }
.auth-brand-panel p { color: #b7b5ae; max-width: 380px; font-size: 1rem; }
.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--paper);
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 38px;
  width: 100%;
  max-width: 420px;
}
.auth-card .mark { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-card .mark img { height: 26px; }

@media (max-width: 860px) {
  .auth-brand-panel { display: none; }
}

/* ---------- Landing page ---------- */
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.landing-nav img { height: 30px; display: block; }
.landing-nav .nav-links { display: flex; align-items: center; gap: 20px; }
.landing-nav a.nav-signin { color: var(--ink); font-weight: 600; text-decoration: none; font-size: 0.92rem; }
.landing-nav a.nav-signin:hover { color: var(--amber-dark); }

.hero {
  background: var(--ink);
  color: #fff;
  padding: 90px 40px 100px;
  text-align: center;
}
.hero h1 {
  color: #fff;
  font-size: 2.6rem;
  max-width: 720px;
  margin: 0 auto 18px;
}
.hero h1 .accent { color: var(--amber); }
.hero p.lead {
  color: #c2c0b9;
  font-size: 1.15rem;
  max-width: 560px;
  margin: 0 auto 34px;
  line-height: 1.6;
}
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-ctas .btn-outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.98rem;
}
.hero-ctas .btn-outline:hover { border-color: #fff; }
.hero-ctas .btn-primary {
  background: var(--amber);
  color: var(--ink);
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.98rem;
}
.hero-ctas .btn-primary:hover { background: #fff; }

.landing-section { max-width: 980px; margin: 0 auto; padding: 70px 40px; }
.landing-section h2 { text-align: center; font-size: 1.6rem; margin-bottom: 8px; }
.landing-section .section-lead { text-align: center; color: var(--muted); max-width: 520px; margin: 0 auto 46px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step { text-align: left; }
.step .check-mark {
  width: 40px; height: 40px;
  background: var(--ink);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.step .check-mark svg { width: 20px; height: 20px; }
.step h3 { margin-top: 0; font-size: 1.05rem; }
.step p { color: var(--muted); font-size: 0.92rem; margin: 0; }

.trust-section { background: var(--paper); }
.trust-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 36px; }
.trust-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.trust-item h4 { margin-top: 0; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 0.98rem; font-weight: 700; }
.trust-item p { color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }

.landing-footer {
  background: var(--ink);
  color: #9a9892;
  padding: 32px 40px;
  text-align: center;
  font-size: 0.85rem;
}
.landing-footer img { height: 22px; margin-bottom: 10px; }

@media (max-width: 760px) {
  .hero h1 { font-size: 2rem; }
  .steps, .trust-list { grid-template-columns: 1fr; }
  .landing-nav, .landing-section { padding-left: 20px; padding-right: 20px; }
}
/* ---------- Responsive: sidebar becomes horizontal scroll nav ---------- */
@media (max-width: 880px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; }
  .sidebar .brand { padding: 14px 16px; }
  .sidebar nav { display: flex; overflow-x: auto; padding: 8px 10px; flex: 1; }
  .sidebar nav a { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; margin-right: 4px; }
  .sidebar nav a.active { border-left-color: transparent; border-bottom-color: var(--amber); }
  .sidebar .sidebar-footer { display: none; }
  .main-content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
}

/* ---------- Invite form: new-vs-existing company toggle ---------- */
.inv-mode-toggle { display: flex; gap: 1.25rem; margin: 0.25rem 0 0.6rem; }
.inv-mode-toggle label.inline { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: normal; margin: 0; cursor: pointer; }
.inv-mode-toggle input[type="radio"] { width: auto; margin: 0; }
p.small, .small { font-size: 0.85rem; }

/* ---------- CSI trade multi-select (chips grid) ---------- */
.trade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; margin: 8px 0; }
.trade-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #e6e2da; border-radius: 6px; font-weight: normal; margin: 0; cursor: pointer; font-size: 0.9rem; transition: background 0.12s, border-color 0.12s; }
.trade-chip:hover { border-color: #9E1B2F; }
.trade-chip.on { background: #fbeaec; border-color: #9E1B2F; }
.trade-chip input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
