/* ==========================================================================
   Builder chrome. Everything in this file is screen-only; @media print
   removes it entirely so the export is nothing but the nine pages.
   ========================================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Ping AR + LT", system-ui, sans-serif;
  background: #eef1f8;
  color: var(--color-text-primary);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-rows: 58px 1fr;
  grid-template-columns: 176px 316px 1fr;
  grid-template-areas: "bar bar bar" "rail fields stage";
  height: 100vh;
}

/* ------------------------------------------------------------------- bar */

.bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--color-brand-600);
  color: #fff;
  position: relative;
  overflow: hidden;
  z-index: 5;
}

.bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at 85% -55%, rgba(74, 114, 187, 0.2), transparent 62%);
}

.bar > * {
  position: relative;
  z-index: 1;
}

.bar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14.5px;
  font-weight: 500;
}

.bar .brand img {
  height: 24px;
  width: auto;
  aspect-ratio: 95.9184 / 36.348;
  object-fit: contain;
  flex: none;
}

.bar .brand span {
  color: rgba(255, 255, 255, 0.62);
  border-inline-start: 1px solid rgba(255, 255, 255, 0.2);
  padding-inline-start: 12px;
}

.bar .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn--primary {
  background: #fff;
  color: var(--color-brand-500);
  border-color: #fff;
}

.btn--primary:hover {
  background: rgba(255, 255, 255, 0.9);
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn svg [stroke] {
  stroke: currentColor;
}

/* --------------------------------------------------------------- rail nav */

.rail {
  grid-area: rail;
  background: var(--color-brand-25);
  border-inline-end: 1px solid var(--color-gray-200);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 10px;
  min-height: 0;
  overflow-y: auto;
}

.rail-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--color-slate-500);
  padding: 12px 6px;
  border-radius: 13px;
  cursor: pointer;
  text-align: center;
  transition: background 0.14s ease, color 0.14s ease;
}

.rail-tab span:last-child {
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
}

.rail-tab .ic {
  width: 22px;
  height: 22px;
  display: block;
}

.rail-tab .ic svg {
  width: 100%;
  height: 100%;
}

.rail-tab .ic svg [stroke] {
  stroke: currentColor;
}

.rail-tab:hover {
  background: #fff;
  color: var(--color-brand-500);
}

.rail-tab[aria-selected="true"] {
  background: var(--color-brand-500);
  color: #fff;
  box-shadow: 0 6px 16px rgba(10, 28, 109, 0.22);
}

/* ------------------------------------------------------------ fields panel */

.fields {
  grid-area: fields;
  background: #fff;
  border-inline-end: 1px solid var(--color-gray-200);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: -8px 0 26px rgba(10, 28, 109, 0.05);
}

.panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.panel::-webkit-scrollbar {
  width: 10px;
}

.panel::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 99px;
  border: 3px solid #fff;
}

.group {
  border: 1px solid var(--color-gray-200);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--color-gray-25);
}

.group > h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-brand-500);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field {
  margin-bottom: 11px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > label {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-slate-500);
  margin-bottom: 5px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--color-text-primary);
  background: #fff;
  border: 1px solid var(--color-gray-300);
  border-radius: 9px;
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

textarea {
  resize: vertical;
  min-height: 62px;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-brand-500);
  box-shadow: 0 0 0 3px rgba(10, 28, 109, 0.09);
}

input.ltr,
select.ltr {
  direction: ltr;
  text-align: start;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mini {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-logo-blue-500);
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 7px;
}

.mini:hover {
  background: var(--color-brand-25);
}

.mini--danger {
  color: #ef4444;
}

.mini--danger:hover {
  background: #fef2f2;
}

.sub {
  border: 1px solid var(--color-gray-200);
  border-radius: 11px;
  padding: 11px;
  margin-bottom: 9px;
  background: #fff;
}

.sub > .sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-slate-500);
}

.toggle-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
}

.toggle-list label:hover {
  background: var(--color-brand-25);
}

.toggle-list input {
  accent-color: var(--color-brand-500);
  width: 15px;
  height: 15px;
}

.hint {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--color-slate-500);
  background: var(--color-brand-25);
  border: 1px solid rgba(10, 28, 109, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.hint b {
  color: var(--color-brand-500);
}

.rep-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--color-gray-200);
  border-radius: 11px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #fff;
}

.rep-pick:hover {
  border-color: var(--color-brand-300);
}

.rep-pick[data-active="true"] {
  border-color: var(--color-brand-500);
  box-shadow: 0 0 0 3px rgba(10, 28, 109, 0.08);
}

.rep-pick .av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-brand-500);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  direction: ltr;
}

.rep-pick .nm {
  font-size: 13px;
  font-weight: 500;
  direction: ltr;
  text-align: start;
}

.rep-pick .em {
  font-size: 11px;
  color: var(--color-slate-500);
  direction: ltr;
  text-align: start;
}

/* ----------------------------------------------------------------- stage */

.stage {
  grid-area: stage;
  overflow: auto;
  padding: 26px 0 40px;
  background:
    radial-gradient(700px circle at 70% -10%, rgba(74, 114, 187, 0.12), transparent 60%),
    radial-gradient(700px circle at 10% 10%, rgba(159, 181, 220, 0.12), transparent 60%),
    #eef1f8;
}

.stage-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.sheet {
  position: relative;
  box-shadow: 0 18px 50px rgba(10, 28, 109, 0.16);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  flex: none;
}

.sheet .page {
  transform-origin: top right;
}

.sheet-label {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 20;
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(10, 28, 109, 0.5);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(10, 28, 109, 0.1);
  border-radius: 999px;
  padding: 3px 9px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.toast {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 50%;
  transform: translateX(50%) translateY(14px);
  background: var(--color-brand-600);
  color: #fff;
  font-size: 13px;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(10, 28, 109, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast[data-on="true"] {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

/* ------------------------------------------------------------ print mode */

@media print {
  body {
    overflow: visible;
    background: #fff;
  }

  .app {
    display: block;
    height: auto;
  }

  .bar,
  .rail,
  .fields,
  .toast,
  .sheet-label {
    display: none !important;
  }

  .stage {
    overflow: visible;
    padding: 0;
    background: none;
  }

  .stage-inner {
    display: block;
    gap: 0;
  }

  .sheet {
    box-shadow: none;
    border-radius: 0;
    width: auto !important;
    height: auto !important;
  }

  .sheet .page {
    transform: none !important;
  }
}
