/* TPP Portal — dense logistics SaaS (Flexport-inspired) */

:root {
  --ink: #102c46;
  --accent: #0759a6;
  --accent-soft: #e8f2fb;
  --body: #40576c;
  --line: #e2e8f0;
  --surface: #f4f7fa;
  --white: #ffffff;
  --ok: #1f7a4d;
  --ok-soft: #e8f6ee;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --sidebar: #0b2136;
  --sidebar-text: #a9bdcf;
}

body.portal-shell {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Barlow", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.saas-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  align-items: stretch;
}

.saas-sidebar {
  background: var(--sidebar);
  color: #e2e8f0;
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #14324c;
}

.saas-sidebar .logo {
  color: #fff;
  text-decoration: none;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 8px 12px;
  border-bottom: 1px solid #1e3a52;
}

.saas-sidebar .logo-name {
  font-size: 10px;
  letter-spacing: 0.12em;
  line-height: 1.35;
  color: #9db0c3;
  font-weight: 600;
}

.saas-nav {
  display: grid;
  gap: 1px;
  flex: 1;
  overflow: auto;
  padding-inline: 2px;
  align-content: start;
}

.nav-section-label {
  margin: 10px 8px 3px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5f758a;
}

.nav-section-label:first-child {
  margin-top: 0;
}

.saas-nav-link {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  column-gap: 10px;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s;
}

.saas-nav-link .nav-icon {
  width: 16px;
  height: 16px;
  display: block;
  margin: 0 auto;
  opacity: 0.85;
}

.saas-nav-link span {
  min-width: 0;
}

.saas-nav-link:hover {
  background: #122f46;
  color: #fff;
}

.saas-nav-link[aria-current="page"] {
  background: #143752;
  color: #fff;
  box-shadow: inset 2px 0 0 #3b82c4;
}

.saas-nav-link[aria-current="page"] .nav-icon {
  opacity: 1;
}

.saas-user {
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid #1e3a52;
  font-size: 0.75rem;
  color: var(--sidebar-text);
  display: grid;
  gap: 8px;
}

.saas-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saas-user button {
  background: none;
  border: 0;
  color: #fff;
  text-align: left;
  padding: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.saas-user button:hover {
  color: #93c5fd;
}

.service-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: #fff;
}

.service-card p {
  margin: 4px 0 0;
}

.saas-main {
  padding: 18px 22px 28px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  box-sizing: border-box;
}

.saas-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 2px;
}

.saas-topbar h1 {
  font-size: 1.5rem;
  margin: 0 0 2px;
  letter-spacing: -0.03em;
}

.saas-topbar p {
  margin: 0;
  color: var(--body);
  font-size: 0.875rem;
}

.saas-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.kpi {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 14px;
}

.kpi span {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--body);
  margin-bottom: 4px;
}

.kpi strong {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.9375rem;
  letter-spacing: -0.02em;
}

.panel-body {
  padding: 12px 14px;
}

.saas-layout:has(.page-dashboard),
.portal-shell-host:has(.page-dashboard) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  align-items: stretch;
}

.portal-loading {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 600;
}

.tracking-card-list {
  display: grid;
  gap: 12px;
}

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

.saas-layout:has(.page-dashboard) > .page-dashboard,
.portal-shell-host:has(.page-dashboard) .page-dashboard {
  min-height: 0;
}

.portal-shell-host {
  min-height: 100vh;
}

.portal-shell-host .saas-main {
  min-height: 0;
}

.page-dashboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 14px 4px;
  /* Shell header already takes --header-height; avoid double 100vh clip. */
  height: calc(100dvh - var(--header-height, 3.5rem));
  max-height: calc(100dvh - var(--header-height, 3.5rem));
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.page-dashboard > .panel,
.page-dashboard .fx-greeting,
.page-dashboard .fx-kpi {
  box-shadow: 0 1px 0 rgba(16, 44, 70, 0.03);
}

.page-dashboard .panel {
  border-radius: 6px;
}

.page-dashboard .panel-head {
  padding: 8px 12px;
  min-height: 36px;
}

.page-dashboard .panel-head h2 {
  font-size: 0.875rem;
}

.page-dashboard .panel-body {
  padding: 10px 12px;
}

.fx-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 1.1fr);
  gap: 8px;
  align-items: stretch;
  flex: 0 0 auto;
}

.fx-greeting {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  display: grid;
  align-content: center;
  gap: 3px;
}

.fx-eyebrow {
  margin: 0;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.fx-greeting h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.fx-greeting > p:last-child {
  margin: 0;
  color: var(--body);
  font-size: 0.8125rem;
  max-width: 46ch;
  line-height: 1.35;
}

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

.fx-kpi {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  min-height: 84px;
  box-shadow: none;
  transition: border-color 0.15s ease;
}

.fx-kpi:hover {
  background: #ffffff;
  border-color: #c7d2de;
}

.fx-kpi-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fx-kpi-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #f8fafc;
  color: #1a365d;
  border: 1px solid #d7dee7;
  flex-shrink: 0;
}

.fx-kpi-icon svg {
  width: 17px;
  height: 17px;
  display: block;
}

.fx-kpi-top > span:last-child {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5d70;
  line-height: 1.2;
}

.fx-kpi strong {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.95;
  color: #102c46;
  font-variant-numeric: tabular-nums;
  padding-left: 2px;
}

.fx-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.9fr);
  gap: 8px;
  flex: 1.4 1 0;
  min-height: 250px;
  max-height: none;
  height: auto;
}

.fx-map-panel,
.fx-tasks-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
}

.fx-map-body {
  padding: 0 !important;
  flex: 1;
  min-height: 0;
  position: relative;
  background: #dfe8f1;
}

.fx-world-map {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #dfe8f1;
}

.fx-world-map .fx-map-tiles {
  filter: saturate(0.72) contrast(1.02) brightness(1.03);
}

.fx-world-map .leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 44, 70, 0.08);
  margin: 12px !important;
}

.fx-world-map .leaflet-control-zoom a {
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  color: var(--ink) !important;
  border-bottom-color: var(--line) !important;
}

.fx-map-marker {
  background: transparent !important;
  border: none !important;
}

.fx-map-marker span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow:
    0 0 0 5px rgba(7, 89, 166, 0.2),
    0 3px 10px rgba(16, 44, 70, 0.28);
  border: 3px solid #fff;
}

.fx-map-marker.is-alert span {
  background: #b42318;
  box-shadow:
    0 0 0 5px rgba(180, 35, 24, 0.2),
    0 3px 10px rgba(16, 44, 70, 0.28);
}

.fx-task-list {
  display: grid;
  gap: 0;
  padding: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: none;
  flex: 1;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fx-task-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.fx-task {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
}

.fx-task:last-child {
  border-bottom: 0;
}

.fx-task:hover {
  background: #f7fafc;
}

.fx-task-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid #c9dff2;
}

.fx-task-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.fx-task-body strong {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-task-side {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.fx-lower-row {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  gap: 8px;
  align-items: stretch;
  flex: 1.1 1 0;
  min-height: 200px;
}

.fx-lower-row > .panel {
  border-radius: 6px;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.fx-lower-row > .panel > .panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fx-lower-row > .panel > .panel-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.fx-lower-row .fx-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: block;
}

.fx-table-wrap {
  padding: 0 !important;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
  -ms-overflow-style: auto;
}

.page-dashboard .fx-table-wrap {
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fx-table-wrap::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.fx-project-table {
  width: 100%;
  table-layout: fixed;
}

.fx-project-table th,
.fx-project-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-project-table thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.fx-project-table th,
.fx-project-table td {
  padding: 8px 12px;
}

.fx-project-table td:nth-child(3) {
  min-width: 100px;
}

.fx-project-table .progress {
  height: 5px;
  margin-top: 3px;
}

.fx-project-cell {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.fx-project-cell img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.fx-project-cell a {
  color: inherit;
  text-decoration: none;
}

.fx-project-cell a:hover strong {
  color: var(--accent);
}

.fx-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.fx-activity {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.fx-activity:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.fx-activity:first-child {
  padding-top: 0;
}

.fx-activity strong {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 3px;
}

.fx-activity p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.fx-activity-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
  flex-shrink: 0;
}

.fx-activity.is-exception {
  background: linear-gradient(90deg, #fef3f2 0%, transparent 70%);
  margin: 0 -16px;
  padding-inline: 16px;
  border-bottom-color: #f4d7d4;
}

.transit-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.transit-timeline li {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 8px 8px 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--body);
  background: #f8fafc;
}

.transit-timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #cbd5e1;
  border-radius: 3px 0 0 3px;
}

.transit-timeline li.done {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #abefc6;
}

.transit-timeline li.done::before {
  background: var(--ok);
}

.transit-timeline li.current {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #bfd8f0;
}

.transit-timeline li.current::before {
  background: var(--accent);
}

.split-2 {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 12px;
  align-items: start;
}

.split-2 > .panel {
  min-height: 100%;
}

.split-detail {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

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

.project-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-card.large {
  grid-template-columns: 148px 1fr;
  padding: 14px;
  gap: 16px;
  min-height: 148px;
}

.project-card:hover {
  border-color: #a9bdcf;
  box-shadow: 0 6px 16px #102c460f;
}

.project-card img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface);
}

.project-card.large img {
  width: 148px;
  height: 148px;
}

.project-card h3 {
  margin: 6px 0 4px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.project-card.large h3 {
  font-size: 1.125rem;
}

.project-card p {
  margin: 0 0 10px;
  color: var(--body);
  font-size: 0.8125rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--body);
  margin-bottom: 4px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.75rem;
  color: var(--body);
  margin-top: auto;
}

.progress {
  height: 8px;
  background: #e8eef5;
  border-radius: 99px;
  overflow: hidden;
  margin: 0 0 10px;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0759a6, #3b82c4);
}

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

.transit-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  background: #fafbfc;
}

.transit-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface);
}

.transit-card h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.transit-card .muted {
  margin: 0;
}

.transit-meta {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
  font-size: 0.75rem;
  color: var(--body);
}

.transit-meta strong {
  color: var(--ink);
  font-size: 0.8125rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1;
}

/* Pipeline: early / planning */
.badge.quote,
.badge.brief_received,
.badge.sourcing {
  background: #d7ebfb;
  color: #0a4f8c;
  border-color: #7eb6e4;
}

/* Pipeline: production work */
.badge.samples,
.badge.production,
.badge.quality_check {
  background: #ffe4c2;
  color: #8a3f00;
  border-color: #f0b36a;
}

/* Pipeline: movement — clear blue/green */
.badge.shipping,
.badge.shipped,
.badge.intransit {
  background: #cfe9df;
  color: #0f5c3d;
  border-color: #6fbf96;
}

/* Success / settled */
.badge.delivered,
.badge.paid {
  background: #bfe8cf;
  color: #0f5a35;
  border-color: #5fbf88;
}

/* Payment outstanding — clear red/orange */
.badge.unpaid {
  background: #ffd4c8;
  color: #9f1d12;
  border-color: #f08a72;
}

/* Payment partial — amber */
.badge.partial {
  background: #ffe08a;
  color: #7a5200;
  border-color: #e0b84a;
}

/* Exception / needs attention */
.badge.exception {
  background: #ffd0cc;
  color: #9f1a14;
  border-color: #ef7f76;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--body);
}

.table tr:hover td {
  background: #f8fafc;
}

.map-frame {
  height: 320px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #dbe4ee;
}

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

.milestone {
  position: relative;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--body);
}

.milestone.done {
  border-color: #93c5aa;
  background: var(--ok-soft);
  color: var(--ok);
}

.milestone.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--line);
  margin-left: 6px;
}

.timeline li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}

.timeline .time {
  display: block;
  font-size: 0.75rem;
  color: var(--body);
}

.price-rows {
  display: grid;
  gap: 8px;
  font-size: 0.875rem;
}

.price-rows div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.price-rows .total {
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 0;
  padding-top: 12px;
}

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

.service-list label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
}

.service-list label:hover {
  border-color: #a9bdcf;
}

.service-list small {
  color: var(--body);
}

.portal-alert {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  color: var(--body);
}

.portal-alert.error {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--ink);
}

.portal-alert.success {
  border-color: #abefc6;
  background: var(--ok-soft);
}

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

.portal-form label {
  display: grid;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.portal-form input,
.portal-form select,
.portal-form textarea {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 8px 10px;
  font: inherit;
}

.page-brief {
  max-width: 1040px;
}

.brief-intake {
  display: grid;
  gap: 12px;
  padding-bottom: 88px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.brief-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.brief-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink, #0f172a);
}

.brief-check input {
  width: 16px;
  height: 16px;
  accent-color: #1a365d;
}

.brief-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
}

.brief-file-preview.empty {
  align-items: center;
  color: var(--body);
  font-size: 0.8125rem;
}

.brief-file-chip {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 3px;
  background: #fff;
  font-size: 0.75rem;
}

.brief-file-chip.is-error {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #9f1239;
}

.brief-submit-bar {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.brief-submit-bar .button {
  min-width: 180px;
}

.brief-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.brief-meta > div,
.brief-field {
  display: grid;
  gap: 4px;
}

.brief-meta span,
.brief-field span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.brief-meta strong,
.brief-field strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink, #0f172a);
  white-space: pre-wrap;
}

.brief-grid {
  display: grid;
  gap: 10px;
}

.admin-brief {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.button.tiny {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.75rem;
}

.muted {
  color: var(--body);
  font-size: 0.8125rem;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--body);
}

.text-link {
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.text-link:hover {
  text-decoration: underline;
}

.ops-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 2px;
}

.ops-toolbar input[type="search"],
.ops-toolbar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  padding: 0 10px;
}

.ops-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 180px;
}

.ops-toolbar select {
  min-width: 120px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--body);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: #9fc2e4;
  color: var(--accent);
}

.page-orders .panel,
.page-projects .panel {
  margin-bottom: 10px;
}

.page-orders .panel-body.fx-table-wrap,
.page-orders .orders-table-wrap {
  padding: 0 !important;
}

.orders-table tbody tr {
  cursor: pointer;
}

.orders-table tbody tr.is-alert td {
  background: linear-gradient(90deg, #fef3f2 0%, transparent 72%);
}

.orders-actions {
  white-space: nowrap;
}

.pipeline-list {
  padding: 0 !important;
}

.pipeline-group + .pipeline-group {
  border-top: 1px solid var(--line);
}

.pipeline-group-head {
  padding: 10px 14px 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--body);
  background: #f8fafc;
}

.pipeline-row {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--line);
}

.pipeline-row:hover {
  background: #f8fafc;
}

.pipeline-row.is-alert {
  background: linear-gradient(90deg, #fef3f2 0%, transparent 70%);
}

.pipeline-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pipeline-row-top strong {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-pct {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.pipeline-row .progress {
  margin-bottom: 8px;
  height: 5px;
}

@media (max-width: 860px) {
  .orders-table th:nth-child(5),
  .orders-table td:nth-child(5) {
    display: none;
  }

  .pipeline-row-top {
    flex-wrap: wrap;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rise {
  animation: rise 0.28s ease-out both;
}

@media (max-width: 900px) {
  .form-grid-2,
  .brief-meta {
    grid-template-columns: 1fr;
  }

  .brief-submit-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .brief-submit-bar .button {
    width: 100%;
  }
}

@media (max-width: 1100px) {
  .kpi-row,
  .project-grid.compact,
  .fx-hero,
  .fx-map-row,
  .fx-lower-row,
  .split-2,
  .split-detail,
  .milestone-track {
    grid-template-columns: 1fr 1fr;
  }

  .fx-map-row {
    flex: none;
    height: auto;
    max-height: none;
    min-height: 240px;
  }

  .fx-lower-row {
    flex: none;
    min-height: 0;
  }

  .fx-map-body,
  .fx-world-map {
    min-height: 200px;
  }

  .fx-task-list {
    max-height: none;
  }

  .project-card,
  .project-card.large {
    grid-template-columns: 112px 1fr;
  }

  .project-card img,
  .project-card.large img {
    width: 112px;
    height: 112px;
  }
}

@media (max-width: 860px) {
  .saas-layout:has(.page-dashboard),
  .portal-shell-host:has(.page-dashboard) {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .page-dashboard {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .saas-layout {
    grid-template-columns: 1fr;
  }

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

  .saas-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-section-label {
    width: 100%;
    margin: 8px 4px 2px;
  }

  .saas-nav-link {
    flex: 1 1 calc(50% - 6px);
    display: flex;
  }

  .kpi-row,
  .project-grid,
  .project-grid.compact,
  .fx-hero,
  .fx-kpi-row,
  .fx-map-row,
  .fx-lower-row,
  .split-2,
  .split-detail,
  .milestone-track,
  .transit-timeline {
    grid-template-columns: 1fr;
  }

  .project-card,
  .project-card.large,
  .transit-card {
    grid-template-columns: 88px 1fr;
  }

  .transit-meta {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
  }

  .fx-task {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .fx-task-side {
    grid-column: 2;
    justify-items: start;
    text-align: left;
  }
}

/* Portal Services — marketing scroll panels */
.page-services {
  gap: 16px;
}

.service-topbar h1 {
  max-width: 18ch;
}

.service-topbar .eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.service-stage-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 10px 0;
  background: linear-gradient(180deg, #f4f7fb 70%, rgb(244 247 251 / 0%));
}

.service-stage-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 999px;
  background: #fff;
  color: var(--ink, #0f172a);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
}

.service-stage-nav a:hover {
  border-color: #94a3b8;
}

.service-stage {
  display: grid;
  gap: 12px;
}

.service-stage-intro {
  padding: 8px 2px 4px;
}

.service-stage-intro .eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.service-stage-intro h2 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}

.service-stage-intro p {
  margin: 0;
  max-width: 54ch;
  color: var(--body);
}

.service-scroll-stack {
  display: grid;
  gap: 14px;
}

.service-scroll-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: min(72vh, 560px);
  border-radius: 10px;
  border: 1px solid #0f172a22;
  color: #fff;
  display: flex;
  align-items: flex-end;
}

.service-scroll-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.06);
  transition: transform 0.9s ease, filter 0.5s ease;
  filter: saturate(0.95) brightness(0.86);
}

.service-scroll-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(11 33 54 / 88%) 0%, rgb(11 33 54 / 62%) 48%, rgb(11 33 54 / 28%) 100%),
    linear-gradient(0deg, rgb(11 33 54 / 72%) 0%, transparent 55%);
}

.service-scroll-panel.is-inview .service-scroll-bg {
  transform: scale(1);
  filter: saturate(1.05) brightness(0.92);
}

.service-scroll-copy {
  position: relative;
  max-width: 560px;
  padding: 28px 30px 32px;
}

.service-scroll-eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cbd5e1;
}

.service-scroll-copy h3 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 2.4vw, 2.125rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.service-scroll-copy p {
  margin: 0 0 18px;
  color: #e2e8f0;
  font-size: 1rem;
  line-height: 1.55;
  max-width: 46ch;
}

.service-scroll-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.service-scroll-link.button.secondary {
  background: rgb(255 255 255 / 12%);
  border-color: rgb(255 255 255 / 35%);
  color: #fff;
}

.service-scroll-link.button.secondary:hover {
  background: rgb(255 255 255 / 20%);
}

.service-addons-panel {
  margin-top: 8px;
}

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

.service-addon {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.service-addon:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.service-addon:first-child {
  padding-top: 0;
}

.service-addon p {
  margin: 4px 0 0;
}

@media (max-width: 900px) {
  .service-scroll-panel {
    min-height: 420px;
  }

  .service-scroll-copy {
    padding: 22px 18px 24px;
  }

  .service-scroll-overlay {
    background:
      linear-gradient(180deg, rgb(11 33 54 / 35%) 0%, rgb(11 33 54 / 88%) 68%),
      linear-gradient(90deg, rgb(11 33 54 / 70%), rgb(11 33 54 / 45%));
  }
}
