:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --success: #047857;
  --warning: #9a5b13;
  --danger: #b91c1c;
  --module: #315b7a;
  --shadow: 0 16px 40px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  width: 260px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 14px;
}

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

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle,
.small-copy,
.eyebrow {
  color: var(--muted);
}

.brand-subtitle,
.small-copy {
  font-size: 13px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-stack {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}

.nav-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 0 12px 2px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  color: var(--muted);
  padding: 0 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

.nav-link:hover,
.nav-link.active {
  background: #eff6ff;
  color: #1d4ed8;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(249, 250, 251, 0.95);
  margin: -26px -26px 22px;
  padding: 18px 26px;
  backdrop-filter: blur(8px);
}

.topbar-title {
  min-width: 0;
}

.topbar-title p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

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

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

h3 {
  font-size: 14px;
}

.topbar-actions,
.panel-header,
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.icon-button:hover {
  border-color: var(--accent);
}

.tenant-switcher {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.tenant-switcher select {
  min-width: 118px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: 0;
}

.user-menu {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 5px 10px 5px 6px;
}

.user-menu:hover {
  border-color: var(--accent);
}

.user-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.user-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}

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

.user-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

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

.status-card,
.workspace-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-card {
  min-height: 150px;
  padding: 18px;
}

.status-card p {
  color: var(--muted);
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.workspace-band {
  margin-top: 18px;
  padding: 20px;
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.neutral {
  background: #e8ecea;
  color: #3e4945;
}

.success {
  background: #dcefe6;
  color: var(--success);
}

.warning {
  background: #f3e7d2;
  color: var(--warning);
}

.danger {
  background: #f3dada;
  color: var(--danger);
}

.module {
  background: #dfe9f4;
  color: var(--module);
}

.module-content {
  margin-top: 18px;
}

.module-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.module-summary > div,
.module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}

.module-summary strong {
  display: block;
  margin-top: 4px;
}

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

.module-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
  }

  .workspace {
    margin-left: 0;
  }

  .status-grid,
  .module-grid,
  .module-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .workspace {
    padding: 18px;
  }

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

  .topbar {
    margin: -18px -18px 18px;
    padding: 16px 18px;
  }

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

  .tenant-switcher,
  .user-menu {
    max-width: 100%;
  }
}
