/* AI Print Server 3.0 — local-first workspace. Every rule is scoped to .aps3-*. */
.aps3-app { --aps3-line: #d0d4da; --aps3-ink: #1d2327; --aps3-muted: #50575e; --aps3-accent: #135e96; --aps3-danger: #b32d2e; --aps3-bg: #f6f7f7; --aps3-ok: #00731f;
  color: var(--aps3-ink); box-sizing: border-box; width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: clamp(0px, 1.5vw, 16px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; container-type: inline-size; container-name: aps3; }
.aps3-app *, .aps3-app *::before, .aps3-app *::after { box-sizing: border-box; }
/* M3.5.A: theme content columns are often a narrow reading width (e.g. .fg-prose, block-theme "constrained" layouts).
   The wide layout steps out of that column, centred, never wider than the viewport minus a gutter (no 100vw overflow).
   [ai_print_server_test layout="contained"] keeps the theme's width. */
/* !important only here: block themes force margin-left/right:auto !important on direct children of constrained columns. */
/* Wide layout: app.js aligns the app with the theme's wider content container (or the viewport), wherever the
   narrow content column sits (centred or left-aligned). Without JavaScript the app keeps the column width. */
.aps3-app.aps3-app--wide { max-width: none; }
/* [hidden] always wins inside the app (component display rules and themes must not reveal empty panels). */
.aps3-app [hidden] { display: none !important; }
/* M3.6: document names — invalid name, inline editor, accepted message. */
.aps3-app .aps3-doc-name.aps3-name-invalid { color: var(--aps3-danger); text-decoration: underline wavy var(--aps3-danger); text-underline-offset: 3px; }
.aps3-app .aps3-name-error { margin: 4px 0; color: var(--aps3-danger); font-size: .9em; }
.aps3-app .aps3-name-ok { margin: 4px 0; color: var(--aps3-ok); font-size: .9em; }
.aps3-app .aps3-name-edit { display: grid; gap: 6px; margin: 6px 0; }
.aps3-app .aps3-name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.aps3-app .aps3-name-input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 10px; border: 1px solid var(--aps3-line); border-radius: 6px; font: inherit; }
.aps3-app .aps3-name-ext { color: var(--aps3-muted); white-space: nowrap; }
.aps3-app .aps3-name-live { margin: 0; font-size: .9em; }
.aps3-app .aps3-name-save { justify-self: start; }
.aps3-app button, .aps3-app select, .aps3-app input, .aps3-app textarea { min-height: 44px; font: inherit; }
.aps3-app button { padding: 0 14px; border: 1px solid var(--aps3-line); border-radius: 6px; background: #fff; color: var(--aps3-ink); cursor: pointer; }
.aps3-app button:disabled { opacity: .55; cursor: not-allowed; }
.aps3-app :focus-visible { outline: 3px solid var(--aps3-accent); outline-offset: 2px; }
.aps3-visually-hidden, .aps3-hp { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; min-width: 0 !important; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.aps3-banner { margin: 0; padding: 12px 16px; background: #eef6fb; border-left: 4px solid var(--aps3-accent); border-radius: 4px; }
.aps3-unavailable { padding: 12px 16px; background: #fcf9e8; border-left: 4px solid #dba617; }
/* Administrator-only preview banner and notes (never rendered for customers). */
.aps3-admin-preview, .aps3-admin-note { max-width: 1440px; margin: 0 auto 12px; padding: 10px 14px; background: #fcf0f1; border-left: 4px solid #b32d2e; color: #1d2327; font-size: 14px; }
.aps3-admin-preview ul { margin: 6px 0 0 1.2em; }

/* Layout: one column (upload, list, preview, options, price, actions); two columns from 900px of available width. */
.aps3-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.aps3-col { display: grid; gap: 12px; min-width: 0; align-content: start; }
@container aps3 (min-width: 900px) { .aps3-layout { grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); gap: 24px; } }
@supports not (container-type: inline-size) { @media (min-width: 960px) { .aps3-layout { grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); gap: 24px; } } }

.aps3-drop { display: grid; gap: 4px; place-items: center; padding: 28px 16px; border: 2px dashed var(--aps3-line); border-radius: 10px; background: var(--aps3-bg); text-align: center; cursor: pointer; }
.aps3-drop:hover { border-color: var(--aps3-accent); }
.aps3-drop--over { border-color: var(--aps3-accent); background: #e7f1f8; }
.aps3-drop-icon { font-size: 1.8em; line-height: 1; color: var(--aps3-accent); }
.aps3-drop-types { color: var(--aps3-muted); font-size: .92em; }
.aps3-file { max-width: 100%; }
.aps3-live { margin: 0; min-height: 1.4em; color: var(--aps3-muted); }
.aps3-live:empty { display: none; }
.aps3-empty { margin: 0; padding: 14px 16px; color: var(--aps3-muted); background: var(--aps3-bg); border-radius: 8px; }
.aps3-empty-panel { padding: 12px; border: 1px solid var(--aps3-line); border-radius: 8px; }
.aps3-empty-panel h3 { margin: 0 0 8px; font-size: 1.05em; }
.aps3-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.aps3-doc { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--aps3-line); border-radius: 8px; background: #fff; }
.aps3-doc--selected { border-color: var(--aps3-accent); box-shadow: 0 0 0 1px var(--aps3-accent); }
.aps3-doc--error { border-color: var(--aps3-danger); }
.aps3-doc-thumb { width: 72px; }
.aps3-thumb-img { width: 72px; height: auto; max-height: 100px; object-fit: contain; border: 1px solid var(--aps3-line); background: #fff; }
.aps3-doc-body { display: grid; gap: 2px; min-width: 0; }
.aps3-doc-name { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0 !important; padding: 0 !important; min-height: 32px !important; font-weight: 600; text-align: left; }
.aps3-doc-meta, .aps3-doc-hint { color: var(--aps3-muted); font-size: .92em; overflow-wrap: anywhere; }
.aps3-doc--error .aps3-doc-info { color: var(--aps3-danger); font-weight: 600; }
.aps3-doc-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.aps3-danger { color: var(--aps3-danger); }
.aps3-warn { margin: 4px 0 0; padding-left: 18px; color: #8a6100; font-size: .92em; }
.aps3-viewer { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--aps3-line); border-radius: 8px; background: var(--aps3-bg); min-width: 0; }
.aps3-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.aps3-page-input { width: 5em; }
.aps3-page-facts { margin: 0; color: var(--aps3-muted); }
.aps3-stage { overflow: auto; max-height: 75vh; text-align: center; background: #e3e5e8; padding: 8px; border-radius: 6px; max-width: 100%; }
.aps3-page-wrap { position: relative; display: inline-block; line-height: 0; }
.aps3-page { display: block; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); max-width: none; }
.aps3-overlay { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.aps3-image-preview { max-width: 100%; height: auto; }
.aps3-thumbs { list-style: none; margin: 0; padding: 4px; display: flex; gap: 8px; overflow-x: auto; max-width: 100%; }
.aps3-thumb button { display: grid; gap: 2px; place-items: center; padding: 4px; min-width: 84px; }
.aps3-thumb canvas { width: 72px; min-height: 40px; background: #fff; }
.aps3-thumb--current button { border-color: var(--aps3-accent); border-width: 2px; }
.aps3-thumb--selected button { background: #e7f1f8; }
.aps3-settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--aps3-line); border-radius: 8px; }
.aps3-settings h3 { grid-column: 1 / -1; margin: 0; font-size: 1.05em; overflow-wrap: anywhere; }
.aps3-field { display: grid; gap: 4px; min-width: 0; margin: 0; }
.aps3-app select, .aps3-app input, .aps3-app textarea { max-width: 100%; min-width: 0; }
.aps3-app .aps3-field select, .aps3-app .aps3-field input:not([type="checkbox"]):not([type="radio"]), .aps3-app .aps3-field textarea { width: 100%; }
.aps3-settings, .aps3-summary, .aps3-viewer { min-width: 0; }
.aps3-field--check { display: flex; align-items: center; gap: 8px; }
.aps3-field-error { color: var(--aps3-danger); font-weight: 600; grid-column: 1 / -1; }
.aps3-range-summary { color: var(--aps3-ink); }
.aps3-range-notes { color: #8a6100; }
.aps3-summary { padding: 12px; border: 1px solid var(--aps3-line); border-radius: 8px; }
.aps3-summary h3 { margin: 0 0 8px; }
.aps3-summary-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.aps3-summary-list li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; align-items: start; padding-bottom: 8px; border-bottom: 1px solid #eceef0; }
.aps3-sum-name { overflow-wrap: anywhere; }
.aps3-note { color: var(--aps3-muted); margin: 6px 0 0; }
.aps3-actions { display: grid; gap: 8px; justify-items: stretch; }
.aps3-actions--row { display: flex; flex-wrap: wrap; gap: 8px; }
.aps3-cart { background: var(--aps3-accent) !important; color: #fff !important; border-color: var(--aps3-accent) !important; font-weight: 600; }
.aps3-quote-btn { font-weight: 600; border-color: var(--aps3-accent) !important; color: var(--aps3-accent) !important; }
.aps3-cart-note { margin: 0; }
.aps3-success { color: var(--aps3-ok); }
.aps3-group { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 10px; margin: 0; padding: 10px 12px 12px; border: 1px solid var(--aps3-line); border-radius: 8px; min-width: 0; }
.aps3-group legend { padding: 0 6px; font-weight: 600; }
.aps3-group > .aps3-field[role="radiogroup"], .aps3-group > .aps3-issues, .aps3-group > .aps3-note, .aps3-group > .aps3-field-error { grid-column: 1 / -1; }
.aps3-field-title { font-weight: 600; }
.aps3-choice { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 8px; align-items: start; min-height: 44px; padding: 6px 0; }
.aps3-choice input { min-height: 0; width: 20px; height: 20px; margin: 2px 0 0; grid-row: 1 / span 3; }
.aps3-choice > :not(input) { grid-column: 2; }
.aps3-choice--off { color: var(--aps3-muted); }
.aps3-price-label { color: var(--aps3-accent); font-weight: 600; }
.aps3-reason { color: var(--aps3-muted); font-size: .92em; }
.aps3-issues { margin: 0; padding: 8px 12px 8px 28px; background: #fcf9e8; border-left: 4px solid #dba617; border-radius: 4px; }
.aps3-sum-qty { color: var(--aps3-muted); }
.aps3-lines { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 2px; }
.aps3-lines li { display: flex; justify-content: space-between; gap: 12px; }
.aps3-lines li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.aps3-lines li span:last-child { white-space: nowrap; }
.aps3-price--error { color: var(--aps3-danger); font-weight: 600; }
.aps3-total { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--aps3-line); }
/* M3.6: one order summary (counts, costs, order minima once) */
.aps3-order { margin: 10px 0 0; display: grid; gap: 2px; font-size: .92em; }
.aps3-ord-row { display: flex; justify-content: space-between; gap: 12px; }
.aps3-ord-row dt, .aps3-ord-row dd { margin: 0; }
.aps3-ord-row dd { text-align: right; font-variant-numeric: tabular-nums; }
.aps3-ord-min { font-weight: 600; }
.aps3-order[aria-busy="true"], .aps3-total[aria-busy="true"] { opacity: .6; }
.aps3-group--card > *:not(.aps3-field) { grid-column: 1 / -1; }
.aps3-card-facts { margin: 0; color: var(--aps3-muted); }
.aps3-preflight-warnings { margin: 0; padding: 8px 12px 8px 28px; background: #fcf9e8; border-left: 4px solid #dba617; border-radius: 4px; }
.aps3-swatch { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin: 0 6px; }
.aps3-legend { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--aps3-muted); font-size: .92em; }
.aps3-guide { vector-effect: non-scaling-stroke; }
.aps3-imposition svg { max-width: 100%; height: auto; }
.aps3-cartflow { padding: 10px 12px; border: 1px solid var(--aps3-line); border-radius: 8px; background: #fff; }
.aps3-quote dl, .aps3-quote { margin: 8px 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
.aps3-quote dd { margin: 0; }

/* "Solicită ofertă" dialog: fits small screens, scrolls inside, never covers the browser chrome. */
.aps3-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 16px 18px; border: 1px solid var(--aps3-line); border-radius: 10px; color: var(--aps3-ink); }
.aps3-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.aps3-dialog h2 { margin: 0 0 8px; font-size: 1.25em; }
.aps3-quote-form { display: grid; gap: 10px; }
.aps3-quote-form p { margin: 0; }
.aps3-quote-docs { margin: 0; padding-left: 20px; overflow-wrap: anywhere; }

@container aps3 (max-width: 599px) {
  .aps3-group { grid-template-columns: minmax(0, 1fr); }
  .aps3-settings { grid-template-columns: minmax(0, 1fr); padding: 8px; }
  .aps3-doc { grid-template-columns: 56px minmax(0, 1fr); }
  .aps3-thumb-img, .aps3-doc-thumb { width: 56px; }
  .aps3-drop { padding: 22px 12px; }
}
@supports not (container-type: inline-size) { @media (max-width: 640px) {
  .aps3-group { grid-template-columns: minmax(0, 1fr); }
  .aps3-settings { grid-template-columns: minmax(0, 1fr); padding: 8px; }
  .aps3-doc { grid-template-columns: 56px minmax(0, 1fr); }
  .aps3-thumb-img, .aps3-doc-thumb { width: 56px; }
} }
@media (prefers-reduced-motion: reduce) { .aps3-app * { scroll-behavior: auto !important; transition: none !important; } }

/* M3.7: findings, dimensions, committed batch, review confirmation, general settings (D-89 … D-95) */
.aps3-warn li.aps3-warn--info { color: #50575e; }
.aps3-warn li.aps3-warn--warning { color: #8a4b00; font-weight: 600; }
.aps3-doc-dim { display: block; font-size: .88em; color: #50575e; margin-top: 2px; }
.aps3-doc-committed { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 10px; background: #e7f6ec; color: #0a6b2e; font-size: .88em; font-weight: 600; }
.aps3-doc-recommit { display: block; margin-top: 4px; font-size: .88em; color: #8a4b00; }
.aps3-review { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--aps3-line, #dcdcde); border-radius: 6px; background: #fbfbfc; }
.aps3-review-warnings { margin: 4px 0 6px; padding-left: 18px; color: #8a4b00; font-size: .92em; }
.aps3-scope { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.aps3-scope button { padding: 6px 10px; border: 1px solid var(--aps3-line, #dcdcde); border-radius: 6px; background: #fff; cursor: pointer; }
.aps3-scope button[aria-pressed="true"] { border-color: #2271b1; background: #f0f6fc; font-weight: 600; }
.aps3-apply-all { margin: 0 0 8px; }
.aps3-inherit { display: block; font-size: .82em; color: #646970; }
.aps3-inherit--own { color: #2271b1; }
.aps3-link { background: none; border: 0; padding: 0; color: #2271b1; text-decoration: underline; cursor: pointer; font: inherit; }
