/*
 * Mạnh Life V84 — Career Revenue OS
 * Sự nghiệp owns measurable revenue goals; Finance remains the source ledger.
 * The visual language intentionally uses open rails, lists and tables instead
 * of a dense bento-card dashboard.
 */

.ml-cro,
.ml-cro-shell {
  --cro-canvas: #f5f8f7;
  --cro-surface: #ffffff;
  --cro-surface-alt: #f8faf9;
  --cro-forest: #075b3a;
  --cro-forest-dark: #073f2a;
  --cro-forest-deep: #043723;
  --cro-forest-soft: #e7f2ed;
  --cro-ink: #16251f;
  --cro-muted: #64716c;
  --cro-muted-2: #8a9691;
  --cro-line: #d7dfdb;
  --cro-line-soft: #e8eeeb;
  --cro-success: #087a4d;
  --cro-warning: #d97706;
  --cro-warning-soft: #fff8ed;
  --cro-danger: #dc2626;
  --cro-danger-soft: #fff2f2;
  --cro-info: #2563b8;
  --cro-info-soft: #edf5ff;
  --cro-shadow: 0 8px 24px rgba(7, 63, 42, 0.055);
  --cro-shadow-modal: 0 28px 80px rgba(4, 38, 25, 0.24);
  width: 100%;
  min-width: 0;
  min-height: 720px;
  margin: 0;
  padding: 24px;
  box-sizing: border-box;
  overflow-x: clip;
  background: var(--cro-canvas);
  color: var(--cro-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ml-cro *,
.ml-cro *::before,
.ml-cro *::after,
.ml-cro-shell *,
.ml-cro-shell *::before,
.ml-cro-shell *::after,
.ml-cro-modal-host *,
.ml-cro-modal-host *::before,
.ml-cro-modal-host *::after {
  box-sizing: border-box;
}

.ml-cro [hidden],
.ml-cro-shell [hidden],
.ml-cro-modal-host[hidden],
.ml-cro-modal-host [hidden] {
  display: none !important;
}

.ml-cro button,
.ml-cro input,
.ml-cro select,
.ml-cro textarea,
.ml-cro-modal-host button,
.ml-cro-modal-host input,
.ml-cro-modal-host select,
.ml-cro-modal-host textarea {
  font: inherit;
}

.ml-cro button,
.ml-cro select,
.ml-cro-modal-host button,
.ml-cro-modal-host select {
  -webkit-tap-highlight-color: transparent;
}

.ml-cro button:focus-visible,
.ml-cro a:focus-visible,
.ml-cro input:focus-visible,
.ml-cro select:focus-visible,
.ml-cro textarea:focus-visible,
.ml-cro-modal-host button:focus-visible,
.ml-cro-modal-host input:focus-visible,
.ml-cro-modal-host select:focus-visible,
.ml-cro-modal-host textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 184, 0.2);
  outline-offset: 2px;
}

.ml-cro svg,
.ml-cro-modal-host svg {
  display: block;
  flex: 0 0 auto;
}

.ml-cro h1,
.ml-cro h2,
.ml-cro h3,
.ml-cro h4,
.ml-cro p,
.ml-cro-modal-host h2,
.ml-cro-modal-host h3,
.ml-cro-modal-host h4,
.ml-cro-modal-host p {
  margin-top: 0;
}

.ml-cro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 58px;
  margin: 0 0 16px;
}

.ml-cro-brand {
  min-width: 0;
}

.ml-cro-brand h1,
.ml-cro-brand h2,
.ml-cro-head h1,
.ml-cro-head h2 {
  margin: 0;
  color: var(--cro-forest-dark);
  font-size: clamp(28px, 2.35vw, 34px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.ml-cro-brand p,
.ml-cro-head p {
  margin: 5px 0 0;
  color: var(--cro-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.ml-cro-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.ml-cro-head-actions select,
.ml-cro-head-actions input,
.ml-cro-toolbar select,
.ml-cro-toolbar input,
.ml-cro-filters select,
.ml-cro-filters input {
  min-height: 42px;
  border: 1px solid var(--cro-line);
  border-radius: 10px;
  background: var(--cro-surface);
  color: var(--cro-ink);
  padding: 0 36px 0 12px;
  font-size: 13px;
  font-weight: 650;
  outline: 0;
}

.ml-cro-head-actions select:hover,
.ml-cro-toolbar select:hover,
.ml-cro-filters select:hover {
  border-color: #aabbb3;
}

.ml-cro-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--cro-line);
  border-radius: 10px;
  padding: 0 14px;
  background: var(--cro-surface);
  color: var(--cro-forest-dark);
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ml-cro-btn:hover {
  border-color: #a9bbb2;
  background: var(--cro-surface-alt);
}

.ml-cro-btn:active {
  transform: translateY(1px);
}

.ml-cro-btn.primary,
.ml-cro-btn.is-primary,
.ml-cro-btn[data-variant="primary"] {
  border-color: var(--cro-forest);
  background: var(--cro-forest);
  color: #fff;
  box-shadow: 0 5px 14px rgba(7, 91, 58, 0.14);
}

.ml-cro-btn.primary:hover,
.ml-cro-btn.is-primary:hover,
.ml-cro-btn[data-variant="primary"]:hover {
  border-color: var(--cro-forest-dark);
  background: var(--cro-forest-dark);
}

.ml-cro-btn.secondary,
.ml-cro-btn.is-secondary,
.ml-cro-btn[data-variant="secondary"] {
  background: var(--cro-surface);
  color: var(--cro-forest);
}

.ml-cro-btn.danger,
.ml-cro-btn.is-danger,
.ml-cro-btn[data-variant="danger"] {
  border-color: #f2c7c7;
  background: var(--cro-danger-soft);
  color: #b91c1c;
}

.ml-cro-btn.icon-only,
.ml-cro-btn.is-icon,
.ml-cro-btn[aria-label]:empty {
  width: 42px;
  padding: 0;
}

.ml-cro-btn:disabled,
.ml-cro button:disabled,
.ml-cro-modal-host button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

/* Goal command strip */
.ml-cro-goal-strip {
  position: relative;
  display: grid;
  gap: 14px;
  margin: 0 0 12px;
  padding: 18px 20px 15px;
  border: 1px solid var(--cro-line);
  border-radius: 14px;
  background: var(--cro-surface);
  box-shadow: var(--cro-shadow);
}

.ml-cro-goal-main {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(150px, .9fr) minmax(130px, .72fr) minmax(190px, 1.1fr) minmax(165px, .9fr) minmax(140px, .78fr);
  align-items: center;
  min-width: 0;
}

.ml-cro-goal-main > * {
  min-width: 0;
  padding: 0 18px;
}

.ml-cro-goal-main > *:first-child {
  padding-left: 0;
}

.ml-cro-goal-main > *:last-child {
  padding-right: 0;
}

.ml-cro-goal-main > * + * {
  border-left: 1px solid var(--cro-line);
}

.ml-cro-goal-stat {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 56px;
}

.ml-cro-goal-stat > span,
.ml-cro-goal-stat > small,
.ml-cro-goal-stat dt {
  color: var(--cro-muted);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.2;
}

.ml-cro-goal-stat > strong,
.ml-cro-goal-stat dd {
  min-width: 0;
  margin: 0;
  color: var(--cro-ink);
  font-size: clamp(15px, 1.2vw, 19px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.ml-cro-goal-stat:first-child > strong,
.ml-cro-goal-stat.is-target > strong {
  font-size: clamp(20px, 1.65vw, 25px);
}

.ml-cro-goal-stat.is-actual > strong,
.ml-cro-goal-stat.actual > strong,
.ml-cro-goal-stat.success > strong {
  color: var(--cro-success);
}

.ml-cro-goal-stat.is-progress > strong,
.ml-cro-goal-stat.progress > strong {
  color: var(--cro-forest);
  font-size: clamp(20px, 1.7vw, 25px);
}

.ml-cro-goal-stat > strong small {
  display: block;
  margin-top: 2px;
  color: var(--cro-muted);
  font-size: 10px;
  font-weight: 650;
}

.ml-cro-goal-stat.is-gap > strong,
.ml-cro-goal-stat.gap > strong,
.ml-cro-goal-stat.danger > strong {
  color: var(--cro-danger);
}

.ml-cro-money,
.ml-cro-kpi strong,
.ml-cro-table td[data-label*="doanh thu" i],
.ml-cro-inflow-row .amount {
  font-variant-numeric: tabular-nums;
}

.ml-cro-goal-progress,
.ml-cro-progress,
.ml-cro-pace-track,
.ml-cro-project-progress {
  position: relative;
  display: block;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e9e7;
}

.ml-cro-goal-progress {
  height: 18px;
  margin-top: 2px;
  overflow: visible;
}

.ml-cro-goal-progress::before,
.ml-cro-goal-progress > span,
.ml-cro-progress > span,
.ml-cro-pace-track > span,
.ml-cro-project-progress > span {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: var(--cro-forest);
  transition: width 240ms ease;
}

.ml-cro-goal-progress > b,
.ml-cro-goal-progress > output,
.ml-cro-progress + small {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cro-muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ml-cro-goal-progress:has(> b),
.ml-cro-goal-progress:has(> output) {
  padding-right: 60px;
  background: #e5e9e7;
  box-shadow: inset -60px 0 0 var(--cro-surface);
}

.ml-cro-goal-progress:has(> b) > span,
.ml-cro-goal-progress:has(> output) > span {
  max-width: calc(100% - 60px);
}

/* Tabs */
.ml-cro-tabs {
  display: flex;
  align-items: flex-end;
  gap: 26px;
  min-width: 0;
  min-height: 48px;
  margin: 0 0 12px;
  padding: 0 8px;
  border-bottom: 1px solid var(--cro-line);
  overflow-x: auto;
  scrollbar-width: none;
}

.ml-cro-tabs::-webkit-scrollbar {
  display: none;
}

.ml-cro-tabs button {
  position: relative;
  flex: 0 0 auto;
  min-height: 48px;
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: var(--cro-muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.ml-cro-tabs button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}

.ml-cro-tabs button:hover {
  color: var(--cro-forest);
}

.ml-cro-tabs button.active,
.ml-cro-tabs button[aria-selected="true"] {
  color: var(--cro-forest-dark);
}

.ml-cro-tabs button.active::after,
.ml-cro-tabs button[aria-selected="true"]::after {
  background: var(--cro-forest);
}

.ml-cro-view {
  min-width: 0;
}

.ml-cro-view[aria-hidden="true"] {
  display: none;
}

/* Open overview layout */
.ml-cro-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.7fr) minmax(310px, 0.9fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.ml-cro-overview-grid > * {
  min-width: 0;
}

.ml-cro-panel {
  min-width: 0;
  border: 1px solid var(--cro-line);
  border-radius: 14px;
  background: var(--cro-surface);
  box-shadow: 0 4px 16px rgba(7, 63, 42, 0.035);
  overflow: hidden;
}

.ml-cro-panel + .ml-cro-panel {
  margin-top: 0;
}

.ml-cro-panel-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--cro-line);
  background: var(--cro-surface);
}

.ml-cro-panel-head > div:first-child {
  min-width: 0;
}

.ml-cro-panel-head h2,
.ml-cro-panel-head h3,
.ml-cro-pace > header h2,
.ml-cro-pace > header h3 {
  margin: 0;
  color: var(--cro-forest-dark);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ml-cro-panel-head p,
.ml-cro-panel-head small {
  display: block;
  margin: 3px 0 0;
  color: var(--cro-muted);
  font-size: 10px;
  line-height: 1.35;
}

.ml-cro-panel-head > div:last-child,
.ml-cro-panel-head .actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.ml-cro-panel-head select,
.ml-cro-panel-head input {
  min-height: 36px;
  border: 1px solid var(--cro-line);
  border-radius: 8px;
  padding: 0 30px 0 10px;
  background: #fff;
  color: var(--cro-ink);
  font-size: 11px;
  font-weight: 650;
}

/* KPI / pace rail */
.ml-cro-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--cro-line);
  border-radius: 14px;
  background: var(--cro-surface);
  overflow: hidden;
}

.ml-cro-kpi {
  min-width: 0;
  padding: 16px;
  background: var(--cro-surface);
}

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

.ml-cro-kpi span,
.ml-cro-kpi small {
  display: block;
  color: var(--cro-muted);
  font-size: 10px;
  line-height: 1.3;
}

.ml-cro-kpi strong {
  display: block;
  margin: 5px 0 2px;
  color: var(--cro-forest-dark);
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.ml-cro-chart .ml-cro-kpi strong {
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.18;
}

.ml-cro-kpi.is-danger strong,
.ml-cro-kpi.danger strong {
  color: var(--cro-danger);
}

.ml-cro-kpi.is-success strong,
.ml-cro-kpi.success strong {
  color: var(--cro-success);
}

.ml-cro-pace {
  display: grid;
  gap: 0;
  min-width: 0;
  border: 1px solid var(--cro-line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--cro-surface);
  box-shadow: 0 4px 16px rgba(7, 63, 42, 0.035);
}

.ml-cro-pace > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.ml-cro-pace-row,
.ml-cro-pace dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 39px;
  margin: 0;
  border-bottom: 1px solid var(--cro-line-soft);
}

.ml-cro-pace-row > span,
.ml-cro-pace-row > dt,
.ml-cro-pace dt {
  color: #394b44;
  font-size: 11px;
  font-weight: 550;
}

.ml-cro-pace-row > strong,
.ml-cro-pace-row > dd,
.ml-cro-pace dd {
  margin: 0;
  color: var(--cro-ink);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ml-cro-pace-row .success,
.ml-cro-pace-row strong.success,
.ml-cro-pace-row dd.success {
  color: var(--cro-success);
}

.ml-cro-pace-row .danger,
.ml-cro-pace-row strong.danger,
.ml-cro-pace-row dd.danger {
  color: var(--cro-danger);
}

.ml-cro-pace-track {
  width: 90px;
  height: 7px;
}

.ml-cro-pace-marker {
  position: relative;
  margin: 12px 0 8px;
  padding: 11px 12px 11px 40px;
  border: 1px solid #f5b45d;
  border-radius: 9px;
  background: var(--cro-warning-soft);
  color: #51351c;
}

.ml-cro-pace-marker::before {
  content: "!";
  position: absolute;
  left: 11px;
  top: 12px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid var(--cro-warning);
  border-radius: 50%;
  color: var(--cro-warning);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.ml-cro-pace-marker strong,
.ml-cro-pace-marker b {
  color: var(--cro-ink);
  font-size: 11px;
}

.ml-cro-pace-marker .variance,
.ml-cro-pace-marker em {
  float: right;
  color: var(--cro-danger);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ml-cro-pace-marker p,
.ml-cro-pace-marker small {
  display: block;
  margin: 3px 0 0;
  color: #6b5745;
  font-size: 9px;
  line-height: 1.45;
}

.ml-cro-queue,
.ml-cro-indicator-list {
  display: grid;
  min-width: 0;
}

.ml-cro-queue > h3,
.ml-cro-pace > h3,
.ml-cro-indicator-list > h3 {
  margin: 8px 0 4px;
  color: var(--cro-ink);
  font-size: 11px;
  font-weight: 800;
}

.ml-cro-queue-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border-top: 1px solid var(--cro-line-soft);
}

.ml-cro-queue-row > b,
.ml-cro-queue-row > i {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cro-success);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.ml-cro-queue-row > div {
  min-width: 0;
}

.ml-cro-queue-row strong,
.ml-cro-queue-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ml-cro-queue-row strong {
  color: var(--cro-ink);
  font-size: 10px;
  font-weight: 650;
}

.ml-cro-queue-row small {
  margin-top: 2px;
  color: var(--cro-muted);
  font-size: 8px;
}

.ml-cro-queue-row time,
.ml-cro-queue-row > span:last-child {
  color: var(--cro-muted);
  font-size: 8px;
  white-space: nowrap;
}

.ml-cro-pace-legend,
.ml-cro-pace-issues {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--cro-line);
}

.ml-cro-pace-legend > strong,
.ml-cro-pace-issues > strong {
  color: var(--cro-ink);
  font-size: 10px;
}

.ml-cro-pace-legend span,
.ml-cro-pace-issues span,
.ml-cro-pace-issues li {
  position: relative;
  padding-left: 12px;
  color: #4d5d57;
  font-size: 8px;
  line-height: 1.45;
}

.ml-cro-pace-legend span::before,
.ml-cro-pace-issues span::before,
.ml-cro-pace-issues li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cro-danger);
}

/* Hierarchical goal table */
.ml-cro-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.ml-cro-table {
  width: 100%;
  min-width: 930px;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--cro-surface);
}

.ml-cro-table th {
  height: 35px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--cro-line);
  background: var(--cro-surface-alt);
  color: #5d6c66;
  font-size: 9px;
  font-weight: 650;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
}

.ml-cro-table td {
  height: 43px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--cro-line-soft);
  color: #273831;
  font-size: 9px;
  line-height: 1.3;
  vertical-align: middle;
}

.ml-cro-table tbody tr:last-child td {
  border-bottom: 0;
}

.ml-cro-table tbody tr:hover td {
  background: #fbfdfc;
}

.ml-cro-table th:first-child,
.ml-cro-table td:first-child {
  width: 29%;
  padding-left: 13px;
}

.ml-cro-table th:nth-child(2),
.ml-cro-table td:nth-child(2),
.ml-cro-table th:nth-child(3),
.ml-cro-table td:nth-child(3),
.ml-cro-table th:nth-child(4),
.ml-cro-table td:nth-child(4) {
  width: 14%;
}

.ml-cro-table th:nth-child(5),
.ml-cro-table td:nth-child(5) {
  width: 14%;
}

.ml-cro-table th:nth-child(6),
.ml-cro-table td:nth-child(6) {
  width: 11%;
}

.ml-cro-table th:last-child,
.ml-cro-table td:last-child {
  width: 6%;
  text-align: center;
}

.ml-cro-project-name {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--cro-forest-dark);
  text-align: left;
}

button.ml-cro-project-name {
  cursor: pointer;
}

.ml-cro-project-name > i,
.ml-cro-project-name > span:first-child:not(:last-child) {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--cro-ink);
  font-size: 13px;
  font-style: normal;
}

.ml-cro-project-name > div,
.ml-cro-project-name > span:last-child {
  min-width: 0;
}

.ml-cro-project-name strong,
.ml-cro-project-name small {
  display: block;
}

.ml-cro-project-name strong {
  overflow: hidden;
  color: var(--cro-forest-dark);
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ml-cro-project-name small {
  margin-top: 1px;
  color: var(--cro-muted);
  font-size: 8px;
  font-weight: 500;
}

.ml-cro-table tr[data-level="1"] .ml-cro-project-name,
.ml-cro-table tr.level-1 .ml-cro-project-name,
.ml-cro-table tr.phase .ml-cro-project-name {
  padding-left: 18px;
}

.ml-cro-table tr[data-level="2"] .ml-cro-project-name,
.ml-cro-table tr.level-2 .ml-cro-project-name,
.ml-cro-table tr.project .ml-cro-project-name {
  padding-left: 36px;
}

.ml-cro-table tr[data-level="3"] .ml-cro-project-name,
.ml-cro-table tr.level-3 .ml-cro-project-name,
.ml-cro-table tr.indicator .ml-cro-project-name {
  padding-left: 54px;
}

.ml-cro-table tr.root td,
.ml-cro-table tr.goal td,
.ml-cro-table tr[data-level="0"] td {
  background: #fcfdfc;
  font-weight: 700;
}

.ml-cro-table tr.phase td,
.ml-cro-table tr[data-level="1"] td {
  background: #f9fbfa;
}

.ml-cro-progress {
  display: inline-block;
  width: min(112px, 72%);
  height: 7px;
  margin-left: 5px;
  vertical-align: middle;
}

.ml-cro-progress + small,
.ml-cro-progress + span {
  position: static;
  display: inline;
  margin-left: 5px;
  color: var(--cro-muted);
  font-size: 8px;
  vertical-align: middle;
  transform: none;
}

.ml-cro-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--cro-muted);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.ml-cro-status::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--cro-muted-2);
}

.ml-cro-status.good,
.ml-cro-status.success,
.ml-cro-status.on-track,
.ml-cro-status[data-status="good"],
.ml-cro-status[data-status="on-track"] {
  color: var(--cro-success);
}

.ml-cro-status.good::before,
.ml-cro-status.success::before,
.ml-cro-status.on-track::before,
.ml-cro-status[data-status="good"]::before,
.ml-cro-status[data-status="on-track"]::before {
  background: var(--cro-success);
}

.ml-cro-status.normal,
.ml-cro-status.info,
.ml-cro-status[data-status="normal"] {
  color: var(--cro-info);
}

.ml-cro-status.normal::before,
.ml-cro-status.info::before,
.ml-cro-status[data-status="normal"]::before {
  background: var(--cro-info);
}

.ml-cro-status.warning,
.ml-cro-status.behind,
.ml-cro-status[data-status="behind"] {
  color: var(--cro-warning);
}

.ml-cro-status.warning::before,
.ml-cro-status.behind::before,
.ml-cro-status[data-status="behind"]::before {
  background: var(--cro-warning);
}

.ml-cro-status.danger,
.ml-cro-status.risk,
.ml-cro-status[data-status="risk"] {
  color: var(--cro-danger);
}

.ml-cro-status.danger::before,
.ml-cro-status.risk::before,
.ml-cro-status[data-status="risk"]::before {
  background: var(--cro-danger);
}

.ml-cro-table .row-action,
.ml-cro-table [data-cro-action="open-project"],
.ml-cro-table [data-cro-action="toggle-row"] {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  color: var(--cro-ink);
  cursor: pointer;
}

.ml-cro-table .row-action:hover,
.ml-cro-table [data-cro-action="open-project"]:hover,
.ml-cro-table [data-cro-action="toggle-row"]:hover {
  background: var(--cro-forest-soft);
  color: var(--cro-forest);
}

.ml-cro-pace-legend,
.ml-cro-table-legend,
.ml-cro-chart-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.ml-cro-table-legend {
  min-height: 36px;
  padding: 8px 13px;
  border-top: 1px solid var(--cro-line);
  background: var(--cro-surface);
}

.ml-cro-table-legend span,
.ml-cro-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cro-muted);
  font-size: 9px;
  white-space: nowrap;
}

.ml-cro-table-legend span::before,
.ml-cro-chart-legend span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--legend-color, var(--cro-muted-2));
}

/* Revenue trend and reconciled Finance inflows */
.ml-cro-cash-grid,
.ml-cro-revenue-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
  gap: 18px;
  margin-top: 18px;
  min-width: 0;
}

.ml-cro-chart {
  min-width: 0;
  padding: 14px;
}

.ml-cro-chart > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ml-cro-chart > header h3 {
  margin: 0;
  color: var(--cro-forest-dark);
  font-size: 14px;
}

.ml-cro-chart > header small {
  color: var(--cro-muted);
  font-size: 9px;
}

.ml-cro-chart svg {
  width: 100%;
  min-width: 0;
  height: auto;
  max-height: 250px;
  overflow: visible;
}

.ml-cro-chart svg text {
  fill: var(--cro-muted);
  font-family: inherit;
  font-size: 10px;
}

.ml-cro-chart svg .grid,
.ml-cro-chart svg [data-series="grid"] {
  stroke: var(--cro-line-soft);
  stroke-width: 1;
}

.ml-cro-chart svg .target,
.ml-cro-chart svg [data-series="target"] {
  fill: none;
  stroke: var(--cro-success);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.ml-cro-chart svg .actual,
.ml-cro-chart svg [data-series="actual"] {
  fill: none;
  stroke: var(--cro-forest-dark);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ml-cro-chart svg circle.actual,
.ml-cro-chart svg [data-point="actual"] {
  fill: var(--cro-forest);
  stroke: #fff;
  stroke-width: 2;
}

.ml-cro-inflow-list {
  display: grid;
  min-width: 0;
}

.ml-cro-inflow-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) minmax(95px, 0.8fr) minmax(135px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--cro-line-soft);
}

.ml-cro-inflow-row.has-action {
  grid-template-columns: minmax(90px, 1.2fr) minmax(85px, 0.8fr) minmax(115px, 1fr) auto 36px;
}

.ml-cro-inflow-row:last-child {
  border-bottom: 0;
}

.ml-cro-inflow-row > * {
  min-width: 0;
}

.ml-cro-inflow-row strong,
.ml-cro-inflow-row small,
.ml-cro-inflow-row time,
.ml-cro-inflow-row span {
  font-size: 9px;
}

.ml-cro-inflow-row strong {
  overflow: hidden;
  color: #31433c;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ml-cro-inflow-row .amount,
.ml-cro-inflow-row > b {
  color: #34463f;
  font-size: 9px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.ml-cro-inflow-row .reconciled,
.ml-cro-inflow-row .status,
.ml-cro-inflow-row [data-status="reconciled"] {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--cro-success);
  white-space: nowrap;
}

.ml-cro-inflow-row .reconciled::before,
.ml-cro-inflow-row [data-status="reconciled"]::before {
  content: "✓";
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 850;
}

.ml-cro-inflow-row time {
  color: var(--cro-muted);
  text-align: right;
  white-space: nowrap;
}

/* Goal-map / phase planning */
.ml-cro-phase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

.ml-cro-phase-card {
  min-width: 0;
  border: 1px solid var(--cro-line);
  border-radius: 12px;
  background: var(--cro-surface);
  overflow: hidden;
}

.ml-cro-phase-card.is-over,
.ml-cro-phase-card[aria-expanded="true"] {
  border-color: #a7c7b8;
}

.ml-cro-phase-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 64px;
  padding: 12px;
  background: var(--cro-surface-alt);
}

.ml-cro-phase-head > div {
  min-width: 0;
}

.ml-cro-phase-head strong,
.ml-cro-phase-head small {
  display: block;
}

.ml-cro-phase-head strong {
  color: var(--cro-forest-dark);
  font-size: 12px;
  line-height: 1.3;
}

.ml-cro-phase-head small {
  margin-top: 3px;
  color: var(--cro-muted);
  font-size: 9px;
}

.ml-cro-phase-head button,
.ml-cro-phase-card > button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cro-line);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  color: var(--cro-forest);
  cursor: pointer;
}

.ml-cro-phase-drop {
  min-height: 92px;
  margin: 10px;
  padding: 10px;
  border: 1px dashed #b9c9c1;
  border-radius: 10px;
  background: #fbfdfc;
}

.ml-cro-phase-drop:empty::before {
  content: "Kéo dự án vào giai đoạn này";
  display: grid;
  min-height: 70px;
  place-items: center;
  color: var(--cro-muted-2);
  font-size: 10px;
}

.ml-cro-phase-drop.drag-over,
.ml-cro-phase-drop.is-over {
  border-color: var(--cro-forest);
  background: var(--cro-forest-soft);
}

.ml-cro-unallocated {
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px dashed #c6d2cc;
  border-radius: 12px;
  background: var(--cro-surface-alt);
}

.ml-cro-unallocated > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.ml-cro-unallocated > header strong {
  color: var(--cro-forest-dark);
  font-size: 11px;
}

.ml-cro-unallocated > header small {
  color: var(--cro-muted);
  font-size: 9px;
}

/* Projects, indicators and search tools */
.ml-cro-toolbar,
.ml-cro-filters {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cro-line);
  background: var(--cro-surface-alt);
}

.ml-cro-search {
  min-width: 220px;
  flex: 1 1 320px;
  position: relative;
}

.ml-cro-search::before {
  content: "⌕";
  position: absolute;
  left: 11px;
  top: 50%;
  color: var(--cro-muted);
  font-size: 18px;
  transform: translateY(-52%);
  pointer-events: none;
}

.ml-cro-search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--cro-line);
  border-radius: 10px;
  padding: 0 12px 0 35px;
  background: #fff;
  color: var(--cro-ink);
  font-size: 12px;
  outline: 0;
}

.ml-cro-search input::placeholder,
.ml-cro-modal-host input::placeholder,
.ml-cro-modal-host textarea::placeholder {
  color: #98a39e;
}

.ml-cro-project-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.ml-cro-project-card {
  min-width: 0;
  border: 1px solid var(--cro-line);
  border-radius: 12px;
  background: var(--cro-surface);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.ml-cro-project-card:hover {
  border-color: #b5c5bd;
  box-shadow: 0 6px 16px rgba(7, 63, 42, 0.05);
}

.ml-cro-project-card > header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(110px, 0.65fr)) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 11px 13px;
}

.ml-cro-project-card > header > * {
  min-width: 0;
}

.ml-cro-project-card > header h3 {
  margin: 0;
  overflow: hidden;
  color: var(--cro-forest-dark);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ml-cro-project-card > header p,
.ml-cro-project-card > header small {
  margin: 3px 0 0;
  color: var(--cro-muted);
  font-size: 9px;
}

.ml-cro-project-card > header dl {
  display: contents;
}

.ml-cro-project-card > header dl > div,
.ml-cro-project-card > header .metric {
  min-width: 0;
}

.ml-cro-project-card > header dt,
.ml-cro-project-card > header .metric span {
  display: block;
  color: var(--cro-muted);
  font-size: 8px;
}

.ml-cro-project-card > header dd,
.ml-cro-project-card > header .metric strong {
  display: block;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--cro-ink);
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ml-cro-project-card > header > button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cro-line);
  border-radius: 9px;
  padding: 0;
  background: #fff;
  color: var(--cro-forest);
  cursor: pointer;
}

.ml-cro-indicator-list {
  border-top: 1px solid var(--cro-line-soft);
  background: var(--cro-surface-alt);
}

.ml-cro-indicator-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(90px, 0.45fr) minmax(100px, 0.55fr) minmax(150px, 0.8fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 13px 8px 34px;
  border-bottom: 1px solid var(--cro-line-soft);
}

.ml-cro-indicator-row:last-child {
  border-bottom: 0;
}

.ml-cro-indicator-row > * {
  min-width: 0;
}

.ml-cro-indicator-row strong,
.ml-cro-indicator-row small,
.ml-cro-indicator-row span {
  font-size: 9px;
}

.ml-cro-indicator-row strong {
  color: #30443b;
}

.ml-cro-indicator-row small,
.ml-cro-indicator-row span {
  color: var(--cro-muted);
}

.ml-cro-indicator-row button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--cro-forest);
  cursor: pointer;
}

/* Empty, loading, and error states */
.ml-cro-empty,
.ml-cro-error,
.ml-cro-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
}

.ml-cro-empty > div,
.ml-cro-error > div,
.ml-cro-loading > div {
  width: min(460px, 100%);
}

.ml-cro-empty i,
.ml-cro-error i,
.ml-cro-loading i {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--cro-forest-soft);
  color: var(--cro-forest);
  font-size: 20px;
  font-style: normal;
}

.ml-cro-error i {
  background: var(--cro-danger-soft);
  color: var(--cro-danger);
}

.ml-cro-empty h3,
.ml-cro-error h3,
.ml-cro-loading h3 {
  margin: 0 0 6px;
  color: var(--cro-forest-dark);
  font-size: 16px;
}

.ml-cro-empty p,
.ml-cro-error p,
.ml-cro-loading p {
  margin: 0 0 14px;
  color: var(--cro-muted);
  font-size: 11px;
  line-height: 1.55;
}

.ml-cro-loading i {
  border: 3px solid var(--cro-forest-soft);
  border-top-color: var(--cro-forest);
  background: transparent;
  animation: mlCroSpin 700ms linear infinite;
}

/* Modal / drawer host may be appended directly to body. */
.ml-cro-modal-host {
  --cro-canvas: #f5f8f7;
  --cro-surface: #ffffff;
  --cro-surface-alt: #f8faf9;
  --cro-forest: #075b3a;
  --cro-forest-dark: #073f2a;
  --cro-forest-soft: #e7f2ed;
  --cro-ink: #16251f;
  --cro-muted: #64716c;
  --cro-line: #d7dfdb;
  --cro-line-soft: #e8eeeb;
  --cro-danger: #dc2626;
  --cro-danger-soft: #fff2f2;
  --cro-shadow-modal: 0 28px 80px rgba(4, 38, 25, 0.24);
  position: fixed;
  inset: 0;
  z-index: 2147483500;
  pointer-events: none;
  color: var(--cro-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ml-cro-modal-host.open,
.ml-cro-modal-host.is-open,
.ml-cro-modal-host:has(.ml-cro-backdrop:not([hidden])) {
  pointer-events: auto;
}

.ml-cro-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 31, 21, 0.52);
  backdrop-filter: blur(4px);
  overflow: auto;
}

.ml-cro-backdrop.drawer {
  place-items: stretch end;
  padding: 0;
}

.ml-cro-modal {
  width: min(760px, 100%);
  max-height: min(900px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  background: var(--cro-surface);
  box-shadow: var(--cro-shadow-modal);
  overflow: hidden;
}

.ml-cro-modal.drawer,
.ml-cro-backdrop.drawer .ml-cro-modal {
  width: min(660px, 94vw);
  height: 100vh;
  max-height: 100vh;
  border-width: 0 0 0 1px;
  border-radius: 0;
}

.ml-cro-modal-head {
  flex: 0 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--cro-line);
  background: var(--cro-surface-alt);
}

.ml-cro-modal-head > div {
  min-width: 0;
}

.ml-cro-modal-head h2,
.ml-cro-modal-head h3 {
  margin: 0;
  color: var(--cro-forest-dark);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ml-cro-modal-head p,
.ml-cro-modal-head small {
  display: block;
  margin: 4px 0 0;
  color: var(--cro-muted);
  font-size: 10px;
}

.ml-cro-modal-head > button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cro-line);
  border-radius: 9px;
  padding: 0;
  background: #fff;
  color: var(--cro-muted);
  font-size: 18px;
  cursor: pointer;
}

.ml-cro-modal > form,
.ml-cro-modal > .body,
.ml-cro-modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

.ml-cro-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 18px;
}

.ml-cro-form-grid > .wide,
.ml-cro-form-grid > .full,
.ml-cro-form-grid > fieldset,
.ml-cro-form-grid > .ml-cro-form-section {
  grid-column: 1 / -1;
}

.ml-cro-form-grid label,
.ml-cro-form-section label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: #46564f;
  font-size: 10px;
  font-weight: 750;
}

.ml-cro-form-grid label > span,
.ml-cro-form-section label > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ml-cro-form-grid input,
.ml-cro-form-grid select,
.ml-cro-form-grid textarea,
.ml-cro-form-section input,
.ml-cro-form-section select,
.ml-cro-form-section textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--cro-line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--cro-ink);
  font-size: 12px;
  font-weight: 550;
  outline: 0;
}

.ml-cro-form-grid textarea,
.ml-cro-form-section textarea {
  min-height: 94px;
  line-height: 1.5;
  resize: vertical;
}

.ml-cro-form-grid input:focus,
.ml-cro-form-grid select:focus,
.ml-cro-form-grid textarea:focus,
.ml-cro-form-section input:focus,
.ml-cro-form-section select:focus,
.ml-cro-form-section textarea:focus {
  border-color: #79a994;
  box-shadow: 0 0 0 3px rgba(7, 91, 58, 0.1);
}

.ml-cro-form-grid input[aria-invalid="true"],
.ml-cro-form-grid select[aria-invalid="true"],
.ml-cro-form-grid textarea[aria-invalid="true"] {
  border-color: #ef8e8e;
  background: #fffafa;
}

.ml-cro-form-grid label > small,
.ml-cro-form-section label > small,
.ml-cro-field-help {
  color: var(--cro-muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.4;
}

.ml-cro-form-section {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--cro-line-soft);
  border-radius: 12px;
  background: var(--cro-surface-alt);
}

.ml-cro-form-section > header,
.ml-cro-form-section > h3,
.ml-cro-form-section > .wide,
.ml-cro-form-section > .full {
  grid-column: 1 / -1;
}

.ml-cro-form-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ml-cro-form-section h3,
.ml-cro-form-section > h3 {
  margin: 0;
  color: var(--cro-forest-dark);
  font-size: 12px;
  font-weight: 800;
}

.ml-cro-modal-foot {
  flex: 0 0 auto;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--cro-line);
  background: #fff;
}

.ml-cro-modal-foot > div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.ml-cro-save-status {
  min-width: 0;
  color: var(--cro-muted);
  font-size: 10px;
  line-height: 1.3;
}

.ml-cro-save-status.saving::before,
.ml-cro-save-status.saved::before,
.ml-cro-save-status.error::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--cro-muted-2);
}

.ml-cro-save-status.saving::before {
  background: var(--cro-warning);
}

.ml-cro-save-status.saved {
  color: var(--cro-success);
}

.ml-cro-save-status.saved::before {
  background: var(--cro-success);
}

.ml-cro-save-status.error {
  color: var(--cro-danger);
}

.ml-cro-save-status.error::before {
  background: var(--cro-danger);
}

.ml-cro-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 2147483600;
  max-width: min(460px, calc(100vw - 24px));
  padding: 11px 15px;
  border-radius: 10px;
  background: var(--cro-forest-dark, #073f2a);
  color: #fff;
  box-shadow: 0 14px 36px rgba(4, 38, 25, 0.24);
  font: 700 11px/1.35 Inter, ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.ml-cro-toast.show,
.ml-cro-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ml-cro-mobile-actions {
  display: none;
}

@keyframes mlCroSpin {
  to { transform: rotate(360deg); }
}

/* Tablet: keep the data model open and readable, then stack the operating rail. */
@media (min-width: 721px) and (max-width: 1100px) {
  .ml-cro-shell {
    padding: 18px;
  }

  .ml-cro-goal-main {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 14px;
  }

  .ml-cro-goal-main > * {
    padding: 0 16px;
  }

  .ml-cro-goal-main > *:nth-child(3n + 1) {
    padding-left: 0;
    border-left: 0;
  }

  .ml-cro-goal-main > *:nth-child(n + 4) {
    padding-top: 12px;
    border-top: 1px solid var(--cro-line-soft);
  }

  .ml-cro-overview-grid {
    grid-template-columns: 1fr;
  }

  .ml-cro-pace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
  }

  .ml-cro-pace > header,
  .ml-cro-pace > .ml-cro-pace-marker,
  .ml-cro-pace > .ml-cro-queue,
  .ml-cro-pace > .ml-cro-pace-legend,
  .ml-cro-pace > .ml-cro-pace-issues {
    grid-column: 1 / -1;
  }

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

  .ml-cro-kpi:nth-child(3) {
    border-left: 0;
  }

  .ml-cro-kpi:nth-child(n + 3) {
    border-top: 1px solid var(--cro-line);
  }

  .ml-cro-cash-grid,
  .ml-cro-revenue-grid {
    grid-template-columns: 1fr;
  }

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

  .ml-cro-project-card > header {
    grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(100px, 0.65fr)) auto;
  }

  .ml-cro-project-card > header > :nth-child(4) {
    display: none;
  }
}

/* True phone layout: no squeezed tables and no core horizontal overflow. */
@media (max-width: 720px) {
  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) {
    padding: 0 !important;
    background: #fff !important;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-blueprint-block {
    display: block !important;
    min-height: 100vh;
    padding: 0 !important;
    background: #fff !important;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-blueprint-head {
    position: relative !important;
    top: auto !important;
    z-index: 5;
    width: 100%;
    height: 58px !important;
    min-height: 58px !important;
    display: block !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #073f2a !important;
    box-shadow: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-blueprint-head::-webkit-scrollbar {
    display: none;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-blueprint-head > div,
  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-blueprint-head > p,
  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-sidebar-profile,
  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-crm-sidebar-toggle {
    display: none !important;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-blueprint-toolbar {
    width: max-content !important;
    height: 46px;
    display: flex !important;
    gap: 3px !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-blueprint-tool {
    width: auto !important;
    min-width: auto !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 12px !important;
    border-radius: 10px !important;
    gap: 7px !important;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-blueprint-tool > div {
    display: block !important;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-blueprint-tool small,
  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-blueprint-tool em,
  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-blueprint-tool-status {
    display: none !important;
  }

  .ml-focus-app[data-life-goals-v1="true"]:has(.ml-cro) .ml-life-blueprint-layout {
    width: 100%;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .ml-cro-shell {
    width: 100%;
    min-height: 100%;
    padding: 0 0 calc(88px + env(safe-area-inset-bottom));
    overflow-x: clip;
    background: #fff;
    font-size: 13px;
  }

  .ml-cro-head {
    min-height: 62px;
    margin: 0;
    padding: 0 20px;
    background: var(--cro-forest);
    color: #fff;
    box-shadow: 0 2px 8px rgba(4, 55, 35, 0.15);
  }

  .ml-cro-brand {
    flex: 1;
    text-align: center;
  }

  .ml-cro-brand h1,
  .ml-cro-brand h2,
  .ml-cro-head h1,
  .ml-cro-head h2 {
    color: #fff;
    font-size: 22px;
    letter-spacing: -0.025em;
  }

  .ml-cro-brand p,
  .ml-cro-head p {
    display: none;
  }

  .ml-cro-head-actions {
    position: absolute;
    right: 12px;
    gap: 4px;
  }

  .ml-cro-head-actions input,
  .ml-cro-head-actions select,
  .ml-cro-head-actions .ml-cro-btn:not(.mobile-menu):not([data-cro-action="mobile-menu"]) {
    display: none;
  }

  .ml-cro-head-actions .mobile-menu,
  .ml-cro-head-actions [data-cro-action="mobile-menu"] {
    width: 44px;
    min-height: 44px;
    border: 0;
    padding: 0;
    background: transparent;
    color: #fff;
    font-size: 24px;
    box-shadow: none;
  }

  .ml-cro-goal-strip {
    gap: 14px;
    margin: 10px 12px 0;
    padding: 16px 13px;
    border-radius: 12px;
    box-shadow: none;
  }

  .ml-cro-goal-main {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    row-gap: 16px;
  }

  .ml-cro-goal-main > * {
    min-height: 60px;
    padding: 0 10px;
    border-left: 0;
  }

  .ml-cro-goal-main > *:first-child,
  .ml-cro-goal-main > .is-target {
    grid-column: 1 / -1;
    padding-left: 0;
    padding-right: 0;
  }

  .ml-cro-goal-main > *:nth-child(2),
  .ml-cro-goal-main > *:nth-child(3),
  .ml-cro-goal-main > *:nth-child(4),
  .ml-cro-goal-main > *:nth-child(5) {
    grid-column: span 3;
    border-left: 1px solid var(--cro-line);
  }

  .ml-cro-goal-main > *:nth-child(2),
  .ml-cro-goal-main > *:nth-child(4),
  .ml-cro-goal-main > *:nth-child(6) {
    padding-left: 0;
    border-left: 0;
  }

  .ml-cro-goal-main > *:nth-child(6) {
    grid-column: 1 / -1;
    min-height: 52px;
    padding-top: 4px;
  }

  .ml-cro-goal-main > *:nth-child(3),
  .ml-cro-goal-main > *:nth-child(6) {
    padding-right: 0;
  }

  .ml-cro-goal-stat > span,
  .ml-cro-goal-stat > small,
  .ml-cro-goal-stat dt {
    font-size: 10px;
  }

  .ml-cro-goal-stat > strong,
  .ml-cro-goal-stat dd {
    font-size: clamp(14px, 4.1vw, 19px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ml-cro-goal-stat:first-child > strong,
  .ml-cro-goal-stat.is-target > strong {
    font-size: clamp(21px, 7.2vw, 29px);
  }

  .ml-cro-goal-stat.is-progress > strong,
  .ml-cro-goal-stat.progress > strong {
    font-size: clamp(19px, 6vw, 24px);
  }

  .ml-cro-goal-main select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--cro-line);
    border-radius: 9px;
    padding: 0 30px 0 10px;
    background: #fff;
    color: var(--cro-ink);
    font-size: 13px;
    font-weight: 650;
  }

  .ml-cro-goal-progress {
    grid-column: 1 / -1;
    height: 18px;
    margin: -2px 0 0;
  }

  .ml-cro-tabs {
    min-height: 60px;
    gap: 0;
    margin: 10px 0 0;
    padding: 0 12px;
    background: #fff;
    scroll-snap-type: x proximity;
  }

  .ml-cro-tabs button {
    min-width: max-content;
    min-height: 60px;
    padding: 0 13px;
    font-size: 12px;
    scroll-snap-align: start;
  }

  .ml-cro-view {
    padding: 10px 12px 0;
  }

  .ml-cro-overview-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* The operating pace rail intentionally comes first on mobile. */
  .ml-cro-overview-grid > .ml-cro-pace {
    order: -10;
  }

  .ml-cro-panel,
  .ml-cro-pace {
    border-radius: 12px;
    box-shadow: none;
  }

  .ml-cro-panel-head {
    min-height: 58px;
    padding: 10px 12px;
  }

  .ml-cro-panel-head h2,
  .ml-cro-panel-head h3,
  .ml-cro-pace > header h2,
  .ml-cro-pace > header h3 {
    font-size: 18px;
  }

  .ml-cro-panel-head > div:last-child,
  .ml-cro-panel-head .actions {
    flex: 0 0 auto;
  }

  .ml-cro-panel-head select,
  .ml-cro-panel-head input,
  .ml-cro-panel-head .actions > *:not(.ml-cro-btn):not([data-cro-action="design-goal"]) {
    display: none;
  }

  .ml-cro-panel-head .ml-cro-btn {
    min-height: 42px;
    padding: 0 10px;
    font-size: 10px;
  }

  .ml-cro-pace {
    padding: 12px;
  }

  .ml-cro-pace > header {
    margin-bottom: 8px;
  }

  .ml-cro-pace-row,
  .ml-cro-pace dl > div {
    min-height: 46px;
  }

  .ml-cro-pace-row > span,
  .ml-cro-pace-row > dt,
  .ml-cro-pace dt,
  .ml-cro-pace-row > strong,
  .ml-cro-pace-row > dd,
  .ml-cro-pace dd {
    font-size: 11px;
  }

  .ml-cro-pace-marker {
    min-height: 65px;
    padding: 10px 9px 10px 39px;
  }

  .ml-cro-pace-marker .variance,
  .ml-cro-pace-marker em {
    float: none;
    margin-left: 7px;
  }

  .ml-cro-pace-marker p,
  .ml-cro-pace-marker small {
    font-size: 9px;
  }

  .ml-cro-queue-row {
    grid-template-columns: 27px minmax(0, 1fr) auto;
    min-height: 50px;
  }

  .ml-cro-queue-row strong {
    font-size: 10px;
    white-space: normal;
  }

  .ml-cro-queue-row time,
  .ml-cro-queue-row > span:last-child {
    font-size: 8px;
  }

  .ml-cro-pace-issues {
    display: none;
  }

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

  .ml-cro-kpi {
    padding: 13px;
  }

  .ml-cro-kpi:nth-child(3) {
    border-left: 0;
  }

  .ml-cro-kpi:nth-child(n + 3) {
    border-top: 1px solid var(--cro-line);
  }

  .ml-cro-kpi strong {
    font-size: 20px;
  }

  /* Replace the desktop table with a readable expandable hierarchy. */
  .ml-cro-table-wrap {
    overflow: visible;
  }

  .ml-cro-table {
    min-width: 0;
    table-layout: auto;
  }

  .ml-cro-table thead {
    display: none;
  }

  .ml-cro-table,
  .ml-cro-table tbody {
    display: block;
    width: 100%;
  }

  .ml-cro-table tr {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 4px 10px;
    min-height: 54px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--cro-line-soft);
    background: #fff;
  }

  .ml-cro-table tr:last-child {
    border-bottom: 0;
  }

  .ml-cro-table tr[hidden],
  .ml-cro-table tr.is-collapsed {
    display: none;
  }

  .ml-cro-table td,
  .ml-cro-table td:first-child,
  .ml-cro-table td:last-child {
    width: auto;
    height: auto;
    min-width: 0;
    display: block;
    padding: 0;
    border: 0;
    background: transparent !important;
    text-align: left;
  }

  .ml-cro-table td:first-child {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .ml-cro-table td:nth-child(2),
  .ml-cro-table td:nth-child(3),
  .ml-cro-table td:nth-child(4) {
    display: none;
  }

  .ml-cro-table td:nth-child(5) {
    grid-column: 2;
    grid-row: 1;
    color: var(--cro-ink);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .ml-cro-table td:nth-child(6) {
    grid-column: 2;
    grid-row: 2;
    min-width: 88px;
  }

  .ml-cro-table td:nth-child(7),
  .ml-cro-table td:last-child {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .ml-cro-project-name {
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 7px;
  }

  .ml-cro-project-name > i,
  .ml-cro-project-name > span:first-child:not(:last-child) {
    width: 23px;
    height: 23px;
    font-size: 15px;
  }

  .ml-cro-project-name strong {
    font-size: 10px;
    white-space: normal;
  }

  .ml-cro-project-name small {
    font-size: 8px;
  }

  .ml-cro-table tr[data-level="1"] .ml-cro-project-name,
  .ml-cro-table tr.level-1 .ml-cro-project-name,
  .ml-cro-table tr.phase .ml-cro-project-name {
    padding-left: 14px;
  }

  .ml-cro-table tr[data-level="2"] .ml-cro-project-name,
  .ml-cro-table tr.level-2 .ml-cro-project-name,
  .ml-cro-table tr.project .ml-cro-project-name {
    padding-left: 30px;
  }

  .ml-cro-table tr[data-level="3"] .ml-cro-project-name,
  .ml-cro-table tr.level-3 .ml-cro-project-name,
  .ml-cro-table tr.indicator .ml-cro-project-name {
    padding-left: 46px;
  }

  .ml-cro-progress {
    width: 64px;
    height: 7px;
    margin-left: 4px;
  }

  .ml-cro-status {
    min-height: 20px;
    font-size: 8px;
  }

  .ml-cro-table-legend {
    gap: 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .ml-cro-table-legend::-webkit-scrollbar {
    display: none;
  }

  .ml-cro-cash-grid,
  .ml-cro-revenue-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
  }

  .ml-cro-chart svg {
    max-height: 210px;
  }

  .ml-cro-inflow-list {
    display: grid;
  }

  .ml-cro-inflow-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 10px;
    min-height: 60px;
    padding: 9px 12px;
  }

  .ml-cro-inflow-row strong {
    grid-column: 1;
    grid-row: 1;
    white-space: normal;
  }

  .ml-cro-inflow-row .amount,
  .ml-cro-inflow-row > b {
    grid-column: 2;
    grid-row: 1;
  }

  .ml-cro-inflow-row .reconciled,
  .ml-cro-inflow-row .status,
  .ml-cro-inflow-row [data-status="reconciled"] {
    grid-column: 1;
    grid-row: 2;
  }

  .ml-cro-inflow-row time {
    grid-column: 2;
    grid-row: 2;
  }

  .ml-cro-inflow-row.has-action {
    grid-template-columns: minmax(0, 1fr) auto 38px;
  }

  .ml-cro-inflow-row.has-action > .ml-cro-btn:last-child {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
  }

  .ml-cro-phase-grid {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .ml-cro-phase-drop {
    min-height: 70px;
  }

  .ml-cro-toolbar,
  .ml-cro-filters {
    align-items: stretch;
    flex-wrap: wrap;
    padding: 10px;
  }

  .ml-cro-search {
    min-width: 100%;
    flex-basis: 100%;
  }

  .ml-cro-toolbar select,
  .ml-cro-filters select {
    min-width: calc(50% - 5px);
    flex: 1 1 calc(50% - 5px);
  }

  .ml-cro-project-list {
    gap: 8px;
    padding: 10px;
  }

  .ml-cro-project-card > header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    min-height: 76px;
    padding: 11px;
  }

  .ml-cro-project-card > header > :first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .ml-cro-project-card > header > button:last-child {
    grid-column: 2;
    grid-row: 1;
  }

  .ml-cro-project-card > header dl,
  .ml-cro-project-card > header .metric {
    grid-column: 1 / -1;
  }

  .ml-cro-project-card > header dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .ml-cro-project-card > header .metric {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ml-cro-indicator-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    min-height: 62px;
    padding: 9px 11px 9px 22px;
  }

  .ml-cro-indicator-row > :nth-child(2),
  .ml-cro-indicator-row > :nth-child(3),
  .ml-cro-indicator-row > :nth-child(4) {
    grid-column: 1;
  }

  .ml-cro-indicator-row > button:last-child {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .ml-cro-mobile-actions {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 100040;
    display: grid;
    grid-template-columns: minmax(116px, 0.7fr) minmax(0, 1.3fr);
    gap: 10px;
    padding: 8px;
    border: 1px solid rgba(215, 223, 219, 0.85);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 32px rgba(4, 55, 35, 0.18);
    backdrop-filter: blur(12px);
  }

  .ml-cro-mobile-actions .ml-cro-btn {
    min-width: 0;
    min-height: 48px;
    padding: 0 10px;
    font-size: 11px;
  }

  .ml-cro-backdrop {
    align-items: end;
    padding: 0;
  }

  .ml-cro-modal,
  .ml-cro-modal.drawer,
  .ml-cro-backdrop.drawer .ml-cro-modal {
    width: 100vw;
    max-width: 100vw;
    height: auto;
    max-height: 94dvh;
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
  }

  .ml-cro-modal.drawer,
  .ml-cro-backdrop.drawer .ml-cro-modal {
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .ml-cro-modal-head {
    min-height: 62px;
    padding: 12px 14px;
  }

  .ml-cro-modal-head h2,
  .ml-cro-modal-head h3 {
    font-size: 17px;
  }

  .ml-cro-form-grid {
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 14px;
  }

  .ml-cro-form-grid > .wide,
  .ml-cro-form-grid > .full,
  .ml-cro-form-grid > fieldset,
  .ml-cro-form-grid > .ml-cro-form-section {
    grid-column: auto;
  }

  .ml-cro-form-section {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .ml-cro-form-section > header,
  .ml-cro-form-section > h3,
  .ml-cro-form-section > .wide,
  .ml-cro-form-section > .full {
    grid-column: auto;
  }

  .ml-cro-form-grid input,
  .ml-cro-form-grid select,
  .ml-cro-form-grid textarea,
  .ml-cro-form-section input,
  .ml-cro-form-section select,
  .ml-cro-form-section textarea {
    min-height: 46px;
    font-size: 16px;
  }

  .ml-cro-modal-foot {
    position: sticky;
    bottom: 0;
    min-height: 70px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .ml-cro-modal-foot > div {
    flex: 1;
  }

  .ml-cro-modal-foot .ml-cro-btn {
    min-height: 46px;
  }

  @media (max-width: 480px) {
    .ml-cro-map-panel .ml-cro-panel-head {
      grid-template-columns: 1fr;
      align-items: stretch;
    }

    .ml-cro-map-panel .ml-cro-panel-head small {
      display: none;
    }

    .ml-cro-map-panel .ml-cro-panel-head .actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
    }

    .ml-cro-map-panel .ml-cro-panel-head .actions .ml-cro-btn {
      width: 100%;
    }
  }

  .ml-cro-toast {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .ml-cro-goal-main > * {
    padding-left: 7px;
    padding-right: 7px;
  }

  .ml-cro-goal-stat > strong,
  .ml-cro-goal-stat dd {
    font-size: 13px;
  }

  .ml-cro-goal-stat:first-child > strong,
  .ml-cro-goal-stat.is-target > strong {
    font-size: 22px;
  }

  .ml-cro-tabs button {
    padding-inline: 11px;
  }

  .ml-cro-mobile-actions {
    grid-template-columns: 110px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ml-cro-shell *,
  .ml-cro-shell *::before,
  .ml-cro-shell *::after,
  .ml-cro-modal-host *,
  .ml-cro-modal-host *::before,
  .ml-cro-modal-host *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
