:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef4fa;
  --ink: #10233f;
  --muted: #62718a;
  --line: #d8e2ee;
  --brand: #183058;
  --brand-2: #25628f;
  --blue: #2077b7;
  --aqua: #26a6cf;
  --amber: #bd7b18;
  --red: #c2413d;
  --green: #11805b;
  --shadow: 0 18px 44px rgba(16, 35, 63, 0.09);
  --shadow-soft: 0 10px 24px rgba(16, 35, 63, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  background: #10233f;
  color: #f7fbff;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.brand {
  display: grid;
  gap: 10px;
  padding: 14px 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.14);
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 62px;
  object-fit: contain;
  object-position: left center;
}

.brand small {
  display: block;
  color: #5e6e83;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 8px;
  border-radius: 8px;
  background: #edf8f4;
}

.brand-mark span {
  display: block;
  border-radius: 3px;
  background: var(--brand);
}

.brand-mark span:nth-child(1) {
  height: 14px;
}

.brand-mark span:nth-child(2) {
  height: 23px;
  background: var(--blue);
}

.brand-mark span:nth-child(3) {
  height: 30px;
  background: var(--amber);
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #dce8f5;
  text-align: left;
  font-weight: 750;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(70, 166, 207, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6d87a6;
}

.nav-item.is-active .nav-dot {
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(38, 166, 207, 0.17);
}

.local-card {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.local-card strong,
.local-card span {
  display: block;
}

.local-card span {
  margin-top: 2px;
  color: #b9cbe0;
  font-size: 12px;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #32d583;
  box-shadow: 0 0 0 5px rgba(50, 213, 131, 0.14);
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 31px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 4px;
  font-size: 17px;
  color: var(--brand);
}

h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.topbar-actions,
.inline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: grid;
  gap: 2px;
  min-height: 38px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.user-chip strong {
  font-size: 13px;
  line-height: 1.1;
}

.user-chip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.button,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.button {
  padding: 0 14px;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.button.primary {
  border-color: var(--brand-2);
  background: var(--brand-2);
  color: #ffffff;
}

.button.danger {
  border-color: #f0cbc9;
  background: #fff5f4;
  color: var(--red);
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 98, 143, 0.38);
}

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.client-card,
.workflow-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  min-height: 118px;
  padding: 16px;
  border-top: 3px solid var(--brand-2);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  color: var(--brand);
  font-size: 29px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
}

.content-grid {
  display: grid;
  gap: 18px;
}

.content-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 16px;
  align-items: stretch;
  padding: 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #1c6a84);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.module-hero h2 {
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 28px;
}

.module-hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
}

.module-hero .eyebrow {
  color: #9be8ff;
}

.module-summary-card {
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.module-summary-card span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.module-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-command-card {
  display: grid;
  gap: 10px;
  min-height: 164px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.module-command-card strong {
  color: var(--brand);
  font-size: 18px;
}

.module-command-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.module-command-card:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 98, 143, 0.3);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 14px;
}

.module-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 318px;
  padding: 17px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--aqua);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.module-card.featured {
  border-top-color: var(--amber);
}

.module-card h3 {
  margin: 0;
  color: var(--brand);
  font-size: 18px;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.module-kicker {
  color: var(--brand-2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.module-meta {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.module-meta span {
  color: var(--muted);
  font-size: 12px;
}

.module-meta strong {
  color: var(--ink);
  font-size: 13px;
}

.module-playbook {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.module-playbook article {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.module-playbook span {
  color: var(--muted);
  font-size: 13px;
}

.client-layout,
.workflow-layout {
  grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.35fr);
}

.payment-layout {
  grid-template-columns: minmax(0, 1.4fr) 360px;
}

.panel {
  min-width: 0;
  padding: 17px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.split {
  align-items: center;
}

.status-bars {
  display: grid;
  gap: 12px;
}

.status-row {
  display: grid;
  gap: 7px;
}

.status-row header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand-2);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.health-tile {
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfe;
}

.health-tile strong {
  display: block;
  margin-top: 16px;
  font-size: 28px;
}

.health-tile span {
  color: var(--muted);
  font-size: 13px;
}

.stack-list,
.timeline,
.client-list,
.workflow-list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.list-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.list-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.green {
  background: #e8f7f1;
  color: var(--green);
}

.pill.amber {
  background: #fff4dc;
  color: var(--amber);
}

.pill.red {
  background: #ffe8e7;
  color: var(--red);
}

.pill.blue {
  background: #e9f4fb;
  color: var(--brand-2);
}

.client-card,
.workflow-card {
  padding: 13px;
  text-align: left;
}

button.client-card,
button.workflow-card {
  width: 100%;
  border-color: var(--line);
}

button.client-card:hover,
button.workflow-card:hover,
button.client-card.is-selected,
button.workflow-card.is-selected {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(37, 98, 143, 0.13), var(--shadow-soft);
}

.client-card header,
.workflow-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.client-card strong,
.workflow-card strong {
  display: block;
  line-height: 1.25;
}

.client-card span,
.workflow-card span {
  color: var(--muted);
  font-size: 13px;
}

.client-detail {
  display: grid;
  gap: 14px;
}

.detail-card {
  padding: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.detail-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.detail-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-stat strong {
  display: block;
  margin-top: 7px;
  font-size: 18px;
}

.workflow-steps {
  display: grid;
  gap: 10px;
}

.step-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.step-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e9f4fb;
  color: var(--brand-2);
  font-weight: 800;
}

.input,
label input,
label select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
}

.input:focus,
label input:focus,
label select:focus,
.status-select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(37, 98, 143, 0.14);
  outline: none;
}

.input.compact {
  width: min(210px, 100%);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: span 2;
}

.form-grid .button {
  align-self: end;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.upload-form {
  display: grid;
  gap: 14px;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 128px;
  border: 2px dashed #9ab8cc;
  border-radius: 8px;
  background: #f7fbfd;
  color: var(--brand);
  cursor: pointer;
  text-align: center;
}

.drop-zone.is-dragging {
  border-color: var(--brand-2);
  background: #e9f4fb;
  box-shadow: 0 0 0 3px rgba(37, 98, 143, 0.13);
}

.drop-zone strong {
  color: var(--ink);
  font-size: 18px;
}

.drop-zone span {
  color: var(--muted);
  font-size: 13px;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.upload-list {
  display: grid;
  gap: 8px;
}

.upload-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.upload-item span {
  color: var(--muted);
  font-size: 12px;
}

.upload-item.is-complete {
  border-color: #b9e3d4;
  background: #f4fbf8;
}

.upload-item.is-error {
  border-color: #f2c0bd;
  background: #fff7f7;
}

.report-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.report-preview {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.report-preview strong {
  font-size: 16px;
}

.report-preview span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tracker-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.report-link {
  width: fit-content;
}

.workflow-template-form {
  display: grid;
  gap: 14px;
}

.step-builder {
  display: grid;
  gap: 12px;
}

.builder-step {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.builder-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.builder-step-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.8fr) 120px minmax(220px, 1.4fr) 140px 160px;
  gap: 12px;
  align-items: end;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 132px;
}

.check-label {
  grid-auto-flow: column;
  grid-template-columns: 18px 1fr;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

.check-label input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

td strong {
  display: block;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.status-select {
  min-width: 130px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 8px;
}

.empty-state {
  min-height: 220px;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state p {
  max-width: 360px;
  margin-bottom: 0;
  line-height: 1.45;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 44%, var(--line) 44%, var(--line) 56%, transparent 56%),
    linear-gradient(0deg, transparent 44%, var(--line) 44%, var(--line) 56%, transparent 56%),
    #f7fbff;
}

.alert-host {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.alert {
  padding: 11px 12px;
  border: 1px solid #c9e2f3;
  border-radius: 8px;
  background: #eef7fc;
  color: var(--brand-2);
  font-size: 14px;
  font-weight: 700;
}

.alert.error {
  border-color: #f0cbc9;
  background: #fff5f4;
  color: var(--red);
}

.auth-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f7fbff 0%, #eef4fa 100%);
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-panel {
  display: grid;
  gap: 22px;
  width: min(460px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  justify-items: center;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.auth-logo {
  max-height: 76px;
  object-position: center;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form h1 {
  font-size: 28px;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid #f0cbc9;
  border-radius: 8px;
  background: #fff5f4;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.demo-logins {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.demo-logins button {
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  text-align: left;
}

.demo-logins button:hover {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(37, 98, 143, 0.13);
}

.demo-logins span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1160px) {
  .metrics-grid,
  .content-grid.three,
  .module-command-grid,
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .client-layout,
  .workflow-layout,
  .payment-layout {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .builder-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .user-chip {
    min-width: 150px;
  }

  .metrics-grid,
  .content-grid.two,
  .content-grid.three,
  .module-hero,
  .module-command-grid,
  .module-grid,
  .module-playbook,
  .form-grid,
  .detail-grid,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  .builder-step-grid {
    grid-template-columns: 1fr;
  }

  .panel-header.split {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .input.compact {
    width: 100%;
  }

  .demo-logins {
    grid-template-columns: 1fr;
  }
}
