/*
  Temperature Check section.
  Layout: single outer border on .temp-table-section (like all other form sections),
  header bar inside with a light bottom separator, card grid inside with no own border.
  Internal card separators use border-left on non-first cards (avoids open right edge).
  Tokens (--pp-border etc.) resolve automatically via data-force-light in the print
  workstation, so no @media print border overrides are needed.
*/

.temp-table-section {
    border: var(--pp-border);
    width: 100%;
    margin-top: 8px;
    font-family: Arial, sans-serif;
    page-break-inside: avoid;
    /* Section is part of the print packet — always light, regardless of host theme.
       Forces UA form-control chrome (input backgrounds) to light too. */
    color-scheme: light;
}

/* ── Hidden restore banner (screen-only, .no-print) ────────────────────────── */

.temp-restore-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--pp-bg-instructions);
    border: 1px solid #fde68a;
    border-radius: var(--pp-radius-lg);
}

.temp-restore-icon {
    width: 14px;
    height: 14px;
    color: #d97706;
    flex-shrink: 0;
}

.temp-restore-text {
    font-size: var(--pp-font-size-sm);
    font-weight: 500;
    color: #92400e;
}

.temp-restore-btn {
    margin-left: auto;
    padding: 2px 10px;
    background: var(--pp-accent-yellow);
    color: white;
    border: none;
    border-radius: var(--pp-radius-md);
    font-size: var(--pp-font-size-xs);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.temp-restore-btn:hover { background: #d97706; }

/* ── Stale warning (screen-only, .no-print) ─────────────────────────────────── */

.temp-stale-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-bottom: 3px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: var(--pp-radius-md);
    font-size: var(--pp-font-size-sm);
    color: #78350f;
}

.temp-stale-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    color: #d97706;
}

.temp-stale-refresh-btn {
    margin-left: auto;
    padding: 1px 8px;
    background: var(--pp-accent-yellow);
    color: white;
    border: none;
    border-radius: var(--pp-radius-sm);
    font-size: var(--pp-font-size-xs);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.temp-stale-refresh-btn:hover { background: #d97706; }

/* ── Section header (inside outer border) ───────────────────────────────────── */

.temp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 8px;
    background: var(--pp-bg-header);
    border-bottom: var(--pp-border-light);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.temp-section-title {
    font-size: var(--pp-font-size-xs);
    font-weight: 700;
    color: var(--pp-text-muted);
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.temp-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.temp-captured-at {
    font-size: var(--pp-font-size-xs);
    color: var(--pp-text-faint);
}

.temp-icon-btn {
    display: flex;
    align-items: center;
    padding: 2px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--pp-text-faint);
    transition: color 0.15s;
    border-radius: var(--pp-radius-sm);
}

.temp-icon-btn:hover { color: var(--pp-text-secondary); }

.temp-btn-icon {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    display: block;
}

.temp-hide-btn:hover { color: #dc2626; }

/* ── Card grid (inside outer border) ────────────────────────────────────────── */

/* Per-card outlines provide the spreadsheet gridline look. Outlines (vs borders)
   don't take up layout space, so adjacent cards share a single 1px line and
   empty grid tracks paint nothing — preserving the white-paper backdrop when
   a row has fewer than the maximum cards. */
.temp-card-grid {
    display: grid;
    /* auto-fill (not auto-fit) keeps trailing empty tracks reserved so a lone
       card doesn't stretch to fill the row. ~7 cards across at typical
       print-packet widths; each card stays at its 120px minimum even when
       the rest of the row is empty. */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0;
    background: transparent;
}

.temp-card {
    display: flex;
    flex-direction: column;
    background: var(--pp-bg-white);
    outline: 1px solid #94a3b8;
    /* Cards must not split across pages — preserve full vessel readout */
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.temp-card--nj {
    background: var(--pp-bg-subheader);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Input row */
.temp-input-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    min-height: 28px;
}

.temp-setpoint-input {
    width: 100%;
    border: none;
    border-bottom: 1.5px solid var(--pp-text-muted);
    background: #fff;
    text-align: center;
    font-size: var(--pp-font-size-md);
    font-weight: 600;
    color: var(--pp-text-primary);
    outline: none;
    padding: 1px 0;
    font-family: inherit;
    min-width: 0;
    color-scheme: light;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.temp-setpoint-input::placeholder { color: var(--pp-text-faint); font-weight: 400; }
.temp-setpoint-input:focus { border-bottom-color: #3b82f6; }

/* Global `.dark input[type=text]` rule in app.css forces a dark background with
   !important and beats the plain class selector above. Scoping under the
   ancestor [data-force-light] (which lives on the print-content root and the
   .temp-table-section) raises specificity past .dark input[type=text] (0,2,1)
   so the white-paper styling sticks inside the print packet. */
[data-force-light] .temp-input-cell {
    background-color: #fff !important;
}
[data-force-light] input.temp-setpoint-input[type=text],
[data-force-light] input.temp-setpoint-input,
.temp-table-section input.temp-setpoint-input {
    background-color: #fff !important;
    color: var(--pp-text-primary) !important;
    border-color: transparent !important;
    border-bottom-color: var(--pp-text-muted) !important;
    color-scheme: light !important;
}
[data-force-light] input.temp-setpoint-input[type=text]:focus,
[data-force-light] input.temp-setpoint-input:focus {
    border-bottom-color: #3b82f6 !important;
}

.temp-nj-label {
    font-size: var(--pp-font-size-xs);
    font-weight: 700;
    color: var(--pp-text-faint);
    letter-spacing: 0.05em;
}

/* Horizontal divider between setpoint row and vessel data */
.temp-card-divider {
    height: 1px;
    background: #cbd5e1; /* slate-300 — readable on print, matches grid contrast */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Vessel data */
.temp-card-body {
    padding: 4px 6px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.temp-vessel-code {
    font-size: var(--pp-font-size-xs);
    font-weight: 700;
    color: var(--pp-text-secondary);
    white-space: nowrap;
}

.temp-readings {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    color: var(--pp-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.temp-sep { color: var(--pp-text-faint); }
.temp-current-temp { color: var(--pp-text-secondary); }
.temp-current-sp   { color: var(--pp-text-faint); }

.temp-nj-subtle {
    font-size: 9px;
    color: var(--pp-text-faint);
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Bottling source-tank drain hint ("empties" / "N gal" remaining). Prints + screen. */
.temp-bottling-hint {
    font-size: 8px;
    font-weight: 600;
    color: var(--pp-text-faint);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}
