/* ops-board.css — màn "Điều hành" (15/10/2026). Dùng biến màu của style.css nên tự theo chế độ tối. */
.ob-wrap { margin: 16px 0 28px; color: var(--text-main); }
.ob-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ob-title { margin: 0; font-size: 22px; font-weight: 800; color: var(--text-main); }
.ob-meta { margin: 4px 0 0; color: var(--text-muted); font-size: 13.5px; }
.ob-actions { display: flex; gap: 8px; align-items: center; }
.ob-select, .ob-btn {
    height: 38px; padding: 0 14px; border: 1px solid var(--border-color); border-radius: 10px;
    background: var(--bg-white); color: var(--text-main); font: 600 14px inherit; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
}
.ob-btn:hover, .ob-select:hover { border-color: var(--color-primary); }
.ob-btn:focus-visible, .ob-select:focus-visible, .ob-todo:focus-visible, .ob-col:focus-visible,
.ob-lane-tab:focus-visible, .ob-ptab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ob-btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
#ops-board-refresh { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
#ops-board-refresh.is-loading i { animation: obSpin 0.8s linear infinite; }
@keyframes obSpin { to { transform: rotate(360deg); } }

.ob-section { margin-bottom: 22px; }
.ob-h3 { margin: 0 0 10px; font-size: 16px; font-weight: 800; color: var(--text-main); }
.ob-empty { padding: 18px; color: var(--text-muted); text-align: center; }

/* ---- Việc cần làm ---- */
.ob-todos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ob-todo {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
    padding: 14px 16px; border: 1px solid var(--border-color); border-radius: 14px;
    background: var(--bg-white); color: var(--text-main); cursor: pointer; font: inherit;
    border-left: 4px solid var(--border-color); transition: border-color .15s, box-shadow .15s;
}
.ob-todo:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.ob-todo.has-fresh { border-left-color: var(--color-primary); }
.ob-todo.is-zero { opacity: .62; }
.ob-todo.is-open { border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(8, 116, 182, .18); }
.ob-todo-label { font-size: 13.5px; font-weight: 700; color: var(--text-muted); line-height: 1.3; }
.ob-todo-count { font-size: 30px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ob-todo.has-fresh .ob-todo-count { color: var(--color-primary); }
.ob-todo-sub { font-size: 12.5px; color: var(--text-muted); }
.ob-old, .ob-late { color: var(--color-red); font-weight: 800; }

/* ---- Luồng hàng ---- */
.ob-flow-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.ob-flow-head .ob-h3 { margin: 0; }
.ob-lane-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-active); gap: 2px; }
.ob-lane-tab {
    height: 32px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent;
    color: var(--text-muted); font: 700 13.5px inherit; cursor: pointer;
}
.ob-lane-tab.is-active { background: var(--bg-white); color: var(--color-primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.ob-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-left: auto; font-size: 12.5px; color: var(--text-muted); }
.ob-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ob-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.ob-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
/* Màn rộng: cả làn trên 1 hàng (giao 8 cột, thu hồi 7 — số cột do JS đặt --ob-cols) */
@media (min-width: 1700px) { .ob-flow { grid-template-columns: repeat(var(--ob-cols, 8), minmax(0, 1fr)); } }
@media (max-width: 900px) { .ob-todos, .ob-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ob-col {
    display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left;
    padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 14px;
    background: var(--bg-white); color: var(--text-main); cursor: pointer; font: inherit; min-width: 0;
    transition: border-color .15s, box-shadow .15s;
}
.ob-col:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.ob-col.is-zero { opacity: .62; }
.ob-col.is-open { border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(8, 116, 182, .18); }
.ob-col-label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: var(--text-muted); line-height: 1.3; }
.ob-step {
    flex: 0 0 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center;
    background: var(--bg-active); color: var(--text-muted); font-size: 11.5px; font-weight: 800;
}
.ob-col-count { font-size: 26px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ob-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bg-active); }
.ob-bar i { display: block; min-width: 3px; }
.ob-bar-empty { flex: 1; }
.ob-col-sub { font-size: 12.5px; color: var(--text-muted); }
.ob-a0 { background: #16a34a; }
.ob-a1 { background: #eab308; }
.ob-a2 { background: #f97316; }
.ob-a3 { background: #dc2626; }

/* ---- Danh sách chi tiết ---- */
.ob-panel { border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-white); padding: 16px; }
.ob-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.ob-panel-head .ob-h3 { margin: 0; }
.ob-panel-total { font-size: 13.5px; font-weight: 700; color: var(--text-muted); margin-left: 6px; }
.ob-close { width: 38px; justify-content: center; padding: 0; }
.ob-panel-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ob-ptab {
    height: 34px; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 9px;
    background: var(--bg-white); color: var(--text-muted); font: 600 13.5px inherit; cursor: pointer;
}
.ob-ptab b { margin-left: 4px; color: var(--text-main); }
.ob-ptab.is-active { border-color: var(--color-primary); color: var(--color-primary); background: rgba(8, 116, 182, .06); }
.ob-table-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--border-color); border-radius: 12px; }
.ob-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ob-table thead th {
    position: sticky; top: 0; z-index: 1; background: var(--bg-active); color: var(--text-muted);
    font-weight: 700; text-align: left; padding: 9px 10px; white-space: nowrap;
}
.ob-table td { padding: 9px 10px; border-top: 1px solid var(--border-color); vertical-align: top; }
.ob-table tbody tr:hover td { background: var(--bg-active); }
.ob-madi { font-weight: 800; cursor: pointer; white-space: nowrap; }
.ob-table td.ob-cell-code { white-space: nowrap; }
.ob-table td.ob-cell-code .ob-client { white-space: normal; max-width: 220px; }
.ob-table td.ob-cell-status { min-width: 120px; }
.ob-tag {
    margin-left: 6px; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 800;
    background: var(--bg-active); color: var(--text-muted);
}
.ob-strong { display: block; font-weight: 700; }
.ob-muted { display: block; color: var(--text-muted); font-size: 12.5px; }
.ob-cell-status { overflow-wrap: break-word; }
.ob-age { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.ob-age-0 { background: rgba(22, 163, 74, .12); color: #15803d; }
.ob-age-1 { background: rgba(234, 179, 8, .16); color: #a16207; }
.ob-age-2 { background: rgba(249, 115, 22, .14); color: #c2410c; }
.ob-age-3 { background: rgba(220, 38, 38, .12); color: #b91c1c; }
.ob-more { margin-top: 8px; }

/* ---- Huy hiệu menu + nhắc việc ---- */
.ob-nav-badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; align-items: center; justify-content: center;
    background: var(--color-red); color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
}
.ob-reminder {
    position: fixed; right: 20px; bottom: 20px; z-index: 1200; width: min(340px, calc(100vw - 32px));
    padding: 14px 16px; border-radius: 16px; background: var(--bg-white); color: var(--text-main);
    border: 1px solid var(--border-color); box-shadow: 0 14px 40px rgba(15, 23, 42, .22);
}
.ob-reminder-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 15px; }
.ob-reminder-x { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 16px; }
.ob-reminder ul { list-style: none; margin: 0 0 12px; padding: 0; }
.ob-reminder li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 14px; border-bottom: 1px dashed var(--border-color); }
.ob-reminder li b { color: var(--color-primary); font-variant-numeric: tabular-nums; }
.ob-reminder-actions { display: flex; gap: 8px; }
@media print { .ob-reminder { display: none !important; } }

/* Dark mode: chữ màu đậm trên nền nhạt của nhãn tuổi đơn đổi sang tông sáng */
body.dark-mode .ob-age-0, [data-theme="dark"] .ob-age-0 { color: #4ade80; }
body.dark-mode .ob-age-1, [data-theme="dark"] .ob-age-1 { color: #facc15; }
body.dark-mode .ob-age-2, [data-theme="dark"] .ob-age-2 { color: #fb923c; }
body.dark-mode .ob-age-3, [data-theme="dark"] .ob-age-3 { color: #f87171; }

/* ---- Thao tác nhanh trên dòng + chọn nhiều (15/10/2026) ---- */
.ob-cell-check { width: 34px; text-align: center; }
.ob-check { width: 17px; height: 17px; cursor: pointer; accent-color: var(--color-primary); }
.ob-table tr.is-selected td { background: rgba(8, 116, 182, .06); }
.ob-table tr.is-done td { opacity: .62; }
.ob-table tr.is-done td.ob-cell-actions, .ob-table tr.is-done td.ob-cell-status { opacity: 1; }
.ob-new-status { display: block; margin-top: 2px; font-weight: 800; color: var(--color-green); }
.ob-cell-actions { width: 1%; white-space: nowrap; }
.ob-acts { display: flex; align-items: center; gap: 4px; }
.ob-act {
    height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--color-primary);
    background: var(--color-primary); color: #fff; font: 700 12.5px inherit; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.ob-act:hover { filter: brightness(1.08); }
.ob-act-failed { background: var(--bg-white); color: var(--color-red); border-color: var(--color-red); }
.ob-act-delivered { background: var(--color-green); border-color: var(--color-green); }
.ob-ibtn {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-color);
    background: var(--bg-white); color: var(--text-muted); display: inline-grid; place-items: center;
    cursor: pointer; text-decoration: none; font-size: 13px;
}
.ob-ibtn:hover { color: var(--color-primary); border-color: var(--color-primary); }
.ob-act:focus-visible, .ob-ibtn:focus-visible, .ob-check:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.ob-done-tag { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 8px; color: var(--color-green); font-weight: 800; font-size: 12.5px; }

.ob-bulk {
    position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-bottom: 10px; padding: 8px 10px; border-radius: 12px;
    background: rgba(8, 116, 182, .08); border: 1px solid rgba(8, 116, 182, .25);
}
.ob-bulk > span { margin-right: 4px; font-size: 13.5px; }
.ob-bulk .ob-btn { height: 34px; }
.ob-bulk-hint { margin: 0 0 8px; }

/* Hộp "Chốt đã giao" */
.ob-modal-backdrop {
    position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 16px;
    background: rgba(15, 23, 42, .45);
}
.ob-modal {
    width: min(460px, 100%); padding: 18px; border-radius: 16px; background: var(--bg-white); color: var(--text-main);
    border: 1px solid var(--border-color); box-shadow: 0 18px 48px rgba(15, 23, 42, .3);
}
.ob-modal .ob-meta { margin-bottom: 12px; }
.ob-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13.5px; font-weight: 700; color: var(--text-muted); }
.ob-field input {
    height: 40px; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 10px;
    background: var(--bg-white); color: var(--text-main); font: 500 14.5px inherit;
}
.ob-field input:focus { outline: 2px solid var(--color-primary); outline-offset: 0; border-color: var(--color-primary); }
.ob-field-row { display: flex; gap: 6px; }
.ob-field-row input { flex: 1; min-width: 0; }
.ob-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
@media print { .ob-modal-backdrop { display: none !important; } }
