.cost-panel,
.cost-strip,
.cost-history-summary {
  border: 1px solid var(--ag-border, #dce5e1);
  background: var(--ag-surface-soft, #f5f8f7);
  color: var(--ag-text, #16201d);
}

.cost-panel {
  margin: 0 0 18px;
  min-width: 0;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: #fff;
  box-shadow: 0 4px 14px rgb(39 54 48 / 5%);
}

.cost-panel strong,
.cost-strip strong,
.cost-history-summary strong,
.cost-card-label {
  font-variant-numeric: tabular-nums;
}

.cost-panel small,
.cost-strip small,
.cost-history-summary small,
.cost-card-label {
  color: var(--ag-muted, #66736f);
}

.cost-panel-copy,
.cost-strip-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cost-panel-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft-emerald-soft, #e8f8f2);
}

.cost-panel-icon img {
  width: 19px;
  height: 19px;
  filter: invert(39%) sepia(37%) saturate(1027%) hue-rotate(111deg) brightness(91%) contrast(92%);
}

.cost-panel-copy strong {
  min-width: 0;
  color: var(--soft-ink, #2d3345);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cost-panel-copy small {
  min-width: 0;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cost-panel a.secondary-button {
  width: auto;
  min-width: 148px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  white-space: nowrap;
}

.cost-strip {
  padding: 9px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  min-width: min(380px, 100%);
}

.cost-history-summary {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: center;
}

.cost-history-summary > div { display: grid; gap: 3px; }
.cost-history-actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
  justify-self: end;
}
.cost-history-actions a { width: auto; justify-self: end; }
.cost-card-label { display: block; margin-top: 8px; font-size: 13px; }

.task-history-cost {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--border, #dce5e1);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.task-history-cost:hover,
.task-history-cost[aria-expanded="true"] {
  border-color: var(--primary, #6366f1);
  background: var(--primary-soft, #eef0ff);
}

.task-history-cost:focus-visible {
  outline: 2px solid var(--focus, #2563eb);
  outline-offset: 2px;
}

.task-history-cost img { width: 19px; height: 19px; }

.task-cost-popover {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--border, #dce5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--text, #2d3345);
  box-shadow: 0 8px 28px rgb(39 54 48 / 16%);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.task-cost-popover .cost-card-label {
  margin: 8px 0 0;
  color: inherit;
}

.task-cost-popover > small:not(.cost-card-label) {
  display: block;
  margin-top: 4px;
  color: var(--text-subtle, #66736f);
  font-size: 12px;
}

.cost-pricing-section { scroll-margin-top: 24px; }

.cost-pricing-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
}
.cost-pricing-heading-copy { min-width: 0; }
.cost-pricing-summary {
  width: 168px;
  margin-left: auto;
  display: grid;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--soft-muted, #687286);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.cost-pricing-summary[hidden] { display: none; }
.cost-pricing-summary strong { color: var(--soft-text, #596174); font-size: 13px; }
.cost-pricing-summary[data-complete="true"] strong { color: var(--soft-emerald, #0f9f78); }
.cost-pricing-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft-surface-pressed, #eef1f6);
}
.cost-pricing-progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--soft-primary, #6366f1);
  transition: width 200ms ease-in-out;
}
.cost-pricing-summary[data-complete="true"] .cost-pricing-progress > span {
  background: var(--soft-emerald, #0f9f78);
}

.cost-pricing-list { display: grid; gap: 10px; }
.cost-pricing-row {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--soft-line, #dfe5ec);
  border-radius: 8px;
  background: var(--soft-surface, #fff);
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(410px, 1.65fr) 136px;
  gap: 20px;
  align-items: center;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.cost-pricing-row:hover {
  border-color: var(--soft-line-strong, #cfd7e2);
  background: #fcfdff;
}
.cost-pricing-row:focus-within {
  border-color: rgb(99 102 241 / 42%);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 8%);
}
.cost-pricing-model {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  overflow-wrap: anywhere;
}
.cost-pricing-model-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--soft-primary-soft, #eef0ff);
}
.cost-pricing-model-icon img {
  width: 19px;
  height: 19px;
  opacity: 0.86;
  filter: invert(38%) sepia(75%) saturate(1726%) hue-rotate(221deg) brightness(99%) contrast(90%);
}
.cost-pricing-model-copy { min-width: 0; display: grid; gap: 4px; }
.cost-pricing-title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cost-pricing-title-line strong { color: var(--soft-ink, #2d3345); font-size: 14px; line-height: 1.35; }
.cost-pricing-model-copy > small {
  max-width: 100%;
  overflow: hidden;
  color: var(--soft-muted, #687286);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cost-pricing-state {
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft-surface-pressed, #eef1f6);
  color: var(--soft-muted, #687286);
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
}
.cost-pricing-state[data-tone="configured"] { background: var(--soft-emerald-soft, #e8f8f2); color: #08775a; }
.cost-pricing-state[data-tone="pending"] { background: var(--soft-amber-soft, #fff6df); color: #93600f; }
.cost-pricing-state[data-tone="working"] { background: var(--soft-primary-soft, #eef0ff); color: var(--soft-primary-strong, #4f46e5); }

.cost-pricing-fields {
  min-width: 0;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}
.cost-currency-field,
.cost-rate-field { min-width: 0; display: grid; gap: 6px; }
.cost-currency-field > label,
.cost-rate-field > span:first-child {
  color: var(--soft-text, #596174);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}
.cost-rate-inputs {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.cost-rate-control {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1.5px solid #c6d6ce;
  border-radius: 8px;
  background: #fbfdfc;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.cost-rate-control:hover { border-color: #9db3a9; }
.cost-rate-control:focus-within {
  border-color: var(--soft-primary-strong, #4f46e5);
  background: #fff;
  box-shadow: 0 0 0 4px rgb(99 102 241 / 12%);
}
.cost-pricing-row .cost-currency-field input,
.cost-rate-control input {
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: transparent;
  color: var(--soft-ink, #2d3345);
  box-shadow: none;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.cost-pricing-row .cost-currency-field input {
  border: 1.5px solid #c6d6ce;
  background: #fbfdfc;
  text-transform: uppercase;
}
.cost-pricing-row .cost-currency-field input:hover { border-color: #9db3a9; }
.cost-pricing-row .cost-currency-field input:focus {
  border-color: var(--soft-primary-strong, #4f46e5);
  background: #fff;
  box-shadow: 0 0 0 4px rgb(99 102 241 / 12%);
}
.cost-rate-control input:focus { box-shadow: none; }
.cost-rate-control input::placeholder { color: #a3abba; }
.cost-rate-unit {
  padding: 0 10px 0 8px;
  flex: 0 0 auto;
  color: var(--soft-muted, #687286);
  font-size: 12px;
  white-space: nowrap;
}
.cost-pricing-actions { min-width: 0; display: grid; gap: 6px; justify-items: stretch; }
.cost-pricing-save { width: 100%; min-width: 0; min-height: 44px; padding-inline: 13px; }
.cost-pricing-row[data-dirty="true"] .cost-pricing-save:not(:disabled) {
  border-color: transparent;
  background: var(--soft-primary, #6366f1);
  color: #fff;
  box-shadow: 0 8px 18px rgb(99 102 241 / 18%);
}
.cost-pricing-row[data-dirty="true"] .cost-pricing-save:not(:disabled) img { filter: brightness(0) invert(1); }
.cost-pricing-row-message {
  min-height: 17px;
  color: var(--soft-muted, #687286);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}
.cost-pricing-row-message[data-tone="success"] { color: #08775a; }
.cost-pricing-row-message[data-tone="error"] { color: var(--soft-danger, #c94c5d); }
.cost-pricing-section > .inline-status:empty { display: none; }

@media (max-width: 980px) {
  .cost-pricing-row { grid-template-columns: 1fr; gap: 16px; }
  .cost-pricing-actions { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .cost-pricing-save { width: 148px; justify-self: end; grid-column: 2; grid-row: 1; }
  .cost-pricing-row-message { grid-column: 1; grid-row: 1; text-align: left; }
}

@media (max-width: 760px) {
  .cost-panel { grid-template-columns: 40px minmax(0, 1fr); align-items: center; }
  .cost-panel a.secondary-button { width: 100%; min-width: 0; grid-column: 1 / -1; justify-self: stretch; }
  .cost-history-summary { align-items: stretch; grid-template-columns: 1fr; }
  .cost-history-actions { width: 100%; display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-self: stretch; }
  .cost-history-actions a { width: 100%; justify-self: stretch; justify-content: center; }
  .cost-strip { width: 100%; min-width: 0; }
  .cost-pricing-heading { grid-template-columns: 44px minmax(0, 1fr); align-items: flex-start; }
  .cost-pricing-summary { width: 100%; margin: 6px 0 0; grid-column: 1 / -1; text-align: left; }
  .cost-pricing-row { padding: 16px; }
  .cost-pricing-fields { grid-template-columns: 78px minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .settings-page .settings-shell { width: calc(100% - 32px); }
  .settings-page .settings-form,
  .settings-page .settings-section,
  .settings-page .field-grid,
  .settings-page .field,
  .settings-page .password-control { width: 100%; min-width: 0; }
  .settings-page .settings-section { padding: 20px; }
  .settings-page .settings-section-title {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .settings-page .settings-section-title > div,
  .settings-page .settings-section-title p { min-width: 0; overflow-wrap: anywhere; }
  .settings-page .field input,
  .settings-page .field select { width: 100%; min-width: 0; }
  .settings-page .settings-actions { width: 100%; min-width: 0; display: grid; grid-template-columns: 1fr; }
  .settings-page .settings-actions .primary-button,
  .settings-page .settings-actions .secondary-button { width: 100%; min-width: 0; }
  .cost-pricing-section { padding: 20px; }
  .cost-pricing-heading { margin-bottom: 20px; }
  .cost-pricing-fields { grid-template-columns: 1fr; }
  .cost-rate-inputs { grid-template-columns: 1fr; }
  .cost-currency-field { width: 110px; }
  .cost-pricing-actions { grid-template-columns: 1fr; }
  .cost-pricing-save,
  .cost-pricing-row-message { width: 100%; grid-column: 1; }
  .cost-pricing-save { grid-row: 1; justify-self: stretch; }
  .cost-pricing-row-message { grid-row: 2; text-align: left; }
}

@media (max-width: 600px) {
  .wizard-action-inner:has(#wizardCostEstimate:not([hidden])) {
    display: grid;
    grid-template-columns: 44px 44px minmax(0, 1fr);
    gap: 8px;
  }

  .wizard-action-inner #wizardCostEstimate:not([hidden]) {
    grid-column: 1 / -1;
    margin: 0;
  }

  .wizard-action-inner:has(#wizardCostEstimate:not([hidden])) #wizardBackButton {
    grid-column: 1;
    width: 44px;
    min-width: 44px;
    margin: 0;
  }

  .wizard-action-inner:has(#wizardCostEstimate:not([hidden])) #draftSaveGroup {
    grid-column: 2;
  }

  .wizard-action-inner:has(#wizardCostEstimate:not([hidden])) #saveDraftButton {
    width: 44px;
    min-width: 44px;
    padding-inline: 0;
  }

  .wizard-action-inner:has(#wizardCostEstimate:not([hidden])) #saveDraftButton span {
    display: none;
  }

  .wizard-action-inner:has(#wizardCostEstimate:not([hidden])) #wizardPrimaryButton {
    grid-column: 3;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding-inline: 10px;
  }

  body:has(#wizardCostEstimate:not([hidden])) .task-summary-drawer {
    bottom: 166px;
  }
}
