.wizard-step { transition: all 0.3s ease; }
.form-card { @apply bg-white rounded-lg shadow-sm border p-6 mb-6; }
.flash-message { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* "Muat dalam satu halaman", step one: take the slack out of the spacing.
 *
 * Deliberately NOT inside @media print. letter-fit.js measures a hidden copy of
 * the letter to decide how much it is over by, and a rule that only existed
 * while printing would be missing from the thing being measured — so the
 * measurement would describe a letter nobody prints.
 *
 * It is also why the screen shows what the paper will: the class is on the
 * letter itself, so a letter the office has set to fit one page reads the same
 * in the tab as it does in the tray.
 *
 * Only the leading and the paragraph gaps. The type size is left alone here —
 * that is the next step, and only if this was not enough.
 */
.letter-fit-tight .letter-content,
.letter-fit-tight .letter-body { line-height: 1.35; }
.letter-fit-tight .letter-content p,
.letter-fit-tight .letter-body p { margin: 0.12em 0; }
.letter-fit-tight .letter-content ul,
.letter-fit-tight .letter-content ol,
.letter-fit-tight .letter-body ul,
.letter-fit-tight .letter-body ol { margin: 0.3em 0; }
.letter-fit-tight .letter-content li,
.letter-fit-tight .letter-body li { margin: 0.1em 0; }

/* A page meant for the printer — the letter, the interview call-up — drawn on
 * screen as the sheet it will become.
 *
 * One margin, declared once, used by both: the card is A4 wide with the margin
 * as its padding, and printing drops the padding because @page supplies the
 * same margin from the paper's edge. The text column is 170mm either way, so
 * the line breaks on screen are the line breaks on paper and the office can
 * see how close to the edge a line lands.
 *
 * Before this the card was a 672px reading column with 32px of padding while
 * the paper gave the text 182mm — printed lines ran about an eighth longer
 * than the ones being written, and nothing on screen showed where the edge of
 * the sheet was.
 */
.print-page { width: 100%; max-width: 210mm; }
.print-page #print-area { padding: 20mm; }

/* Print styles */
@media print {
    header, footer, .flash-message { display: none !important; }
    body { background: white !important; }
    main { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .print-clean { box-shadow: none !important; border: none !important; border-radius: 0 !important; }

    /* A page whose whole purpose is to be printed: the letter, the interview
     * call-up. The same A4 margin the admin's print layout uses, so one letter
     * occupies one sheet whichever side it was printed from.
     *
     * Without this the card kept its screen furniture on paper — 32px of
     * padding inside a 672px column, inside a main with its own padding, under
     * a 32px top margin. A letter written to fill one page came out of the
     * printer onto two, and the second carried three lines. */
    /* The margin the on-screen sheet shows as its padding. Change the two
     * together or the screen stops being a preview. */
    @page { size: A4; margin: 20mm; }
    .print-page { max-width: none !important; margin: 0 !important; }
    .print-page #print-area {
        box-shadow: none !important;
        border: 0 !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* "Muat dalam satu halaman". The factor is measured and set by
     * assets/js/letter-fit.js, which only adds the class when a letter is over
     * a page and close enough to pull back onto one.
     *
     * zoom, not transform. A transform is painted, not laid out: the element
     * keeps its full untransformed height, so the browser paginates exactly
     * where it would have anyway and a letter drawn smaller still breaks onto a
     * second sheet. zoom scales the layout, so the page count follows it. */
    .letter-fit-on { zoom: var(--letter-fit, 1); }
}

/* ---------------------------------------------------------------- dark mode
 *
 * The public side is 41 views built from a handful of light-mode utilities and
 * no `dark:` variants. Rather than edit every file, the theme is a remap of the
 * utilities those views actually use, applied when <html> carries `.dark`.
 *
 * `html.dark .x` outranks a bare `.x`, so these win wherever they apply. A view
 * that does declare its own `dark:` variant is not broken by this — the remap
 * simply supplies its shade instead.
 *
 * Palette matches the admin side (navy 900-400 in layouts/public.php).
 */
html.dark body { background-color: #10121a; }

/* surfaces */
html.dark .bg-white { background-color: #181b2e; }
html.dark .bg-gray-50 { background-color: #10121a; }
html.dark .bg-gray-100 { background-color: #1e2238; }
html.dark .bg-gray-200 { background-color: #252a42; }
html.dark .hover\:bg-gray-50:hover { background-color: #1e2238; }
html.dark .hover\:bg-gray-100:hover { background-color: #252a42; }

/* text */
html.dark .text-gray-900,
html.dark .text-gray-800 { color: #f3f4f6; }
html.dark .text-gray-700 { color: #e5e7eb; }
html.dark .text-gray-600 { color: #d1d5db; }
html.dark .text-gray-500 { color: #9ca3af; }
html.dark .text-gray-400 { color: #6b7280; }
html.dark .text-gray-300 { color: #4b5563; }

/* borders — every weight collapses to one, so cards keep a visible edge */
html.dark .border,
html.dark .border-b,
html.dark .border-t,
html.dark .border-l,
html.dark .border-r,
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300 { border-color: #2a2f48; }
html.dark .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: #2a2f48; }

/* form controls */
html.dark input,
html.dark select,
html.dark textarea {
    background-color: #1e2238;
    border-color: #2a2f48;
    color: #e5e7eb;
}
html.dark input::placeholder,
html.dark textarea::placeholder { color: #6b7280; }

/* tinted panels: keep the hue, drop the brightness so text stays readable */
html.dark .bg-blue-50 { background-color: #1c2740; }
html.dark .bg-blue-100 { background-color: #22304e; }
html.dark .bg-amber-50 { background-color: #33270f; }
html.dark .bg-green-50 { background-color: #122a1c; }
html.dark .bg-green-100 { background-color: #17351f; }
html.dark .bg-red-50 { background-color: #331519; }
html.dark .bg-purple-50 { background-color: #241d3a; }
html.dark .bg-yellow-50 { background-color: #332b0f; }
html.dark .hover\:bg-blue-50:hover { background-color: #22304e; }

/* tinted text on those panels */
html.dark .text-blue-800 { color: #93c5fd; }
html.dark .text-amber-800,
html.dark .text-amber-700 { color: #fcd34d; }
html.dark .text-green-800 { color: #86efac; }
html.dark .text-red-800 { color: #fca5a5; }
html.dark .text-blue-600 { color: #60a5fa; }

/* borders on tinted panels */
html.dark .border-amber-200 { border-color: #5c4813; }
html.dark .border-blue-200 { border-color: #2c4270; }
html.dark .border-green-200 { border-color: #1f5133; }
html.dark .border-red-200 { border-color: #6b2229; }

/* Buttons and badges keep their own solid colours — bg-blue-600, bg-green-600
 * and the status pills are readable as-is and are deliberately left alone. */

/* ──────────────────────────────────────────────────────────────────────────
   Rich text produced by the Quill editors
   ──────────────────────────────────────────────────────────────────────────
   Status letters, notification bodies and a form's terms & conditions are all
   written in Quill and rendered back here. Quill's own stylesheet is only
   loaded on the pages that *edit* — pulling it into every public page for the
   sake of a bulleted list is not worth the request — and Tailwind's preflight
   strips list markers and heading sizes, so the output needs these rules or a
   numbered clause renders as an unnumbered paragraph.

   Kept to what the toolbar can actually emit.
   ────────────────────────────────────────────────────────────────────────── */
.rich-content > :first-child { margin-top: 0; }
.rich-content > :last-child { margin-bottom: 0; }
.rich-content p { margin: 0 0 0.75em; }
.rich-content h1 { font-size: 1.5em; font-weight: 700; margin: 1em 0 0.5em; }
.rich-content h2 { font-size: 1.25em; font-weight: 700; margin: 1em 0 0.5em; }
.rich-content h3 { font-size: 1.1em; font-weight: 600; margin: 1em 0 0.5em; }
.rich-content strong { font-weight: 700; }
.rich-content em { font-style: italic; }
.rich-content u { text-decoration: underline; }
.rich-content s { text-decoration: line-through; }
.rich-content ol { list-style: decimal; padding-left: 1.5em; margin: 0 0 0.75em; }
.rich-content ul { list-style: disc; padding-left: 1.5em; margin: 0 0 0.75em; }
.rich-content li { margin: 0.25em 0; }
.rich-content blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 0.875em;
    margin: 0 0 0.75em;
    color: #4b5563;
}
.rich-content a { color: #2563eb; text-decoration: underline; }
.rich-content img { max-width: 100%; height: auto; }

/* A table written in the editor. The terms and the pledge are offered the same
   table tool a letter has, and an unbordered grid of words is not a table. */
.rich-content table { border-collapse: collapse; table-layout: fixed; width: 100%; margin: 0 0 0.75em; }
.rich-content td, .rich-content th { border: 1px solid #9ca3af; padding: 4px 8px; vertical-align: top; }
.rich-content th { font-weight: 700; background: #f3f4f6; }
/* A table used for lining things up rather than tabulating them. The border
   stays, in transparent, so the lines go without the layout shifting. */
.rich-content td.cell-lines-off, .rich-content th.cell-lines-off { border-color: transparent; background: none; }

/* A page break where there are no pages: the config's letter preview and the
   terms on screen. Drawn as the divider it stands for, so a letter written in
   two parts does not read here as one run-on block. */
.rich-content .page-break { height: 0; border-top: 1px dashed #cbd5e1; margin: 1em 0; }
@media print { .rich-content .page-break { break-after: page; page-break-after: always; border: 0; margin: 0; } }

/* Quill writes alignment and indentation as classes, not inline styles. */
.rich-content .ql-align-center { text-align: center; }
.rich-content .ql-align-right { text-align: right; }
.rich-content .ql-align-justify { text-align: justify; }
.rich-content .ql-indent-1 { padding-left: 3em; }
.rich-content .ql-indent-2 { padding-left: 6em; }
.rich-content .ql-indent-3 { padding-left: 9em; }
.rich-content .ql-indent-4 { padding-left: 12em; }

/* The age an identity number gives, measured against the range the institution
   accepts — green inside it, red outside. Written here rather than as utility
   classes because the read-back line is built by script after the page has
   loaded, and styling it must not depend on anything re-scanning the DOM.
   Colours match the palette the rest of the page uses. */
.age-in-range { color: #16a34a; font-weight: 600; }
.age-out-of-range { color: #dc2626; font-weight: 600; }

/*
 * A box that says whether what is in it will be accepted.
 *
 * Only on the identity number, and only where the institution takes the MyKad
 * alone — a green border is a promise that something was checked, and a
 * passport has no shape to check it against.
 *
 * Colour is not the only signal: the same answer is written out in words under
 * the box, because a border is invisible to anyone who cannot distinguish the
 * two colours, and the words are what say *what* is wrong.
 */
.field-valid { border-color: #16a34a !important; }
.field-invalid { border-color: #dc2626 !important; }

/* The searchable dropdown's styling moved to assets/css/searchable.css, which
 * the admin layout loads too — it does not load this file. */


