*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    background: #f4f5f7;
    color: #1a1a2e;
}

header {
    background: #1a1a2e;
    color: white;
    padding: 0 1.5rem;
}
.header-inner {
    max-width: 800px;
    margin: 0 auto;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.5px; }
nav a { color: #ccc; text-decoration: none; margin-left: 1.5rem; font-size: 0.9rem; }
nav a:hover { color: white; }

main {
    max-width: 800px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
h1 { font-size: 1.4rem; }
h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: #444; }

.date-nav { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.date-nav-top { display: flex; align-items: center; gap: 1rem; }
.date-nav-top a { text-decoration: none; color: #1a1a2e; font-size: 1.2rem; padding: 0.2rem 0.4rem; }
.date-nav-top span { font-weight: 600; }
.date-nav-top .nav-disabled { color: #ccc; font-weight: 400; padding: 0.2rem 0.4rem; }
.date-jump { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.date-jump input[type="date"] { font-family: inherit; font-size: 0.9rem; padding: 0.25rem 0.4rem; border: 1px solid #ccc; border-radius: 5px; }
.date-jump .btn { margin-top: 0; padding: 0.3rem 0.9rem; font-size: 0.85rem; }

.card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.8rem; text-transform: uppercase; color: #888; padding: 0.4rem 0.5rem; border-bottom: 1px solid #eee; }
td { padding: 0.55rem 0.5rem; border-bottom: 1px solid #f0f0f0; }
tfoot td { font-size: 1rem; border-top: 2px solid #eee; border-bottom: none; padding-top: 0.75rem; }

.badge { font-size: 0.78rem; padding: 0.2rem 0.5rem; border-radius: 4px; font-weight: 600; }
.badge-ok  { background: #e6f4ea; color: #276738; }
.badge-warn{ background: #fff8e1; color: #9a6700; }
.badge-err { background: #fce8e6; color: #c62828; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error   { background: #fce8e6; color: #c62828; }
.alert-success { background: #e6f4ea; color: #276738; }
.alert-warn    { background: #fff8e1; color: #9a6700; }

.instructions { margin-top: 1rem; font-size: 0.88rem; color: #555; }
.instructions ul { margin: 0.4rem 0 0 1.2rem; }
.instructions li { margin-bottom: 0.2rem; }

.form-row { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 0.9rem; }
.form-row label { min-width: 170px; font-size: 0.9rem; color: #555; }
.form-row input, .form-row select, .form-row textarea {
    flex: 1;
    padding: 0.45rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95rem;
    font-family: inherit;
}
.form-row textarea { resize: vertical; }
.form-row input:disabled, .form-row select:disabled, .form-row textarea:disabled,
.override-checkbox:disabled {
    background: #eee;
    color: #888;
    border-color: #ddd;
    cursor: not-allowed;
}
.readonly { font-weight: 600; font-size: 1rem; }
.form-locked fieldset { border: none; margin: 0; padding: 0; }

.btn {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary   { background: #1a1a2e; color: white; }
.btn-primary:hover:not(:disabled) { background: #2d2d4e; }
.btn-secondary { background: #eee; color: #333; }

.submitted-view .row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}
.over-short td, .over-short span { color: #c62828; font-weight: 600; }
.over td, .over span { color: #276738; font-weight: 600; }

.manager-alert-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.manager-alert-row:last-child { border-bottom: none; }
@media (max-width: 480px) {
    .manager-alert-row { flex-direction: column; align-items: stretch; }
    .manager-alert-row form { align-self: flex-start; }
}

.match-status {
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.match-ok  { background: #e6f4ea; color: #276738; }
.match-err { background: #fce8e6; color: #c62828; }

/* Select-checks inline expansion (Shift Change) — plain accordion within the
   page's normal flow, not an overlay, so there's nothing that could be
   mistaken for or blocked like a popup. */
.inline-expand {
    background: #f9f9fb;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 1rem;
    margin: 0.9rem 0;
}

/* Parse loading overlay */
.parse-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26,26,46,0.55);
    z-index: 999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}
.parse-overlay.active { display: flex; }
.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Narrow-phone nav: 4 links (added by CLOSE-012's Manager link) no longer
   fit the fixed-height header without wrapping the whole page horizontally
   -- shrink spacing/type and let the nav itself scroll sideways as a
   fallback, so the page body never does. */
@media (max-width: 480px) {
    header { padding: 0 0.75rem; }
    .header-inner { height: 48px; }
    nav { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    nav a { margin-left: 0.9rem; font-size: 0.82rem; white-space: nowrap; }
    nav a:first-child { margin-left: 0; }
}

/* Print report (Night Close, admin) — one page: hide site chrome and
   in-progress UI, keep the vendor table and the submitted close summary. */
@media print {
    .no-print { display: none !important; }
    body { background: white; font-size: 12px; }
    main { max-width: 100%; margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; padding: 0.75rem; margin-bottom: 0.75rem; break-inside: avoid; }
    h1 { font-size: 1.15rem; }
    h2 { font-size: 0.9rem; }
    .submitted-view .row { padding: 0.3rem 0; font-size: 0.85rem; }
    table { font-size: 0.85rem; }
    @page { margin: 0.5in; }
}
