/* po-fields-card-editor · Odia composer tokens from apps/web/src/assets/styles/globals.css */
:root {
  --background: #f3effa;
  --card: #ffffff;
  --foreground: #121021;
  --primary: #06041f;
  --primary-foreground: #ffffff;
  --muted: #e8e5f0;
  --muted-foreground: #6e6a8b;
  --accent-soft: #e9e5f9;
  --accent-soft-hover: #ddd6f3;
  --accent-interactive: #5935e9;
  --border: #d4c5e6;
  --ring: #5935e9;
  --warning: #f9c152;
  --warning-strong: #8a5a0b;
  --destructive: #e62b0f;
  --success: #08775b;
  --success-soft: #dff8ef;
  --email-accent: #9c8b7c;
  --email-footer: #9ca3af;
  --shadow: 0 24px 70px rgba(28, 21, 58, 0.16);
  color: var(--foreground);
  background: var(--background);
  font-family: Manrope, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 0; background: var(--background); }
button, input, textarea, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible, [tabindex]:focus-visible, select:focus-visible, input:focus-visible, [contenteditable]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 16px; height: 16px; flex: 0 0 auto; }
.icon.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* External review shell */
.review-toolbar { position: sticky; z-index: 60; top: 0; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 22px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 1px 0 var(--border); backdrop-filter: blur(18px); }
.review-brand { display: grid; gap: 2px; }
.review-brand strong { font-size: 15px; }
.review-kicker { color: var(--accent-interactive); font-size: 9px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.review-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.review-controls label { display: grid; gap: 3px; color: var(--muted-foreground); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.review-controls select, .quiet-button, .notes-toggle { min-height: 34px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); padding: 0 12px; }
.notes-toggle { grid-auto-flow: column !important; align-items: center; padding-top: 0 !important; }
.notes-toggle input { accent-color: var(--accent-interactive); }
.state-pills { display: flex; gap: 7px; overflow-x: auto; padding: 11px 22px 0; }
.state-pill { flex: 0 0 auto; border: 0; border-radius: 999px; background: var(--card); padding: 8px 12px; color: var(--muted-foreground); font-size: 11px; font-weight: 700; box-shadow: 0 1px 3px rgba(25, 19, 55, 0.08); }
.state-pill:hover { background: var(--accent-soft); color: var(--foreground); }
.state-pill.active { background: var(--primary); color: white; }
.prototype-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 16px; padding: 16px 22px 44px; }
.prototype-stage, .screen-root { min-width: 0; }
.review-notes { position: sticky; top: 84px; display: grid; max-height: calc(100vh - 104px); gap: 14px; overflow-y: auto; border-radius: 24px; background: var(--card); padding: 18px; box-shadow: 0 14px 42px rgba(27, 20, 60, 0.1); }
.review-notes[hidden] { display: none; }
.note-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-group, .score-target { border-radius: 999px; padding: 5px 8px; font-size: 8px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.note-group { background: var(--accent-soft); color: var(--accent-interactive); }
.score-target { background: var(--success-soft); color: var(--success); }
.review-notes h2 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }
.review-notes section { padding-top: 12px; box-shadow: inset 0 1px 0 var(--muted); }
.review-notes h3 { margin: 0 0 5px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.review-notes p, .review-notes li { margin: 0; color: var(--muted-foreground); font-size: 11px; line-height: 1.5; }
.review-notes ul { display: grid; gap: 4px; margin: 0; padding-left: 16px; }
.question-card { border-radius: 17px; background: var(--primary); padding: 13px !important; box-shadow: none !important; }
.question-card h3, .question-card p { color: white; }

/* Shared controls (Button variants from components/ui/button.tsx) */
.btn { display: inline-flex; height: 36px; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; background: transparent; padding: 0 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.btn.small { height: 32px; font-size: 12px; }
.btn.xs { height: 28px; padding: 0 8px; font-size: 12px; }
.btn.icon { width: 36px; padding: 0; }
.btn.tinted { background: var(--accent-soft); color: var(--accent-interactive); }
.btn.tinted:hover { background: var(--accent-soft-hover); }
.btn.ghost { color: var(--foreground); }
.btn.ghost:hover { background: var(--muted); }
.btn.primary { background: var(--primary); color: var(--primary-foreground); padding: 0 16px; }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 90%, white); }
.btn.primary:disabled { background: color-mix(in srgb, var(--primary) 50%, white); color: rgba(255, 255, 255, 0.7); }
.btn:disabled { pointer-events: none; }
.btn.ghost:disabled, .btn.tinted:disabled { color: var(--muted-foreground); }
.chip-accent { display: inline-flex; align-items: center; border-radius: 999px; background: var(--accent-soft); padding: 2px 8px; font-size: 12px; font-weight: 600; color: var(--foreground); white-space: nowrap; }

/* Email focus shell (EmailFocusShell.tsx) */
.email-focus { position: relative; display: flex; height: 860px; min-width: 0; flex-direction: column; overflow: hidden; border-radius: 22px; background: var(--background); box-shadow: var(--shadow); }
.focus-header { display: flex; min-width: 0; flex: 0 0 auto; align-items: center; gap: 12px; padding: 12px 20px; background: var(--card); box-shadow: 0 1px 0 var(--border); }
.focus-title { min-width: 0; flex: 1; }
.focus-title h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.focus-title p { margin: 0; overflow: hidden; color: var(--muted-foreground); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.type-switch { display: flex; flex: 0 0 auto; border-radius: 999px; background: var(--muted); padding: 4px; }
.type-switch .btn { height: 32px; padding: 0 12px; font-size: 12px; }
.type-switch .btn.ghost:hover { background: var(--card); }
.pane-switch { display: none; flex: 0 0 auto; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--card); }
.pane-switch .btn { height: 40px; padding: 0 16px; }
.focus-split { display: flex; min-height: 0; flex: 1; }
.focus-editor { min-width: 0; flex: 0 1 var(--editor-width, 50%); overflow-x: hidden; overflow-y: auto; padding: 20px 24px; }
.email-focus.is-pending .focus-editor { pointer-events: none; opacity: 0.6; }
.split-handle { display: flex; width: 8px; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 999px; cursor: col-resize; touch-action: none; user-select: none; transition: background-color 200ms ease; }
.split-handle span { width: 1px; height: 48px; border-radius: 999px; background: color-mix(in srgb, var(--border) 60%, transparent); transition: background-color 200ms ease, width 200ms ease; }
.split-handle:hover, .split-handle:focus-visible { background: var(--accent-soft); }
.split-handle:hover span, .split-handle:focus-visible span, .split-handle:active span { width: 4px; background: var(--accent-interactive); }
.focus-preview { display: flex; min-width: 22rem; flex: 1 1 0; flex-direction: column; min-height: 0; overflow: hidden; background: var(--card); }
.focus-footer { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); background: var(--card); padding: 12px 24px; }
.footer-note { display: flex; min-width: 0; align-items: center; gap: 6px; color: var(--muted-foreground); font-size: 12px; }
.footer-note.is-warning { color: var(--warning-strong); }
.footer-actions { display: flex; margin-left: auto; align-items: center; gap: 8px; }

/* Composer form (JourneyEmailComposer.tsx) */
.composer-form { display: flex; width: 100%; max-width: 48rem; flex-direction: column; gap: 16px; margin: 0 auto; }
.envelope { display: flex; flex-direction: column; border-radius: 24px; background: color-mix(in srgb, var(--muted) 40%, transparent); padding: 2px; }
.env-row { display: flex; min-height: 32px; min-width: 0; align-items: center; gap: 12px; border-radius: 16px; padding: 0 12px; font-size: 14px; }
.env-row.is-sender { min-height: 28px; }
.env-label { width: 56px; flex: 0 0 auto; color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.env-value { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-link { color: var(--foreground); font-size: 12px; font-weight: 600; text-decoration: underline; }
.env-fill { display: flex; min-width: 0; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; }
.env-placeholder { color: var(--muted-foreground); font-size: 14px; }
.env-end { display: inline-flex; margin-left: auto; flex: 0 0 auto; }
.recipient { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); padding: 2px 6px 2px 4px; font-size: 13px; }
.recipient b { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 8px; background: var(--primary); color: white; font-size: 9px; font-weight: 800; }
.recipient button { display: grid; width: 18px; height: 18px; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--muted-foreground); padding: 0; }
.recipient button .icon { width: 12px; height: 12px; }

.editor { border: 1px solid var(--border); border-radius: 24px; background: var(--card); }
.editor-toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 10px; box-shadow: inset 0 -1px 0 var(--muted); }
.tb { display: inline-flex; height: 32px; min-width: 32px; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 10px; background: transparent; color: var(--foreground); padding: 0 6px; font-size: 13px; font-weight: 600; }
.tb:hover { background: var(--muted); }
.tb .icon { width: 18px; height: 18px; }
.tb.select { padding: 0 8px 0 10px; }
.tb.select .icon { width: 14px; height: 14px; }
.tb-divider { width: 1px; height: 20px; margin: 0 6px; background: var(--muted); }
.tb-spacer { flex: 1; }
.ai-button { display: inline-flex; height: 32px; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--border); padding: 0 12px 0 8px; font-size: 13px; font-weight: 700; }
.ai-button .odi { width: 20px; height: 20px; }
.editor-body { min-height: 96px; padding: 14px 16px 18px; font-size: 15px; line-height: 1.6; outline: none; }
.editor-body p { margin: 0 0 6px; }
.editor-body:focus-visible { outline: none; }

/* Details picker (JourneyDetailsPicker.tsx) */
.details-picker { border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); padding: 8px 0; }
.details-head { display: flex; align-items: center; gap: 4px; }
.details-toggle { display: flex; min-width: 0; flex: 1; align-items: center; gap: 12px; border: 0; border-radius: 16px; background: transparent; padding: 4px 8px; text-align: left; }
.details-toggle > span { display: block; min-width: 0; flex: 1; }
.details-title { display: block; font-size: 14px; font-weight: 700; }
.details-sub { display: block; color: var(--muted-foreground); font-size: 12px; }
.details-toggle .icon { transform: rotate(180deg); }
.settings-link { flex: 0 0 auto; color: var(--muted-foreground); font-size: 12px; text-decoration: underline; }
.details-groups { display: grid; gap: 8px; margin-top: 8px; }
.details-group { border-radius: 16px; background: var(--card); padding: 6px; }
.group-head { display: flex; min-height: 36px; align-items: center; gap: 8px; padding: 0 6px; }
.group-title { display: flex; min-width: 0; flex: 1; align-items: center; justify-content: space-between; gap: 8px; border: 0; border-radius: 10px; background: transparent; padding: 4px 6px; margin: 0 -6px; font-size: 14px; font-weight: 700; text-align: left; }
.group-title > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-meta { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; color: var(--muted-foreground); font-size: 12px; font-weight: 500; }
.group-meta .icon { width: 14px; height: 14px; transform: rotate(180deg); }
.group-count { flex: 0 0 auto; color: var(--muted-foreground); font-size: 12px; font-weight: 500; }
.is-pills .group-title:hover { background: var(--accent-soft); }
.details-group.is-pills { padding: 4px 6px 6px; }
.details-group.is-pills .group-head { min-height: 32px; }
.group-rows { display: grid; gap: 2px; padding: 4px 4px 0; }
.detail-row { display: grid; width: 100%; grid-template-columns: 16px minmax(0, 1fr) minmax(0, auto); align-items: center; gap: 8px; border: 0; border-radius: 12px; background: transparent; padding: 6px 10px; font-size: 14px; text-align: left; }
.detail-row:hover { background: var(--accent-soft); }
.detail-row.is-selected { background: var(--accent-soft); }
.detail-row.is-disabled { cursor: not-allowed; opacity: 0.6; }
.detail-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-value { min-width: 0; overflow: hidden; color: var(--muted-foreground); font-size: 12px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.detail-row.is-missing { background: color-mix(in srgb, var(--warning) 12%, transparent); }
.detail-row.is-missing .detail-value { color: var(--warning-strong); font-weight: 600; }
.checkbox { display: grid; width: 16px; height: 16px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 4px; background: var(--border); color: white; padding: 0; }
.checkbox .icon { width: 13px; height: 13px; }
.checkbox.is-checked, .checkbox.is-mixed { background: var(--primary); }
.checkbox.is-disabled { opacity: 0.5; cursor: not-allowed; }
.checkbox.is-disabled.is-checked { background: color-mix(in srgb, var(--primary) 70%, transparent); }

/* Proposed: field pills */
.pill-wrap { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 4px; }
.field-pill { display: inline-flex; height: 26px; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); padding: 0 10px 0 8px; font-size: 12px; font-weight: 600; white-space: nowrap; transition: background-color 150ms ease, color 150ms ease; }
.field-pill .icon { width: 14px; height: 14px; }
.field-pill.is-off:hover { background: var(--accent-soft); color: var(--foreground); }
.field-pill.is-on { background: var(--accent-soft); color: var(--foreground); }
.field-pill.is-on:hover { background: var(--accent-soft-hover); }
.field-pill.is-required { background: var(--accent-soft); color: var(--muted-foreground); cursor: default; }
.field-pill.is-required:disabled { opacity: 1; }
.field-pill.is-missing { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning-strong); }
.field-pill.is-missing:hover { background: color-mix(in srgb, var(--warning) 24%, transparent); }

/* Preview pane (EmailPreviewPane.tsx + EmailDocumentPreview.tsx) */
.preview-pane { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 12px; padding: 16px 20px; }
.preview-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px; }
.preview-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.preview-head p { margin: 0; color: var(--muted-foreground); font-size: 12px; }
.preview-head dl { display: flex; min-width: 0; flex-wrap: wrap; justify-content: end; gap: 2px 12px; margin: 0; color: var(--muted-foreground); font-size: 12px; }
.preview-head dd { max-width: 160px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-document { position: relative; min-height: 0; flex: 1; overflow-y: auto; border: 1px solid var(--border); border-radius: 16px; background: #f3effa; scroll-behavior: smooth; }
.email-body { max-width: 600px; margin: 0 auto; padding: 32px 20px; color: #121021; font-family: Manrope, "Helvetica Neue", Arial, sans-serif; line-height: 1.6; }
.email-message { margin-bottom: 24px; border: 1px solid #d4c5e6; border-radius: 24px; background: #ffffff; padding: 16px; font-size: 16px; font-weight: 500; }
.email-message p { margin: 0 0 6px; }
.email-signature { margin-top: 32px; border-top: 1px solid #d4c5e6; padding-top: 24px; }
.email-signature p { margin: 0 0 2px; color: #6e6a8b; font-size: 14px; }
.email-signature .sig-name { margin-bottom: 4px; color: #121021; font-size: 16px; font-weight: 500; }
.email-powered { margin-top: 32px; color: #9ca3af; font-size: 13px; text-align: center; }
.email-powered a { color: #9ca3af; }

/* Supplier service card (email-shared.ts renderServiceCardWrapper/Header/InfoSection) */
.po-card { margin-bottom: 24px; border: 1px solid #d4c5e6; border-radius: 24px; background: #ffffff; padding: 24px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); transition: box-shadow 200ms ease; }
.po-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 16px; border-left: 4px solid #9c8b7c; padding-left: 16px; }
.po-card-head > div { min-width: 0; }
.po-card-bulk { flex: 0 0 auto; margin-top: 2px; color: var(--muted-foreground); font-family: Manrope, ui-sans-serif, sans-serif; }
.po-card-bulk:hover { background: var(--accent-soft); color: var(--foreground); }
.po-card-head h3 { margin: 0 0 8px; color: #121021; font-size: 18px; font-weight: 600; }
.po-card-head p { margin: 0; color: #6e6a8b; font-size: 16px; font-weight: 500; }
.po-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0 -8px; }
.po-field { position: relative; display: block; min-width: 0; border: 0; border-radius: 12px; background: transparent; padding: 8px; font: inherit; text-align: left; transition: background-color 150ms ease; }
.po-field .k { display: block; margin-bottom: 6px; color: #6e6a8b; font-size: 13px; font-weight: 500; }
.po-field .v { display: block; overflow-wrap: anywhere; color: #121021; font-size: 16px; font-weight: 500; }
.po-field.is-block { grid-column: 1 / -1; }
.po-card.is-legacy .po-card-grid { margin: 0; border: 1px solid #d4c5e6; border-radius: 16px; padding: 12px; }
.po-legacy-block { margin-top: 16px; border: 1px solid #d4c5e6; border-radius: 16px; padding: 16px; }
.po-legacy-block .k { display: block; margin-bottom: 4px; color: #6e6a8b; font-size: 13px; font-weight: 500; }
.po-legacy-block .v { display: block; color: #121021; font-size: 16px; font-weight: 500; }
.po-card.is-following { box-shadow: 0 0 0 2px var(--accent-interactive), 0 2px 4px rgba(0, 0, 0, 0.05); }
.is-flash { animation: flash 1200ms ease-out; }
@keyframes flash { 0%, 35% { background-color: var(--accent-soft-hover); } 100% { background-color: transparent; } }

/* Proposed: edit fields on the card (card-editor prototype) */
.po-card.is-editable .po-field.is-optional { cursor: pointer; padding-right: 32px; }
.po-card.is-editable .po-field.is-optional:hover, .po-card.is-editable .po-field.is-optional:focus-visible { background: var(--accent-soft); }
.po-card.is-editable .po-field.is-locked { padding-right: 32px; cursor: default; }
.po-card.is-editable .po-field.is-locked:hover, .po-card.is-editable .po-field.is-locked:focus-visible, .po-card.is-editable .po-field.is-hover-demo { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.po-field-badge { position: absolute; top: 8px; right: 8px; display: grid; width: 22px; height: 22px; place-items: center; border-radius: 999px; color: var(--muted-foreground); opacity: 0; transition: opacity 150ms ease; }
.po-field-badge .icon { width: 14px; height: 14px; }
.po-field:hover .po-field-badge, .po-field:focus-visible .po-field-badge, .po-field.is-hover-demo .po-field-badge { opacity: 1; }
.po-field.is-optional:hover .po-field-badge { background: var(--card); color: var(--foreground); }
.po-field.is-locked[data-tip]::after { position: absolute; z-index: 3; right: 8px; bottom: calc(100% - 2px); display: none; border-radius: 10px; background: var(--primary); color: white; padding: 6px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; content: attr(data-tip); }
.po-field.is-locked:hover::after, .po-field.is-locked:focus-visible::after, .po-field.is-locked.is-hover-demo::after { display: block; }
.po-field.is-missing { background: color-mix(in srgb, var(--warning) 12%, transparent); cursor: pointer; padding-right: 32px; }
.po-field.is-missing .v { color: var(--warning-strong); }
.po-field.is-missing:hover { background: color-mix(in srgb, var(--warning) 22%, transparent); }
.po-field.is-missing .po-field-badge { color: var(--warning-strong); opacity: 1; }
.po-card-hidden { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 12px; }
.po-card-hidden .hint { margin-right: 4px; color: var(--muted-foreground); font-size: 12px; }
.editor-cards { display: grid; gap: 0; margin-top: 12px; }
.editor-cards .po-card { margin-bottom: 12px; }

@media (max-width: 899px) {
  .prototype-layout { grid-template-columns: 1fr; }
  .review-notes { position: static; max-height: none; }
  .hide-compact { display: none !important; }
  .pane-switch { display: flex; }
  .focus-split { display: block; }
  .split-handle { display: none; }
  .focus-editor { height: 100%; padding: 16px; }
  .focus-preview { min-width: 0; height: 100%; }
  .email-focus[data-pane="write"] .focus-preview { display: none; }
  .email-focus[data-pane="preview"] .focus-editor { display: none; }
  .footer-note:not(.is-warning) { display: none; }
  .footer-actions { width: 100%; justify-content: end; }
  .env-end { margin-left: 0; }
}

@media (max-width: 1100px) and (min-width: 900px) {
  .prototype-layout { grid-template-columns: 1fr; }
  .review-notes { position: static; max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  .email-document { scroll-behavior: auto; }
  .is-flash, .icon.spin { animation: none; }
  .split-handle, .split-handle span, .field-pill, .po-field, .po-card { transition: none; }
}
