/* FinalPack — Box designer (boxtest-style workspace, dark RTL) */

.fp-box-page {
  min-height: 100vh;
  background: var(--fp-bg, #0f1211);
  color: var(--fp-text, #fff);
  overflow: hidden;
}

/* صفحات فرم (مثل استعلام) باید اسکرول شوند */
.fp-box-page.fp-box-page--scroll {
  overflow: auto;
  overflow-x: hidden;
  height: auto;
  min-height: 100vh;
}

[data-theme="light"] .fp-box-page {
  --fp-bg: #f4f5f4;
  --fp-card: #ffffff;
  --fp-border: rgba(15, 18, 17, 0.1);
  --fp-text: #0f1211;
  --fp-text-muted: #5e6662;
}

[data-theme="dark"] .fp-box-page {
  --fp-bg: #0f1211;
  --fp-card: #141716;
  --fp-border: #2a2f2c;
  --fp-text: #ffffff;
  --fp-text-muted: #9aa09c;
}

.fp-box-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--fp-border, #2a2f2c);
  background: color-mix(in srgb, var(--fp-card, #141716) 92%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 56px;
}

.fp-box-topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.fp-box-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

.fp-box-brand__mark {
  width: 34px;
  height: 34px;
  display: block;
}

.fp-box-brand__type {
  width: 118px;
  height: 22px;
  display: block;
}

[data-theme="dark"] .fp-box-brand__type {
  filter: brightness(1.15) contrast(0.95);
}

[data-theme="light"] .fp-box-brand__type {
  filter: brightness(0.35);
}

.fp-box-back {
  color: var(--fp-accent, #98be1c);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

.fp-box-topbar__title {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.fp-box-topbar__title strong {
  display: block;
  font-size: 0.82rem;
  color: var(--fp-accent, #98be1c);
}

.fp-box-topbar__title span {
  font-size: 0.85rem;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fp-box-topbar__user {
  font-size: 0.82rem;
  color: var(--fp-text-muted, #9aa09c);
  white-space: nowrap;
}

/* ── 3-column workspace (RTL: controls → center → preview) ── */

.fp-box-lab .fp-box-workspace {
  display: grid;
  grid-template-columns: 52px minmax(240px, 280px) minmax(0, 1fr) minmax(260px, 300px);
  grid-template-rows: calc(100vh - 56px);
  height: calc(100vh - 56px);
  margin: 0;
  min-height: 0;
  overflow: hidden;
}

.fp-box-icon-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.35rem;
  background: #111413;
  border-left: 1px solid var(--fp-border, #2a2f2c);
}

.fp-box-icon-rail__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: 42px;
  padding: 0.45rem 0.2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fp-text-muted, #9aa09c);
  font-family: inherit;
  font-size: 0.65rem;
  cursor: pointer;
}

.fp-box-icon-rail__btn span {
  font-size: 1.1rem;
  line-height: 1;
}

.fp-box-icon-rail__btn.is-active {
  background: rgba(152, 190, 28, 0.15);
  color: var(--fp-accent, #98be1c);
}

.fp-box-icon-rail__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.fp-box-rail {
  background: var(--fp-card, #141716);
  border-left: 1px solid var(--fp-border, #2a2f2c);
  overflow-y: auto;
  padding: 0.85rem 0.9rem 1.25rem;
  min-height: 0;
  min-width: 0;
}

.fp-box-rail--controls {
  display: flex;
  flex-direction: column;
}

.fp-box-rail__section {
  margin-bottom: 1.1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--fp-border, #252927);
}

.fp-box-rail__section--theme {
  margin-top: auto;
  padding-top: 0.75rem;
  border-bottom: none;
}

.fp-box-rail__section--theme .fp-theme {
  width: 100%;
  justify-content: center;
}

.fp-box-rail__title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.fp-box-dim-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.fp-box-dim-row--flaps {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.fp-box-field-warn {
  margin: 0.55rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #eab308;
  font-size: 0.72rem;
  line-height: 1.45;
}

.fp-box-dim__label {
  display: block;
  font-size: 0.78rem;
  color: var(--fp-text-muted, #9aa09c);
  margin-bottom: 0.25rem;
}

.fp-box-dim__input {
  display: flex;
  align-items: center;
  border: 1px solid var(--fp-border, #3a3f3c);
  border-radius: 8px;
  background: var(--fp-bg, #0f1211);
  overflow: hidden;
}

.fp-box-dim__input input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--fp-text, #fff);
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.fp-box-dim__input input:focus {
  outline: none;
}

.fp-box-dim__unit {
  padding: 0 0.65rem;
  font-size: 0.75rem;
  color: var(--fp-text-muted, #9aa09c);
  border-right: 1px solid var(--fp-border, #3a3f3c);
}

.fp-box-select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--fp-border, #3a3f3c);
  background: var(--fp-bg, #0f1211);
  color: var(--fp-text, #fff);
  font-family: inherit;
  font-size: 0.88rem;
}

.fp-box-thickness {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fp-box-thickness input[type="range"] {
  flex: 1;
  accent-color: var(--fp-accent, #98be1c);
}

.fp-box-thickness output {
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 3.5rem;
  text-align: left;
}

.fp-box-segment {
  display: flex;
  gap: 0.25rem;
  padding: 3px;
  background: var(--fp-bg, #0f1211);
  border-radius: 8px;
  border: 1px solid var(--fp-border, #3a3f3c);
}

.fp-box-segment__btn {
  flex: 1;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.35rem;
  font-family: inherit;
  font-size: 0.72rem;
  background: transparent;
  color: var(--fp-text-muted, #9aa09c);
  cursor: pointer;
}

.fp-box-segment__btn.is-active {
  background: var(--fp-accent, #98be1c);
  color: #0f1211;
  font-weight: 700;
}

.fp-box-segment__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fp-box-dim-summary {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  font-size: 0.78rem;
}

.fp-box-dim-summary li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-dim-summary strong {
  color: var(--fp-text, #fff);
  font-weight: 600;
}

/* Center stage */

.fp-box-stage {
  display: flex;
  flex-direction: column;
  background: #e8eaec;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

[data-theme="dark"] .fp-box-stage {
  background: #373a39;
}

.fp-box-stage__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  background: #f4f5f6;
  border-bottom: 1px solid #d0d4d8;
  font-size: 0.72rem;
}

[data-theme="dark"] .fp-box-stage__legend {
  background: #2f3231;
  border-bottom-color: #454847;
}

[data-theme="dark"] .fp-box-legend,
[data-theme="dark"] .fp-box-debug-toggle {
  color: #c5c8c6;
}

.fp-box-debug-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: auto;
  color: #555;
  cursor: pointer;
  user-select: none;
}

.fp-box-debug-toggle input {
  accent-color: var(--fp-accent, #98be1c);
}

.fp-box-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #444;
}

.fp-box-legend::before {
  content: '';
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

.fp-box-legend--bleed::before {
  background: #22c55e;
}

.fp-box-legend--trim::before {
  background: #3b82f6;
}

.fp-box-legend--crease::before {
  background: transparent;
  border-top: 2px dashed #ef4444;
  height: 0;
}

.fp-box-stage__viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  position: relative;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

[data-theme="dark"] .fp-box-stage__viewport {
  background: #373a39;
}

.fp-box-stage__viewport.is-dragging {
  cursor: grabbing;
}

.fp-box-stage__canvas {
  transform-origin: center center;
  position: relative;
  padding: 0;
  margin: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.fp-box-stage__canvas svg {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  pointer-events: auto;
}

.fp-box-stage__empty {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.fp-box-stage__toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  background: #f4f5f6;
  border-top: 1px solid #d0d4d8;
}

[data-theme="dark"] .fp-box-stage__toolbar {
  background: #2f3231;
  border-top-color: #454847;
}

[data-theme="dark"] .fp-box-tool {
  background: #3d403f;
  border-color: #555957;
  color: #e8eae9;
}

[data-theme="dark"] .fp-box-tool:hover {
  background: #4a4e4d;
}

[data-theme="dark"] .fp-box-tool__sep {
  background: #555957;
}

[data-theme="dark"] .fp-box-tool__status {
  color: #b7bbb8;
}

.fp-box-tool {
  width: 32px;
  height: 32px;
  border: 1px solid #c8ccd0;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.fp-box-tool:hover {
  background: #eef0f2;
}

.fp-box-tool__sep {
  width: 1px;
  height: 20px;
  background: #c8ccd0;
  margin: 0 0.35rem;
}

.fp-box-tool__status {
  margin-right: auto;
  font-size: 0.75rem;
  color: #666;
}

/* Preview rail */

.fp-box-rail--preview {
  border-left: none;
  border-right: 1px solid var(--fp-border, #2a2f2c);
}

.fp-box-canvas {
  width: 100%;
  border-radius: 8px;
  background: #1a1d1c;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .fp-box-canvas {
  background: #e8eaec;
}

.fp-box-canvas--mini {
  height: 220px;
}

.fp-box-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border-radius: 8px;
  position: absolute;
  top: 0;
  left: 0;
}

.fp-box-fold-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
  font-size: 0.75rem;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-fold-row input[type="range"] {
  flex: 1;
  accent-color: var(--fp-accent, #98be1c);
}

.fp-box-format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.fp-box-format-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.fp-box-format {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.65rem 0.4rem;
  border: 1px solid var(--fp-border, #3a3f3c);
  border-radius: 10px;
  background: var(--fp-bg, #0f1211);
  color: var(--fp-text, #fff);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.fp-box-format:hover:not(:disabled) {
  border-color: var(--fp-accent, #98be1c);
}

.fp-box-format:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fp-box-format__icon {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--fp-accent, #98be1c);
}

.fp-box-format__label {
  font-size: 0.72rem;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-quota {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--fp-border, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  background: rgba(152, 190, 28, 0.06);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--fp-text, #fff);
}

.fp-box-quota--unlimited {
  border-color: rgba(152, 190, 28, 0.35);
  color: var(--fp-accent, #98be1c);
}

.fp-box-quota-warn {
  margin: -0.35rem 0 0.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(232, 168, 56, 0.45);
  border-radius: 8px;
  background: rgba(232, 168, 56, 0.1);
  font-size: 0.76rem;
  line-height: 1.5;
  color: #e8b84a;
}
.fp-box-quota-warn a {
  color: inherit;
  text-decoration: underline;
}

.fp-box-quota__remain {
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-quota-upgrade {
  margin: 0 0 0.85rem;
  padding: 0.75rem;
  border: 1px solid rgba(152, 190, 28, 0.35);
  border-radius: 10px;
  background: rgba(152, 190, 28, 0.08);
}

.fp-box-quota-upgrade p {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--fp-text, #fff);
}

.fp-box-error__link {
  display: inline-flex;
  margin-top: 0.55rem;
  color: var(--fp-accent, #98be1c);
  font-weight: 650;
  text-decoration: none;
}

.fp-box-error__link:hover {
  text-decoration: underline;
}

.fp-box-note {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-rail__section--next {
  padding-top: 0.25rem;
}

/* Shared */

.fp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.fp-btn--block {
  width: 100%;
}

.fp-btn--primary {
  background: var(--fp-accent, #98be1c);
  color: #0f1211;
}

.fp-btn--ghost {
  background: transparent;
  border-color: var(--fp-border, #3a3f3c);
  color: var(--fp-text, #fff);
}

.fp-btn:disabled,
.fp-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fp-box-error {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid #dc3545;
  color: #ffb3b3;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  margin: 0;
}

.fp-box-muted {
  color: var(--fp-text-muted, #9aa09c);
  font-size: 0.85rem;
  margin: 0;
}

/* Showcase cards */
.fp-box-card__desc {
  color: var(--fp-text-muted, #9aa09c);
  font-size: 0.88rem;
  margin: 0 0 0.5rem;
}

.fp-box-card__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  position: relative;
  overflow: hidden;
  background: #101413;
}

.fp-box-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
}

.fp-box-card:hover .fp-box-card__image {
  transform: scale(1.04);
}

.fp-box-card.is-inactive:hover .fp-box-card__image {
  transform: none;
}

.fp-box-icon {
  font-size: 3.5rem;
  opacity: 0.85;
}

.fp-box-style-badge {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  left: 0.65rem;
  background: var(--fp-accent, #98be1c);
  color: #0f1211;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.fp-box-soon-note {
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

.fp-box-file {
  width: 100%;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-upload-wrap {
  position: relative;
  margin-top: 0.55rem;
  border-radius: 8px;
  background: #0f1211;
  border: 1px solid var(--fp-border, #2a2f2c);
  overflow: hidden;
  max-height: 72px;
}

.fp-box-upload-thumb {
  display: block;
  width: 100%;
  height: 72px;
  max-height: 72px;
  object-fit: contain;
  object-position: center;
}

.fp-box-upload-clear {
  position: absolute;
  top: 4px;
  inset-inline-start: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(15, 18, 17, 0.82);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.fp-box-upload-clear:hover {
  background: rgba(220, 38, 38, 0.9);
}

.fp-box-upload-status {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--fp-text-muted, #9aa09c);
  min-height: 0;
}
.fp-box-upload-status.is-error {
  color: #e85d4c;
  font-weight: 600;
}

.fp-box-muted--compact {
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

/* Preview full page */
.fp-box-preview-page .fp-box-preview-layout {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 320px);
  gap: 0;
  min-height: calc(100vh - 52px);
}

.fp-box-preview-stage {
  position: relative;
  min-width: 0;
  min-height: calc(100vh - 52px);
  height: calc(100vh - 52px);
  background: #1a1d1c;
}

[data-theme="light"] .fp-box-preview-stage {
  background: #e8eaec;
}

.fp-box-canvas--full {
  min-height: 100%;
  height: 100%;
}

.fp-box-fold-bar {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(400px, calc(100% - 2.5rem));
  padding: 0.45rem 0.55rem 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 18, 17, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  color: #c8ccc8;
  font-size: 0.78rem;
  box-sizing: border-box;
}

.fp-box-fold-bar input[type="range"] {
  flex: 1;
  accent-color: var(--fp-accent, #98be1c);
  cursor: pointer;
}

.fp-box-fold-play {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(152, 190, 28, 0.18);
  color: var(--fp-accent, #98be1c);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.fp-box-fold-play:hover {
  background: rgba(152, 190, 28, 0.32);
}

.fp-box-fold-play[data-paused="1"] {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

[data-theme="light"] .fp-box-fold-bar {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 18, 17, 0.12);
  color: #5e6662;
}

[data-theme="light"] .fp-box-fold-play[data-paused="1"] {
  background: rgba(15, 18, 17, 0.08);
  color: #0f1211;
}

.fp-box-preview-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--fp-border, #2a2f2c);
  background: var(--fp-card, #141716);
  padding: 1rem;
  overflow-y: auto;
  min-height: 0;
}

.fp-box-preview-sidebar .fp-box-panel {
  background: var(--fp-card, #141716);
  border: 1px solid var(--fp-border, #2a2f2c);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.fp-box-preview-sidebar .fp-box-panel--upload {
  flex: 0 0 auto;
}

.fp-box-preview-sidebar .fp-box-panel--actions {
  margin-top: auto;
  margin-bottom: 0;
}

.fp-box-preview-sidebar .fp-box-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.fp-box-preview-sidebar .fp-box-panel--actions .fp-btn:last-child {
  margin-bottom: 0;
}

.fp-box-preview-sidebar .fp-btn {
  width: 100%;
  margin-bottom: 0.5rem;
}

.fp-box-fold-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--fp-text-muted, #9aa09c);
}

@media (max-width: 1100px) {
  .fp-box-lab .fp-box-workspace {
    grid-template-columns: 44px minmax(200px, 240px) minmax(0, 1fr) minmax(220px, 260px);
  }
}

@media (max-width: 900px) {
  .fp-box-lab .fp-box-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 55vh auto;
    height: auto;
    min-height: calc(100vh - 52px);
  }

  .fp-box-icon-rail {
    flex-direction: row;
    justify-content: center;
    border-left: none;
    border-bottom: 1px solid var(--fp-border, #2a2f2c);
  }

  .fp-box-stage {
    min-height: 55vh;
  }

  .fp-box-rail--preview {
    border-right: none;
  }
}

/* More settings (ECMA technical properties) */
.fp-box-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-check-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--fp-text, #fff);
  margin: 0.35rem 0;
  cursor: pointer;
}

.fp-box-more {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--fp-border, #252927);
}

.fp-box-more__hint {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--fp-text-muted, #9aa09c);
}

.fp-box-more__group {
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--fp-border, #2a2f2c);
  border-radius: 10px;
  background: var(--fp-bg, #0f1211);
}

.fp-box-more__group-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--fp-accent, #98be1c);
}

#btnMoreSettings.is-active {
  border-color: var(--fp-accent, #98be1c);
  color: var(--fp-accent, #98be1c);
}

.fp-nesting__btn-row {
  display: grid;
  gap: 0.45rem;
}
.fp-nesting__badge {
  display: inline-flex;
  align-self: start;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(152, 190, 28, 0.4);
  color: var(--fp-accent, #98be1c);
  background: rgba(152, 190, 28, 0.1);
}
#btnNesting.is-locked {
  opacity: 0.72;
}
.fp-nesting__result {
  margin-top: 0.7rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--fp-border, rgba(255,255,255,.08));
  border-radius: 10px;
  background: var(--fp-bg-elevated, #121614);
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--fp-text, #fff);
}
.fp-nesting__result strong { color: var(--fp-accent, #98be1c); }
.fp-nesting__mini-kicker {
  font-size: 0.68rem;
  color: var(--fp-accent, #98be1c);
  margin-bottom: 0.2rem;
}
.fp-nesting__mini-note {
  margin: 0.35rem 0 0;
  opacity: 0.8;
  font-size: 0.72rem;
  line-height: 1.55;
}
.fp-nesting__sheet {
  display: block;
  width: 100%;
  max-height: 160px;
  height: auto;
  margin-top: 0.55rem;
  border-radius: 6px;
  background: #0b0e0c;
}
.fp-nesting-opt .fp-nesting__sheet {
  max-height: 120px;
}
.fp-nesting-modal[hidden],
.fp-upgrade-modal[hidden] {
  display: none !important;
  pointer-events: none !important;
}
.fp-nesting-modal,
.fp-upgrade-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}
.fp-nesting-modal__backdrop,
.fp-upgrade-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}
.fp-nesting-modal__panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: 1.2rem 1.3rem 1.15rem;
  border-radius: 16px;
  border: 1px solid var(--fp-border, rgba(255,255,255,.12));
  background: var(--fp-card, #1a1f1d);
  color: var(--fp-text, #fff);
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
  direction: rtl;
  text-align: right;
}
.fp-nesting-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.fp-nesting-modal__head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.fp-nesting-modal__x {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.fp-nesting-modal__lead {
  margin: 0.45rem 0 1rem;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--fp-text-muted, #b7bbb8);
}
.fp-nesting-modal__grain {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.fp-nesting-modal__grain legend {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  padding: 0;
}
.fp-nesting-modal__qty > label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.fp-nesting-modal__hint {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--fp-text-muted, #b7bbb8);
}
#nestingGap {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--fp-border, rgba(255,255,255,.12));
  background: var(--fp-bg, #0f1211);
  color: inherit;
  margin-bottom: 0;
}
.fp-nesting-grain {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--fp-border, rgba(255,255,255,.12));
  background: var(--fp-bg, #0f1211);
  cursor: pointer;
}
.fp-nesting-grain:has(input:checked) {
  border-color: #98be1c;
  box-shadow: 0 0 0 1px rgba(152, 190, 28, 0.35);
}
.fp-nesting-grain input { margin-top: 0.2rem; }
.fp-nesting-grain span { display: grid; gap: 0.15rem; min-width: 0; }
.fp-nesting-grain small {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--fp-text-muted, #b7bbb8);
}
.fp-nesting-opt__grain {
  font-size: 0.68rem;
  font-weight: 700;
  color: #e8b84a;
  border: 1px solid rgba(232,184,74,.35);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
}
.fp-nesting-modal__qty-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.fp-nesting-modal__qty-row input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--fp-border, rgba(255,255,255,.12));
  background: var(--fp-bg, #0f1211);
  color: inherit;
  font: inherit;
}
.fp-nesting-modal__status {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--fp-text-muted, #b7bbb8);
}
.fp-nesting-modal__status.is-error { color: #fc8181; }
.fp-nesting-modal__list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}
.fp-nesting-opt {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--fp-border, rgba(255,255,255,.1));
  background: var(--fp-bg-elevated, #121614);
  cursor: pointer;
}
.fp-nesting-opt.is-recommended {
  border-color: rgba(152, 190, 28, 0.45);
}
.fp-nesting-opt:has(input:checked) {
  border-color: #98be1c;
  box-shadow: 0 0 0 1px rgba(152, 190, 28, 0.35);
}
.fp-nesting-opt input { margin-top: 0.25rem; }
.fp-nesting-opt__body { display: grid; gap: 0.25rem; min-width: 0; }
.fp-nesting-opt__top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
}
.fp-nesting-opt__waste {
  font-size: 0.75rem;
  font-weight: 700;
  color: #98be1c;
}
.fp-nesting-opt__waste.is-high {
  color: #e85d4c;
}
.fp-nesting-opt__tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--fp-accent, #98be1c);
  border: 1px solid rgba(152,190,28,.4);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
}
.fp-nesting-opt__meta,
.fp-nesting-opt__explain,
.fp-nesting-opt__note {
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--fp-text-muted, #b7bbb8);
}
.fp-nesting-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.fp-upgrade-modal[hidden] {
  display: none !important;
  pointer-events: none !important;
}
.fp-upgrade-modal__panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100% - 2rem));
  padding: 1.25rem 1.35rem 1.15rem;
  border-radius: 16px;
  border: 1px solid var(--fp-border, rgba(255,255,255,.12));
  background: var(--fp-card, #1a1f1d);
  color: var(--fp-text, #fff);
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  direction: rtl;
  text-align: right;
}
.fp-upgrade-modal__panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}
.fp-upgrade-modal__panel p {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--fp-text-muted, #b7bbb8);
}
.fp-upgrade-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
