/* BOS 1Office — cùng ngôn ngữ thiết kế với BOS Automation Hub (nền navy, thẻ bo góc, gradient xanh–tím). */
:root {
  --bg: #0b0f19; --bg-2: #111827; --card: #1e293b; --card-hover: #26354a; --line: #334155; --line-soft: rgba(51,65,85,.55);
  --blue: #3b82f6; --purple: #8b5cf6; --cyan: #38bdf8; --text: #f8fafc; --muted: #94a3b8; --dim: #64748b;
  --ok: #34d399; --ok-bg: rgba(16,185,129,.12); --ok-line: rgba(16,185,129,.28);
  --warn: #fbbf24; --warn-bg: rgba(245,158,11,.12); --warn-line: rgba(245,158,11,.3);
  --bad: #f87171; --bad-bg: rgba(239,68,68,.12); --bad-line: rgba(239,68,68,.3);
  --glow: rgba(59,130,246,.18); --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 14px;
  background: var(--bg); color: var(--text); display: flex; flex-direction: column; min-height: 100vh;
  background-image: radial-gradient(circle at 12% 8%, rgba(59,130,246,.09) 0%, transparent 38%),
                    radial-gradient(circle at 88% 92%, rgba(139,92,246,.09) 0%, transparent 40%);
  background-attachment: fixed;
}
button, input { font: inherit; color: inherit; }
b { font-weight: 700; }

/* ---------- thanh trên ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 28px; border-bottom: 1px solid var(--line-soft); background: rgba(11,15,25,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo-badge { background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; font-weight: 800; font-size: 18px;
  padding: 8px 13px; border-radius: 12px; box-shadow: 0 4px 16px rgba(59,130,246,.4); letter-spacing: .5px; }
.brand h1 { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.brand p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.top-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 12px;
  font-weight: 700; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); }
.chip.muted { font-weight: 600; color: var(--dim); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.chip-id { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.chip-id.offline { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.chip-id.busy { color: var(--cyan); background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.3); }

/* ---------- bố cục ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 370px 1fr; gap: 22px; padding: 22px 28px 28px;
  max-width: 1680px; width: 100%; margin: 0 auto; }
.steps { display: flex; flex-direction: column; gap: 18px; }
.board { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  position: relative; transition: border-color .2s ease, box-shadow .2s ease; }
.card.step::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--blue), var(--purple)); opacity: .0; transition: opacity .2s; }
.card.step:hover::before, .card.step:focus-within::before { opacity: 1; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-no { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, rgba(59,130,246,.25), rgba(139,92,246,.25)); border: 1px solid rgba(139,92,246,.35); }
.step-head h2 { font-size: 15px; font-weight: 700; }

/* ---------- ô nhập ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
input[type=text], input[type=password], input[type=number], input[type=search] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; outline: none;
  transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--glow); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 70px 84px 1fr; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; margin: 2px 0 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }
.hint { font-size: 12px; color: var(--dim); margin-top: 10px; line-height: 1.5; }
.hint:empty { display: none; }

.folder-box { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px dashed var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.folder-box.set { border-style: solid; border-color: rgba(59,130,246,.45); }
.folder-icon { font-size: 20px; }
.folder-path { flex: 1; font-size: 12.5px; color: var(--muted); word-break: break-all; line-height: 1.4; }
.folder-box.set .folder-path { color: var(--text); }

/* ---------- nút ---------- */
.btn { background: var(--bg-2); border: 1px solid var(--line); padding: 9px 15px; border-radius: 10px; font-weight: 650;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: all .18s ease; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--blue); transform: translateY(-1px); box-shadow: 0 4px 12px var(--glow); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #2563eb, #3b82f6); border: none; box-shadow: 0 4px 14px rgba(37,99,235,.3); }
.btn-run { background: linear-gradient(135deg, #2563eb, #7c3aed); border: none; font-size: 14.5px; padding: 12px 16px;
  box-shadow: 0 6px 20px rgba(124,58,237,.35); }
.btn-ghost { background: transparent; }
.btn-accept { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.btn-row.right { justify-content: flex-end; }
.btn-col { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.icon-btn { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg-2); color: var(--text); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.segmented button { background: transparent; border: none; padding: 8px; border-radius: 9px; cursor: pointer; font-weight: 650;
  font-size: 12.5px; color: var(--muted); transition: all .15s; }
.segmented button.active { background: var(--card-hover); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }

.progress { position: relative; height: 26px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  margin: 12px 0 10px; overflow: hidden; display: none; }
.progress.on { display: block; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--blue), var(--purple));
  transition: width .4s ease; }
.progress span { position: relative; display: block; text-align: center; font-size: 12px; font-weight: 700; line-height: 24px; }

/* ---------- thống kê ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; }
.stat-num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.stat.good .stat-num { color: var(--ok); }
.stat.warn .stat-num { color: var(--warn); }
.stat.muted .stat-num { color: var(--dim); }
.warnings { background: var(--warn-bg); border: 1px solid var(--warn-line); color: #fde68a; border-radius: 12px; padding: 10px 14px;
  font-size: 13px; line-height: 1.5; }

/* ---------- bảng ---------- */
.table-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; min-height: 420px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar-right input { width: 180px; padding: 6px 10px; }
.tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { background: transparent; border: none; padding: 5px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 650;
  color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--card-hover); color: var(--text); }
.table-wrap { overflow: auto; flex: 1; max-height: calc(100vh - 330px); position: relative; }
table.tasks { width: 100%; border-collapse: collapse; }
.tasks th { position: sticky; top: 0; background: var(--bg-2); z-index: 2; text-align: left; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .6px; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tasks td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 13px; }
.tasks tbody tr { cursor: pointer; transition: background .12s; }
.tasks tbody tr:hover { background: rgba(38,53,74,.55); }
.tasks tbody tr.sel { background: rgba(59,130,246,.10); box-shadow: inset 3px 0 0 var(--blue); }
.tasks tbody tr.none td { color: var(--dim); }
.c-check { width: 44px; } .c-files { width: 30%; } .c-method { width: 110px; } .c-result { width: 22%; }
.cb { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); display: grid; place-items: center;
  background: var(--bg); cursor: pointer; transition: all .12s; }
.cb.on { background: linear-gradient(135deg, var(--blue), var(--purple)); border-color: transparent; }
.cb.on::after { content: '✓'; font-size: 13px; font-weight: 900; color: #fff; }
.cb.dis { opacity: .3; cursor: not-allowed; }
.t-title { font-weight: 650; line-height: 1.4; }
.t-sub { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.t-id { font-family: Consolas, 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--cyan); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  border: 1px solid var(--line); color: var(--muted); background: var(--bg-2); white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.pill.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.pill.info { color: var(--cyan); background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.28); }
.flag { color: var(--warn); font-size: 12px; margin-top: 5px; line-height: 1.45; }
.flag::before { content: '⚠ '; }
.files { display: flex; flex-direction: column; gap: 5px; }
.file { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file img { width: 38px; height: 38px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); flex-shrink: 0; background: var(--bg); }
.file .ph { width: 38px; height: 38px; border-radius: 7px; border: 1px dashed var(--line); display: grid; place-items: center; flex-shrink: 0; color: var(--dim); }
.file span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.res-detail { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.empty { position: absolute; inset: 60px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; gap: 8px; pointer-events: none; }
.empty-icon { font-size: 46px; opacity: .8; }
.empty h3 { color: var(--text); font-size: 17px; }

/* ---------- nhật ký ---------- */
.console { padding: 0; }
.console summary { cursor: pointer; padding: 12px 16px; font-weight: 700; font-size: 13px; list-style: none; }
.console summary::before { content: '▸ '; color: var(--dim); }
.console[open] summary::before { content: '▾ '; }
.console pre { margin: 0 14px 14px; max-height: 220px; overflow: auto; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-family: Consolas, 'JetBrains Mono', monospace; font-size: 11.5px; color: #cbd5e1;
  white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.muted { color: var(--dim); font-weight: 500; }

/* ---------- ngăn chi tiết ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 92vw; background: var(--bg-2);
  border-left: 1px solid var(--line); z-index: 40; display: flex; flex-direction: column; box-shadow: -20px 0 40px rgba(0,0,0,.45);
  animation: slide .22s cubic-bezier(.16,1,.3,1); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line-soft); }
.drawer-head h3 { font-size: 15px; line-height: 1.45; }
.drawer-body { padding: 16px 18px 24px; overflow: auto; }
.dr-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.dr-img { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; min-height: 180px; display: grid; place-items: center;
  overflow: hidden; color: var(--dim); font-size: 13px; }
.dr-img img { max-width: 100%; max-height: 380px; display: block; cursor: zoom-in; }
.dr-files { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.dr-files .file span { color: var(--text); }
.dr-flags { margin-top: 10px; }
.dr-result { margin-top: 12px; }

/* ---------- hộp thoại ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(2,6,15,.7); backdrop-filter: blur(3px); z-index: 60;
  display: grid; place-items: center; padding: 20px; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 18px; width: 560px; max-width: 100%;
  max-height: 86vh; display: flex; flex-direction: column; padding: 22px; box-shadow: 0 30px 60px rgba(0,0,0,.5);
  animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 17px; margin-bottom: 12px; }
.md-body { overflow: auto; font-size: 13.5px; line-height: 1.6; color: #cbd5e1; margin-bottom: 18px; }
.md-body .kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin: 8px 0 12px; }
.md-body .kv b { color: var(--text); }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; background: var(--bg); }
.pick.on { border-color: var(--blue); background: rgba(59,130,246,.08); }
.pick img, .pick .ph { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.pick .ph { border: 1px dashed var(--line); display: grid; place-items: center; }
.pick small { color: var(--warn); display: block; }

/* ---------- thông báo ---------- */
.toasts { position: fixed; top: 76px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; width: 380px; max-width: 90vw; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px;
  padding: 12px 14px; font-size: 13px; line-height: 1.5; box-shadow: 0 12px 30px rgba(0,0,0,.45); animation: pop .2s ease; }
.toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.error { border-left-color: var(--bad); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
