:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #64748b;
  --soft: #f1f5f9;
  --panel: #ffffff;
  --line: #dbe4ee;
  --primary: #166534;
  --primary-dark: #14532d;
  --accent: #15803d;
  --teal: #047857;
  --focus: #22c55e;
  --focus-soft: #ecfdf5;
  --accent-text: #166534;
  --body-bg: #eef7f0;
  --sidebar-bg: #0b1f16;
  --brand-start: #16a34a;
  --brand-end: #0f766e;
  --hero-start: #0b1f16;
  --hero-end: #166534;
  --hero-muted: #bbf7d0;
  --progress-start: #22c55e;
  --progress-end: #0f766e;
  --response-bg: #f0fdf4;
  --response-border: #bbf7d0;
  --response-text: #14532d;
  --amber: #b45309;
  --red: #b42318;
  --blue: #166534;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--body-bg);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: var(--sidebar-bg);
  color: #f8fafc;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.flowtrust-logo {
  display: block;
  object-fit: cover;
  object-position: center;
  background: #ffffff;
}

.sidebar-logo {
  width: 190px;
  height: 72px;
  margin-left: -8px;
  border-radius: 10px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
  font-weight: 650;
}

.brand-mark.large {
  width: 62px;
  height: 62px;
  color: white;
  font-size: 1.05rem;
}

.eyebrow,
.label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #94a3b8;
}

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

strong {
  font-weight: 650;
}

h1 {
  margin-bottom: 0;
  font-size: 1.2rem;
  font-weight: 650;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 650;
  line-height: 1.16;
}

h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
  font-weight: 650;
}

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

.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: color-mix(in srgb, var(--focus) 20%, transparent);
  color: #ffffff;
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

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

.sidebar-card span {
  margin-top: 6px;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.sidebar-logout {
  width: 100%;
  min-height: 40px;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.36);
  color: #ffffff;
  cursor: pointer;
  font-weight: 650;
}

.sidebar-logout:hover {
  background: rgba(14, 165, 233, 0.22);
}

.sidebar-logout:active {
  transform: translateY(1px);
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-header,
.form-actions,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar-actions,
.form-actions {
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button,
.upload-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.primary-button {
  padding: 0 16px;
  background: var(--primary);
  color: white;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active,
.connector-row:active,
.contact-row:active {
  transform: translateY(1px);
}

.primary-button.wide {
  width: 100%;
}

.secondary-button,
.upload-button {
  padding: 0 14px;
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.secondary-button:hover,
.upload-button:hover {
  border-color: #aebfb5;
}

.secondary-button.danger {
  color: var(--red);
}

.icon-button {
  width: 40px;
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.72fr);
  gap: 28px;
  min-height: 100vh;
  padding: 32px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--focus) 22%, transparent), transparent 34%),
    linear-gradient(135deg, var(--focus-soft), #f8fafc 48%, #f0fdf4);
}

.login-hero,
.login-card {
  align-self: center;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 780px;
}

.login-logo {
  flex: 0 0 auto;
  width: clamp(150px, 22vw, 230px);
  height: clamp(58px, 8vw, 88px);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

.login-brand h1 {
  max-width: 680px;
  font-family: "Arial Narrow", "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  font-size: 2.8rem;
  font-weight: 750;
  line-height: 1.02;
}

.login-brand h1 span {
  display: block;
}

.login-copy {
  max-width: 650px;
  margin: 22px 0 28px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.form-hint {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.auth-tab {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 650;
}

.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

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

.login-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 760px;
}

.login-option,
.login-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.login-option {
  padding: 16px;
}

.login-option p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-card {
  padding: 24px;
}

.login-card h2 {
  margin-bottom: 18px;
  font-size: 1.35rem;
}

.connector-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.auth-summary {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.auth-summary p {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.45;
}

.connector-row {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.connector-row:hover {
  border-color: var(--focus);
  background: var(--focus-soft);
}

.connector-row small,
.connector-row em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 18px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 1.62rem;
  font-weight: 650;
  line-height: 1;
  color: #0f172a;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  margin-bottom: 16px;
}

.lower-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

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

.panel-header {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

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

.workflow-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.workflow-row:hover,
.workflow-row.selected {
  border-color: #7fb69a;
  background: var(--focus-soft);
}

.workflow-row small,
.workflow-row em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.workflow-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--focus-soft);
  color: var(--accent-text);
  font-weight: 650;
  font-size: 0.72rem;
}

.status-pill,
.table-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 650;
}

.status-pill {
  background: var(--focus-soft);
  color: var(--accent-text);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--ink);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding: 12px;
}

.upload-button {
  justify-self: start;
}

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

table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

.table-status.approved {
  background: #dcfce7;
  color: #166534;
}

.table-status.pending {
  background: #fff6df;
  color: var(--amber);
}

.table-status.review {
  background: #ffebeb;
  color: var(--red);
}

.table-status.rejected {
  background: #fee2e2;
  color: #991b1b;
}

.approval-card {
  display: grid;
  gap: 14px;
}

.approval-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.approval-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approval-meta span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

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

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

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

.template-card,
.module-card {
  display: grid;
  gap: 12px;
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.module-card:hover,
.template-card:hover,
.metric-card:hover {
  border-color: var(--focus);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.11);
}

.template-card strong,
.module-card strong {
  font-size: 1rem;
}

.template-card p,
.template-card small,
.module-card p,
.module-card small,
.panel-copy {
  color: var(--muted);
  line-height: 1.5;
}

.template-card p,
.module-card p {
  margin-bottom: 0;
}

.policy-list,
.insight-list,
.approval-stack,
.channel-list {
  display: grid;
  gap: 10px;
}

.policy-list p,
.insight-list p {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
  color: var(--muted);
  line-height: 1.45;
}

.policy-list strong {
  color: var(--ink);
}

.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.contact-list {
  display: grid;
  gap: 10px;
}

.contact-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.contact-row:hover,
.contact-row.active {
  border-color: var(--focus);
  background: var(--focus-soft);
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-weight: 650;
}

.avatar.large {
  width: 50px;
  height: 50px;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-title small,
.contact-row small {
  color: var(--muted);
}

.message-thread {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.message-thread p {
  max-width: 760px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f1f5f9;
  color: #334155;
  line-height: 1.45;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid var(--focus);
  border-radius: 14px;
  background: #0f172a;
  color: white;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
  font-weight: 600;
}

.channel-row p,
.chain-text,
td small {
  color: var(--muted);
}

.channel-row p,
.chain-text {
  margin: 6px 0 0;
  line-height: 1.45;
}

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

  .login-brand h1 {
    font-size: 2.35rem;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .sidebar-card {
    margin-top: 0;
  }

  .metric-grid,
  .workspace-grid,
  .lower-grid,
  .module-grid,
  .template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .login-shell {
    gap: 18px;
    padding: 16px;
  }

  .login-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .login-logo {
    width: 138px;
    height: 54px;
  }

  .login-brand h1 {
    max-width: 320px;
    font-size: 1.72rem;
    line-height: 1.03;
  }

  .login-copy {
    margin: 14px 0 0;
  }

  .login-option-grid {
    grid-template-columns: 1fr;
  }

  .form-pair {
    grid-template-columns: 1fr;
  }

  .main-content,
  .sidebar {
    padding: 18px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    max-height: 46vh;
    overflow: auto;
    gap: 14px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
  }

  .sidebar-logo {
    width: 156px;
    height: 58px;
    margin-left: -6px;
  }

  .sidebar-card {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    white-space: nowrap;
  }

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

  .topbar-actions {
    width: 100%;
    align-items: stretch;
  }

  .profile-chip,
  .clearance-badge {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    flex: 1;
  }

  .nav-list,
  .metric-grid,
  .workspace-grid,
  .lower-grid,
  .module-grid,
  .template-grid,
  .target-grid,
  .quick-actions,
  .lead-form {
    grid-template-columns: 1fr;
  }

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

  .chat-compose {
    grid-template-columns: 1fr;
  }

  .workflow-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .workflow-row em {
    grid-column: 2;
  }
}

html[data-theme="emerald"] {
  --primary: #059669;
  --primary-dark: #047857;
  --accent: #10b981;
  --teal: #0d9488;
  --focus: #34d399;
  --focus-soft: #ecfdf5;
  --accent-text: #047857;
  --body-bg: #eefbf5;
  --sidebar-bg: #052e22;
  --brand-start: #10b981;
  --brand-end: #059669;
  --hero-start: #052e22;
  --hero-end: #047857;
  --hero-muted: #a7f3d0;
  --progress-start: #34d399;
  --progress-end: #059669;
  --response-bg: #ecfdf5;
  --response-border: #a7f3d0;
  --response-text: #064e3b;
}

html[data-theme="forest"] {
  --primary: #365314;
  --primary-dark: #1a2e05;
  --accent: #4d7c0f;
  --teal: #166534;
  --focus: #84cc16;
  --focus-soft: #f7fee7;
  --accent-text: #3f6212;
  --body-bg: #f3f7ed;
  --sidebar-bg: #17210b;
  --brand-start: #65a30d;
  --brand-end: #166534;
  --hero-start: #17210b;
  --hero-end: #365314;
  --hero-muted: #d9f99d;
  --progress-start: #a3e635;
  --progress-end: #4d7c0f;
  --response-bg: #f7fee7;
  --response-border: #d9f99d;
  --response-text: #365314;
}

html[data-theme="lagoon"] {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #0d9488;
  --teal: #0891b2;
  --focus: #2dd4bf;
  --focus-soft: #ecfeff;
  --accent-text: #0f766e;
  --body-bg: #eef8f7;
  --sidebar-bg: #0f1f22;
  --brand-start: #14b8a6;
  --brand-end: #0891b2;
  --hero-start: #0f1f22;
  --hero-end: #0f766e;
  --hero-muted: #99f6e4;
  --progress-start: #2dd4bf;
  --progress-end: #0891b2;
  --response-bg: #ecfeff;
  --response-border: #99f6e4;
  --response-text: #134e4a;
}

html[data-theme="graphite"] {
  --primary: #334155;
  --primary-dark: #1e293b;
  --accent: #475569;
  --teal: #0f766e;
  --focus: #64748b;
  --focus-soft: #f1f5f9;
  --accent-text: #334155;
  --body-bg: #f3f5f7;
  --sidebar-bg: #111827;
  --brand-start: #64748b;
  --brand-end: #0f766e;
  --hero-start: #111827;
  --hero-end: #334155;
  --hero-muted: #cbd5e1;
  --progress-start: #64748b;
  --progress-end: #0f766e;
  --response-bg: #f8fafc;
  --response-border: #cbd5e1;
  --response-text: #1e293b;
}

html[data-theme="midnight"] {
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --soft: #111827;
  --panel: #111827;
  --line: #263449;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --accent: #4ade80;
  --teal: #22c55e;
  --focus: #4ade80;
  --focus-soft: #10281b;
  --accent-text: #86efac;
  --body-bg: #020617;
  --sidebar-bg: #020617;
  --brand-start: #22c55e;
  --brand-end: #0f766e;
  --hero-start: #020617;
  --hero-end: #14532d;
  --hero-muted: #bbf7d0;
  --progress-start: #4ade80;
  --progress-end: #22c55e;
  --response-bg: #10281b;
  --response-border: #166534;
  --response-text: #dcfce7;
  --blue: #86efac;
}

html[data-theme="midnight"] body {
  background: var(--body-bg);
}

html[data-theme="midnight"] .main-content,
html[data-theme="midnight"] .metric-card strong,
html[data-theme="midnight"] .template-card strong,
html[data-theme="midnight"] .module-card strong,
html[data-theme="midnight"] .policy-list strong {
  color: #e5e7eb;
}

html[data-theme="midnight"] input,
html[data-theme="midnight"] select,
html[data-theme="midnight"] textarea,
html[data-theme="midnight"] .module-card,
html[data-theme="midnight"] .template-card,
html[data-theme="midnight"] .channel-row,
html[data-theme="midnight"] .contact-row,
html[data-theme="midnight"] .policy-list p,
html[data-theme="midnight"] .insight-list p,
html[data-theme="midnight"] .message-thread p {
  background: #0f172a;
  color: #e5e7eb;
}

html[data-theme="clear"] {
  --primary: #15803d;
  --primary-dark: #166534;
  --accent: #16a34a;
  --teal: #0f766e;
  --focus: #22c55e;
  --focus-soft: #f8fafc;
  --accent-text: #166534;
  --body-bg: #f8fafc;
  --sidebar-bg: #0f172a;
  --brand-start: #16a34a;
  --brand-end: #0f766e;
  --hero-start: #0f172a;
  --hero-end: #166534;
  --hero-muted: #bbf7d0;
  --progress-start: #22c55e;
  --progress-end: #0f766e;
  --response-bg: #f8fafc;
  --response-border: #dbe4ee;
  --response-text: #14532d;
  --line: #e2e8f0;
}

html[data-theme="clear"] body {
  background: var(--body-bg);
}

html[data-typeface="system"] body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-typeface="humanist"] body {
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", ui-sans-serif, system-ui, sans-serif;
}

html[data-typeface="rounded"] body {
  font-family: "Nunito Sans", "Avenir Next", "Segoe UI", ui-rounded, ui-sans-serif, system-ui, sans-serif;
}

html[data-typeface="editorial"] body {
  font-family: "Source Sans 3", "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
}

html[data-font="compact"] body {
  font-size: 13.5px;
}

html[data-font="large"] body {
  font-size: 15.75px;
}

html[data-density="roomy"] .panel,
html[data-density="roomy"] .metric-card,
html[data-density="roomy"] .module-card,
html[data-density="roomy"] .template-card {
  padding: 24px;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 1fr;
}

.app-shell.sidebar-collapsed .sidebar {
  display: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.nav-toggle {
  flex: 0 0 auto;
}

.clearance-badge {
  display: grid;
  min-height: 40px;
  min-width: 150px;
  align-content: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.clearance-badge strong,
.clearance-badge span {
  line-height: 1.1;
}

.clearance-badge span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-chip {
  display: flex;
  min-width: 230px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.profile-chip strong,
.profile-chip span {
  display: block;
  line-height: 1.15;
}

.profile-chip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.profile-photo {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assistant-strip {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(20, 184, 166, 0.08)), var(--panel);
  box-shadow: var(--shadow);
}

.assistant-strip strong,
.assistant-strip span {
  display: block;
}

.assistant-strip span {
  margin-top: 3px;
  color: var(--muted);
}

.assistant-strip form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.assistant-response {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid var(--response-border);
  border-radius: 12px;
  background: var(--response-bg);
  color: var(--response-text);
  line-height: 1.45;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--hero-start), var(--hero-end));
  color: white;
  box-shadow: var(--shadow);
}

.dashboard-hero h3 {
  max-width: 760px;
  font-size: clamp(1.18rem, 2.5vw, 1.85rem);
  font-weight: 600;
  line-height: 1.2;
}

.dashboard-hero .eyebrow,
.dashboard-hero .assistant-mini span {
  color: var(--hero-muted);
}

.assistant-mini {
  width: min(320px, 100%);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
}

.assistant-mini strong,
.assistant-mini span {
  display: block;
}

.assistant-mini span {
  margin-top: 5px;
  line-height: 1.45;
}

.metric-grid.interactive {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.metric-button.active {
  border-color: var(--focus);
  box-shadow: 0 18px 45px color-mix(in srgb, var(--focus) 20%, transparent);
}

.dashboard-grid,
.finance-grid,
.client-layout,
.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.support-hub {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.identity-panel {
  background: linear-gradient(160deg, #ffffff, #f0fdfa);
}

.identity-number {
  width: fit-content;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #0f172a;
  color: white;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: 650;
  letter-spacing: 0;
}

.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.permission-list span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--focus-soft);
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 650;
}

.support-flow-list,
.clearance-grid {
  display: grid;
  gap: 10px;
}

.support-flow,
.clearance-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.support-flow {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.support-flow p,
.clearance-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.clearance-card span {
  color: var(--accent-text);
  font-weight: 650;
}

.policy-list.compact {
  gap: 8px;
}

.client-list {
  display: grid;
  gap: 10px;
}

.client-row {
  display: flex;
  width: 100%;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.client-row:hover,
.client-row.active {
  border-color: var(--focus);
  background: var(--focus-soft);
}

.client-row small,
.client-row em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
}

.client-detail {
  align-self: start;
}

.client-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.client-meta-grid p,
.client-action-card {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.45;
}

.client-action-card {
  display: grid;
  gap: 12px;
  color: var(--ink);
}

.client-action-card strong {
  line-height: 1.45;
}

.client-log-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.client-log-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 10px;
}

.client-timeline {
  display: grid;
  gap: 10px;
}

.client-log-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.timeline-dot {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-weight: 650;
}

.client-log-entry p,
.client-log-entry small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.chart-panel {
  min-height: 360px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.segmented button.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.chart-copy {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.bar-chart,
.timeline,
.project-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.bar-row span,
.bar-row strong {
  font-size: 0.88rem;
}

.bar-track,
.progress-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.bar-fill,
.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--progress-start), var(--progress-end));
}

.summary-chart {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 260px;
  text-align: center;
}

.score-ring {
  display: grid;
  width: 148px;
  height: 148px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel) 58%, transparent 60%),
    conic-gradient(var(--progress-end) var(--score), #e2e8f0 0);
}

.score-ring strong,
.score-ring span {
  grid-area: 1 / 1;
}

.score-ring strong {
  margin-top: -12px;
  font-size: 1.7rem;
}

.score-ring span {
  margin-top: 42px;
  color: var(--muted);
  font-weight: 600;
}

.bi-hero {
  background:
    radial-gradient(circle at 84% 18%, rgba(34, 197, 94, 0.22), transparent 28%),
    linear-gradient(135deg, #0b1f16, #0f2f25 58%, #166534);
}

.bi-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bi-score-row,
.bi-table,
.bi-pipeline-chart {
  display: grid;
  gap: 12px;
}

.bi-signal {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}

.bi-signal-top,
.bi-table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bi-signal-top strong {
  color: var(--primary-dark);
  font-size: 1.35rem;
}

.bi-signal-top span,
.bi-signal p,
.bi-brief-row p,
.bi-table-row p {
  margin: 0;
  color: var(--muted);
}

.bi-signal p {
  color: var(--ink);
  font-weight: 650;
}

.bi-brief-row,
.bi-table-row {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}

.bi-brief-row {
  display: grid;
  gap: 4px;
}

.bi-brief-row strong,
.bi-table-row span {
  color: var(--primary-dark);
  font-size: 1.2rem;
  font-weight: 700;
}

.bi-brief-row span,
.bi-table-row strong {
  font-weight: 700;
}

.bi-wide {
  grid-column: 1 / -1;
}

.bi-pipeline-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.72fr) minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}

.bi-pipeline-row strong,
.bi-pipeline-row span,
.bi-pipeline-row em {
  display: block;
}

.bi-pipeline-row span,
.bi-pipeline-row em {
  color: var(--muted);
  font-style: normal;
}

.bi-pipeline-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.bi-pipeline-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--progress-start), var(--progress-end));
}

.timeline p {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 44px;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.timeline span,
.timeline em {
  color: var(--muted);
  font-style: normal;
}

.table-status.neutral {
  background: #e2e8f0;
  color: #475569;
}

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

.staff-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.access-list,
.device-list {
  display: grid;
  gap: 10px;
}

.access-event,
.device-row,
.access-review-card {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.access-event {
  grid-template-columns: minmax(0, 1fr) auto;
}

.access-review-card {
  align-items: stretch;
}

.device-row {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.access-event p,
.access-review-card p,
.access-event small,
.device-row p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.review-note {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--focus-soft);
}

.access-hero {
  background: linear-gradient(135deg, var(--hero-start), var(--brand-end));
}

.staff-card p,
.staff-card small,
.panel-copy {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.project-row:hover,
.project-row.active {
  border-color: var(--focus);
  background: var(--focus-soft);
}

.project-row small,
.project-row em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
}

.project-detail {
  align-self: start;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag-row span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--focus-soft);
  color: var(--accent-text);
  font-size: 0.82rem;
  font-weight: 650;
}

.settings-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 40;
  display: grid;
  gap: 14px;
  width: min(360px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
}

.action-drawer {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 45;
  display: grid;
  gap: 14px;
  width: min(420px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.24);
}

.action-drawer + .settings-panel {
  right: 456px;
}

.settings-note {
  padding: 12px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  line-height: 1.45;
}

.settings-tabs,
.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

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

.settings-tabs button,
.drawer-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.settings-tabs button:first-child,
.drawer-tabs button.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.settings-help-grid {
  display: grid;
  gap: 10px;
}

.settings-help-grid article,
.calendar-preview,
.evidence-note {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}

.settings-help-grid p,
.calendar-preview span,
.evidence-note,
.evidence-note span {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.calendar-preview,
.evidence-note {
  display: grid;
  gap: 8px;
}

.empty-state,
.empty-state-inline {
  color: var(--muted);
}

.empty-state {
  text-align: center;
}

.empty-state-inline {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.ops-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.ops-stack,
.inventory-grid,
.slack-outbox {
  display: grid;
  gap: 12px;
}

.ops-card,
.inventory-card,
.slack-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.ops-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.ops-card p,
.inventory-card p,
.slack-row p,
.ops-card small,
.inventory-card small,
.slack-row small {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.ops-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ops-meta-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.ops-meta-grid small {
  margin: 0;
}

.inventory-card.low-stock {
  border-color: color-mix(in srgb, var(--red) 30%, var(--line));
  background: #fff7ed;
}

.stock-balance {
  display: grid;
  gap: 2px;
  width: 130px;
  padding: 12px;
  border-radius: 12px;
  background: var(--focus-soft);
  color: var(--accent-text);
}

.stock-balance strong {
  font-size: 1.7rem;
  line-height: 1;
}

.stock-form {
  display: grid;
  grid-template-columns: 120px 90px minmax(0, 1fr) auto;
  gap: 8px;
}

.stock-form input,
.stock-form select {
  min-height: 38px;
}

.slack-row {
  background: #ffffff;
}

.command-hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.command-list,
.ops-board {
  display: grid;
  gap: 12px;
}

.command-item,
.agops-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.command-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.command-item.critical,
.agops-card.blocked {
  border-color: color-mix(in srgb, var(--red) 35%, var(--line));
  background: #fff7ed;
}

.command-rank {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--focus-soft);
  color: var(--accent-text);
  font-weight: 700;
}

.command-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.agops-health {
  display: grid;
  gap: 5px;
  max-width: 260px;
}

.agops-health strong {
  font-size: 1.4rem;
  line-height: 1;
}

.agops-health span {
  color: var(--muted);
}

.agops-health div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.agops-health i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #f59e0b, var(--primary));
}

.slack-outbox.expanded {
  grid-template-columns: 1fr;
}

.slack-row.sent {
  opacity: 0.72;
}

.field-today,
.lead-entry {
  display: grid;
  gap: 16px;
}

.field-focus {
  background: linear-gradient(160deg, #ffffff, #f0fdf4);
}

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

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

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

.lead-form .wide-field,
.lead-form button {
  grid-column: 1 / -1;
}

.lead-list,
.update-list {
  display: grid;
  gap: 12px;
}

.lead-list.compact {
  gap: 10px;
}

.lead-card,
.update-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.lead-card p,
.lead-card small,
.update-card p,
.update-card small {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.field-staff-card {
  min-height: 112px;
}

@media (max-width: 1120px) {
  .dashboard-grid,
  .finance-grid,
  .client-layout,
  .project-layout,
  .support-hub,
  .assistant-strip {
    grid-template-columns: 1fr;
  }

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

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

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

@media (max-width: 760px) {
  .metric-grid.interactive,
  .staff-grid {
    grid-template-columns: 1fr;
  }

  .topbar-left,
  .topbar-actions {
    flex-wrap: wrap;
  }

  .assistant-strip form,
  .client-log-form,
  .timeline p,
  .bar-row,
  .bi-pipeline-row,
  .client-meta-grid,
  .staff-card,
  .support-flow,
  .ops-card-top,
  .ops-meta-grid,
  .stock-form,
  .ops-overview,
  .command-item {
    grid-template-columns: 1fr;
  }

  .command-actions {
    justify-content: stretch;
  }

  .command-actions button {
    flex: 1;
  }

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