:root {
  color-scheme: light;
  --bg: #eef3f6;
  --surface: #ffffff;
  --surface-muted: #f7f9fb;
  --ink: #172033;
  --muted: #657086;
  --line: #d6dee8;
  --line-strong: #bac7d6;
  --primary: #14736f;
  --primary-dark: #0f5652;
  --accent: #b85f12;
  --violet: #6847b7;
  --danger: #b42318;
  --success: #1f7a4d;
  --warning: #aa5b00;
  --shadow: 0 12px 32px rgba(19, 31, 47, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.login-body {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: auto;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card p {
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 18px;
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand__mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

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

.eyebrow {
  display: inline-block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.nav-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #344054;
  font-weight: 700;
  padding: 0 10px;
}

.nav-link:hover {
  background: #f2f5f8;
}

.nav-link.is-active {
  border-color: #b5d9d6;
  background: #e6f4f2;
  color: var(--primary-dark);
}

.nav-card {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

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

.main-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 14px 22px;
}

.topbar h1,
.page-header h2,
.panel h2,
.dialog-card h2,
.empty-state h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 22px;
}

.topbar__actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-header h2 {
  margin-bottom: 6px;
  font-size: 30px;
}

.page-header p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
}

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

.kpi-card,
.panel,
.mini-card,
.stage-card,
.empty-state,
.banner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.kpi-card {
  display: grid;
  min-height: 132px;
  gap: 5px;
  padding: 15px;
}

.kpi-card__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #e9f4f2;
  color: var(--primary);
}

.kpi-card strong {
  font-size: 28px;
}

.layout-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.layout-two--wide-left {
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.7fr);
}

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

.panel--visual {
  overflow: hidden;
}

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

.panel__head h2,
.dialog-card h2 {
  font-size: 20px;
}

.stack {
  display: grid;
  gap: 10px;
}

.mini-card,
.match-row,
.setting-row,
.person {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.mini-card,
.setting-row {
  justify-content: space-between;
  padding: 12px;
}

.mini-card div,
.match-row div,
.setting-row div {
  min-width: 0;
}

.mini-card strong,
.mini-card span,
.match-row strong,
.match-row span,
.setting-row strong,
.setting-row span {
  display: block;
}

.mini-card span,
.match-row span,
.setting-row span {
  color: var(--muted);
}

meter {
  width: 90px;
  height: 9px;
}

.city-map,
.route-map {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf5f6;
}

.city-map svg,
.route-map svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 330px;
}

.city-map path {
  fill: none;
  stroke: #8ab8bc;
  stroke-width: 9;
  stroke-linecap: round;
}

.city-map path:nth-child(2) {
  stroke: #d2b278;
}

.city-map path:nth-child(3) {
  stroke: #9ea8d6;
}

.map-pin {
  position: absolute;
  display: grid;
  min-width: 112px;
  gap: 2px;
  border: 1px solid #9fcac7;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px;
}

.map-pin::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 12px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  border-left: 1px solid #9fcac7;
  border-bottom: 1px solid #9fcac7;
  background: #fff;
}

.route-map rect {
  fill: #f4f7fa;
}

.route-map .street {
  fill: none;
  stroke: #d9e1ea;
  stroke-width: 12;
  stroke-linecap: round;
}

.route-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-dot {
  fill: var(--accent);
  stroke: white;
  stroke-width: 4;
}

.route-map__overlay {
  position: absolute;
  right: 14px;
  bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.route-map__overlay span,
.route-map__overlay strong {
  display: block;
}

.route-map__overlay strong {
  font-size: 28px;
}

.media-frame {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7f9;
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: white;
}

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

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

td span {
  display: block;
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

.button,
.icon-button,
.segmented__item,
.tab {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  padding: 0 12px;
}

.button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.button--secondary {
  border-color: #96cac7;
  background: #e7f4f3;
  color: var(--primary-dark);
}

.button--ghost {
  background: #fff;
}

.button--compact {
  min-height: 32px;
  padding-inline: 10px;
}

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

.segmented {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.segmented__item {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  color: var(--muted);
}

.segmented__item + .segmented__item {
  border-left: 1px solid var(--line);
}

.segmented__item.is-active,
.tab.is-active {
  background: var(--ink);
  color: #fff;
}

.segmented--large {
  width: fit-content;
}

.tabbar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

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

.field-row,
.filter-grid {
  display: grid;
  gap: 12px;
}

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

.filter-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

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

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

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.form-output {
  min-height: 24px;
  color: var(--muted);
  font-weight: 700;
}

.price,
.hero-metric {
  margin: 8px 0;
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
}

.detail-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 12px 0 0;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 800;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--avatar, #2563eb);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 0 9px;
  white-space: nowrap;
}

.chip--high,
.chip--critical,
.chip--error {
  background: #fde9e7;
  color: var(--danger);
}

.chip--medium,
.chip--blocked,
.chip--due,
.chip--late {
  background: #fff3df;
  color: var(--warning);
}

.chip--low,
.chip--done,
.chip--paid,
.chip--resolved,
.chip--assigned,
.chip--handover {
  background: #e7f6ef;
  color: var(--success);
}

.chip--open,
.chip--requested,
.chip--needs-cover,
.chip--in-progress {
  background: #e8f1ff;
  color: #2855a5;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stage-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.stage-card__number {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.ladder {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.ladder li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.ladder span {
  display: grid;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #f0eadf;
  color: #7a4b12;
  font-weight: 900;
}

.toggle-list,
.check-list {
  display: grid;
  gap: 12px;
}

.toggle-list label,
.check-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.setting-row {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.switch {
  display: inline-flex;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #c8d2dd;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--primary);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.relative {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: none;
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 6px;
}

.menu.is-open {
  display: grid;
}

.menu button,
.menu a {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.menu button:hover,
.menu a:hover {
  background: var(--surface-muted);
}

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  font-weight: 800;
}

.banner--error {
  border-color: #f6b0aa;
  background: #fff1f0;
  color: var(--danger);
}

.banner--success {
  border-color: #a7dec5;
  background: #eefaf4;
  color: var(--success);
}

.banner--info {
  border-color: #b9cff1;
  background: #f0f5ff;
  color: #2855a5;
}

dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.dialog-card {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 18px;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
}

.empty-state p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
}

.skeleton-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 15px;
}

.skeleton-card span,
.skeleton-card strong,
.skeleton-card p {
  display: block;
  border-radius: 6px;
  background: #e1e7ee;
}

.skeleton-card span {
  width: 46px;
  height: 28px;
}

.skeleton-card strong {
  width: 70%;
  height: 22px;
  margin-top: 22px;
}

.skeleton-card p {
  width: 90%;
  height: 14px;
  margin-top: 12px;
}

code {
  display: block;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f7fa;
  padding: 12px;
}

@media (max-width: 1180px) {
  .kpi-grid,
  .stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-two,
  .layout-two--wide-left {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .main-column {
    display: block;
  }

  .content {
    overflow: visible;
    padding: 16px;
  }

  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar__actions,
  .segmented {
    flex-wrap: wrap;
  }

  .kpi-grid,
  .stage-grid,
  .filter-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .page-header h2 {
    font-size: 25px;
  }
}
