:root {
  --line: #e9eef3;
  --azureish-white-soft: #f4fbfa;
}

/* ===== Modal root ===== */

#smdm-syl-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
}

#smdm-syl-modal[hidden] {
  display: none !important;
}

/* ===== Modal layout ===== */

.smdm-modal {
  position: fixed;
  inset: 0;
}

.smdm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.smdm-modal__dialog {
  position: relative;
  width: min(860px, calc(100vw - 32px));
  max-height: min(92vh, 980px);
  margin: 6vh auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.98);
  opacity: 0;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

#smdm-syl-modal.is-open .smdm-modal__dialog {
  transform: scale(1);
  opacity: 1;
}

/* ===== Header ===== */

.smdm-modal__head {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
}

.smdm-modal__title {
  margin: 0;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.2;
}

.smdm-modal__sub {
  margin-top: 0.25rem;
  justify-self: flex-end;
  text-align: right;
  font-size: 0.9rem;
}

.smdm-modal__sub a {
  text-decoration: underline;
}

/* Close pill at top */
.smdm-modal__close {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 0;
  width: 40px;
  border: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  background-color: var(--azureish-white-soft);
  cursor: pointer;
}

/* ===== Body ===== */

.smdm-modal__body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 10px 18px 16px;
  line-height: 1.6;
  display: grid;
  grid-auto-rows: min-content;
  row-gap: 12px;
}

.smdm-modal__body h4 {
  margin: 0;
}

.smdm-modal__desc p {
  margin-top: 0;
}

/* ===== Footer ===== */

.smdm-modal__foot {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.foot-1 {
  justify-self: flex-start;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.foot-2 {
  justify-self: flex-end;
}

/* ===== PDF viewer ===== */

.smdm-pdfbox {
  background: var(--azureish-white-soft);
  border-radius: 10px;
  border: 1px solid var(--line);
  max-height: 70vh;
  min-height: 320px;
  overflow: auto;
  padding: 8px;
}

.smdm-pdfbox canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

/* ===== Alerts ===== */

.smdm-alert {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.35;
}

.smdm-alert--error {
  background: var(--azureish-white-soft);
  border: 1px solid var(--line);
  color: inherit;
}

.is-hidden {
  display: none !important;
}

/* ===== Small screens ===== */

@media (max-width: 640px) {
  .smdm-pdfbox {
    max-height: 52vh;
  }
}
/* ===== PowerPoint / Office viewer ===== */
/* We reuse .smdm-pdfbox as the generic preview container */
.smdm-pdfbox iframe.smdm-officeframe {
  width: 100%;
  height: min(70vh, 720px);
  border: 0;
  display: block;
  background: #fff;
  border-radius: 8px;
}

/* Small screens: match your reduced viewport height */
@media (max-width: 640px) {
  .smdm-pdfbox iframe.smdm-officeframe {
    height: 52vh;
  }
}
