:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --paper: #f7fafc;
  --panel: #ffffff;
  --brand: #0f766e;
  --brand-2: #e11d48;
  --gold: #f59e0b;
  --green: #16a34a;
  --shadow: 0 18px 50px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15,118,110,.12), transparent 30%),
    linear-gradient(315deg, rgba(225,29,72,.10), transparent 35%),
    var(--paper);
}
a { color: inherit; text-decoration: none; }
input, select, button { font: inherit; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  padding: 22px;
  background: rgba(255,255,255,.88);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 900;
}
.brand small { display: block; color: var(--muted); margin-top: 3px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  color: #344054;
  margin: 3px 0;
}
.nav-link:hover { background: #eef6f5; color: var(--brand); }
.main {
  min-height: 100vh;
  padding: 32px;
  margin-left: 280px;
}
.topbar {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
  color: white;
  background:
    linear-gradient(rgba(23,32,42,.72), rgba(23,32,42,.72)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1600&q=80") center/cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.topbar.compact { min-height: 150px; }
.topbar h1 {
  max-width: 850px;
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}
.compact h1 { font-size: clamp(2rem, 3vw, 3rem); }
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: .08em;
}
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 15px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: white; }
.btn:hover { transform: translateY(-1px); }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.metric, .panel, .module-tile {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric { padding: 20px; }
.metric small { color: var(--muted); font-weight: 800; }
.metric strong { display: block; font-size: 2rem; margin-top: 10px; }
.workgrid {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 18px;
  margin-bottom: 18px;
}
.panel { padding: 22px; }
.panel.wide { min-width: 0; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0; font-size: 1.15rem; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
  font-size: .78rem;
}
.pill.green { background: #ecfdf3; color: #027a48; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.module-tile {
  display: grid;
  gap: 8px;
  min-height: 140px;
  padding: 18px;
}
.module-tile span { color: var(--brand-2); font-size: 1.6rem; }
.module-tile small { color: var(--muted); line-height: 1.35; }
.stack { display: grid; gap: 10px; }
.ai-row, .role-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.ai-row small, .role-list small { display: block; color: var(--muted); margin-top: 4px; }
.payment-form, .dynamic-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}
.console {
  min-height: 58px;
  overflow: auto;
  padding: 14px;
  margin: 14px 0 0;
  border-radius: 8px;
  background: #101828;
  color: #d1fadf;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; }
.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.control {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  font-weight: 850;
}
.auth-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
}
.auth-card {
  width: min(460px, 100%);
  display: grid;
  gap: 12px;
  padding: 28px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .sidebar { position: static; width: auto; max-height: none; }
  .main { margin-left: 0; padding: 18px; }
  .metrics, .module-grid, .workgrid, .payment-form, .dynamic-form, .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 22px; }
  .metrics, .module-grid, .workgrid, .payment-form, .dynamic-form, .control-grid { grid-template-columns: 1fr; }
}
