/* Meet DC & DPC. Styled to match Meet the Officer (mto.css): same shell, colours, fonts and buttons.
   Every selector is prefixed .mdd or uses the .mdd-modal root, so the dashboard's styles stay out. */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Malayalam:wght@400;600;700;900&family=Noto+Sans+Malayalam:wght@400;600;700&display=swap');

.mdd, .mdd * { box-sizing: border-box; }
.mdd [hidden] { display: none !important; }

/* ── Modal shell (as .mto-modal-*) ─────────────────────────── */
.mdd-modal {
    position: fixed; inset: 0; z-index: 999999;
    background: rgba(10, 20, 30, .65);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.mdd-box {
    background: #fff; border-radius: 18px; width: 100%; max-width: 640px; max-height: 92vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    font-family: "Noto Serif Malayalam", "Noto Sans Malayalam", Georgia, serif;
    color: #1a1a1a; line-height: 1.8; font-size: 1rem;
    /* Applicants submit the printed PDF, not pasted text: text in the box cannot be selected. Form fields stay editable. */
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.mdd-box input, .mdd-box select, .mdd-box textarea { -webkit-user-select: text; user-select: text; }
.mdd-box.mdd-veil { filter: blur(10px); }
.mdd-box.mdd-veil::after {
    content: "Content is hidden. Return to this window to continue.";
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .85); text-align: center; padding: 24px; font-weight: 700;
}
.mdd-box { position: relative; }

/* Top bar (as .mto-modal-topbar) */
.mdd-head {
    display: flex; align-items: center; gap: 14px; padding: 16px 20px;
    background: linear-gradient(120deg, #0a2a4a, #1b4f70); color: #fff; flex: none;
}
.mdd-title { flex: 1; min-width: 0; }
.mdd-title span { display: block; font-weight: 800; font-size: 1.02rem; line-height: 1.4; }
.mdd-title small {
    display: block; font-size: .75rem; color: #cfe6fb; line-height: 1.5;
    font-family: "Noto Sans Malayalam", sans-serif;
}
/* Step dots (as .mto-step-dot). The number is kept for screen readers and the title attribute. */
.mdd-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: center; }
.mdd-steps li {
    width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .3);
    font-size: 0; line-height: 0; cursor: default; overflow: hidden;
}
.mdd-steps li.is-active { background: #f0a500; }
.mdd-steps li.mdd-tab-link { cursor: pointer; }
/* Prefixed with .mdd-box so the dashboard's own button styles cannot make it square or large */
.mdd-box button.mdd-close {
    background: rgba(255, 255, 255, .15); border: none; color: #fff; padding: 0; margin: 0;
    width: 30px; height: 30px; min-width: 30px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; flex: none;
}
.mdd-box button.mdd-close:focus-visible { outline: 2px solid #f0a500; outline-offset: 2px; }

/* Form area scrolls; the footer stays at the bottom. The SHO / SDPO window has its own form id (#mto-sho-form). */
#mdd-form, #mto-sho-form { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
/* In the SHO / SDPO window the footer is the form's last child: keep Next and Back on screen while the steps scroll. */
#mto-sho-form > .mdd-foot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid #e5e7eb; z-index: 1; }

/* Step panels (as .mto-mstep) */
.mdd-panel { display: none; padding: 18px 22px 6px; }
.mdd-panel.is-active { display: block; }
.mdd-mstep-header { padding: 0 0 6px; }
.mdd-step-badge {
    display: inline-block; background: #eaf3fb; color: #0a2a4a; font-size: .72rem; font-weight: 700;
    padding: 3px 12px; border-radius: 20px; font-family: "Noto Sans Malayalam", sans-serif; margin-bottom: 8px;
}
.mdd-mstep-header h2 { margin: 0 0 6px; font-size: 1.25rem; color: #0a2a4a; line-height: 1.4; }

/* Form fields (as .mto-label / .mto-input) */
.mdd-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; margin-top: 12px; }
.mdd-grid label, .mdd-offices label {
    display: block; font-size: .82rem; font-weight: 700; color: #0a2a4a; margin-bottom: 12px;
    font-family: "Noto Sans Malayalam", sans-serif;
}
.mdd-grid input, .mdd-grid select, .mdd-offices select {
    display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
    border: 1.5px solid #d5e0ea; border-radius: 8px; font: inherit; font-size: .95rem; background: #fff; color: #1a1a1a;
}
.mdd-grid input:focus, .mdd-grid select:focus { outline: none; border-color: #1b4f70; }
.mdd-grid input[readonly] { background: #f4f7fa; color: #64748b; }
.mdd-grid input.is-bad, .mdd-grid select.is-bad { border-color: #d9534f; }
.mdd-wide { grid-column: 1 / -1; }

/* Office and DM choice boxes (as .mto-membership-box) */
.mdd-offices {
    border: 1.5px solid #b8d8f2; background: #f6fbff; border-radius: 10px;
    padding: 12px 14px 4px; margin: 14px 0 0;
}
.mdd-offices.is-bad { border-color: #d9534f; }
.mdd-offices legend {
    padding: 0 6px; font-weight: 800; font-size: .85rem; color: #0a2a4a; font-family: "Noto Sans Malayalam", sans-serif;
}
.mdd-hint { color: #64748b; font-size: .8rem; font-family: "Noto Sans Malayalam", sans-serif; line-height: 1.6; margin: 6px 0 10px; }
.mdd-radio {
    display: flex !important; align-items: center; gap: 10px; font-weight: 400 !important; font-size: .85rem !important;
    line-height: 1.7; padding: 6px 0 10px; margin: 0 !important; cursor: pointer; font-family: "Noto Sans Malayalam", sans-serif;
}
.mdd-radio input { width: 17px; height: 17px; flex: 0 0 auto; margin: 0 !important; }

/* Consent (as .mto-check-label) */
.mdd-check {
    display: flex !important; gap: 10px; align-items: flex-start; font-size: .85rem !important; font-weight: 400 !important;
    line-height: 1.7; margin: 14px 0 0 !important; cursor: pointer; font-family: "Noto Sans Malayalam", sans-serif;
}
.mdd-check input { margin-top: 4px; width: 17px; height: 17px; flex-shrink: 0; }

/* Review summary (as .mto-membership-box) */
.mdd-review {
    background: #f6fbff; border: 1.5px solid #b8d8f2; border-radius: 10px; padding: 6px 14px; margin: 12px 0 14px;
}
.mdd-kv { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 9px 0; border-bottom: 1px dashed #d5e0ea; }
.mdd-kv:last-child { border-bottom: none; }
.mdd-k { color: #64748b; font-size: .78rem; font-family: "Noto Sans Malayalam", sans-serif; }
.mdd-v { font-weight: 700; color: #0a2a4a; font-family: "Noto Sans Malayalam", sans-serif; }

/* Result and list (as .mto-success-*, .mto-myletters-*) */
.mdd-result {
    background: #f0f9f2; border: 1px solid #a7d9b5; color: #14532d; border-radius: 10px;
    padding: 10px 14px; font-family: "Noto Sans Malayalam", sans-serif; font-size: .85rem; line-height: 1.7;
}
.mdd-row { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 12px 0; border-bottom: 1px dashed #d5e0ea; }
.mdd-ref { font-weight: 800; color: #0a2a4a; letter-spacing: .5px; }
.mdd-office, .mdd-status { color: #64748b; font-size: .8rem; font-family: "Noto Sans Malayalam", sans-serif; }
.mdd-reason { color: #8a2c2c; font-size: .8rem; font-family: "Noto Sans Malayalam", sans-serif; line-height: 1.5; }
.mdd-row .mdd-btn { justify-self: start; text-decoration: none; margin-top: 6px; }
.mdd-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-self: start; }

/* Preview of the PDF (step 5) */
.mdd-preview {
    display: block; width: 100%; height: min(60vh, 560px); min-height: 320px; overflow-y: auto; padding: 10px;
    border: 1.5px solid #d5e0ea; border-radius: 10px; background: #e9eef4;
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none;
}
/* Pages are canvases: no image menu on long press, and no pointer events, so nothing is saved from them */
.mdd-page-canvas {
    display: block; width: 100%; height: auto; margin: 0 0 10px; background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2); pointer-events: none;
}

/* Find button next to the PIN field (as .mto-btn-search) */
.mdd-find { display: flex; align-items: flex-end; margin-bottom: 12px; }
.mdd-find .mdd-btn { width: 100%; min-height: 42px; }

/* Messages (as .mto-err) */
.mdd-msg {
    margin: 12px 22px 0; padding: 10px 12px; border-radius: 8px; background: #f6fbff; color: #1b4f70;
    border: 1px solid #b8d8f2; font-family: "Noto Sans Malayalam", sans-serif; font-size: .85rem; line-height: 1.6;
}
.mdd-msg.is-error { background: #fdf1f1; color: #8a2c2c; border-color: #eab8b8; }
.mdd-pin-msg.is-error { color: #d9534f; }

/* Footer buttons (as .mto-modal-footer, .mto-btn-success, .mto-btn-outline-sm) */
.mdd-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 22px 20px; flex: none; }
.mdd-panel > .mdd-foot { padding: 14px 0 6px; }
.mdd-btn {
    background: transparent; border: 1.5px solid #cbd5e1; color: #475569; border-radius: 30px;
    padding: 10px 20px; font-weight: 600; font-size: .88rem; min-height: 42px; cursor: pointer;
    font-family: "Noto Sans Malayalam", sans-serif; display: inline-flex; align-items: center; justify-content: center;
}
.mdd-btn.mdd-primary { background: #1b4f70; border-color: #1b4f70; color: #fff; font-weight: 700; padding: 11px 26px; }
.mdd-btn:disabled { opacity: .5; cursor: not-allowed; }
.mdd-btn:focus-visible { outline: 3px solid #f0a500; outline-offset: 2px; }
.mdd-find .mdd-btn.mdd-primary { padding: 10px 16px; }

/* Body lock while open */
body.mdd-open { overflow: hidden; }

/* Phone: full screen, 16px gutter, no horizontal scroll */
@media (max-width: 600px) {
    .mdd-modal { padding: 0; }
    .mdd-box { max-width: none; max-height: 100vh; height: 100%; border-radius: 0; }
    .mdd-head { padding: 14px 16px; }
    .mdd-panel { padding: 16px 16px 6px; }
    .mdd-msg { margin: 12px 16px 0; }
    .mdd-foot { padding: 12px 16px 18px; }
    .mdd-foot .mdd-btn { flex: 1 1 auto; }
}

/* Wide: two fields in a row (as .mto-row2) */
@media (min-width: 600px) {
    .mdd-grid { grid-template-columns: 1fr 1fr; }
    .mdd-row { grid-template-columns: 1.2fr 1.5fr 1.5fr auto; align-items: center; }
    .mdd-kv { grid-template-columns: 150px 1fr; align-items: center; }
}

/* Printing: the letter is never printed from this page */
@media print {
    .mdd-modal { display: none !important; }
    body.mdd-open { overflow: visible; }
}

/* Start screen: two large buttons */
.mdd-start { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-top: 8px; }
.mdd-start-btn { flex: 1 1 180px; padding: 14px 18px; font-size: 16px; }
/* Meet DC & DPC is orange, with a note under it; Download prepared letters is green (3.1.3) */
.mdd-start-item { flex: 1 1 180px; display: flex; flex-direction: column; }
.mdd-start-item .mdd-start-btn { flex: none; width: 100%; }
.mdd-btn.mdd-start-orange { background: #c2410c; border-color: #c2410c; color: #fff; }
.mdd-btn.mdd-start-orange:hover { background: #9a3412; border-color: #9a3412; }
.mdd-btn.mdd-start-green { background: #15803d; border-color: #15803d; color: #fff; }
.mdd-btn.mdd-start-green:hover { background: #166534; border-color: #166534; }
.mdd-start-note { margin: 6px 4px 0; font-family: "Noto Sans Malayalam", sans-serif; font-size: 13.5px; line-height: 1.5; color: #7c2d12; }
/* An empty confirmation line takes no space */
.mdd-result:empty { display: none; }

/* Approved PDFs: the status of each letter, the reason for a rejected one, and the PDF password next to Download. */
.mdd-row-rejected .mdd-status { color: #8a2c2c; }
.mdd-row-pending .mdd-status { color: #8a6d1f; }
.mdd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.mdd-actions .mdd-btn { margin-top: 0; }
.mdd-password { color: #334155; font-size: .8rem; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Meet the SHO, SDPO: the review rows (label and value) */
.mto-sho-row { display: flex; gap: 10px; margin: 3px 0; line-height: 1.4; }
.mto-sho-label { min-width: 150px; font-weight: 600; color: #334155; }
@media (max-width: 480px) { .mto-sho-row { flex-direction: column; gap: 0; } .mto-sho-label { min-width: 0; } }

/* Declaration of consent (3.0.1): the form the member reads before a letter is sent or made. */
.mdd-consent { border: 1px solid #0b2545; border-radius: 10px; background: #f6f9fc; padding: 14px 16px; margin: 12px 0; font-size: 15px; line-height: 1.5; color: #0f172a; }
.mdd-consent:empty { display: none; }
.mdd-consent h3 { margin: 0 0 8px; font-size: 1.05rem; }
.mdd-consent p { margin: 0 0 8px; }
.mdd-consent ul { margin: 0 0 8px; padding-left: 22px; }
.mdd-consent li { margin-bottom: 4px; }

/* Meet the SHO / SDPO (3.1.0): a hint that reports a problem, and the recipient block of the review */
.mdd-hint.is-error { color: #b32d2e; font-weight: 600; }
.mto-sho-recipient { font-weight: 600; color: #0a2a4a; line-height: 1.6; }

/* Scroll-down control in the SHO / SDPO window: shown only while more of the step is below */
.mdd-more {
    position: absolute; right: 16px; bottom: 96px; z-index: 3; border: 0; border-radius: 999px;
    padding: 9px 16px; background: #1b4f70; color: #fff; cursor: pointer;
    font-family: "Noto Sans Malayalam", sans-serif; font-size: .85rem; font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.mdd-more[hidden] { display: none; }
.mdd-more:focus-visible { outline: 3px solid #f0a500; outline-offset: 2px; }
