:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --accent: #2563eb;
  --sidebar: #14213d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

.app-sidebar {
  background: var(--sidebar);
  color: #fff;
  padding: 18px 14px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 18px;
}

.user-card {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 18px;
}

.user-card span {
  display: block;
  color: rgba(255,255,255,.7);
  font-size: .82rem;
  overflow-wrap: anywhere;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: rgba(255,255,255,.72);
  background: transparent;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-group-toggle:hover,
.nav-group-toggle[aria-expanded="true"] {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.nav-group-chevron {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  transform: rotate(0deg);
  transition: transform .15s ease;
}

.nav-group-toggle.collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: grid;
  gap: 1px;
  padding: 2px 0 6px 8px;
}

.app-sidebar .nav-link {
  color: rgba(255,255,255,.82);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: .92rem;
  overflow-wrap: anywhere;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.12);
}

.app-sidebar .nav-link.active {
  box-shadow: inset 3px 0 0 #93c5fd;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
}

.content {
  padding: 24px;
}

.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

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

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.table td,
.table th {
  vertical-align: middle;
}

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

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

.permission-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(4, 96px);
  gap: 8px;
  align-items: center;
}

.badge-soft {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: .78rem;
}

.choices {
  margin-bottom: 0;
}

.choices__inner {
  min-height: 38px;
  border-color: #dee2e6;
  background: #fff;
  border-radius: .375rem;
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
  border-color: #86b7fe;
  box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
  z-index: 1050;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  min-width: 240px;
  background: #eef3f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.kanban-column-header h2 {
  font-size: .95rem;
  margin: 0;
}

.kanban-column-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.kanban-card {
  display: grid;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.kanban-card-title {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.kanban-card-title:hover {
  color: var(--accent);
}

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

.task-meta-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.task-meta-grid span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  margin-bottom: 2px;
}

.task-meta-grid strong {
  display: block;
  font-size: .95rem;
}

.task-description {
  overflow-wrap: anywhere;
}

.portal-sidebar {
  background: #12302d;
}

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

.portal-metric,
.portal-list-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
}

.portal-metric {
  min-height: 112px;
  text-decoration: none;
}

.portal-metric span,
.portal-metric small {
  display: block;
  color: var(--muted);
}

.portal-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
}

.portal-metric:hover,
.portal-list-card:hover {
  border-color: #8bb6aa;
}

.portal-rich-text {
  overflow-wrap: anywhere;
}

.portal-rich-text p:last-child {
  margin-bottom: 0;
}

.portal-progress {
  height: 8px;
  min-width: 110px;
}

.settings-nav .nav-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  border-radius: 6px;
}

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

.settings-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.utilities-table {
  max-height: 440px;
  overflow: auto;
}

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

  .app-sidebar {
    position: static;
  }

  .form-grid,
  .permission-grid,
  .task-meta-grid,
  .portal-metrics {
    grid-template-columns: 1fr;
  }
}
