/* ============================================================================
   line_downtime.css — простои и переналадки линии (mobile-first)
   ========================================================================= */

.ld-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 12px 80px;
}

.ld-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.ld-header h2 { font-size: 20px; margin: 0; }
.ld-refresh {
    width: 40px; height: 40px;
    border: 1px solid #cbd5e1; border-radius: 10px;
    background: #fff; font-size: 18px; cursor: pointer;
}
.ld-refresh:active { background: #f1f5f9; }

/* ---- Cards ---- */
.ld-lines { display: flex; flex-direction: column; gap: 12px; }

.ld-card {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    border-radius: 14px; padding: 14px 16px;
    border: 1px solid #e2e8f0; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.ld-card-info { flex: 1; min-width: 0; }
.ld-card-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ld-order { font-size: 16px; font-weight: 700; color: #0f172a; }
.ld-chip {
    font-size: 12px; color: #475569; background: #eef2f7;
    border-radius: 6px; padding: 1px 8px; font-weight: 600;
}
.ld-equip { font-size: 14px; color: #64748b; margin-top: 2px; }
.ld-product {
    font-size: 14px; color: #0f172a; font-weight: 600; margin-top: 4px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ld-product-prev { font-size: 13px; color: #94a3b8; margin-top: 2px; }
.ld-meta { font-size: 12.5px; color: #94a3b8; margin-top: 3px; }
.ld-chg-from { font-size: 13px; color: #94a3b8; margin-top: 5px; line-height: 1.35; }
.ld-chg-to { font-size: 14px; color: #0f172a; font-weight: 600; margin-top: 3px; line-height: 1.35; }
.ld-chg-from b, .ld-chg-to b { color: #64748b; }

.ld-running { border-left: 5px solid #22c55e; }
.ld-down { border-left: 5px solid #ef4444; background: #fff7f7; }
.ld-changeover { border-left: 5px solid #f59e0b; background: #fffbeb; }

.ld-downbanner {
    margin-top: 8px; font-size: 15px; font-weight: 700; color: #dc2626;
    display: flex; align-items: center; gap: 6px;
}
.ld-banner-orange { color: #d97706; }
.ld-elapsed { font-variant-numeric: tabular-nums; font-size: 17px; }
.ld-reason { margin-top: 6px; font-size: 14px; color: #334155; }
.ld-reason-empty { color: #b45309; font-weight: 600; }
.ld-reason-edit {
    border: none; background: transparent; color: #94a3b8;
    cursor: pointer; font-size: 13px; padding: 0 4px;
}
.ld-reason-edit:hover { color: #2563eb; }

.ld-card-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }

/* ---- Buttons ---- */
.ld-btn {
    border: none; border-radius: 12px; cursor: pointer;
    font-weight: 700; font-size: 16px; padding: 12px 16px;
    color: #fff; min-width: 96px;
}
.ld-btn:active { transform: translateY(1px); }
.ld-btn:disabled { opacity: .5; cursor: not-allowed; }

.ld-stop { background: #f59e0b; font-size: 20px; min-width: 110px; min-height: 64px; }
.ld-stop:active { background: #d97706; }
.ld-go { background: #22c55e; }
.ld-go:active { background: #16a34a; }
.ld-go-full { flex: 1; min-height: 56px; }
.ld-reason-btn { background: #64748b; }
.ld-start { background: #f59e0b; width: 100%; margin-top: 8px; }
.ld-start:active { background: #d97706; }

/* ---- Empty / recent ---- */
.ld-empty {
    text-align: center; color: #94a3b8; padding: 28px 12px;
    border: 1px dashed #e2e8f0; border-radius: 12px; line-height: 1.5;
}
.ld-empty-sm { padding: 14px; }

.ld-recent { margin-top: 22px; }
.ld-recent h3, .ld-form h3 { font-size: 15px; color: #475569; margin: 0 0 10px; }
.ld-recent-list { display: flex; flex-direction: column; gap: 6px; }
.ld-log-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: 10px; background: #f8fafc;
}
.ld-log-body { flex: 1; min-width: 0; }
.ld-log-title { font-size: 14px; font-weight: 600; color: #0f172a; line-height: 1.35; }
.ld-log-sub {
    font-size: 12.5px; color: #64748b; margin-top: 3px; line-height: 1.4;
}
.ld-log-dur { font-weight: 700; color: #334155; font-variant-numeric: tabular-nums; }
.ld-live { color: #dc2626; font-weight: 700; }
.ld-log-del {
    border: none; background: transparent; color: #cbd5e1;
    font-size: 16px; cursor: pointer; padding: 2px 6px; flex-shrink: 0;
}
.ld-log-del:hover { color: #ef4444; }

/* ---- Sheet (место → причина) ---- */
.ld-sheet-overlay {
    position: fixed; inset: 0; z-index: 1080;
    background: rgba(15,23,42,.45);
    display: flex; align-items: flex-end; justify-content: center;
}
.ld-sheet-overlay.hidden { display: none; }
.ld-sheet {
    width: 100%; max-width: 720px;
    background: #fff; border-radius: 18px 18px 0 0;
    padding: 16px 16px 28px;
    max-height: 80vh; overflow-y: auto;
    animation: ld-slide-up .18s ease-out;
}
@keyframes ld-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.ld-sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.ld-sheet-head span { font-size: 17px; font-weight: 700; }
.ld-sheet-close {
    border: none; background: #f1f5f9; border-radius: 8px;
    width: 34px; height: 34px; font-size: 16px; cursor: pointer;
}
.ld-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ld-tile {
    border: 1px solid #cbd5e1; border-radius: 12px; background: #f8fafc;
    padding: 18px 12px; font-size: 16px; font-weight: 600; color: #0f172a;
    cursor: pointer; min-height: 64px; text-align: center;
}
.ld-tile:active { background: #e2e8f0; }
.ld-tile-other { grid-column: 1 / -1; background: #fef3c7; border-color: #fcd34d; }
.ld-back {
    border: none; background: transparent; color: #2563eb;
    font-size: 15px; cursor: pointer; padding: 4px 0 12px;
}

/* ---- Changeover form ---- */
.ld-form { margin-top: 22px; padding: 16px; border: 1px solid #e2e8f0; border-radius: 14px; }
.ld-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ld-field > span { font-size: 13px; color: #64748b; font-weight: 600; }
.ld-field-hint { font-size: 12px; color: #94a3b8; font-weight: 400; }
.ld-select {
    border: 1px solid #cbd5e1; border-radius: 10px; padding: 12px;
    font-size: 15px; background: #fff;
}
.ld-prev {
    font-size: 14px; color: #0f172a; font-weight: 600;
    background: #f1f5f9; border-radius: 8px; padding: 10px 12px;
}

/* Кнопка выбора заказа + превью перехода */
.ld-pick {
    width: 100%; text-align: left; border: 1px solid #cbd5e1; border-radius: 10px;
    padding: 12px; font-size: 15px; background: #fff; color: #64748b; cursor: pointer;
    display: flex; align-items: center; gap: 8px; min-height: 48px;
}
.ld-pick.ld-pick-selected { color: #0f172a; border-color: #94a3b8; }
.ld-pick-num { font-weight: 700; flex-shrink: 0; }
.ld-pick-prod { color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-preview {
    font-size: 15px; color: #92400e; background: #fef3c7; border: 1px solid #fcd34d;
    border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; text-align: center;
}
.ld-preview b { color: #78350f; }

/* Поиск заказа в шите */
.ld-sheet-search {
    width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 12px;
    font-size: 15px; margin-bottom: 12px; box-sizing: border-box;
}
.ld-ord-list { display: flex; flex-direction: column; gap: 6px; }
.ld-ord-day {
    font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase;
    letter-spacing: .03em; padding: 8px 2px 2px;
}
.ld-ord-card {
    display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
    border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; padding: 12px; cursor: pointer;
}
.ld-ord-card:active { background: #f1f5f9; }
.ld-ord-date {
    flex-shrink: 0; font-size: 12px; font-weight: 700; color: #2563eb;
    background: #eff6ff; border-radius: 6px; padding: 3px 8px; min-width: 54px; text-align: center;
    font-variant-numeric: tabular-nums;
}
.ld-ord-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ld-ord-num { font-size: 15px; font-weight: 700; color: #0f172a; }
.ld-ord-prod { font-size: 13.5px; color: #334155; line-height: 1.3; }
.ld-ord-meta { font-size: 12px; color: #94a3b8; }

/* Оборудование — кнопки в ряд */
.ld-equip-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ld-equip-btn {
    flex: 1 1 90px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
    color: #334155; font-size: 15px; font-weight: 600; padding: 12px 10px;
    cursor: pointer; min-height: 48px;
}
.ld-equip-btn:active { background: #f1f5f9; }
.ld-equip-btn.active { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.ld-equip-btn.active:active { background: #d97706; }

/* Карточка «с какого» (read-only) и «на какой» (кликабельная) */
.ld-ord-static { cursor: default; }
.ld-ord-pick { width: 100%; position: relative; padding-right: 80px; }
.ld-ord-change {
    position: absolute; top: 10px; right: 12px; font-size: 12px; font-weight: 600; color: #2563eb;
}
.ld-prev-empty { font-size: 14px; color: #94a3b8; padding: 10px 2px; }

/* Свободная причина «Другое» */
.ld-other-input {
    width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 12px;
    font-size: 15px; resize: vertical; font-family: inherit; margin-bottom: 12px; box-sizing: border-box;
}
.ld-other-save { width: 100%; background: #22c55e; }

/* ---- Catalog (admin) ---- */
.ld-catalog { max-width: 820px; }
.ld-catalog-hint { color: #64748b; font-size: 13px; margin: -4px 0 16px; }
.ld-add-loc { background: #2563eb; }
.ld-catalog-body { display: flex; flex-direction: column; gap: 14px; }
.ld-cat-loc {
    border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; background: #fff;
}
.ld-cat-loc-head {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 8px; border-bottom: 1px solid #f1f5f9; margin-bottom: 8px;
}
.ld-cat-loc-name { font-size: 16px; font-weight: 700; }
.ld-cat-reasons { display: flex; flex-direction: column; gap: 4px; }
.ld-cat-reason {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 8px; border-radius: 6px;
}
.ld-cat-reason:hover { background: #f8fafc; }
.ld-cat-name { font-size: 14px; color: #1e293b; }
.ld-cat-actions button {
    border: none; background: transparent; cursor: pointer;
    font-size: 14px; padding: 3px 5px; border-radius: 6px;
}
.ld-cat-actions button:hover { background: #e2e8f0; }
.ld-cat-add-reason {
    margin-top: 8px; border: 1px dashed #cbd5e1; background: transparent;
    color: #2563eb; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.ld-inactive { opacity: .45; }
.ld-inactive .ld-cat-name { text-decoration: line-through; }
