/* Core Structural Tokens */
:root {
    --primary-dark: #0f172a;
    --accent-blue: #2563eb;
    --border-slate: #cbd5e1;
    --bg-light: #f8fafc;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--primary-dark);
    background-color: #ffffff;
    margin: 0;
}

/* Dashboard Control Panel Interface */
.controls-container {
    max-width: 950px;
    margin: 0 auto 30px auto;
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-slate);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.controls-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
}

select {
    padding: 8px 12px;
    font-size: 0.95rem;
    border-radius: 4px;
    border: 1px solid var(--border-slate);
    background-color: #ffffff;
    outline: none;
}

button {
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

button:hover {
    background-color: #1d4ed8;
}
/* worksheet creator >> */
.form-row {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
    font-size: 1.5rem;
}
.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
/* worksheet creator << */
.hidden {
    display: none !important;
}

/* Printable Assignment Metadata Board */
.worksheet-header {
    max-width: 100%;
    margin: 0 auto 30px auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    border-bottom: 2px solid var(--primary-dark);
    padding-bottom: 15px;
}

.header-field {
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 1px dashed #64748b;
    padding-bottom: 5px;
    color: #1e293b;
}

/* Locked 5-Column Grid Layout */
.sums-grid {
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 20px;
}

.sum-card {
    border: 1px solid var(--border-slate);
    border-radius: 6px;
    padding: 18px 15px; 
    background: #ffffff;
    text-align: right;
    font-family: "Courier New", Courier, monospace;
    font-size: 1.5rem; 
    font-weight: bold;
    letter-spacing: 2px;
    box-sizing: border-box;
}

.division-layout {
    text-align: left !important;
    letter-spacing: 1px !important;
    font-size: 1.35rem !important;
    padding-top: 30px !important;
    padding-bottom: 40px !important;
}

.number-line {
    display: block;
    margin-bottom: 5px;
}

.operator-line {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary-dark);
    padding-bottom: 4px;
    margin-bottom: 45px;
}

/* HARD A4 PRINT EXECUTION LAYER OVERRIDES */
@page {
    size: A4 portrait;
    margin: 12mm 12mm;
}

@media print {
    .controls-container {
        display: none !important;
    }
    
    body {
        padding: 0;
        margin: 0;
        background-color: #ffffff;
        width: 100% !important;
    }

    .worksheet-header {
        margin-bottom: 25px;
        border-bottom: 2px solid #000000;
    }

    .header-field {
        border-bottom: 1px solid #000000;
        font-size: 1rem;
    }

    .sums-grid {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 10px !important; /* Compressed gap forces 5 to remain cleanly aligned on paper width */
        width: 100% !important;
    }

    .sum-card {
        box-shadow: none !important;
        border: 1px solid #000000 !important;
        background: #ffffff !important;
        padding: 12px 8px !important;
        font-size: 1.25rem !important;
        page-break-inside: avoid;
    }

    .operator-line {
        border-bottom: 2px solid #000000 !important;
        margin-bottom: 40px !important;
    }
}

/* Mobile Viewports fall back gracefully to 2 columns */
@media (max-width: 600px) {
    .sums-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .worksheet-header { grid-template-columns: 1fr; gap: 10px; }
}
