/* Salary slip template — GrapesJS layout, visible blocks column, high-contrast UI */

.salary-slip-template-overlay-root.team-field-rule-overlay {
  z-index: 12000;
}

.salary-slip-template-dialog.team-field-rule-dialog {
  max-width: min(1280px, 98vw);
  width: 100%;
  max-height: 96vh;
}

.salary-slip-template-body.team-field-rule-body {
  padding-top: 12px;
}

/* Lead text: slightly larger for readability */
.salary-slip-lead-visible {
  font-size: 14px;
  line-height: 1.55;
  color: #334155;
}

.salary-slip-lead-visible strong {
  color: #0f172a;
}

/* Editor: blocks column + Grapes host */
.salary-slip-editor-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-height: 560px;
  max-height: min(64vh, 720px);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  background: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.salary-slip-blocks-aside {
  flex: 0 0 240px;
  width: 240px;
  max-width: 28%;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-right: 2px solid #cbd5e1;
  z-index: 2;
}

.salary-slip-aside-head {
  flex-shrink: 0;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.salary-slip-aside-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.salary-slip-aside-hint {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  margin-top: 4px;
}

/* GrapesJS injects blocks here — tall scroll list */
.salary-slip-blocks-mount {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 8px 14px;
  -webkit-overflow-scrolling: touch;
}

/* Block thumbnails — larger, clearer */
.salary-slip-blocks-mount .gjs-blocks-c {
  padding: 4px 2px 12px !important;
}

.salary-slip-blocks-mount .gjs-block-category .gjs-title {
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  color: #475569 !important;
  background: #e2e8f0 !important;
  padding: 8px 10px !important;
  border-radius: 6px !important;
  margin: 12px 4px 8px !important;
}

.salary-slip-blocks-mount .gjs-block {
  min-height: 76px !important;
  width: calc(100% - 8px) !important;
  margin: 4px !important;
  padding: 10px 8px 8px !important;
  border-radius: 10px !important;
  border: 2px solid #e2e8f0 !important;
  background: #fff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.salary-slip-blocks-mount .gjs-block:hover {
  border-color: rgba(237, 32, 71, 0.45) !important;
  box-shadow: 0 2px 8px rgba(237, 32, 71, 0.12) !important;
}

.salary-slip-blocks-mount .gjs-block-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  line-height: 1.25 !important;
}

.salary-slip-blocks-mount .gjs-block__media {
  margin-bottom: 6px !important;
}

.salary-slip-blocks-mount .gjs-block__media svg,
.salary-slip-blocks-mount .gjs-block__media i {
  font-size: 22px !important;
  opacity: 0.95;
}

/* Grapes root — canvas + right panels */
.salary-slip-gjs-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #cbd5e1;
  /* Let GrapesJS handle canvas scrolling; outer overflow:auto caused nested scrollbars/jank */
  overflow: hidden;
}

.salary-slip-gjs#gjs,
.salary-slip-gjs.grapesjs-editor {
  min-height: 520px;
}

/* Right toolbar icons — bigger touch targets */
.salary-slip-gjs-wrap .gjs-pn-panel .gjs-pn-buttons {
  gap: 2px;
}

.salary-slip-gjs-wrap .gjs-pn-btn {
  min-width: 42px !important;
  min-height: 42px !important;
  padding: 8px !important;
  border-radius: 8px !important;
}

.salary-slip-gjs-wrap .gjs-pn-btn.gjs-pn-active {
  background: rgba(237, 32, 71, 0.18) !important;
  box-shadow: inset 0 0 0 2px rgba(237, 32, 71, 0.35);
}

/* Layers / style panel copy */
.salary-slip-gjs-wrap .gjs-sm-sector .gjs-sm-title,
.salary-slip-gjs-wrap .gjs-layer-title {
  font-size: 13px !important;
  font-weight: 600 !important;
}

.salary-slip-gjs-wrap .gjs-field input,
.salary-slip-gjs-wrap .gjs-field select {
  font-size: 13px !important;
}

/* Canvas iframe area slightly inset */
.salary-slip-gjs-wrap .gjs-cv-canvas {
  background: #94a3b8;
}

.salary-slip-gjs-wrap .gjs-frame-wrapper {
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
}

/* Puck editor mount — full width when classic blocks column is hidden */
.salary-slip-puck-host {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 560px;
  overflow: hidden;
  background: #f1f5f9;
}

.salary-slip-puck-host > * {
  min-height: 560px;
}

/* Inline SlipCraft: use internal panel scrollers, not outer host scroll */
#salarySlipInlineBuilderRoot,
#salarySlipInlineBuilderRoot #app {
  height: 100%;
  min-height: 560px;
}

#salarySlipInlineBuilderRoot {
  position: relative;
}

#salarySlipInlineBuilderRoot #topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

#salarySlipInlineBuilderRoot #left-panel,
#salarySlipInlineBuilderRoot #right-panel,
#salarySlipInlineBuilderRoot #canvas-wrap {
  overflow: auto !important;
}

#salarySlipInlineBuilderRoot #canvas-wrap {
  padding-bottom: 88px !important; /* keep canvas visible above zoom bar */
}

#salarySlipInlineBuilderRoot #zoom-bar {
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  bottom: 12px !important;
  z-index: 30 !important;
}

#salarySlipInlineBuilderRoot #left-panel::-webkit-scrollbar,
#salarySlipInlineBuilderRoot #right-panel::-webkit-scrollbar,
#salarySlipInlineBuilderRoot #canvas-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#salarySlipInlineBuilderRoot #left-panel::-webkit-scrollbar-thumb,
#salarySlipInlineBuilderRoot #right-panel::-webkit-scrollbar-thumb,
#salarySlipInlineBuilderRoot #canvas-wrap::-webkit-scrollbar-thumb {
  background: #0f3460;
  border-radius: 5px;
}

.salary-slip-simple-root {
  padding: 14px;
  background: #f8fafc;
  min-height: 560px;
  overflow: auto;
}

.salary-slip-simple-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.salary-slip-simple-col {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
}

.salary-slip-simple-col-wide {
  grid-column: 1 / -1;
}

.salary-slip-simple-col h4 {
  font-size: 13px;
  margin: 0 0 8px;
  color: #0f172a;
}

.salary-slip-simple-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 12px;
  color: #334155;
}

.salary-slip-simple-note {
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
}

.salary-slip-simple-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.salary-slip-simple-form input,
.salary-slip-simple-form select {
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
}

.salary-slip-simple-form input {
  flex: 1;
}

.salary-slip-simple-form button {
  height: 30px;
  border: 1px solid #ed2047;
  background: #ed2047;
  color: #fff;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
  cursor: pointer;
}

.salary-slip-simple-custom-list {
  max-height: 160px;
  overflow: auto;
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px;
}

.salary-slip-simple-custom-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
}

.salary-slip-simple-custom-item button {
  border: 1px solid #fca5a5;
  background: #fff1f2;
  color: #b91c1c;
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
}

.salary-slip-fixed {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
}

.salary-slip-fixed-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.salary-slip-fixed .muted {
  font-size: 12px;
  color: #64748b;
}

.salary-slip-fixed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.salary-slip-fixed-grid h4 {
  margin: 0;
  background: #ff6b4a;
  color: #111827;
  font-size: 14px;
  padding: 6px 8px;
}

.salary-slip-fixed-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.salary-slip-fixed-grid td {
  border-bottom: 1px solid #e2e8f0;
  padding: 5px 4px;
}

.salary-slip-fixed-net {
  margin-top: 12px;
  background: #ff5b3d;
  color: #111827;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
}

.salary-slip-template-preview-hint {
  font-size: 13px;
  color: #475569;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}

.salary-slip-template-preview-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #ececec;
}

.salary-slip-template-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.salary-slip-template-preview-heading span {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.salary-slip-template-print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
}

.salary-slip-template-print-btn:hover {
  background: #cbd5e1;
}

.salary-slip-template-preview-inner {
  font-size: 14px;
  line-height: 1.55;
  color: #1e293b;
  word-wrap: break-word;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  min-height: 100px;
  max-height: 260px;
  overflow: auto;
}

.salary-slip-template-preview-inner img,
.salary-slip-template-preview-inner video,
.salary-slip-template-preview-inner iframe {
  max-width: 100%;
  height: auto;
}

.salary-slip-preview-placeholder {
  color: #94a3b8;
  font-style: italic;
}

/* Quick insert chips row — slightly louder */
#salarySlipTemplateAtPickers.team-field-at-chips .team-field-at-chip {
  font-size: 12px !important;
  padding: 7px 11px !important;
  font-weight: 600 !important;
}

@media (max-width: 900px) {
  .salary-slip-editor-layout {
    flex-direction: column;
    max-height: none;
  }

  .salary-slip-blocks-aside {
    flex: none;
    width: 100%;
    max-width: none;
    max-height: 220px;
    border-right: 0;
    border-bottom: 2px solid #cbd5e1;
  }
}
