.cooking-page[data-kind="converter"] {
  container-type: inline-size;
  --cp-line: #dce7df;
  --cp-muted: #5b7061;
  --cp-ink: #1d3c2a;
  --cp-accent: #326746;
}
.cooking-page[data-kind="converter"] .cp-hero { padding-bottom: 22px; }
.cooking-page[data-kind="converter"] .cp-hero p { overflow-wrap: anywhere; }
.cooking-page[data-kind="converter"] .cp-hero .ed-badges { margin-top: 14px; }
.cp-workspace, .cp-dialog { color: var(--cp-ink); }
.cp-workspace-heading, .cp-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.cp-workspace-heading h2, .cp-section-head h2 { margin: 0 0 7px !important; color: var(--cp-ink) !important; font-size: 23px !important; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.cp-workspace-heading p, .cp-section-head p { margin: 0; color: var(--cp-muted); font-size: 14px; line-height: 1.65; }
.cp-workspace .cp-kicker { margin: 0 0 6px; color: var(--cp-accent); font-size: 12px; font-weight: 750; }
.cp-draft-state { flex-shrink: 0; padding: 4px 9px; border-radius: 20px; background: #fff3d8; color: #7b5b1d; font-size: 12px; }
.cp-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-toolbar button { min-height: 44px; padding: 9px 14px; background: #f6faf6; color: var(--cp-accent); font-size: 14px; }
.cp-settings-summary { min-height: 1.5em; margin: 10px 0 20px; color: var(--cp-muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.cp-workspace input, .cp-workspace select, .cp-workspace button, .cp-dialog input, .cp-dialog select, .cp-dialog button, .cp-dialog .ed-download { min-height: 44px; }
.cp-workspace .ed-field label, .cp-dialog .ed-field label { font-size: 14px; }
.cp-workspace .ed-field input, .cp-workspace .ed-field textarea, .cp-dialog .ed-field input, .cp-dialog .ed-field select { font-size: 16px; background: #fcfefb; border-color: #cddbcf; color: var(--cp-ink); }
.cp-name-field { margin-bottom: 18px; }
.cp-serving-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cp-serving-fields input { font-weight: 750; font-variant-numeric: tabular-nums; }
.cp-quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 20px; }
.cp-quick > span { width: 100%; font-size: 13px; color: var(--cp-muted); }
.cp-quick button { padding: 8px 12px; }
.cp-quick [data-factor] { flex: 1 1 100px; }
.cp-quick [data-target] { flex: 1 1 44px; }
.cp-source { margin-top: 18px; }
.cp-source textarea { min-height: 182px; line-height: 1.7 !important; }
.cp-source .ed-note { margin-top: 8px; font-size: 13px; line-height: 1.65; }
.cp-main-actions { margin-top: 18px; }
.cp-main-actions .ed-primary { min-width: 168px; }
.cp-workspace .ed-status { overflow-wrap: anywhere; }
.cp-empty-state { margin: 15px 0 0; padding: 15px 17px; border: 1px dashed #cfddce; border-radius: 12px; color: var(--cp-muted); font-size: 14px; background: #f9fcf7; }
.cp-workspace:has(#ck-result:not([hidden])) #ck-empty-state { display: none; }
.cp-result { margin-top: 18px; padding: 20px !important; background: #f4f9f2 !important; border: 1px solid #d7e4d6; }
.cp-result .cp-section-head { align-items: center; }
.cp-result .cp-export-trigger { flex-shrink: 0; margin: 0; color: #fff; background: var(--cp-accent); border-color: var(--cp-accent); }
.cp-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.cp-metric { min-width: 0; margin: 0; padding: 11px 12px; border: 1px solid var(--cp-line); border-radius: 11px; background: #fff; }
.cp-metric dt { color: var(--cp-muted); font-size: 12px; line-height: 1.45; }
.cp-metric dd { margin: 5px 0 0; color: var(--cp-ink); font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cp-comparison-help { margin-top: 12px; font-size: 13px; line-height: 1.7; }
.cp-comparison-wrap { min-width: 0; margin-top: 15px; overflow: hidden; border: 1px solid var(--cp-line); border-radius: 12px; background: #fff; }
.cp-comparison { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.cp-comparison th { padding: 12px 10px; background: #e7f0e5; color: #36533e; text-align: left; font-size: 13px; }
.cp-comparison th:nth-child(1), .cp-comparison th:nth-child(2) { width: 34%; }
.cp-comparison th:nth-child(3) { width: 18%; }
.cp-comparison th:nth-child(4) { width: 14%; }
.cp-comparison td { padding: 14px 10px; border-top: 1px solid var(--cp-line); vertical-align: top; overflow-wrap: anywhere; white-space: pre-wrap; }
.cp-comparison td:nth-child(2) { color: #245c38; font-weight: 750; }
.cp-line-note { display: block; margin-top: 6px; color: var(--cp-muted); font-size: 12px; font-weight: 400; }
.cp-line-status { display: inline-block; max-width: 100%; padding: 4px 7px; border-radius: 7px; background: #e9f3e7; color: #31613d; font-size: 12px; line-height: 1.5; font-weight: 700; }
.cp-line-status[data-state="fixed"] { background: #f6eedc; color: #725625; }
.cp-line-status[data-state="unchanged"] { background: #f1f3f5; color: #57646d; }
/* Override the shared result label's block layout, including in narrow table cards. */
.cp-comparison .cp-fixed { display: flex; flex-flow: row nowrap; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 44px; margin: 0; font-size: 13px; line-height: 1.4; white-space: normal; text-align: left; cursor: pointer; }
.cp-comparison .cp-fixed input[type="checkbox"] { flex: 0 0 19px; align-self: center; width: 19px; min-width: 19px; max-width: 19px; height: 19px; min-height: 19px; margin: 0; padding: 0; accent-color: var(--cp-accent); }
.cp-comparison .cp-fixed > span { display: block; min-width: 0; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
.cp-output-details { margin-top: 16px; padding: 13px; border: 1px solid var(--cp-line); border-radius: 12px; background: #fff; }
.cp-output-details summary { font-size: 14px; font-weight: 700; cursor: pointer; }
.cp-output-details textarea { margin-top: 10px; font-size: 14px; }
.cp-workspace a[aria-disabled="true"], .cp-dialog a[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* Native dialogs stay in the top layer, above the navigator and advertisement rails. */
html.cp-modal-open { overflow: hidden; scrollbar-gutter: stable; }
body:has(.cp-dialog[open]) { overflow: hidden; }
.cp-dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  max-height: min(90dvh, 900px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d5e2d7;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 100px #132d2480;
}
.cp-dialog[open] { display: flex; flex-direction: column; }
.cp-dialog::backdrop { background: rgb(18 37 28 / 52%); }
.cp-dialog-head { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 23px 24px 18px; border-bottom: 1px solid var(--cp-line); background: #f8fbf6; }
.cp-dialog-head h2 { margin: 0; color: var(--cp-ink); font-size: 22px; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.cp-dialog-head p { margin: 8px 0 0; color: var(--cp-muted); font-size: 14px; line-height: 1.6; }
.cp-dialog .cp-dialog-close { display: inline-flex; flex: 0 0 44px; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid #d4e0d5; border-radius: 12px; background: #fff; color: #3d5a45; font-size: 25px; line-height: 1; }
.cp-dialog-body { min-height: 0; padding: 22px 24px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.cp-dialog-body .ed-note { margin-top: 12px; color: var(--cp-muted); font-size: 13px; line-height: 1.7; }
.cp-dialog-footer { display: flex; flex: 0 0 auto; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 16px 24px; border-top: 1px solid var(--cp-line); background: #fff; }
.cp-dialog button:disabled { cursor: default; }
.cp-dialog .ed-actions { margin-top: 15px; }
.cp-dialog .ed-actions button { flex: 1 1 170px; }
.cp-dialog-status { min-height: 0; margin: 14px 0 0; color: #276143; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.cp-dialog-status:empty { display: none; }
.cp-dialog-status[data-error="true"] { color: #b42335; }
.cp-dialog .cp-format-fields { margin-top: 20px; }
.cp-storage-group + .cp-storage-group { margin-top: 22px; padding-top: 21px; border-top: 1px solid var(--cp-line); }
.cp-storage-group h3 { margin: 0; color: var(--cp-ink); font-size: 16px; line-height: 1.5; }
.cp-saved-summary { margin: 8px 0 0; padding: 12px 14px; border-radius: 10px; background: #f3f8ef; color: #49624e; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.cp-storage-delete { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--cp-line); }
.cp-storage-delete summary { min-height: 44px; color: #6b675e; font-size: 14px; cursor: pointer; }
.cp-storage-delete button { margin-top: 13px; color: #a33d32; border-color: #e6cfc8; }
.cp-export-hint { margin: 0 0 16px; color: var(--cp-muted); font-size: 14px; line-height: 1.65; }
.cp-export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cp-export-grid > * { display: flex; align-items: center; justify-content: center; min-width: 0; margin: 0 !important; min-height: 54px !important; padding: 13px 14px; text-align: center; overflow-wrap: anywhere; }
.cp-export-grid .ed-download { background: #fff; color: var(--cp-accent); border-color: #ccdbcc; }
.cooking-page[data-kind="converter"] .cp-export-grid .ed-download:hover,
.cooking-page[data-kind="converter"] .cp-export-grid .ed-download:focus-visible { background: #eff6ef; color: #245c38; border-color: #91b59a; }
.cp-dialog .ck-unit-panel { margin-top: 0; }
.cp-dialog .ck-unit-result { margin: 19px 0 0; font-size: 19px; line-height: 1.6; }
.cp-confirm-dialog { width: min(480px, calc(100vw - 32px)); }
.cp-confirm-dialog #ck-confirm-message { margin: 0; color: #3d5143; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }

@container (max-width: 620px) {
  .cp-comparison, .cp-comparison tbody { display: block; width: 100%; }
  .cp-comparison thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cp-comparison tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .cp-comparison tr + tr { border-top: 7px solid #edf4e9; }
  .cp-comparison td { display: block; width: 100%; min-width: 0; border-top: 0; padding: 11px 10px; }
  .cp-comparison td::before { display: block; margin-bottom: 4px; color: var(--cp-muted); font-size: 12px; font-weight: 500; content: attr(data-label); }
  .cp-comparison td:nth-child(3), .cp-comparison td:nth-child(4) { border-top: 1px dashed #dfe8da; }
  .cp-result .cp-section-head { flex-wrap: wrap; }
  .cp-result .cp-export-trigger { width: 100%; }
  .cp-result { padding: 15px !important; }
}
@media (max-width: 560px) {
  .cooking-page[data-kind="converter"] { padding-left: 0; padding-right: 0; }
  .cp-workspace { padding: 20px 16px !important; }
  .cp-workspace-heading { flex-wrap: wrap; gap: 8px; }
  .cp-workspace-heading h2, .cp-section-head h2 { font-size: 21px !important; }
  .cp-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-toolbar button { padding: 9px 8px; }
  .cp-settings-summary { margin-bottom: 18px; font-size: 12px; }
  .cp-main-actions > button { flex: 1 1 130px; }
  .cp-metric { padding: 9px 7px; }
  .cp-metric dt { font-size: 12px; }
  .cp-metric dd { font-size: 16px; }
  .cp-result { padding: 13px !important; }
  .cp-dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); border-radius: 18px; }
  .cp-dialog-head { gap: 10px; padding: 18px 16px 15px; }
  .cp-dialog-head h2 { font-size: 20px; }
  .cp-dialog-body { padding: 18px 16px; }
  .cp-dialog-footer { padding: 14px 16px; }
  .cp-dialog-footer button { flex: 1 1 110px; }
  .cp-dialog .ed-fields { grid-template-columns: 1fr; }
  .cp-export-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .cp-serving-fields .ed-field label { display: flex; min-height: 2.8em; align-items: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .cp-workspace *, .cp-dialog * { scroll-behavior: auto !important; }
}
