.dlg-wrap,
.dlg-wrap * {
  box-sizing: border-box;
}

.dlg-wrap {
  font-family: "SolaimanLipi", "Noto Serif Bengali", "Noto Sans Bengali", Arial, sans-serif;
  color: #1f2933;
  line-height: 1.6;
}

.dlg-login-box {
  max-width: 760px;
  padding: 20px;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  background: #fffdf4;
  color: #263238;
  font-family: "SolaimanLipi", "Noto Serif Bengali", Arial, sans-serif;
}

.dlg-top-card {
  border: 1px solid #d8e7dd;
  background: linear-gradient(135deg, #f4fff7, #fff);
  border-radius: 18px;
  padding: 22px;
  margin: 16px 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.dlg-top-card h2 {
  margin: 0 0 6px;
  color: #0d7a3a;
  font-size: 28px;
}

.dlg-top-card p {
  margin: 0 0 18px;
  color: #3b4a40;
}

.dlg-letter-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dlg-letter-buttons button,
.dlg-generate-btn,
.dlg-actions button,
#dlg-send-email,
#dlg-phonetic-toggle {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  padding: 11px 18px;
  font-size: 15px;
  transition: all .18s ease;
}

.dlg-type-btn {
  background: #e8f5ee;
  color: #0d7a3a;
  border: 1px solid #9bd3b0 !important;
}

.dlg-type-btn.active,
.dlg-generate-btn,
#dlg-save-record,
.dlg-phonetic-on {
  background: #0d7a3a;
  color: white;
}

.dlg-phonetic-off {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa !important;
}

.dlg-actions button,
#dlg-send-email {
  background: #eef2f7;
  color: #1f2933;
  border: 1px solid #d0d7de;
}

.dlg-actions button:hover,
#dlg-send-email:hover,
.dlg-generate-btn:hover,
.dlg-type-btn:hover,
#dlg-phonetic-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.09);
}

.dlg-typing-help {
  margin: 16px auto 0;
  max-width: 980px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px dashed #b7dec4;
  background: rgba(255, 255, 255, .72);
  border-radius: 14px;
  color: #284135;
  text-align: left;
}

.dlg-typing-help span {
  flex: 1 1 420px;
  font-size: 14px;
}

.dlg-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.88fr) minmax(420px, 1.12fr);
  gap: 18px;
  align-items: start;
}

.dlg-form-panel,
.dlg-preview-panel {
  border: 1px solid #e1e5ea;
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.dlg-form-panel h3,
.dlg-preview-panel h3,
.dlg-email-box h3 {
  margin: 6px 0 12px;
  font-size: 19px;
  color: #0d7a3a;
}

.dlg-required {
  color: #b42318;
}

.dlg-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.dlg-field-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  color: #263238;
  font-size: 14px;
}

.dlg-full {
  grid-column: 1 / -1;
}

.dlg-field-grid input,
.dlg-field-grid textarea {
  width: 100%;
  border: 1px solid #ccd4dd;
  border-radius: 10px;
  padding: 10px 11px;
  min-height: 42px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  background: #fbfcfe;
}

.dlg-field-grid textarea {
  min-height: 78px;
  resize: vertical;
}

.dlg-field-grid input:focus,
.dlg-field-grid textarea:focus {
  border-color: #0d7a3a;
  outline: 2px solid rgba(13, 122, 58, 0.12);
  background: white;
}

.dlg-letter-form {
  display: none;
  border-top: 1px dashed #d5dce4;
  margin-top: 16px;
  padding-top: 14px;
}

.dlg-letter-form.active {
  display: block;
}

.dlg-generate-btn {
  width: 100%;
  margin-top: 6px;
}

.dlg-preview-scroll {
  background: #eef2f7;
  padding: 12px;
  border-radius: 14px;
  overflow: auto;
  max-height: 900px;
  width: 100%;
}

.dlg-preview-stage {
  width: 100%;
  min-width: 300px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.dlg-empty-preview {
  display: grid;
  place-items: center;
  min-height: 1123px;
  color: #64748b;
  text-align: center;
  font-weight: 700;
  padding: 40px;
}

.dlg-letter-a4 {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  background: white;
  color: #101828;
  box-shadow: 0 8px 25px rgba(0, 0, 0, .15);
  position: relative;
  overflow: hidden;
  font-family: "SolaimanLipi", "Noto Serif Bengali", "Noto Sans Bengali", Georgia, serif;
  flex: 0 0 auto;
}

.dlg-print-page {
  position: relative;
  min-height: 1123px;
  padding: 0 54px 36px;
}

.dlg-letter-head {
  display: block;
  width: 100%;
  max-height: 198px;
  object-fit: contain;
  margin: 0 0 20px;
}

.dlg-watermark {
  position: absolute;
  width: 380px;
  height: 380px;
  object-fit: contain;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  opacity: .10;
  z-index: 0;
  pointer-events: none;
}

.dlg-letter-content {
  position: relative;
  z-index: 1;
  font-size: 18px;
  line-height: 1.58;
}

.dlg-letter-content p {
  margin: 0 0 10px;
  text-align: justify;
}

.dlg-letter-content .dlg-subject {
  font-weight: 800;
  text-decoration: underline;
  margin: 14px 0 12px;
}

.dlg-letter-content .dlg-mini-note {
  float: right;
  width: 245px;
  border: 1px solid #2c3e50;
  padding: 12px 15px;
  margin: 0 0 14px 20px;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 700;
}

.dlg-letter-content .dlg-meta-line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 16px;
  margin-bottom: 12px;
}

.dlg-letter-content .dlg-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 15px;
  line-height: 1.35;
}

.dlg-letter-content .dlg-table th,
.dlg-letter-content .dlg-table td {
  border: 1px solid #202020;
  padding: 6px 8px;
  text-align: right;
  vertical-align: top;
}

.dlg-letter-content .dlg-table th {
  background: #f1f5f9;
  font-weight: 800;
}

.dlg-signature-block {
  width: 300px;
  margin-left: auto;
  margin-top: 24px;
  text-align: center;
  line-height: 1.45;
  font-size: 16px;
}

.dlg-signature-block img {
  max-width: 200px;
  max-height: 58px;
  object-fit: contain;
  display: block;
  margin: 2px auto 6px;
}

.dlg-issuer-line {
  display: none !important;
}

.dlg-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.dlg-email-box {
  border-top: 1px dashed #d5dce4;
  margin-top: 14px;
  padding-top: 14px;
}

.dlg-attachment-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 12px;
  padding: 10px 12px;
  border: 1px solid #e1e5ea;
  border-radius: 12px;
  background: #fbfcfe;
}

.dlg-attachment-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.dlg-note {
  font-size: 13px;
  color: #667085;
  margin-bottom: 0;
}

.dlg-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  display: none;
}

.dlg-status.success {
  display: block;
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid #abefc6;
}

.dlg-status.error {
  display: block;
  background: #fef3f2;
  color: #b42318;
  border: 1px solid #fecdca;
}

@media (max-width: 1100px) {
  .dlg-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dlg-field-grid {
    grid-template-columns: 1fr;
  }
  .dlg-preview-scroll {
    padding: 8px;
    max-height: 780px;
  }
  .dlg-top-card h2 {
    font-size: 22px;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }
  #dlg-letter,
  #dlg-letter * {
    visibility: visible !important;
  }
  #dlg-letter {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 210mm !important;
    min-height: 297mm !important;
    box-shadow: none !important;
    margin: 0 !important;
    transform: none !important;
  }
  .dlg-print-page {
    min-height: 297mm !important;
  }
  @page {
    size: A4;
    margin: 0;
  }
}

/* Version 1.2 compact A4 layout fixes */
.dlg-letter-a4 {
  height: 1123px;
  overflow: hidden;
}
.dlg-print-page {
  min-height: 1123px;
  padding: 0 48px 28px;
}
.dlg-letter-head {
  max-height: 168px;
  margin: 0 0 12px;
}
.dlg-watermark {
  width: 360px;
  height: 360px;
  opacity: .09;
  top: 55%;
}
.dlg-letter-content {
  font-size: 17px;
  line-height: 1.48;
}
.dlg-student-page .dlg-letter-content {
  font-size: 15.2px;
  line-height: 1.42;
}
.dlg-letter-content p {
  margin: 0 0 8px;
}
.dlg-letter-content .dlg-subject {
  margin: 10px 0 10px;
}
.dlg-letter-content .dlg-mini-note {
  width: 235px;
  padding: 10px 13px;
  margin: 0 0 10px 18px;
  font-size: 15px;
  line-height: 1.45;
}
.dlg-letter-content .dlg-meta-line {
  font-size: 15px;
  margin-bottom: 10px;
}
.dlg-letter-content .dlg-table {
  margin: 8px 0 10px;
  font-size: 13.4px;
  line-height: 1.25;
}
.dlg-letter-content .dlg-table th,
.dlg-letter-content .dlg-table td {
  padding: 4px 6px;
}
.dlg-compact-box {
  border: 1px solid #202020;
  margin: 8px 0 10px;
  font-size: 13.5px;
}
.dlg-box-title {
  background: #f1f5f9;
  font-weight: 800;
  text-align: right;
  border-bottom: 1px solid #202020;
  padding: 4px 7px;
}
.dlg-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.dlg-info-grid span {
  border-top: 1px solid #e5e7eb;
  padding: 4px 7px;
}
.dlg-info-grid span:first-child {
  grid-column: 1 / -1;
  border-top: 0;
}
.dlg-signature-block {
  width: 286px;
  margin-top: 14px;
  line-height: 1.35;
  font-size: 15px;
}
.dlg-student-page .dlg-signature-block {
  margin-top: 8px;
  font-size: 14px;
}
.dlg-signature-block img {
  max-width: 190px;
  max-height: 48px;
  margin: 1px auto 4px;
}

/* v1.3 bulk/login improvements */
.dlg-login-user-box{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:12px;padding:12px 14px;margin-bottom:12px;color:#14532d;line-height:1.7;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.dlg-login-user-info{min-width:220px;flex:1 1 auto}
.dlg-logout-link{display:inline-block;background:#fff7ed;color:#9a3412;border:1px solid #fed7aa;border-radius:10px;padding:8px 13px;text-decoration:none;font-weight:700;white-space:nowrap}
.dlg-logout-link:hover{background:#ffedd5;color:#7c2d12;text-decoration:none}
.dlg-warning-text{color:#b42318;font-weight:700}
.dlg-date-grid{margin-bottom:16px}
.dlg-bulk-panel{margin-top:22px;border-top:1px dashed #d0d5dd;padding-top:18px;background:#fbfffd;border-radius:12px}
.dlg-bulk-panel h3{margin-top:0;color:#087443}
.dlg-template-buttons{display:flex;align-items:end;gap:10px;flex-wrap:wrap}
.dlg-template-link{display:inline-block;background:#087443;color:#fff!important;text-decoration:none;border-radius:8px;padding:10px 14px;font-weight:700;line-height:1.2}
.dlg-template-link:hover{background:#065f46;color:#fff!important}
.dlg-bulk-result{margin-top:12px}
.dlg-bulk-summary{background:#fff;border:1px solid #d0d5dd;border-radius:10px;padding:10px 12px;line-height:1.7}
.dlg-bulk-ok{color:#087443;font-weight:700}.dlg-bulk-error{color:#b42318;font-weight:700}
.dlg-bulk-table{width:100%;border-collapse:collapse;margin-top:10px;background:#fff;font-size:13px}
.dlg-bulk-table th,.dlg-bulk-table td{border:1px solid #d0d5dd;padding:7px;text-align:left;vertical-align:top}
.dlg-bulk-table th{background:#f2f4f7;font-weight:800}
.dlg-bulk-actions{margin-top:12px;display:flex;gap:8px;flex-wrap:wrap}
.dlg-bulk-actions button,#dlg-bulk-validate{background:#087443;color:#fff;border:0;border-radius:8px;padding:10px 14px;font-weight:700;cursor:pointer}
.dlg-bulk-actions button:hover,#dlg-bulk-validate:hover{background:#065f46}


/* v1.3.1 front-end login and bulk validation display */
.dlg-login-form-box{max-width:420px;margin:40px auto;padding:24px;background:#fffef8;border:1px solid #e3dac2;border-radius:14px;box-shadow:0 10px 30px rgba(15,23,42,.08)}
.dlg-login-form-box h3{margin:0 0 8px;color:#087443;font-size:24px}.dlg-login-form-box p{margin:6px 0 14px}.dlg-login-form-box label{display:block;font-weight:700;margin:10px 0 6px}.dlg-login-form-box input[type=text],.dlg-login-form-box input[type=password]{width:100%;max-width:100%;padding:10px;border:1px solid #cbd5e1;border-radius:8px}.dlg-login-form-box .login-submit input{background:#087443;color:#fff;border:0;border-radius:8px;padding:10px 18px;font-weight:700;cursor:pointer}.dlg-login-form-box .login-submit input:hover{background:#065f46}
.dlg-bulk-result.dlg-bulk-no-error{background:#f0fdf4;border-color:#86efac;color:#064e3b}.dlg-bulk-result.dlg-bulk-has-error{background:#fff7ed;border-color:#fdba74;color:#7c2d12}.dlg-bulk-error-list{margin-top:10px}.dlg-bulk-error-list ul{margin:8px 0 0 18px;padding:0}.dlg-bulk-error-list li{margin:4px 0;color:#b42318;font-weight:700}


/* Version 1.3.7 toast notifications - page inside alert, not browser popup */
.dlg-toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 999999;
  width: min(420px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  font-family: inherit;
}

.dlg-toast {
  pointer-events: auto;
  position: relative;
  padding: 14px 44px 14px 16px;
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(16, 24, 40, .18);
  background: #fff;
  border: 1px solid #d0d5dd;
  animation: dlgToastIn .22s ease-out;
}

.dlg-toast-success {
  background: #ecfdf3;
  border-color: #75e0a7;
  color: #02633f;
}

.dlg-toast-error {
  background: #fff1f1;
  border-color: #fda29b;
  color: #9f1f18;
}

.dlg-toast-title {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 4px;
}

.dlg-toast-message {
  font-weight: 700;
  line-height: 1.55;
  font-size: 14px;
}

.dlg-toast-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: .75;
}

.dlg-toast-close:hover {
  opacity: 1;
}

.dlg-toast-hide {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .22s ease, transform .22s ease;
}

@keyframes dlgToastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .dlg-toast-wrap {
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
  }
}
#dlg-bulk-reset.dlg-secondary-btn{background:#eef2f7;color:#0f172a;border:1px solid #cbd5e1;border-radius:8px;padding:10px 14px;font-weight:700;cursor:pointer;margin-left:8px}
#dlg-bulk-reset.dlg-secondary-btn:hover{background:#e2e8f0}
