/* =====================================================================
   รอบ 38: หน้า นำเข้า/ส่งออกข้อมูล (/data, DataCenter.razor) + ลิงก์ "Excel" ในหน้าสินค้า/คลัง
   - โครง .fit ของ fit.css: หัว (แท็บนำเข้า/ส่งออก) อยู่กับที่, การ์ด/ตารางเลื่อนในกรอบ
   - .data-icard  การ์ดนำเข้า (แม่แบบ + ช่องวางไฟล์)       .data-pv*   ตรวจไฟล์ (ชิปตัวกรอง + ตาราง + แถบนำเข้า)
   - .data-done*  ผลการนำเข้า                              .data-x*    การ์ดส่งออก + แถบตัวกรอง
   - สีใช้ตัวแปรของธีมทั้งหมด (โหมดมืดทับตัวแปรเองใน dark.css) สีเฉพาะอยู่ท้ายไฟล์
   ===================================================================== */

@media screen {
  /* ---------- แท็บ ---------- */
  .data-tabs {
    display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--chip);
  }
  .data-tabs button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 18px;
    border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .data-tabs button:hover { color: var(--ink); }
  .data-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
  .data-tabs button.on svg { color: var(--brand); }

  /* ---------- ส่วนร่วม ---------- */
  .data-body { gap: 16px; }
  .data-lead { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
  .data-lead p { margin: 0; min-width: 0; }
  .data-limits {
    display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px;
    background: var(--chip); color: var(--muted); font-size: .78rem; font-weight: 600; white-space: nowrap;
  }
  .data-lock-note { margin: 0; }
  .data-ico {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
    background: var(--brand-soft); color: var(--brand-strong, var(--brand));
  }
  .data-tag {
    display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 9px; border-radius: 999px;
    background: var(--chip); color: var(--muted); font-size: .74rem; font-weight: 600; white-space: nowrap;
  }
  .data-tag.ok { background: var(--ok-soft); color: var(--ok); }
  .data-tag.lock { background: var(--warn-soft); color: var(--warn-text, #7a5300); }

  /* ---------- การ์ดนำเข้า ---------- */
  .data-icards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 16px; align-items: stretch; }
  .data-icard { margin: 0; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .data-icard-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .data-icard-title { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
  .data-icard-title h2 { margin: 0; font-size: 1.04rem; }
  .data-icard-desc { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
  .data-branch { gap: 4px; }
  .data-branch select { width: 100%; }
  .data-icard.is-locked .data-ico { background: var(--chip); color: var(--muted); }

  .data-drop {
    position: relative; flex: 1 0 auto; min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 16px 12px; border: 2px dashed var(--line); border-radius: 14px; background: var(--brand-tint);
    color: var(--muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  }
  .data-drop:hover, .data-drop:focus-within { border-color: var(--brand); color: var(--brand-strong, var(--brand)); }
  .data-drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .data-drop input[type="file"]:disabled { cursor: progress; }
  .data-drop-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); margin-bottom: 4px; }
  .data-drop strong { color: var(--ink); font-size: .92rem; font-weight: 600; }
  .data-drop small { font-size: .78rem; }
  .data-drop.is-busy { border-color: var(--brand); border-style: solid; }
  .data-drop.is-busy .data-drop-ico { animation: data-pulse 1.1s ease-in-out infinite; }
  @keyframes data-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

  .data-locked-box {
    flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 132px;
    padding: 16px 12px; border-radius: 14px; background: var(--warn-soft); color: var(--warn-text, #7a5300); text-align: center; font-size: .88rem;
  }
  .data-tpl {
    display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; padding: 4px 2px;
    color: var(--brand-strong, var(--brand)); font-size: .9rem; font-weight: 600; text-decoration: none;
  }
  .data-tpl:hover { text-decoration: underline; }

  /* ---------- ตรวจไฟล์ ---------- */
  .data-pv { gap: 12px; }
  .data-pv-head { margin: 0; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
  .data-pv-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 280px; }
  .data-pv-name { min-width: 0; }
  .data-pv-name h2 { margin: 0; font-size: 1.08rem; }
  .data-pv-file { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: .85rem; min-width: 0; }
  .data-pv-fname { overflow-wrap: anywhere; }
  .data-pv-branch { font-weight: 600; color: var(--ink); }

  .data-pv-chips { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
  .data-fchip {
    --c: var(--muted); --cbg: var(--chip);
    display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px 0 14px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .data-fchip .data-n { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--cbg); color: var(--c); font-size: .8rem; }
  .data-fchip.f-new { --c: var(--ok); --cbg: var(--ok-soft); }
  .data-fchip.f-update { --c: var(--brand-strong, var(--brand)); --cbg: var(--brand-soft); }
  .data-fchip.f-error { --c: var(--danger); --cbg: var(--danger-soft); }
  .data-fchip.f-warning { --c: var(--warn-text, #7a5300); --cbg: var(--warn-soft); }
  .data-fchip:hover { border-color: var(--muted); }
  .data-fchip.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

  .data-fwarn {
    padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn-text, #7a5300); font-size: .9rem;
  }
  .data-fwarn ul { margin: 4px 0 0; padding-left: 20px; }

  .data-pv-list { margin: 0; padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .data-pv-scroll { border: 0; border-radius: 0; background: none; }
  .data-ptable td { vertical-align: top; font-size: .92rem; }
  .data-ptable .data-c-line { width: 1%; text-align: right; color: var(--muted); white-space: nowrap; }
  .data-ptable th.r { text-align: right; }
  .data-ptable .data-c-key code { font-size: .84rem; background: var(--chip); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
  .data-ptable .data-c-key code:empty { display: none; }
  .data-ptable .data-c-key { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .data-ptable .data-c-name { min-width: 160px; font-weight: 500; }
  .data-ptable .data-c-sum { color: var(--muted); min-width: 160px; }
  .data-ptable .data-c-msg { min-width: 220px; }
  .data-ptable tr.is-err td { background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
  .data-ptable tr.is-err td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
  .data-ptable tr.is-warn td:first-child { box-shadow: inset 3px 0 0 #d39b1f; }
  .data-act { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
  .data-act.new { background: var(--ok-soft); color: var(--ok); }
  .data-act.upd { background: var(--brand-soft); color: var(--brand-strong, var(--brand)); }
  .data-act.err { background: var(--danger-soft); color: var(--danger); }
  .data-msg { display: block; position: relative; padding-left: 14px; font-size: .85rem; line-height: 1.45; }
  .data-msg + .data-msg { margin-top: 3px; }
  .data-msg::before { content: ""; position: absolute; left: 2px; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .data-msg.err { color: var(--danger); }
  .data-msg.warn { color: var(--warn-text, #8a5d00); }
  .data-more { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; border-top: 1px solid var(--line); }

  .data-pv-bar {
    flex: none; display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap;
    padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .data-pv-bar .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
  .data-refile { position: relative; overflow: hidden; cursor: pointer; }
  .data-refile input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
  .data-refile.is-off { opacity: .45; pointer-events: none; }
  .data-pv-opts { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .data-skip { font-size: .9rem; font-weight: 600; line-height: 1.4; }
  .data-skip input { flex: none; }
  .data-pv-hint { color: var(--muted); font-size: .82rem; }
  .data-go { min-height: 44px; padding-left: 20px; padding-right: 20px; font-weight: 700; }

  .data-confirm { display: flex; flex-direction: column; gap: 12px; }
  .data-confirm p { margin: 0; }
  .data-confirm .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

  /* ---------- ผลการนำเข้า ---------- */
  .data-done { margin: 0 auto; width: 100%; max-width: 760px; padding: 28px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
  .data-done h2 { margin: 4px 0 0; font-size: 1.3rem; }
  .data-done-sub { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
  .data-done-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
  .data-done.has-err .data-done-ico { background: var(--warn-soft); color: var(--warn-text, #7a5300); }
  .data-done-stats { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 8px; }
  .data-dstat { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; border-radius: 14px; background: var(--chip); }
  .data-dstat strong { font-size: 1.7rem; line-height: 1.2; font-weight: 700; }
  .data-dstat span { color: var(--muted); font-size: .84rem; }
  .data-dstat.ok strong { color: var(--ok); }
  .data-dstat.upd strong { color: var(--brand-strong, var(--brand)); }
  .data-dstat.skip strong { color: var(--warn-text, #7a5300); }
  .data-dstat.err strong { color: var(--danger); }
  .data-docno { margin: 4px 0 0; padding: 8px 14px; border-radius: 12px; background: var(--brand-tint); color: var(--muted); font-size: .9rem; }
  .data-docno strong { color: var(--ink); margin-left: 4px; }
  .data-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
  .data-done-actions .btn { display: inline-flex; align-items: center; gap: 7px; }
  .data-done-errs { margin: 0 auto; width: 100%; max-width: 760px; padding: 16px; }
  .data-done-errs h3 { margin: 0 0 10px; font-size: 1rem; color: var(--danger); }

  /* ---------- ส่งออก ---------- */
  .data-xbar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
  .data-xbranch select { min-width: 180px; }
  .data-periods { display: flex; gap: 6px; flex-wrap: wrap; }
  .data-periods .chip { cursor: pointer; font: inherit; font-size: .88rem; }
  .data-dates { display: flex; gap: 10px; flex-wrap: wrap; }
  .data-dates input { min-height: 38px; }
  .data-range { font-size: .88rem; white-space: nowrap; }

  .data-xgroup { display: flex; flex-direction: column; gap: 10px; }
  .data-xgroup-title { margin: 0; font-size: .82rem; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
  .data-xcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
  .data-xcard {
    display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "ico main" "ico act"; gap: 6px 14px;
    padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0;
  }
  .data-xcard > .data-ico { grid-area: ico; }
  .data-xcard-main { grid-area: main; min-width: 0; }
  .data-xcard-main h3 { margin: 0; font-size: 1rem; font-weight: 600; }
  .data-xdesc { margin: 2px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
  .data-xmeta { margin: 6px 0 0; font-size: .8rem; font-weight: 600; color: var(--ink); opacity: .75; }
  .data-xcard-act { grid-area: act; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
  .data-dl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
  .data-dl:hover { border-color: var(--brand); color: var(--brand-strong, var(--brand)); }
  .data-xlock, .data-xblock {
    display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; text-decoration: none;
  }
  .data-xlock { background: var(--warn-soft); color: var(--warn-text, #7a5300); }
  .data-xblock { background: var(--chip); color: var(--muted); }
  .data-xcard.is-off .data-ico { background: var(--chip); color: var(--muted); }
  .data-xcard.is-off .data-xcard-main h3 { color: var(--muted); }

  /* ---------- ลิงก์ Excel ในหน้าสินค้า/คลัง ---------- */
  .data-xl-row {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
    background: var(--brand-tint); border: 1px solid var(--brand-soft); color: var(--ink); text-decoration: none; line-height: 1.35;
  }
  .data-xl-row svg { flex: none; color: var(--brand); }
  .data-xl-row strong { color: var(--brand-strong, var(--brand)); font-size: .92rem; }
  .data-xl-row small { display: block; color: var(--muted); font-size: .8rem; }
  .data-xl-row:hover { border-color: var(--brand); }
}

/* ---------- จอคอม: ตารางตรวจไฟล์เลื่อนในกรอบ แถบนำเข้าอยู่ล่างเสมอ ---------- */
@media screen and (min-width: 1025px) {
  .data-pv { overflow: hidden; }
  .data-pv > .data-pv-head, .data-pv > .data-fwarn { flex: none; }
  .data-pv-list { flex: 1 1 auto; }
  .data-pv-list > .data-pv-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
  .data-fwarn { max-height: 120px; overflow: auto; }
}

/* ---------- แท็บเล็ต/มือถือ ---------- */
@media screen and (max-width: 1024px) {
  .data-pv-list { overflow: visible; }
  .data-pv-bar { position: sticky; bottom: 12px; z-index: 5; }
}

@media screen and (max-width: 760px) {
  .data-fit .fit-tools { width: 100%; }
  .data-tabs { width: 100%; }
  .data-tabs button { padding: 0 8px; }
  .data-lead { font-size: .86rem; }
  .data-icards { gap: 12px; }
  .data-icard { padding: 14px; gap: 10px; }
  .data-drop, .data-locked-box { min-height: 104px; }

  .data-pv-head { padding: 12px; }
  .data-pv-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 2px; width: calc(100% + 24px); scrollbar-width: none; }
  .data-pv-chips::-webkit-scrollbar { display: none; }
  .data-fchip { flex: none; min-height: 34px; }

  /* ตาราง → การ์ด */
  .data-pv-scroll { overflow: visible; }
  .data-ptable thead { display: none; }
  .data-ptable, .data-ptable tbody { display: block; width: 100%; }
  .data-ptable tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "key act" "name name" "sum sum" "msg msg";
    gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .data-ptable td { display: block; padding: 0; border: 0; min-width: 0 !important; }
  .data-ptable td:empty { display: none; }
  .data-ptable .data-c-line { display: none; }
  .data-ptable .data-c-key { grid-area: key; }
  .data-ptable .data-c-act { grid-area: act; justify-self: end; }
  .data-ptable .data-c-name { grid-area: name; }
  .data-ptable .data-c-sum { grid-area: sum; font-size: .85rem; }
  .data-ptable .data-c-msg { grid-area: msg; margin-top: 4px; }
  .data-ptable tr.is-err td, .data-ptable tr.is-err td:first-child, .data-ptable tr.is-warn td:first-child { background: none; box-shadow: none; }
  .data-ptable tr.is-err { background: color-mix(in srgb, var(--danger-soft) 45%, transparent); box-shadow: inset 3px 0 0 var(--danger); }
  .data-ptable tr.is-warn { box-shadow: inset 3px 0 0 #d39b1f; }
  .data-ptable.is-errs tr { grid-template-areas: "key key" "msg msg"; }
  .data-more { flex-direction: column; gap: 8px; }

  .data-pv-bar { bottom: calc(84px + env(safe-area-inset-bottom)); padding: 10px; gap: 8px; }
  .data-pv-opts { order: -1; flex: 1 1 100%; }
  .data-pv-bar > .btn.ghost { flex: none; }
  .data-refile { flex: 1 1 0; min-width: 0; padding-left: 10px; padding-right: 10px; }
  .data-refile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .data-go { flex: 2 1 0; min-width: 0; padding-left: 12px; padding-right: 12px; }
  .data-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .data-done { padding: 22px 14px; }
  .data-done-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-done-errs { padding: 12px; }

  .data-xbar { gap: 10px; }
  .data-xbranch { width: 100%; }
  .data-xbranch select { flex: 1 1 auto; min-width: 0; }
  .data-periods { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .data-periods::-webkit-scrollbar { display: none; }
  .data-dates { width: 100%; }
  .data-dates .field { flex: 1 1 140px; }
  .data-dates input { flex: 1 1 auto; min-width: 0; }
  .data-xcard { padding: 12px 14px; }
}

/* ---------- โหมดมืด: สีเฉพาะ ---------- */
@media screen {
  html[data-theme="dark"] .data-tabs button.on { box-shadow: 0 1px 3px rgba(0,0,0,.4); }
  html[data-theme="dark"] .data-ptable tr.is-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn-text); }
  html[data-theme="dark"] .data-drop-ico { background: var(--raised, var(--surface)); }
}
@media screen and (max-width: 760px) {
  html[data-theme="dark"] .data-ptable tr.is-warn { box-shadow: inset 3px 0 0 var(--warn-text); }
}

/* =====================================================================
   รอบ 104: <ImportWizard> (imw-) — โครงนำเข้าไฟล์ตัวกลาง (นำเข้านักเรียน · ยอดค้างยกมา)
   หน้าเต็ม = .fit-body ของแต่ละขั้น · Compact (ในหน้าต่าง) = .imw-c
   ===================================================================== */
.imw-upload { max-width: 760px; }
.imw-lead { margin: 0 0 16px; color: var(--muted); }
.imw-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: imw-step; }
.imw-steps > li { display: flex; gap: 12px; align-items: flex-start; counter-increment: imw-step; }
.imw-step-n {
  flex: none; width: 30px; height: 30px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 700;
}
.imw-step-n::before { content: counter(imw-step); }
.imw-step-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; flex: 1; }
.imw-file { position: relative; overflow: hidden; cursor: pointer; }
.imw-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.imw-file.is-off { opacity: .55; pointer-events: none; }

.imw-c { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.imw-pv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.panel.imw-pv-head { padding: 14px 16px; }
.imw-pv-title { min-width: 0; }
.imw-pv-title h2 { margin: 0; font-size: 1.05rem; }
.imw-pv-title p { margin: 2px 0 0; overflow-wrap: anywhere; }
.imw-pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.imw-fchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font: inherit; font-size: .85rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.imw-fchip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.imw-n { font-weight: 700; }
.imw-fwarn { background: var(--warn-soft); color: var(--ink); }
.imw-c .imw-pv-scroll { max-height: min(48vh, 420px); overflow: auto; overscroll-behavior: contain; }
.imw-c .imw-pv-scroll .table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
.imw-ptable tr.is-err td { background: var(--danger-soft); }
.imw-ptable tr.is-warn td { background: var(--warn-soft); }
.imw-p-name { font-weight: 600; overflow-wrap: anywhere; }
.imw-p-msgs { min-width: 0; }
.imw-code { white-space: nowrap; }
.imw-act { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.imw-act.new { background: var(--ok-soft); color: var(--ok); }
.imw-act.upd { background: var(--brand-soft); color: var(--brand-strong); }
.imw-act.err { background: var(--danger); color: var(--surface); }
.imw-msg { display: block; font-size: .85rem; overflow-wrap: anywhere; }
.imw-msg.ok { color: var(--ok); }
.imw-msg.err { color: var(--danger); }
.imw-msg.warn { color: var(--ink); }
.imw-msg.warn::before { content: "⚠ "; }
.imw-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 10px 14px; }
.imw-pv-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.imw-c .imw-pv-bar { padding: 0; border: 0; background: none; }
.imw-pv-opts { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.imw-done { max-width: 760px; }
.imw-done h2 { margin: 0 0 4px; font-size: 1.15rem; }
.imw-done h3 { margin: 16px 0 8px; font-size: .98rem; }
.imw-sub { margin: 0; overflow-wrap: anywhere; }
.imw-dstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.imw-dstat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--chip); }
.imw-dstat strong { font-size: 1.4rem; }
.imw-dstat span { font-size: .82rem; color: var(--muted); }
.imw-dstat.ok strong { color: var(--ok); }
.imw-dstat.upd strong { color: var(--brand-strong); }
.imw-dstat.skip strong, .imw-dstat.err strong { color: var(--danger); }
.imw-errlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.imw-errlist li { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: .88rem; overflow-wrap: anywhere; }
.imw-done-actions { margin-top: 16px; flex-wrap: wrap; }

@media screen and (min-width: 1025px) {
  .fit-body.imw-pv { min-height: 0; }
  .fit-body.imw-pv > .imw-pv-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
  .fit-body.imw-pv > .imw-pv-head, .fit-body.imw-pv > .imw-pv-bar, .fit-body.imw-pv > .alert { flex: none; }
}
@media (max-width: 760px) {
  .imw-pv-bar { flex-direction: column; align-items: stretch; }
  .imw-pv-bar .btn { width: 100%; }
  .imw-pv-opts { flex: none; }
  .imw-c .imw-pv-scroll { max-height: none; }
}
