:root {
  --ink: #243047;
  --muted: #516074;
  --soft: #f5f8fb;
  --line: #d7dee8;
  --panel: #ffffff;
  --blue: #213343;
  --orange: #ff5c35;
  --teal: #00a4bd;
  --green: #00bda5;
  --yellow: #ffbc4b;
  --red: #f2545b;
  --shadow: 0 18px 48px rgba(36, 48, 71, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #f5f8fb;
}
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(430px, 620px) minmax(420px, 1fr);
  background: linear-gradient(180deg, #f7fbfd 0%, #eef6f9 100%);
}
.login-panel {
  padding: 48px clamp(28px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
  border-right: 1px solid var(--line);
}
.brand-logo {
  width: 176px;
  height: auto;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.brand-logo.small {
  width: 104px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #fff;
  mix-blend-mode: normal;
}
.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}
.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  font-size: 13px;
}
.eyebrow {
  margin: 0 0 8px;
  color: #627184;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
h1, h2, h3, h4, p { margin-top: 0; }
h1 {
  margin: 16px 0 12px;
  font-size: clamp(36px, 4.6vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}
.login-copy {
  max-width: 470px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}
.auth-card {
  margin-top: 18px;
  max-width: 540px;
  padding: 22px;
  border: 1px solid #dbe4ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(33, 51, 67, 0.08);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid #dbe4ed;
  border-radius: 8px;
  background: #f5f8fb;
}
.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4f5f70;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.auth-tab.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(33, 51, 67, 0.08);
}
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  align-items: start;
}
.auth-grid + .auth-grid {
  margin-top: 14px;
}
label {
  display: grid;
  gap: 7px;
  align-content: start;
  align-self: start;
  font-size: 13px;
  font-weight: 800;
  color: #33475b;
}
input, select {
  width: 100%;
  height: 44px;
  min-height: 44px;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
input::placeholder {
  color: #9aa8b5;
  font-weight: 500;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 9999s ease-out;
}
input:focus, select:focus {
  outline: 0;
  border-color: #00a4bd;
  box-shadow: 0 0 0 3px rgba(0, 164, 189, 0.16);
  background: #fff;
}
input:disabled {
  color: #5b6777;
  background: #f5f8fb;
  border-color: #dbe4ed;
}
.field-note {
  margin: -6px 0 0;
  color: #718093;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}
.span-2 { grid-column: 1 / -1; }
.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.primary-action, .secondary-action, .ghost-action {
  border: 0;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
}
.primary-action {
  color: #fff;
  background: var(--orange);
  box-shadow: 0 10px 18px rgba(255, 92, 53, 0.2);
}
.primary-action.full, .secondary-action.full { width: 100%; }
.secondary-action { color: #12394a; background: #dff4f8; }
.ghost-action { color: var(--blue); background: #fff; border: 1px solid var(--line); }
.fine-print {
  margin-top: 14px;
  max-width: 460px;
  color: #6e7b8d;
  font-size: 12px;
  line-height: 1.45;
}
.error-text { color: #af3542; font-weight: 800; }

.login-preview {
  margin: 44px;
  border: 1px solid rgba(33, 51, 67, 0.12);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
  align-self: center;
  min-height: 540px;
}
.mock-top {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin: -4px -4px 20px;
}
.mock-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--orange); }
.mock-search { flex: 1; height: 30px; border-radius: 8px; background: #edf4f8; }
.mock-record { display: grid; grid-template-columns: 160px 1fr 160px; gap: 14px; }
.mock-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}
.mock-focus { background: #fff; box-shadow: 0 12px 24px rgba(36,48,71,.08); }
.mock-name {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  margin-bottom: 12px;
}
.mock-line { height: 10px; border-radius: 8px; background: #e6eef5; margin: 10px 0; }
.mock-line.short { width: 68%; }
.mock-line.tiny { width: 44%; }
.mock-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.mock-tabs span { padding: 0 0 10px; font-weight: 850; font-size: 12px; }
.mock-tabs span:first-child { border-bottom: 3px solid var(--orange); }
.mock-activity {
  border: 1px solid #e7edf3;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}
.sidebar {
  min-height: 100vh;
  padding: 18px;
  background: #213343;
  color: #d9e5ef;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-brand span { display: block; color: #9fb1c2; font-size: 12px; }
.nav-stack { display: grid; gap: 6px; }
.nav-item {
  min-height: 42px;
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #d9e5ef;
  background: transparent;
  cursor: pointer;
}
.nav-item.active, .nav-item:hover { background: rgba(255,255,255,0.13); color: #fff; }
.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border-radius: 8px;
  background: rgba(0, 164, 189, 0.14);
  font-size: 13px;
  line-height: 1.45;
}
.sidebar-note span { display: block; color: #bfd0df; margin-top: 6px; }

.main-area { min-width: 0; }
.topbar {
  min-height: 88px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
}
.topbar h2 { margin: 0; font-size: 27px; }
.selectors { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.selectors select { min-width: 146px; }
.license-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 22px;
  background: #eef4f8;
  border-bottom: 1px solid var(--line);
}
.tier-step {
  min-height: 68px;
  text-align: left;
  border: 1px solid #d4e1eb;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
}
.tier-step span, .tier-step strong, .tier-step em { display: block; }
.tier-step span { font-weight: 900; }
.tier-step strong { margin-top: 5px; color: var(--teal); }
.tier-step em { color: var(--muted); font-style: normal; font-size: 12px; }
.tier-step.active {
  border-color: var(--orange);
  box-shadow: inset 0 0 0 2px rgba(255,92,53,.18);
}
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  padding: 22px;
}
.workspace-column { min-width: 0; }
.advisor-panel, .command-panel, .action-lab, .tier-column, .record-left, .record-center, .side-card, .builder-shell, .matrix-table, .source-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(36, 48, 71, 0.06);
}
.advisor-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 16px;
}
.advisor-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.advisor-header h3 { margin: 0; }
.advisor-block { margin: 0 0 16px; }
.advisor-block.highlight {
  border: 1px solid #b9eaf2;
  background: #f0fbfd;
  border-radius: 8px;
  padding: 12px;
}
.advisor-block h4 { margin: 0 0 8px; font-size: 14px; }
.advisor-block p, .advisor-block li { color: var(--muted); line-height: 1.5; }
.advisor-block ul { margin: 0; padding-left: 18px; }
.progress {
  margin-top: 8px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef4;
}
.progress span { display: block; height: 100%; background: var(--green); }

.workspace-screen { display: grid; gap: 18px; }
.command-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  padding: 22px;
}
.command-panel h3 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.22;
}
.command-panel p, .action-lab p, .builder-shell p, .source-list p { color: var(--muted); line-height: 1.5; }
.unlock-panel {
  border: 1px solid #d8e6ee;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}
.unlock-panel strong, .unlock-panel span { display: block; }
.unlock-panel strong { font-size: 20px; }
.unlock-panel span { margin-top: 4px; color: var(--teal); font-weight: 850; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef4f8;
  color: #385066;
  font-size: 12px;
  font-weight: 850;
}
.pill.good { background: #dff8f3; color: #087c6c; }
.pill.warn { background: #fff4d8; color: #846015; }
.pill.lock { background: #fde8e8; color: #af3542; }
.pill.clickable { border: 0; cursor: pointer; }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.section-heading.compact { margin: 0 0 14px; }
.section-heading h3 { margin: 0; }
.action-lab { padding: 18px; }
.action-grid.visual {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.feature-card {
  position: relative;
  overflow: hidden;
  min-height: 140px;
  border: 1px solid #d8e6ee;
  border-radius: 8px;
  background: #fff;
}
.feature-card.available { border-left: 5px solid var(--green); }
.feature-card.blocked {
  border-left: 5px solid var(--red);
  background: linear-gradient(135deg, #fff 0%, #fff7f5 100%);
}
.feature-main {
  width: 100%;
  min-height: 104px;
  display: flex;
  gap: 12px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 14px;
  cursor: pointer;
}
.feature-main:hover, .tier-feature-list button:hover, .quick-actions button:hover, .composer-tabs button:hover, .workflow-node button:hover, .timeline-item:hover, .matrix-item:hover {
  background: #eef9fb;
}
.feature-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7f7fb;
  color: #0b7285;
  font-weight: 900;
}
.feature-copy em, .feature-copy strong, .feature-copy small { display: block; }
.feature-copy em { color: var(--muted); font-style: normal; font-size: 12px; font-weight: 900; }
.feature-copy strong { margin: 4px 0; }
.feature-copy small { color: var(--muted); line-height: 1.35; }
.upgrade-inline {
  width: calc(100% - 24px);
  margin: 0 12px 12px;
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--orange);
  font-weight: 850;
  cursor: pointer;
}
.included-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.tier-column { overflow: hidden; }
.tier-column.active { border-color: var(--orange); }
.tier-column-head {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #f8fbfd;
  padding: 13px;
  cursor: pointer;
}
.tier-column-head span, .tier-column-head strong { display: block; }
.tier-column-head span { font-weight: 900; }
.tier-column-head strong { margin-top: 3px; color: var(--muted); font-size: 12px; }
.tier-feature-list { display: grid; padding: 10px; gap: 7px; }
.tier-feature-list button, .matrix-item {
  min-height: 32px;
  text-align: left;
  border: 1px solid #d8e6ee;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.tier-feature-list button.locked, .matrix-item.locked { color: #9e4d55; background: #fff7f5; }
.tier-feature-list button.included, .matrix-item.included { color: #087c6c; background: #f2fbf8; }

.crm-record {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr) 280px;
  gap: 16px;
}
.record-left, .record-center, .side-card { padding: 16px; min-width: 0; }
.record-right { display: grid; gap: 14px; align-content: start; min-width: 0; }
.avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 12px;
}
.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 14px 0;
}
.quick-actions button, .composer-tabs button {
  min-height: 36px;
  border: 1px solid #d8e6ee;
  border-radius: 8px;
  background: #f7fbfd;
  color: #234055;
  cursor: pointer;
  font-weight: 850;
  font-size: 12px;
}
.quick-actions button span { margin-right: 6px; }
.quick-actions button.locked, .composer-tabs button.locked { color: #af3542; background: #fff7f5; }
.property-list { display: grid; gap: 10px; font-size: 13px; }
.property-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef2f6;
}
.property-list em { color: var(--muted); font-style: normal; text-align: right; }
.record-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin: -16px -16px 14px;
  padding: 0 16px;
}
.tabs { display: flex; gap: 12px; }
.tab {
  padding: 14px 0 11px;
  border: 0;
  background: transparent;
  border-bottom: 3px solid transparent;
  font-weight: 850;
  cursor: pointer;
}
.tab.active { border-color: var(--orange); color: var(--blue); }
.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.summary-strip button {
  text-align: left;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
  cursor: pointer;
}
.summary-strip strong, .summary-strip em { display: block; }
.summary-strip em { margin-top: 4px; color: var(--muted); font-style: normal; font-size: 12px; }
.timeline { display: grid; gap: 10px; }
.timeline-item {
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid #e7edf3;
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
}
.timeline-item p { margin-bottom: 0; color: var(--muted); }
.activity-composer {
  border: 1px solid #d8e6ee;
  border-radius: 8px;
  background: #fbfdff;
  margin-bottom: 14px;
}
.composer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #e7edf3;
}
.composer-box { padding: 14px; }
.side-card.health { border-left: 5px solid var(--teal); }

.builder-shell { padding: 18px; }
.automation-canvas {
  display: grid;
  gap: 12px;
}
.automation-canvas.large {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  overflow: auto;
  padding-bottom: 8px;
}
.workflow-node {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  position: relative;
}
.workflow-node::after {
  content: "";
  position: absolute;
  right: -13px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: #c9d7e3;
}
.workflow-node:last-child::after { display: none; }
.workflow-node.available { border-left: 5px solid var(--green); }
.workflow-node.locked { border-left: 5px solid var(--red); background: #fff7f5; }
.workflow-node > button {
  width: 100%;
  min-height: 112px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 14px;
  cursor: pointer;
}
.node-dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  margin-bottom: 10px;
}
.workflow-node strong, .workflow-node p { display: block; }
.workflow-node p { color: var(--muted); }

.matrix-table { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 880px; }
th, td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { background: #f8fbfd; color: #405169; font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
th.current, td.current { background: #fff9f6; }
th button { border: 0; background: transparent; font-weight: 900; cursor: pointer; }
.matrix-item { display: block; width: 100%; margin-bottom: 6px; }
.source-list { padding: 18px; display: grid; gap: 12px; }
.source-list article { border: 1px solid #e7edf3; border-radius: 8px; padding: 12px; background: #fbfdff; }
.source-list a { color: #0b7285; font-weight: 850; text-decoration: none; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 160ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.spotlight {
  position: absolute;
  z-index: 20;
  width: 316px;
  padding: 14px;
  border: 1px solid #9edfea;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.spotlight strong { display: block; padding-right: 26px; }
.spotlight p { color: var(--muted); line-height: 1.45; }
.spot-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #edf4f8;
  cursor: pointer;
}

@media (max-width: 1160px) {
  .content-grid { grid-template-columns: 1fr; }
  .advisor-panel { position: static; }
  .crm-record, .command-panel { grid-template-columns: 1fr; }
  .action-grid.visual, .included-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mock-record { grid-template-columns: 1fr; }
  .automation-canvas.large { grid-template-columns: 1fr; }
  .workflow-node::after { display: none; }
}
@media (max-width: 760px) {
  .login-shell, .app-shell { grid-template-columns: 1fr; }
  .login-preview { display: none; }
  .sidebar { min-height: auto; }
  .topbar { align-items: stretch; flex-direction: column; }
  .selectors, .auth-grid, .license-rail, .action-grid.visual, .included-map, .summary-strip { grid-template-columns: 1fr; display: grid; }
  .selectors label, select { width: 100%; }
  .content-grid { padding: 14px; }
}
