.publisher-style-dialog-open {
  overflow: hidden;
}

.publisher-style-modal[hidden] {
  display: none !important;
}

.publisher-style-modal {
  position: fixed;
  inset: 0;
  z-index: 13200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}

.publisher-style-dialog {
  width: min(1080px, 96vw);
  max-height: min(820px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  color: #172033;
  background: #f8fbff;
  border: 1px solid #b8c8dc;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.36), 0 3px 12px rgba(15, 23, 42, 0.18);
}

.publisher-style-dialog:focus {
  outline: none;
}

.publisher-style-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px 18px;
  color: #fff;
  background: linear-gradient(125deg, #083f76, #0b75bb 58%, #16a4d8);
}

.publisher-style-header h2 {
  margin: 0;
  font: 700 22px/1.2 Arial, sans-serif;
  letter-spacing: -0.01em;
}

.publisher-style-header p {
  margin: 6px 0 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.86);
  font: 13px/1.45 Arial, sans-serif;
}

.publisher-style-close {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 10px;
  font: 300 25px/1 Arial, sans-serif;
  cursor: pointer;
}

.publisher-style-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.publisher-style-dialog-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
}

.publisher-style-tabs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 15px 12px;
  background: #edf4fb;
  border-right: 1px solid #cfdeed;
}

.publisher-style-tabs button {
  min-height: 38px;
  padding: 8px 11px;
  color: #334155;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font: 600 13px/1.25 Arial, sans-serif;
  text-align: left;
  cursor: pointer;
}

.publisher-style-tabs button:hover {
  color: #083f76;
  background: #fff;
  border-color: #c7d9ec;
}

.publisher-style-tabs button[aria-selected="true"] {
  color: #fff;
  background: linear-gradient(115deg, #0b5e9f, #0b75bb);
  border-color: #07538f;
  box-shadow: 0 4px 12px rgba(11, 117, 187, 0.23);
}

.publisher-style-panels {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #fff;
}

.publisher-style-panels [role="tabpanel"][hidden] {
  display: none !important;
}

.publisher-style-inline-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 15px;
  padding: 11px 13px;
  color: #334155;
  background: #f6f9fd;
  border: 1px solid #d7e2ee;
  border-radius: 10px;
  font: 600 12px/1.4 Arial, sans-serif;
}

.publisher-style-inline-field label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.publisher-style-inline-field small {
  flex: 1 1 260px;
  color: #64748b;
  font-weight: 400;
}

.publisher-style-inline-field input[type="number"],
.publisher-style-inline-field input:not([type]) {
  width: 78px;
  min-height: 32px;
  padding: 5px 8px;
  color: #172033;
  background: #fff;
  border: 1px solid #aebfd2;
  border-radius: 7px;
  font: 13px/1.2 Arial, sans-serif;
}

.publisher-style-inline-field input[type="color"] {
  width: 42px;
  height: 32px;
  padding: 2px;
  background: #fff;
  border: 1px solid #aebfd2;
  border-radius: 7px;
  cursor: pointer;
}

.publisher-style-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: #334155;
  font: 600 12px/1.4 Arial, sans-serif;
}

.publisher-style-inline-field .publisher-style-check {
  margin: 0;
}

.publisher-style-check input {
  width: 16px;
  height: 16px;
  accent-color: #0b75bb;
}

.publisher-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.publisher-style-card {
  min-width: 0;
  min-height: 92px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 10px;
  color: #172033;
  background: #fff;
  border: 1px solid #cbd8e6;
  border-radius: 11px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  text-align: left;
  cursor: pointer;
}

.publisher-style-card:hover {
  border-color: #6aa9d5;
  box-shadow: 0 5px 16px rgba(11, 117, 187, 0.12);
  transform: translateY(-1px);
}

.publisher-style-card[aria-selected="true"] {
  background: #eef8ff;
  border-color: #0b75bb;
  box-shadow: 0 0 0 2px rgba(11, 117, 187, 0.16), 0 6px 18px rgba(11, 117, 187, 0.14);
}

.publisher-style-card-preview {
  width: 72px;
  height: 62px;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-content: center;
  align-items: center;
  gap: 3px 5px;
  overflow: hidden;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
}

.publisher-style-card-preview > b {
  font: 700 13px/1 Arial, sans-serif;
  text-align: right;
}

.publisher-style-card-preview > i {
  height: 3px;
  margin-right: 7px;
  background: #94a3b8;
  border-radius: 3px;
}

.publisher-style-card-copy {
  min-width: 0;
  display: block;
}

.publisher-style-card-copy strong,
.publisher-style-card-copy small {
  display: block;
}

.publisher-style-card-copy strong {
  margin-bottom: 4px;
  color: #172033;
  font: 700 13px/1.3 Arial, sans-serif;
}

.publisher-style-card-copy small {
  color: #64748b;
  font: 11px/1.35 Arial, sans-serif;
}

.publisher-style-drop-preview {
  grid-column: 1 / -1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 27px 1fr;
  grid-template-rows: repeat(3, 8px);
  align-content: center;
  gap: 4px;
  padding: 7px;
  box-sizing: border-box;
}

.publisher-style-drop-preview b {
  grid-row: 1 / 4;
  align-self: center;
  color: #0b5e9f;
  font: 700 38px/.8 Georgia, serif;
}

.publisher-style-drop-preview i {
  height: 3px;
  align-self: center;
  background: #94a3b8;
  border-radius: 3px;
}

.publisher-style-border-grid .publisher-style-card-preview {
  display: block;
  padding: 3px;
  box-sizing: border-box;
  background: #fff;
}

.publisher-style-border-grid svg {
  width: 100%;
  height: 100%;
  display: block;
}

.publisher-style-none-mark {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font: 300 32px/1 Arial, sans-serif;
}

.publisher-style-colour-grid .publisher-style-card-preview,
#publisherStylePanel-styles .publisher-style-card-preview {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0;
}

.publisher-style-colour-grid .publisher-style-card-preview i,
#publisherStylePanel-styles .publisher-style-card-preview i {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
}

.publisher-style-footer {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 12px 18px;
  background: #f2f7fc;
  border-top: 1px solid #d1deeb;
}

.publisher-style-status {
  min-width: 0;
  flex: 1 1 auto;
  color: #526277;
  font: 12px/1.35 Arial, sans-serif;
}

.publisher-style-footer button {
  min-width: 88px;
  min-height: 36px;
  padding: 7px 14px;
  color: #25364a;
  background: #fff;
  border: 1px solid #afc0d2;
  border-radius: 8px;
  font: 700 12px/1.2 Arial, sans-serif;
  cursor: pointer;
}

.publisher-style-footer .publisher-style-apply {
  color: #fff;
  background: linear-gradient(115deg, #0b5e9f, #0b75bb);
  border-color: #07538f;
}

.publisher-style-footer button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.publisher-style-dialog button:focus-visible,
.publisher-style-dialog input:focus-visible {
  outline: 3px solid rgba(22, 164, 216, 0.34);
  outline-offset: 2px;
}

.publisher-accessible-list {
  margin: 0;
  padding-left: 1.8em;
  list-style: none;
}

.publisher-accessible-list > li {
  margin: 0;
}

.publisher-accessible-list .publisher-list-marker {
  display: inline-block;
  min-width: 1.35em;
  margin-left: -1.35em;
}

.publisher-drop-cap {
  text-rendering: geometricPrecision;
}

.publisher-style-launch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.publisher-style-launch-row .ribbon-toggle-btn,
#objectBorderGalleryBtn,
#pageBorderGalleryBtn {
  min-height: 26px;
  white-space: nowrap;
}

.linked-text-engine-char.publisher-drop-cap-glyph,
.linked-text-engine-run.publisher-drop-cap-glyph {
  overflow: visible !important;
  text-rendering: geometricPrecision;
  transform-origin: left top;
}

body[data-ui-theme="dark"] .publisher-style-dialog {
  color: #e5edf7;
  background: #17202c;
  border-color: #3b4b60;
}

body[data-ui-theme="dark"] .publisher-style-tabs {
  background: #141d29;
  border-color: #334155;
}

body[data-ui-theme="dark"] .publisher-style-tabs button {
  color: #c7d4e4;
}

body[data-ui-theme="dark"] .publisher-style-tabs button:hover {
  color: #fff;
  background: #253247;
  border-color: #435672;
}

body[data-ui-theme="dark"] .publisher-style-panels {
  background: #1b2635;
}

body[data-ui-theme="dark"] .publisher-style-inline-field,
body[data-ui-theme="dark"] .publisher-style-card,
body[data-ui-theme="dark"] .publisher-style-card-preview {
  color: #e5edf7;
  background: #222f42;
  border-color: #40516a;
}

body[data-ui-theme="dark"] .publisher-style-card[aria-selected="true"] {
  background: #123552;
  border-color: #38a9e1;
}

body[data-ui-theme="dark"] .publisher-style-card-copy strong {
  color: #f7fbff;
}

body[data-ui-theme="dark"] .publisher-style-card-copy small,
body[data-ui-theme="dark"] .publisher-style-inline-field small,
body[data-ui-theme="dark"] .publisher-style-status {
  color: #aebed1;
}

body[data-ui-theme="dark"] .publisher-style-inline-field input {
  color: #f4f8fd;
  background: #141d29;
  border-color: #50627a;
}

body[data-ui-theme="dark"] .publisher-style-footer {
  background: #141d29;
  border-color: #344258;
}

body[data-ui-theme="dark"] .publisher-style-footer button:not(.publisher-style-apply) {
  color: #e5edf7;
  background: #222f42;
  border-color: #50627a;
}

@media (max-width: 720px) {
  .publisher-style-modal {
    padding: 8px;
  }

  .publisher-style-dialog {
    width: 100%;
    max-height: 96vh;
    border-radius: 13px;
  }

  .publisher-style-header {
    padding: 15px;
  }

  .publisher-style-dialog-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .publisher-style-tabs {
    flex-direction: row;
    overflow-x: auto;
    padding: 9px;
    border-right: 0;
    border-bottom: 1px solid #cfdeed;
  }

  .publisher-style-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .publisher-style-panels {
    padding: 12px;
  }

  .publisher-style-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .publisher-style-card {
    transition: none;
  }
}

@media print {
  .publisher-style-modal {
    display: none !important;
  }
}
