/* ============================================
   Units panel
   Same black/red/white look as the Equipment Manager.
   ============================================ */

#units-panel-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;
}

.up-modal {
    background: #0a0a1a;
    border: 1px solid #2a2a3a;
    border-top: 2px solid #e63946;
    color: #e0e0e0;
    border-radius: 12px;
    width: 600px;
    max-width: 95vw;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.up-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #1e1e2e;
    flex-shrink: 0;
}
.up-header h2 { margin: 0; font-size: 1.05em; font-weight: 600; color: #fff; letter-spacing: 0.02em; }

.up-close-btn {
    background: none; border: none; color: #555; font-size: 1.4em;
    cursor: pointer; padding: 0 4px; line-height: 1; transition: color 0.15s;
}
.up-close-btn:hover { color: #e63946; }

.up-body {
    flex: 1; overflow-y: auto; padding: 16px 20px;
    display: flex; flex-direction: column; gap: 20px;
}

.up-list-section h3,
.up-form-section h3 {
    margin: 0 0 10px 0; font-size: 0.8em; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em; color: #888;
}

.up-empty { color: #777; font-size: 0.9em; padding: 10px 2px; }

/* ── One unit ───────────────────────────────── */

.up-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; background: #111120;
    border: 1px solid #1e1e30; border-left: 4px solid #2e7d4f;
    border-radius: 8px; margin-bottom: 8px;
}
/* quiet too long: amber */
.up-row-quiet { border-left-color: #f0a202; background: #17140c; }

.up-row-main { flex: 1; min-width: 0; }
.up-row-title { display: flex; align-items: center; gap: 8px; }
.up-name { font-size: 1.02em; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-type {
    font-size: 0.7em; font-weight: 700; letter-spacing: 0.06em;
    color: #cfd3da; background: #23233a; border-radius: 4px; padding: 2px 6px; flex-shrink: 0;
}
.up-serial { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8em; color: #8a8fa0; margin-top: 3px; }

.up-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.up-fact { font-size: 0.84em; color: #b6bac6; }
.up-fact-quiet { color: #f0a202; font-weight: 600; }
.up-fact-look { color: #ff8a80; font-weight: 600; }

.up-row-side { flex-shrink: 0; width: 190px; max-width: 42%; }
.up-small-label { display: block; font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.06em; color: #777; margin-bottom: 4px; }

/* ── What is on each line of a unit ─────────── */

.up-lines {
    margin: -9px 0 8px; padding: 10px 14px 12px;
    background: #0d0d1a; border: 1px solid #1e1e30; border-top: 1px dashed #26263a;
    border-left: 4px solid #2e7d4f; border-radius: 0 0 8px 8px;
}
.up-lines-title { font-size: 0.78em; font-weight: 600; color: #9aa0b2; margin-bottom: 8px; }
/* Two boxes a row, so a real product name fits without being cut off. */
.up-lines-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.up-line { min-width: 0; }
.up-line-select {
    width: 100%; box-sizing: border-box;
    background: #0f0f1e; color: #e8e8ee;
    border: 1px solid #2a2a40; border-radius: 6px;
    padding: 7px 8px; font-size: 0.86em; font-family: inherit;
}
.up-line-select:focus, .up-line-day:focus { outline: none; border-color: #e63946; }
.up-line-past { font-size: 0.74em; color: #7d8296; margin-top: 5px; line-height: 1.35; }
.up-line-now { color: #b6bac6; }
.up-line-x {
    background: none; border: none; padding: 0 0 0 6px; cursor: pointer;
    color: #8a8fa0; font-size: 1em; font-family: inherit; text-decoration: underline;
}
.up-line-x:hover { color: #ff8a80; }
.up-line-x:disabled { opacity: 0.5; cursor: default; }
.up-line-change {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
    margin-top: 12px; padding: 10px 12px;
    background: #17140c; border: 1px solid #5c4a12; border-radius: 6px;
}
.up-line-change-words { font-size: 0.88em; color: #f3e3b0; font-weight: 600; }
.up-line-day {
    background: #0f0f1e; color: #e8e8ee; border: 1px solid #2a2a40; border-radius: 6px;
    padding: 7px 8px; font-size: 0.9em; font-family: inherit; color-scheme: dark;
}
.up-line-change .up-add-btn, .up-line-change .up-cancel-btn { padding: 7px 14px; }
.up-line-change-note { flex-basis: 100%; font-size: 0.78em; color: #a89a6a; }
@media (max-width: 520px) { .up-lines-grid { grid-template-columns: minmax(0, 1fr); } }

/* ── Form ───────────────────────────────────── */

.up-form-section { border-top: 1px solid #1e1e2e; padding-top: 16px; }
.up-field { margin-bottom: 12px; }
.up-field label { display: block; font-size: 0.82em; font-weight: 600; color: #c8ccd6; margin-bottom: 5px; }
.up-field-hint { font-size: 0.76em; color: #6f7484; margin-top: 4px; }

.up-field input,
.up-field select,
.up-truck-select {
    width: 100%; box-sizing: border-box;
    background: #0f0f1e; color: #e8e8ee;
    border: 1px solid #2a2a40; border-radius: 6px;
    padding: 9px 10px; font-size: 0.92em; font-family: inherit;
}
.up-field input:focus,
.up-field select:focus,
.up-truck-select:focus { outline: none; border-color: #e63946; }
#up-input-serial { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.06em; text-transform: uppercase; }

.up-status { font-size: 0.88em; min-height: 1.2em; margin: 4px 0 10px; line-height: 1.35; }
.up-status-ok { color: #7bd88f; }
.up-status-error { color: #ff8a80; }

.up-form-btns { display: flex; gap: 10px; }
.up-add-btn {
    background: #e63946; color: #fff; border: none; border-radius: 6px;
    padding: 10px 18px; font-size: 0.92em; font-weight: 600; cursor: pointer;
}
.up-add-btn:hover { background: #cf2f3c; }
.up-add-btn:disabled { opacity: 0.5; cursor: default; }
.up-cancel-btn {
    background: none; color: #b6bac6; border: 1px solid #2a2a40; border-radius: 6px;
    padding: 10px 18px; font-size: 0.92em; font-weight: 600; cursor: pointer;
}
.up-cancel-btn:hover { border-color: #555; color: #fff; }
#up-list-status { margin: 8px 0 12px; }
#up-list-status:empty { margin: 0 0 4px; min-height: 0; }

/* ── "To look at" ───────────────────────────── */

button.up-fact-look {
    background: none; border: none; padding: 0; cursor: pointer;
    font-family: inherit; text-decoration: underline;
}
.up-problems {
    margin: -2px 0 10px 14px; padding: 10px 12px;
    background: #0f0f1e; border: 1px solid #2a2a40; border-radius: 8px;
}
.up-problems-note { font-size: 0.8em; color: #8a8fa0; margin-bottom: 8px; }
.up-problem { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid #1e1e30; }
.up-problem-text { flex: 1; min-width: 0; }
.up-problem-what { font-size: 0.88em; color: #e0e0e0; }
.up-problem-raw {
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.74em; color: #9aa0b4;
    background: #0a0a16; border-radius: 4px; padding: 5px 7px; margin-top: 5px;
    white-space: pre-wrap; word-break: break-all;
}
.up-problem-when { font-size: 0.74em; color: #6f7484; margin-top: 4px; }
.up-looked-btn {
    flex-shrink: 0; background: none; color: #c8ccd6; border: 1px solid #3a3a55; border-radius: 6px;
    padding: 6px 10px; font-size: 0.8em; font-weight: 600; cursor: pointer;
}
.up-looked-btn:hover { border-color: #7bd88f; color: #7bd88f; }
.up-looked-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Last files received ────────────────────── */

.up-uploads-section { border-top: 1px solid #1e1e2e; padding-top: 16px; }
.up-uploads-section h3 {
    margin: 0 0 10px 0; font-size: 0.8em; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em; color: #888;
}
.up-upload { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 6px 0; border-bottom: 1px solid #16162a; font-size: 0.84em; }
.up-upload-when { color: #8a8fa0; width: 118px; flex-shrink: 0; }
.up-upload-unit { color: #fff; font-weight: 600; width: 120px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-upload-what { color: #b6bac6; flex: 1; min-width: 180px; }
.up-upload-notin .up-upload-what { color: #f0a202; }

@media (max-width: 560px) {
    #units-panel-modal { padding-top: 12px; }
    .up-row { flex-direction: column; align-items: stretch; }
    .up-row-side { width: 100%; max-width: 100%; }
}
