.mg-offers-page { background: #f4f6f8; color: #17212b; }
.mg-offers-shell { min-height: 100vh; }
.mg-offers-topbar { position: sticky; z-index: 5; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 12px 24px; background: #fff; border-bottom: 1px solid #dbe1e7; box-shadow: 0 2px 8px #17212b0a; }
.mg-offers-back { color: #43515e; text-decoration: none; font-weight: 650; }
.mg-offers-brand { display: flex; align-items: center; gap: 10px; }
.mg-offers-brand img { width: 36px; height: 36px; }
.mg-offers-brand strong, .mg-offers-brand span { display: block; }
.mg-offers-brand span { color: #6d7783; font-size: 12px; margin-top: 2px; }
.mg-offers-actions { display: flex; justify-content: flex-end; gap: 9px; }
.mg-offers-main { max-width: 1560px; margin: 0 auto; padding: 22px; }
.mg-offer-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); align-items: start; gap: 18px; }
.mg-offer-list-panel { position: sticky; top: 82px; max-height: calc(100vh - 104px); overflow: auto; }
.mg-offer-group { margin-top: 14px; }
.mg-offer-group-heading { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; color: #465361; font-size: 13px; }
.mg-offer-group-heading span { display: inline-grid; min-width: 21px; height: 21px; place-items: center; border-radius: 20px; background: #edf0f3; color: #54616d; font-size: 11px; }
.mg-offer-list { display: grid; gap: 8px; }
.mg-offer-list-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px 9px 8px 12px; border: 1px solid #dce2e8; border-radius: 10px; background: #fff; color: inherit; }
.mg-offer-list-item:hover, .mg-offer-list-item.is-active { border-color: #c8102e; box-shadow: 0 0 0 2px #c8102e14; }
.mg-offer-list-open { display: grid; gap: 4px; min-width: 0; padding: 3px 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.mg-offer-list-open strong { font-size: 14px; }
.mg-offer-list-open > span:not(.mg-offer-status), .mg-offer-list-open small { color: #65717d; font-size: 12px; }
.mg-offer-delete { padding: 6px 8px; border: 1px solid #e4c4ca; border-radius: 7px; background: #fff; color: #a20e27; font: inherit; font-size: 11px; cursor: pointer; }
.mg-offer-delete:hover { background: #fff0f2; }
.mg-offer-list-actions { display: grid; gap: 6px; }
.mg-offer-revise { padding: 6px 8px; border: 1px solid #cbd8e5; border-radius: 7px; background: #f4f8fc; color: #294f70; font: inherit; font-size: 11px; cursor: pointer; }
.mg-offer-revise:hover { background: #eaf2f9; }
.mg-offer-status { display: inline-flex; width: max-content; align-items: center; border-radius: 30px; padding: 3px 8px; background: #fff2d4; color: #7a4d00 !important; font-weight: 700; }
.mg-offer-status.finalized { background: #e2f4e9; color: #176536 !important; }
.mg-offer-editor-panel { min-width: 0; }
.mg-offer-editor-panel .panel-header { align-items: center; }
.mg-offer-editor-panel .panel-header h1 { margin: 2px 0 0; font-size: 23px; }
.mg-offer-version { color: #677381; font-size: 12px; text-align: right; }
.mg-offer-section-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin: 22px 0 10px; padding-bottom: 7px; border-bottom: 1px solid #e3e7ec; }
.mg-offer-section-heading h2 { margin: 0; font-size: 16px; }
.mg-offer-section-heading small { color: #697582; }
.mg-offer-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.mg-offer-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mg-offer-grid.three { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mg-offer-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mg-offer-grid label, .mg-offer-note { display: grid; gap: 5px; min-width: 0; color: #44515e; font-size: 12px; font-weight: 650; }
.mg-offer-grid input, .mg-offer-grid select, .mg-offer-note textarea, .mg-catalog-dialog input:not([type=file]), .mg-catalog-dialog textarea { width: 100%; min-width: 0; border: 1px solid #cfd7df; border-radius: 7px; padding: 9px 10px; color: #19232d; background: white; font: inherit; font-weight: 450; }
.mg-offer-grid input:disabled { color: #596572; background: #f0f2f4; }
.mg-offer-checkbox { display: flex !important; align-items: center; align-self: end; min-height: 37px; gap: 8px !important; padding: 7px 8px; border: 1px solid #d9dfe6; border-radius: 7px; background: #fafbfc; }
.mg-offer-checkbox input { width: 16px; min-width: 16px; height: 16px; margin: 0; }
.mg-offer-model-note { min-height: 17px; margin: 0; color: #6a7681; font-size: 12px; }
.mg-offer-calculation { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px 18px; margin: 13px 0; padding: 14px; border: 1px solid #dce1e7; border-radius: 10px; background: #f8fafb; }
.mg-offer-calculation div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.mg-offer-calculation b { text-align: right; }
.mg-offer-calculation .mg-offer-total { grid-column: 1 / -1; margin-top: 4px; padding: 10px 11px; border-left: 4px solid #c8102e; border-radius: 4px; background: #f9e9ed; color: #a20e27; font-size: 16px; }
.mg-offer-calculation .mg-offer-registration { grid-column: 1 / -1; color: #53606d; }
.mg-offer-error { grid-column: 1 / -1; color: #a20e27; font-size: 12px; font-weight: 700; }
.mg-offer-note textarea { resize: vertical; }
.mg-offer-form-status { min-height: 18px; margin-top: 10px; color: #a20e27; font-size: 13px; }
.mg-offer-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.mg-offers-notice { margin-bottom: 14px; padding: 12px 15px; border-radius: 9px; background: #fff3d8; color: #704a02; }
.mg-catalog-dialog { width: min(1080px, calc(100vw - 28px)); max-height: min(92vh, 1000px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 16px 55px #121a2470; }
.mg-catalog-dialog::backdrop { background: #11192399; }
.mg-final-pdf-dialog { width: min(1100px, calc(100vw - 28px)); height: min(92vh, 1000px); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 14px; box-shadow: 0 16px 55px #121a2470; }
.mg-final-pdf-dialog::backdrop { background: #11192399; }
.mg-final-pdf-inner { display: flex; height: 100%; flex-direction: column; padding: 16px; }
.mg-final-pdf-inner .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mg-final-pdf-inner h2 { margin: 2px 0 8px; }
.mg-final-pdf-status { min-height: 18px; margin: 0 0 8px; color: #a20e27; font-size: 13px; }
.mg-final-pdf-inner iframe { flex: 1; width: 100%; min-height: 0; border: 1px solid #dce2e8; border-radius: 8px; background: white; }
.mg-catalog-dialog-inner { padding: 22px; overflow: auto; }
.mg-catalog-dialog .dialog-header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.mg-catalog-dialog h2 { margin: 2px 0 5px; }
.mg-catalog-import-box, .mg-catalog-json-details { margin: 14px 0; padding: 14px; border: 1px solid #dce2e8; border-radius: 9px; background: #fafbfc; }
.mg-catalog-source-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 14px 0; padding: 14px; border: 1px solid #cad8e8; border-radius: 9px; background: #f4f8fc; }
.mg-catalog-source-box p { margin: 5px 0 0; color: #677381; font-size: 12px; }
.mg-catalog-source-box button { flex: 0 0 auto; }
.mg-catalog-source-status { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: #edf5f0; color: #2b5138; font-size: 12px; line-height: 1.5; }
.mg-catalog-source-status.is-error { background: #fff0f0; color: #9b1c2e; }
.mg-catalog-source-status ul { margin: 6px 0 0; padding-left: 18px; }
.mg-catalog-import-box p, .mg-catalog-json-details p { color: #677381; font-size: 12px; }
.mg-catalog-import-box input[type=file] { margin: 7px 10px 7px 0; }
.mg-catalog-json-details summary { cursor: pointer; font-weight: 700; }
.mg-catalog-json-details textarea { margin: 10px 0; font: 12px/1.5 Consolas, monospace; }
.mg-catalog-preview-summary { margin: 14px 0; padding: 10px; background: #edf5f0; border-radius: 8px; font-weight: 700; }
.mg-catalog-preview-table { max-height: 260px; overflow: auto; }
.mg-catalog-preview-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mg-catalog-preview-table th, .mg-catalog-preview-table td { padding: 7px; border-bottom: 1px solid #e4e8ec; text-align: left; vertical-align: top; }
.mg-catalog-preview-table th { position: sticky; top: 0; background: #f4f6f8; }
.mg-catalog-preview-table details { min-width: 140px; }
.mg-catalog-preview-table details summary { cursor: pointer; color: #455563; }
.mg-catalog-preview-table details ul { max-height: 180px; overflow: auto; margin: 5px 0 0; padding-left: 18px; }
.mg-catalog-preview-table details li { padding: 2px 0; }
.mg-catalog-row-status { font-weight: 700; }
.mg-catalog-row-status.error { color: #b42332; }
.mg-catalog-row-status.modified { color: #9b6100; }
.mg-catalog-row-status.new { color: #176536; }
.mg-offer-toast { position: fixed; z-index: 20; right: 22px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 8px; color: white; background: #202a34; box-shadow: 0 5px 20px #10182044; }
@media (max-width: 1050px) {
  .mg-offer-layout { grid-template-columns: 1fr; }
  .mg-offer-list-panel { position: static; max-height: 300px; }
  .mg-offer-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mg-offer-grid.four, .mg-offer-grid.three { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .mg-offers-topbar { grid-template-columns: 1fr auto; padding: 10px 13px; }
  .mg-offers-back { grid-column: 1 / -1; }
  .mg-offers-brand { grid-column: 1; grid-row: 2; }
  .mg-offers-actions { grid-column: 2; grid-row: 2; flex-direction: column; align-items: stretch; }
  .mg-offers-main { padding: 12px; }
  .mg-offer-list { grid-template-columns: 1fr; }
  .mg-offer-grid.two, .mg-offer-grid.three, .mg-offer-grid.four, .mg-offer-calculation { grid-template-columns: 1fr; }
  .mg-offer-calculation .mg-offer-total, .mg-offer-calculation .mg-offer-registration { grid-column: auto; }
  .mg-offer-form-actions { justify-content: stretch; }
  .mg-offer-form-actions button { flex: 1 1 100%; }
  .mg-catalog-dialog-inner { padding: 15px; }
  .mg-catalog-source-box { align-items: stretch; flex-direction: column; }
}
