/* --- General On-Screen Styling (MORE COMPACT) --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    background-color: #f4f4f9;
    color: #333;
    margin: 0;
    padding: 15px; /* Compact */
    font-size: 14px; /* Compact */
}
.container {
    max-width: 1000px;
    margin: auto;
    background: #fff;
    padding: 15px 20px; /* Compact */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 { 
    margin-top: 0;
    margin-bottom: 15px; /* Compact */
    font-size: 1.7em; /* Compact */
}
h2 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 6px; /* Compact */
    margin-top: 15px; /* Compact */
    margin-bottom: 10px; /* Compact */
    font-size: 1.3em; /* Compact */
}

/* --- Two-Column Controls Layout (MORE COMPACT) --- */
#controls {
    background-color: #ecf0f1;
    padding: 12px 15px; /* Compact */
    border-radius: 5px;
    margin-bottom: 15px; /* Compact */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px 20px; /* Compact */
    align-items: start;
}
#generate-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px; /* Compact */
}
#action-buttons {
    margin-top: 10px; /* Compact */
    display: flex;
    gap: 10px;
}
#custom-controls {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Compact */
}
.input-with-button { display: flex; }
.input-with-button input {
    flex-grow: 1; border-right: none; border-top-right-radius: 0; border-bottom-right-radius: 0;
}
.input-with-button button { border-top-left-radius: 0; border-bottom-left-radius: 0; }

.form-group { display: flex; flex-direction: column; }
label { font-weight: bold; margin-bottom: 3px; font-size: 0.9em; color: #555; } /* Compact */
input[type="text"], input[type="number"], select {
    padding: 6px 8px; /* Compact */
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    width: 130px; /* Compact */
}
button {
    padding: 7px 12px; /* Compact */
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em; /* Compact */
    transition: background-color 0.3s ease;
}
button:hover { background-color: #2980b9; }
#print-button { background-color: #27ae60; }
#print-button:hover { background-color: #229954; }

/* --- On-Screen List Styling (MORE COMPACT) --- */
#list-container-screen { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.list-column table { width: 100%; border-collapse: collapse; }
.list-column td {
    padding: 4px 6px; /* Compact */
    text-align: left;
    border-bottom: 1px solid #ddd;
}
.category-header-screen {
    background-color: #3498db !important;
    color: white;
    font-weight: bold;
    font-size: 1.05em; /* Compact */
}
input.quantity-input { width: 45px; padding: 3px; text-align: center; border: 1px solid #ccc; border-radius: 4px; } /* Compact */

/* --- NEW: Footer Style --- */
footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-style: italic;
    color: #777;
    font-size: 0.9em;
}

/* --- Print-Only Structure (Hidden on screen) --- */
#print-container { display: none; }

/* --- Print-specific Styles --- */
@media print {
    body { margin: 0.5cm; padding: 0; font-size: 8pt; line-height: 1.3; }
    body > *:not(#print-container) { display: none !important; }
    #print-container { display: flex !important; flex-direction: row; gap: 15px; }
    .print-column { flex: 1; min-width: 0; }
    h3.print-category {
        font-size: 10pt; font-weight: bold; margin: 8px 0 3px 0;
        padding-bottom: 2px; border-bottom: 1.5px solid black;
    }
    .print-item {
        display: flex;
        align-items: center;
        gap: 5px;
        padding: 2px 0;
        border-radius: 2px;
        border-bottom: 0.5pt solid #ddd;
    }
    .print-checkbox {
        width: 9px; height: 9px; border: 1px solid #333; flex-shrink: 0;
        border-radius: 50%;
    }
    .print-quantity { font-weight: bold; text-align: right; width: 15px; flex-shrink: 0; }
    .print-item-name { flex-grow: 1; }
    .print-tally { width: 45px; height: 10px; border-bottom: 0.75px solid #888; flex-shrink: 0; }
    .critical-item { font-weight: bold; background-color: #e0e0e0; }

    .print-tally-boxes {
        display: flex;
        flex-direction: column;
        gap: 2px;
        margin-left: auto;
    }
    .tally-row {
        display: flex;
        gap: 2px;
    }
    .print-tally-box {
        width: 7px; height: 7px; border: 0.75px solid #666;
    }
}
