.die-layout-page { padding-bottom: 32px; }
.die-layout-shell { display: grid; gap: 16px; }
.die-layout-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 24px; border: 1px solid var(--jl-color-border-default, #dce3eb); border-radius: var(--jl-radius-xl, 18px);
  background: linear-gradient(135deg, #fff 0%, #f4f8fc 65%, #eef6ff 100%);
  box-shadow: var(--jl-shadow-card, 0 8px 24px rgba(24, 34, 48, .06));
}
.die-layout-hero-copy { display: grid; gap: 6px; }
.die-layout-kicker { color: var(--jl-color-bg-brand, #0071e3); font-weight: 800; font-size: 13px; letter-spacing: .06em; }
.die-layout-hero h2 { margin: 0; color: var(--jl-color-text-primary, #182230); font-size: clamp(24px, 2vw, 34px); }
.die-layout-hero p { margin: 0; color: var(--jl-color-text-secondary, #667085); line-height: 1.65; }
.die-layout-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.die-layout-badges span {
  padding: 8px 12px; border: 1px solid #cae0f4; border-radius: 999px;
  color: #225f93; background: rgba(255,255,255,.82); font-size: 13px; font-weight: 750; white-space: nowrap;
}
.die-tool-tabs {
  width: fit-content; max-width: 100%; display: flex; gap: 6px; padding: 5px;
  border: 1px solid #d8e2ec; border-radius: 14px; background: #edf2f7;
}
.die-tool-tabs button {
  min-height: 42px; padding: 9px 16px; border: 0; border-radius: 10px;
  color: #627083; background: transparent; font: inherit; font-weight: 800; cursor: pointer;
}
.die-tool-tabs button.is-active { color: #fff; background: #162333; box-shadow: 0 7px 14px rgba(22,35,51,.16); }
.die-layout-grid { display: grid; grid-template-columns: minmax(330px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.die-layout-grid[hidden] { display: none !important; }
.die-layout-panel { border: 1px solid var(--jl-color-border-default, #dce3eb); border-radius: var(--jl-radius-xl, 18px); background: var(--jl-color-bg-surface, #fff); box-shadow: var(--jl-shadow-card, 0 8px 24px rgba(24,34,48,.06)); }
.die-layout-controls { padding: 20px; display: grid; gap: 18px; position: sticky; top: 92px; }
.die-layout-section { display: grid; gap: 11px; }
.die-layout-section + .die-layout-section { border-top: 1px solid #edf1f5; padding-top: 17px; }
.die-layout-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.die-layout-section-head strong { color: #1d2a3a; font-size: 16px; }
.die-layout-section-head span { color: #8490a0; font-size: 12px; }
.die-field { display: grid; gap: 6px; }
.die-field label { color: #536275; font-size: 13px; font-weight: 750; }
.die-field input, .die-field select {
  width: 100%; min-width: 0; height: var(--jl-control-height-default, 44px); padding: 0 12px; border: 1px solid var(--jl-color-border-default, #dce3eb);
  border-radius: var(--jl-radius-md, 10px); color: var(--jl-color-text-primary, #182230); background: var(--jl-color-bg-subtle, #fbfcfe); font: inherit;
}
.die-field input:focus, .die-field select:focus { outline: 0; border-color: var(--jl-color-focus, #0071e3); box-shadow: var(--jl-focus-ring, 0 0 0 4px rgba(0,113,227,.14)); }
.die-field small { color: #8995a5; font-size: 11px; line-height: 1.4; }
.die-field-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.die-box-selector {
  width: 100%; min-height: 116px; padding: 11px; display: grid; grid-template-columns: 104px minmax(0,1fr) auto;
  align-items: center; gap: 12px; text-align: left; border: 1px solid #cbd9e7; border-radius: 14px;
  color: #1d2a3a; background: linear-gradient(135deg,#fff,#f5f9fd); cursor: pointer;
}
.die-box-selector:hover { border-color: #67a9e3; box-shadow: 0 8px 20px rgba(30,88,138,.11); }
.die-box-selector:focus-visible { outline: 0; border-color: #0071e3; box-shadow: 0 0 0 4px rgba(0,113,227,.14); }
.die-box-selector-preview {
  min-height: 88px; display: grid; place-items: center; overflow: visible; border: 1px solid #e0e7ee;
  border-radius: 10px; background: #fff;
}
.die-box-selector-preview svg { width: 100%; height: 82px; display: block; overflow: visible; object-fit: contain; contain: layout style; }
.die-box-selector-copy { min-width: 0; display: grid; gap: 4px; }
.die-box-selector-copy small { color: #64768a; font-size: 11px; font-weight: 700; }
.die-box-selector-copy strong { color: #152334; font-size: 15px; line-height: 1.35; }
.die-box-selector-copy em { color: #1f75bf; font-size: 11px; font-style: normal; font-weight: 800; letter-spacing: .04em; }
.die-box-selector-action { align-self: end; color: #1771bd; font-size: 12px; font-weight: 850; white-space: nowrap; }
.die-box-description { display: block; margin-top: -3px; color: #718094; font-size: 12px; line-height: 1.55; }
.die-box-catalog-modal[hidden] { display: none !important; }
body.die-box-catalog-open { overflow: hidden; }
.die-box-catalog-modal {
  position: fixed; inset: 0; z-index: 10080; width: 100vw; height: 100dvh;
  display: flex; align-items: center; justify-content: center; padding: 28px;
  overflow: hidden; overscroll-behavior: contain;
  background: rgba(12,22,34,.56); backdrop-filter: blur(4px);
}
.die-box-catalog-dialog {
  width: min(1460px, 96vw); height: min(880px, calc(100dvh - 56px)); min-height: 0;
  max-height: calc(100dvh - 56px); display: grid; grid-template-rows: auto minmax(0,1fr) auto;
  overflow: hidden; border: 1px solid #d5dee8; border-radius: 19px; background: #fff;
  box-shadow: 0 28px 70px rgba(8,20,34,.3);
}
.die-box-catalog-head {
  min-height: 80px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  border-bottom: 1px solid #e3e8ee; background: #fff;
}
.die-box-catalog-head > div { display: grid; gap: 5px; }
.die-box-catalog-head strong { color: #142234; font-size: 24px; }
.die-box-catalog-head span { color: #748295; font-size: 12px; }
.die-box-catalog-head button {
  width: 42px; height: 42px; border: 1px solid #d9e1e9; border-radius: 50%; color: #526174; background: #fff;
  font-size: 28px; line-height: 1; cursor: pointer;
}
.die-box-catalog-body {
  min-height: 0; display: grid; grid-template-columns: 180px 240px minmax(0,1fr); overflow: hidden;
}
.die-box-main-categories, .die-box-subcategories {
  min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
  touch-action: pan-y; display: grid; align-content: start; border-right: 1px solid #e3e8ee; background: #fafbfd;
}
.die-box-subcategories { background: #fff; }
.die-box-main-categories button, .die-box-subcategories button {
  min-height: 68px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 9px;
  text-align: left; border: 0; border-bottom: 1px solid #eef2f6; color: #57677a; background: transparent;
  font: inherit; font-weight: 800; cursor: pointer;
}
.die-box-main-categories button span, .die-box-subcategories button span { color: #8a96a5; font-size: 12px; font-weight: 700; }
.die-box-main-categories button.is-active {
  color: #172535; background: #fff; box-shadow: inset 4px 0 #f0bd19;
}
.die-box-subcategories button.is-active { color: #182638; background: #fff2a8; }
.die-box-template-area { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); background: #f7f9fb; }
.die-box-template-toolbar {
  min-height: 68px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid #e3e8ee; background: #fff;
}
.die-box-template-toolbar > div { display: flex; align-items: baseline; gap: 8px; }
.die-box-template-toolbar strong { color: #182638; font-size: 17px; }
.die-box-template-toolbar span { color: #8390a0; font-size: 12px; }
.die-box-template-toolbar label { display: flex; align-items: center; gap: 7px; }
.die-box-template-toolbar input {
  width: min(260px, 28vw); height: 38px; padding: 0 11px; border: 1px solid #d6dfe8; border-radius: 9px; font: inherit;
}
.die-box-template-grid {
  min-height: 0; padding: 18px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable; touch-action: pan-y; display: grid; grid-template-columns: repeat(3,minmax(190px,1fr));
  align-content: start; gap: 14px;
}
.die-box-template-card {
  min-width: 0; padding: 0; overflow: visible; display: grid; grid-template-rows: 205px auto; text-align: left;
  border: 1px solid #d8e0e8; border-radius: 13px; color: #1d2a3a; background: #fff; cursor: pointer;
}
.die-box-template-card:hover { border-color: #62a2da; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(25,65,103,.11); }
.die-box-template-card.is-active { border-color: #1680d7; box-shadow: inset 0 0 0 2px #1680d7; }
.die-box-template-card-preview {
  min-width: 0; display: grid; place-items: center; padding: 9px; overflow: visible; border-bottom: 1px solid #e5eaf0; background: #fafbfc;
}
.die-box-template-card-preview svg { width: 100%; height: 188px; display: block; overflow: visible; object-fit: contain; contain: layout style; }
.die-box-template-card-copy { min-width: 0; padding: 12px 13px 13px; display: grid; gap: 5px; }
.die-box-template-card-copy strong { color: #182638; line-height: 1.4; }
.die-box-template-card-copy span { color: #3677af; font-size: 11px; font-weight: 850; }
.die-box-template-state {
  width: max-content; max-width: 100%; padding: 4px 8px; border-radius: 999px;
  font-size: 11px; line-height: 1.25; font-style: normal; font-weight: 850;
}
.die-box-template-state.is-verified { color: #087643; background: #e8f8ef; }
.die-box-template-state.is-pending { color: #925b00; background: #fff1cc; }
.die-box-template-card.is-pending .die-box-template-card-preview { background: #fffdf7; }
.die-box-template-card-copy small { color: #778597; line-height: 1.45; }
.die-box-template-empty { grid-column: 1/-1; padding: 54px 20px; text-align: center; color: #728095; }
.die-box-catalog-foot {
  min-height: 66px; padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-top: 1px solid #e3e8ee; background: #fff;
}
.die-box-catalog-foot span { color: #84601d; font-size: 12px; line-height: 1.5; }
.die-box-catalog-foot button {
  min-width: 96px; height: 40px; border: 1px solid #cfd9e3; border-radius: 10px; color: #315a7d; background: #fff; font-weight: 800; cursor: pointer;
}
.die-upload-zone {
  width: 100%; min-height: 150px; padding: 22px 16px; display: grid; place-items: center; align-content: center; gap: 7px;
  border: 2px dashed #b9cce0; border-radius: 15px; color: #2b669c; background: #f8fbfe; cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.die-upload-zone:hover, .die-upload-zone.is-dragging { border-color: #2984d3; background: #eef7ff; transform: translateY(-1px); }
.die-upload-zone.is-reading { cursor: wait; opacity: .72; }
.die-upload-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #176fc0; font-size: 27px; line-height: 1; }
.die-upload-zone strong { color: #1d2a3a; font-size: 15px; }
.die-upload-zone em { max-width: 290px; color: #718094; font-size: 12px; line-height: 1.5; font-style: normal; }
.die-file-info { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #cce0f3; border-radius: 12px; background: #f2f8fe; min-width: 0; }
.die-file-info[hidden], .die-file-clear[hidden] { display: none; }
.die-file-info > div { min-width: 0; display: grid; gap: 3px; }
.die-file-info strong, .die-file-info em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.die-file-info strong { color: #1d2a3a; font-size: 13px; }
.die-file-info em { color: #637286; font-size: 11px; font-style: normal; }
.die-file-kind { flex: 0 0 auto; padding: 5px 7px; border-radius: 7px; color: #fff; background: #176fc0; font-size: 10px; font-weight: 850; }
.die-file-clear { justify-self: start; border: 0; padding: 2px 0; color: #b33a32; background: transparent; font-weight: 750; cursor: pointer; }
.die-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.die-field-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.die-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.die-actions button, .die-export-actions button {
  min-height: 44px; border: 1px solid #cbd9e7; border-radius: 11px; padding: 9px 13px;
  background: #fff; color: #1d63a3; font-weight: 800; cursor: pointer;
}
.die-actions .primary { border-color: #162333; color: #fff; background: #162333; }
.die-actions button:hover, .die-export-actions button:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(39,69,99,.1); }
.die-demo-note { padding: 11px 12px; border-radius: 11px; color: #85560d; background: #fff8e9; border: 1px solid #f3d39c; font-size: 12px; line-height: 1.55; }
.die-layout-results { display: grid; gap: 16px; min-width: 0; }
.die-candidate-panel { padding: 18px; display: grid; gap: 13px; }
.die-candidate-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.die-candidate {
  min-width: 0; padding: 13px; display: grid; gap: 5px; text-align: left; border: 1px solid #dce5ee;
  border-radius: 13px; color: #48586b; background: #fafbfd; cursor: pointer;
}
.die-candidate span { color: #3379b9; font-size: 12px; font-weight: 800; }
.die-candidate strong { color: #1d2a39; font-size: 15px; }
.die-candidate em { font-style: normal; font-size: 12px; line-height: 1.5; }
.die-candidate.is-active { border-color: #57a2e2; background: #eef7ff; box-shadow: inset 0 0 0 1px #8bc1ee; }
.die-metrics { display: grid; grid-template-columns: repeat(6, minmax(100px,1fr)); gap: 9px; }
.die-metrics div { padding: 12px; display: grid; gap: 5px; border: 1px solid #e2e9f0; border-radius: 12px; background: #fbfcfd; }
.die-metrics span { color: #718094; font-size: 12px; }
.die-metrics strong { color: #162333; font-size: 18px; }
.die-preview-panel { padding: 18px; display: grid; gap: 14px; }
.die-preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.die-preview-toolbar div { display: grid; gap: 3px; }
.die-preview-toolbar strong { color: #1d2a39; }
.die-preview-toolbar span { color: #748294; font-size: 12px; }
.die-line-legend { display: flex !important; grid-auto-flow: column; gap: 10px !important; }
.die-line-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.die-line-legend span::before { content: ""; width: 24px; border-top: 2px solid currentColor; }
.die-line-legend .cut { color: #111827; }
.die-line-legend .fold { color: #dc2626; }
.die-line-legend .fold::before { border-top-style: dashed; }
.die-line-legend .bleed { color: #3659d9; }
.die-line-legend .bleed::before { border-top-style: dashed; }
.die-layout-preview {
  min-height: 430px; display: grid; place-items: center; padding: 18px; overflow: auto;
  border: 1px solid #dce5ee; border-radius: 14px; background: repeating-linear-gradient(45deg,#f8fafc,#f8fafc 12px,#f3f6f9 12px,#f3f6f9 24px);
}
.die-layout-preview svg { display: block; max-width: 100%; max-height: 600px; width: 100%; height: 100%; overflow: visible; object-fit: contain; contain: layout style; filter: drop-shadow(0 8px 18px rgba(38,56,76,.12)); }
.die-box-preview { min-height: 540px; }
.die-box-preview svg { max-height: 720px; }
.die-empty { display: grid; gap: 7px; text-align: center; color: #728095; }
.die-empty strong { color: #2d3a4a; font-size: 18px; }
.die-export-panel { padding: 18px; display: grid; gap: 12px; }
.die-export-actions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.die-export-actions.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.die-status { min-height: 20px; color: #607084; font-size: 13px; }
.die-status[data-kind="ok"] { color: #15854b; }
.die-status[data-kind="error"] { color: #c12e2e; }
.die-warnings { margin: 0; padding: 12px 14px 12px 32px; border: 1px solid #f0d2a0; border-radius: 12px; color: #865415; background: #fff9ef; line-height: 1.6; font-size: 13px; }
.die-warnings:empty { display: none; }

@media (max-width: 1180px) {
  .die-layout-grid { grid-template-columns: 1fr; }
  .die-layout-controls { position: static; }
  .die-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .die-box-catalog-body { grid-template-columns: 145px 205px minmax(0,1fr); }
  .die-box-template-grid { grid-template-columns: repeat(2,minmax(180px,1fr)); }
}
@media (max-width: 760px) {
  .die-layout-hero { align-items: flex-start; flex-direction: column; padding: 18px; }
  .die-layout-badges { justify-content: flex-start; }
  .die-tool-tabs { width: 100%; display: grid; grid-template-columns: 1fr; }
  .die-field-grid.four, .die-field-grid.three { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .die-candidate-list, .die-actions { grid-template-columns: 1fr; }
  .die-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .die-export-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .die-export-actions.three { grid-template-columns: 1fr; }
  .die-preview-toolbar { align-items: flex-start; flex-direction: column; }
  .die-layout-preview { min-height: 300px; padding: 10px; }
  .die-box-selector { grid-template-columns: 88px minmax(0,1fr); }
  .die-box-selector-action { display: none; }
  .die-box-catalog-modal { padding: 0; }
  .die-box-catalog-dialog { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .die-box-catalog-body { min-height: 0; grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0,1fr); }
  .die-box-main-categories, .die-box-subcategories { grid-auto-flow: column; grid-auto-columns: minmax(112px,1fr); overflow-x: auto; border-right: 0; border-bottom: 1px solid #e3e8ee; }
  .die-box-main-categories button, .die-box-subcategories button { min-height: 48px; padding: 10px 12px; border-bottom: 0; border-right: 1px solid #eef2f6; }
  .die-box-main-categories button.is-active { box-shadow: inset 0 -4px #f0bd19; }
  .die-box-template-toolbar { align-items: flex-start; flex-direction: column; }
  .die-box-template-toolbar label, .die-box-template-toolbar input { width: 100%; }
  .die-box-template-grid { grid-template-columns: 1fr; padding: 12px; }
  .die-box-catalog-foot span { display: none; }
}
