/* Ký chuyển phiếu hoa hồng (sign-flow.js, 14/11/2026): khung "Ký chuyển" trên phiếu, trang "Ký duyệt", ảnh chữ ký trên bản in. */
@media screen {
  #appView .sg-host { margin:14px 0; }
  #appView .sg-btn[hidden] { display:none !important; }
  #appView .sg-btn.sg-turn { border-color:#a9783a !important; background:#FAF1E1 !important; color:#6E4A1C !important; font-weight:700; }
  /* Khu xổ "Thông Tin Ký Chuyển" cuối phiếu (trên Nhật ký) */
  #appView .sg-info { padding:0; }
  #appView .sg-info > summary { display:flex; align-items:center; gap:10px; padding:12px 16px; cursor:pointer; list-style:none; font-weight:700; font-size:15px; }
  #appView .sg-info > summary::-webkit-details-marker { display:none; }
  #appView .sg-info > summary::after { content:'▾'; margin-left:auto; color:#8B8177; transition:transform .15s; }
  #appView .sg-info[open] > summary::after { transform:rotate(180deg); }
  #appView .sg-info > .sg-steps { margin:0; padding:0 16px; }
  #appView .sg-info > .sg-note { margin:10px 0 0; padding:0 16px; }
  #appView .sg-info[open] { padding-bottom:14px; }
  #appView .sg-card { padding:14px 16px; }
  #appView .sg-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  #appView .sg-head h2 { margin:0; font-size:15px; }
  #appView .sg-acts { display:flex; gap:8px; flex-wrap:wrap; margin-left:auto; }
  #appView .sg-acts .danger { color:#a3321f; border-color:#e7b9ae; }
  #appView .sg-chip { display:inline-flex; align-items:center; padding:3px 10px; border-radius:999px; font-size:12.5px; font-weight:700; line-height:1.4; white-space:nowrap; }
  #appView .sg-chip.is-draft { background:#F1EEE9; color:#6F655A; }
  #appView .sg-chip.is-pending { background:#FDF1DD; color:#8A5B22; }
  #appView .sg-chip.is-returned { background:#FBE7E2; color:#a3321f; }
  #appView .sg-chip.is-ok { background:#E5F3EA; color:#1f6b3a; }
  #appView .sg-steps { list-style:none; margin:12px 0 0; padding:0; display:grid; grid-template-columns:repeat(auto-fit, minmax(128px, 1fr)); gap:8px; counter-reset:sg; }
  #appView .sg-steps li { position:relative; padding:8px 10px 8px 30px; border:1px solid #EFE8DD; border-radius:8px; background:#fff; display:grid; gap:2px; min-width:0; counter-increment:sg; }
  #appView .sg-steps li::before { content:counter(sg); position:absolute; left:8px; top:9px; width:16px; height:16px; border-radius:50%; background:#E9E2D6; color:#6F655A; font-size:10.5px; font-weight:800; display:grid; place-items:center; }
  #appView .sg-steps li b { font-size:12.5px; }
  #appView .sg-steps li span { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #appView .sg-steps li small { color:#8B8177; font-size:11.5px; }
  #appView .sg-steps li.is-done { border-color:#BFE0CB; background:#F5FBF7; }
  #appView .sg-steps li.is-done::before { content:'✓'; background:#2f8a52; color:#fff; }
  #appView .sg-steps li.is-cur { border-color:#a9783a; box-shadow:0 0 0 1px #a9783a inset; }
  #appView .sg-steps li.is-cur::before { background:#a9783a; color:#fff; }
  #appView .sg-steps .sg-wait { color:#8B8177; }
  #appView .sg-note { margin:10px 0 0; font-size:13px; color:#6F655A; line-height:1.5; }
  #appView .sg-link { padding:0; border:0; background:none; color:#8A5B22; font:inherit; font-weight:700; text-decoration:underline; cursor:pointer; min-height:0; height:auto; }
  #appView .sg-locked { opacity:.55; }
  /* Trang Ký duyệt (14/11/2026): 4 tab — Chờ tôi ký · Phiếu đã trình · Chữ ký của tôi · Phân công người ký */
  #appView .sg-page { width:100%; min-width:0; }
  #appView .sg-tabs { margin-bottom:16px; }
  #appView .sg-panel { display:grid; gap:12px; }
  #appView .sg-lead { margin:0; color:#6F655A; font-size:13.5px; line-height:1.5; }
  #appView .sg-list { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
  #appView .sg-item { display:flex !important; align-items:center; justify-content:flex-start !important; gap:14px; width:100%; height:auto !important; min-height:0; padding:14px 16px; text-align:left !important; border:1px solid #EFE9DD !important; border-radius:12px; background:#fff !important; color:#25211C !important; font-weight:400; white-space:normal; cursor:pointer; box-shadow:0 1px 2px #392e220d; transition:border-color .15s, box-shadow .15s; }
  #appView .sg-item:hover { border-color:#a9783a !important; box-shadow:0 4px 14px #392e2214; }
  #appView .sg-ic { flex:none; width:40px; height:40px; border-radius:10px; display:grid; place-items:center; background:#FAF1E1; color:#8A5B22; }
  #appView .sg-body { flex:1; min-width:0; display:grid; gap:3px; }
  #appView .sg-body b { font-size:14.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #appView .sg-type { font-size:11px; color:#8A5B22; font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
  #appView .sg-body small { color:#6F655A; font-size:12.5px; }
  #appView .sg-body .sg-reason { color:#a3321f; }
  #appView .sg-side { flex:none; display:flex; flex-direction:column; align-items:flex-end; gap:8px; }
  #appView .sg-open { display:inline-flex; align-items:center; gap:2px; color:#8A5B22; font-size:13px; font-weight:700; }
  #appView .sg-empty { display:grid; justify-items:center; gap:6px; padding:44px 16px; border:1px dashed #E3D7C4; border-radius:12px; background:#FDFBF7; text-align:center; color:#8B8177; }
  #appView .sg-empty svg { color:#B99563; }
  #appView .sg-empty b { color:#25211C; font-size:15px; }
  #appView .sg-empty span { font-size:13px; max-width:440px; }
  /* Chữ ký của tôi */
  #appView .sg-sigwrap { display:grid; grid-template-columns:minmax(0, 420px) minmax(0, 1fr); gap:16px; align-items:start; }
  #appView .sg-sigcard { display:grid; gap:12px; padding:16px; border:1px solid #EFE9DD; border-radius:12px; background:#fff; }
  #appView .sg-sigbox { height:150px; border:1px dashed #D9CBB4; border-radius:10px; display:grid; place-items:center; background:repeating-linear-gradient(0deg, #fff 0 29px, #F6F1E9 29px 30px); }
  #appView .sg-sigbox img { max-width:90%; max-height:128px; }
  #appView .sg-sigph { display:grid; justify-items:center; gap:6px; color:#8B8177; font-size:13px; }
  #appView .sg-sigph svg { color:#B99563; }
  #appView .sg-sigmeta { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  #appView .sg-sigmeta small { color:#8B8177; font-size:12.5px; }
  #appView .sg-sigacts { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
  #appView .sg-sigacts .sg-del { margin-left:auto; color:#a3321f; }
  #appView .sg-file { position:relative; display:inline-flex; align-items:center; padding:0 14px; height:36px; border:1px solid #D9CBB4; border-radius:8px; background:#fff; font-weight:600; cursor:pointer; }
  #appView .sg-file:hover { border-color:#a9783a; }
  #appView .sg-file input { position:absolute; inset:0; opacity:0; cursor:pointer; }
  #appView .sg-tips { margin:0; padding:16px 16px 16px 34px; border-radius:12px; background:#FAF6EF; color:#4A4238; font-size:13.5px; line-height:1.6; display:grid; gap:4px; }
  /* Phân công người ký */
  #appView .sg-sumbar { display:grid; grid-template-columns:auto auto 1fr; gap:12px; align-items:stretch; }
  #appView .sg-stat { display:grid; gap:2px; padding:10px 16px; border:1px solid #EFE9DD; border-radius:12px; background:#fff; min-width:170px; }
  #appView .sg-stat span { font-size:12.5px; color:#6F655A; }
  #appView .sg-stat b { font-size:20px; }
  #appView .sg-stat small { font-size:12px; color:#a3321f; max-width:260px; }
  #appView .sg-stat.is-warn { border-color:#F0CDBF; background:#FFF8F5; }
  #appView .sg-sumbar .sg-lead { align-self:center; }
  #appView .sg-roles { width:100%; border-collapse:separate; border-spacing:0; border:1px solid #EFE9DD; border-radius:12px; overflow:hidden; background:#fff; }
  #appView .sg-roles th { padding:10px 14px; background:#FAF6EF; color:#6F655A; font-size:12.5px; font-weight:700; text-align:left !important; border-bottom:1px solid #EFE9DD; }
  #appView .sg-roles td { padding:10px 14px; text-align:left !important; vertical-align:middle; border-bottom:1px solid #F3EEE6; }
  #appView .sg-roles tr:last-child td { border-bottom:0; }
  #appView .sg-roles .sg-rl { font-weight:700; }
  #appView .sg-roles select { width:100%; max-width:280px; }
  #appView .sg-who { display:inline-flex; align-items:center; gap:2px; margin:2px 6px 2px 0; padding:3px 4px 3px 10px; border-radius:999px; background:#F5EFE5; font-size:13px; font-weight:600; }
  #appView .sg-who.is-nosig { background:#FFF1EC; color:#9B2F23; }
  #appView .sg-who.is-nosig::after { content:'chưa có chữ ký'; margin-left:6px; font-size:11px; font-weight:500; }
  #appView .sg-who button { order:2; width:22px; height:22px; min-height:0; padding:0; border:0; border-radius:50%; background:transparent; color:#8B8177; cursor:pointer; }
  #appView .sg-who button:hover { background:#0000000d; }
  #appView .sg-none { color:#a3321f; font-size:13px; font-weight:600; }
  #appView .sg-auto { color:#6F655A; font-size:13px; font-style:italic; }
  #appView .sg-set-acts { display:flex; justify-content:flex-end; align-items:center; gap:12px; }
  #appView .sg-dirty { color:#8A5B22; font-size:13px; font-weight:600; }
  @media (max-width: 760px) {
    #appView .sg-item { flex-wrap:wrap; }
    #appView .sg-side { flex-direction:row; width:100%; justify-content:space-between; align-items:center; }
    #appView .sg-sigwrap, #appView .sg-sumbar { grid-template-columns:1fr; }
    #appView .sg-roles colgroup { display:none; }
    #appView .sg-roles, #appView .sg-roles tbody, #appView .sg-roles tr, #appView .sg-roles td { display:block; width:100%; box-sizing:border-box; }
    #appView .sg-roles thead { display:none; }
    #appView .sg-roles tr { padding:6px 0; border-bottom:1px solid #F3EEE6; }
    #appView .sg-roles td { border:0; padding:4px 12px; }
    #appView .sg-roles select { max-width:none; }
  }
}
/* Bảng vẽ chữ ký */
.sg-pad-ov { position:fixed; inset:0; z-index:1200; display:grid; place-items:center; background:#0006; padding:16px; }
.sg-pad { width:min(640px, 100%); background:#fff; border-radius:12px; padding:16px; box-shadow:0 10px 40px #0004; }
.sg-pad h3 { margin:0 0 10px; font-size:16px; }
.sg-pad canvas { display:block; width:100%; height:auto; aspect-ratio:600/240; border:1px dashed #C9B89C; border-radius:8px; background:#fff; touch-action:none; cursor:crosshair; }
.sg-pad-acts { display:flex; gap:8px; margin-top:12px; }
.sg-pad-acts span { flex:1; }
/* Bản in: ảnh chữ ký nằm trong ô ký (.s), tên + ngày ký bên dưới. */
@media print {
  #printRoot .hh-p-sig .s, #printRoot .hh-mi-sig .s { display:flex; align-items:flex-end; justify-content:center; }
  #printRoot .hh-p-sig .sg-img { display:block; max-width:100%; max-height:11mm; object-fit:contain; }
  #printRoot .hh-mi-sig .sg-img { display:block; max-width:100%; max-height:13mm; object-fit:contain; }
  #printRoot .hh-p-sig .d, #printRoot .hh-mi-sig .d { font-size:7pt; color:#555; }
  #printRoot .hh-mi-sig .n { font-weight:700; font-size:8.5pt; }
}

/* Bàn trình ký (14/11/2026): thẻ tóm tắt phiếu trong "Ký duyệt" + bản xem duyệt (tài liệu web) */
@media screen {
  #appView .sg-strip { display:flex; gap:12px; flex-wrap:wrap; }
  #appView .sg-strip > div { display:grid; gap:2px; padding:10px 16px; min-width:160px; border:1px solid #EFE9DD; border-radius:12px; background:#fff; }
  #appView .sg-strip span { font-size:12.5px; color:#6F655A; }
  #appView .sg-strip b { font-size:19px; }
  #appView .sg-tk { display:flex !important; align-items:stretch; justify-content:space-between !important; gap:18px; width:100%; height:auto !important; min-height:0; padding:16px 18px; text-align:left !important;
    border:1px solid #EFE9DD !important; border-radius:14px; background:#fff !important; color:#25211C !important; font-weight:400; white-space:normal; cursor:pointer; box-shadow:0 1px 2px #392e220d; transition:border-color .15s, box-shadow .15s; }
  #appView .sg-tk:hover { border-color:#a9783a !important; box-shadow:0 6px 18px #392e2217; }
  #appView .sg-tk.is-wait { border-left:4px solid #a9783a !important; }
  #appView .sg-tk-main { flex:1; min-width:0; display:grid; gap:7px; align-content:start; }
  #appView .sg-tk-top { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  #appView .sg-tk-title { font-size:16px; font-weight:800; line-height:1.3; }
  #appView .sg-age { display:inline-flex; align-items:center; gap:4px; color:#8B8177; font-size:12px; font-weight:600; }
  #appView .sg-pays { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
  #appView .sg-pays em { font-style:normal; font-size:12px; color:#8B8177; margin-right:2px; }
  #appView .sg-pay { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px; background:#F7F2EA; font-size:12.5px; }
  #appView .sg-pay i { font-style:normal; color:#4A4238; max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #appView .sg-pay b { color:#25211C; }
  #appView .sg-pay.is-more { color:#8A5B22; font-weight:700; }
  #appView .sg-reason { color:#a3321f; font-size:13px; }
  #appView .sg-tk-meta { color:#6F655A; font-size:12.5px; }
  #appView .sg-tk-amt { flex:none; display:grid; justify-items:end; align-content:space-between; gap:4px; min-width:170px; padding-left:18px; border-left:1px dashed #EFE9DD; text-align:right; }
  #appView .sg-tk-amt > span:first-child { font-size:12px; color:#6F655A; }
  #appView .sg-tk-amt b { font-size:20px; font-weight:800; color:#25211C; }
  #appView .sg-rownotes { margin:4px 0 0; padding-left:18px; }
  /* Bản xem duyệt */
  #appView .sv { width:100%; min-width:0; display:grid; gap:14px; padding-bottom:20px; }
  #appView .sv.is-return { padding-bottom:16px; }
  #appView .sv-top { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  #appView .sv-top #svBack { display:inline-flex; align-items:center; gap:4px; }
  #appView .sv-acts { display:flex; gap:8px; flex-wrap:wrap; margin-left:auto; }
  #appView .sv-acts .danger { color:#a3321f !important; border-color:#E7B9AE !important; }
  #appView .sv-hero { display:flex; gap:20px; align-items:stretch; padding:20px 22px; border-radius:16px; background:linear-gradient(135deg, #FFFDF9, #F8EFE1); border:1px solid #EADCC6; }
  #appView .sv-hero-l { flex:1; min-width:0; display:grid; gap:6px; align-content:start; }
  #appView .sv-hero h2 { margin:0; font-size:20px; line-height:1.3; }
  #appView .sv-hero p { margin:0; color:#4A4238; font-size:14px; font-weight:600; }
  #appView .sv-hero-meta { display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:13px; color:#6F655A; margin-top:4px; }
  #appView .sv-total { flex:none; display:grid; align-content:center; justify-items:end; gap:2px; min-width:240px; padding:14px 18px; border-radius:12px; background:#fff; border:1px solid #EADCC6; text-align:right; }
  #appView .sv-total span { font-size:12.5px; color:#6F655A; font-weight:600; }
  #appView .sv-total b { font-size:26px; font-weight:800; color:#6E4A1C; letter-spacing:-.01em; }
  #appView .sv-total small { font-size:12px; color:#8B8177; max-width:300px; }
  #appView .sv-alert { padding:14px 16px; border-radius:12px; background:#FFF6F3; border:1px solid #F0CDBF; color:#5B2A20; font-size:13.5px; }
  #appView .sv-alert p { margin:4px 0 0; }
  #appView .sv-alert ul { margin:6px 0 0; padding-left:18px; }
  #appView .sv-grid { display:grid; grid-template-columns:minmax(0, 1.6fr) minmax(320px, 1fr); gap:14px; align-items:start; }
  #appView .sv-card { padding:16px 18px; border:1px solid #EFE9DD; border-radius:14px; background:#fff; min-width:0; }
  #appView .sv-card h3 { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 12px; font-size:15px; }
  #appView .sv-hint { margin-left:auto; font-size:12.5px; font-weight:600; color:#8A5B22; }
  #appView .sv-facts { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:12px 20px; margin:0; }
  #appView .sv-facts > div { min-width:0; }
  #appView .sv-facts > div.w { grid-column:1 / -1; }
  #appView .sv-facts dt { font-size:12px; color:#8B8177; }
  #appView .sv-facts dd { margin:2px 0 0; font-size:14px; font-weight:600; color:#25211C; overflow-wrap:anywhere; }
  #appView .sv-payees { list-style:none; margin:0; padding:0; display:grid; gap:4px; }
  #appView .sv-payees li { position:relative; display:flex; justify-content:space-between; align-items:center; gap:10px; padding:8px 10px; border-radius:8px; overflow:hidden; }
  #appView .sv-payees li > div { position:relative; z-index:1; display:grid; min-width:0; }
  #appView .sv-payees li b { font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #appView .sv-payees li small { font-size:12px; color:#8B8177; }
  #appView .sv-payees li > span { position:relative; z-index:1; flex:none; font-weight:800; font-size:14px; }
  #appView .sv-payees li > i { position:absolute; left:0; top:0; bottom:0; background:#F7EEDF; border-radius:8px; }
  #appView .sv-table { width:100%; border-collapse:collapse; font-size:13.5px; }
  #appView .sv-table th { padding:9px 10px; background:#FAF6EF; color:#6F655A; font-size:12px; font-weight:700; text-align:left; border-bottom:1px solid #EFE9DD; white-space:nowrap; }
  #appView .sv-table td { padding:9px 10px; border-bottom:1px solid #F3EEE6; vertical-align:top; }
  #appView .sv-table .r { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
  #appView .sv-table .c { text-align:center; color:#8B8177; }
  #appView .sv-table tfoot td { font-weight:800; background:#FDFBF7; border-bottom:0; }
  #appView .sv-table tr.has-note td { background:#FFF8EC; }
  #appView .sv-noteh { min-width:220px; color:#8A5B22 !important; }
  #appView .sv-notec { min-width:220px; color:#8A5B22; font-weight:600; }
  #appView .sv-notec textarea { width:100%; min-height:34px; resize:vertical; padding:6px 8px; border:1px solid #E3C79E; border-radius:8px; font:inherit; font-size:13px; background:#fff; box-sizing:border-box; }
  #appView .sv-flow { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fit, minmax(118px, 1fr)); gap:10px; }
  #appView .sv-flow li { display:grid; justify-items:center; gap:4px; padding:12px 8px; border:1px solid #EFE8DD; border-radius:12px; text-align:center; background:#fff; }
  #appView .sv-flow li b { font-size:12px; }
  #appView .sv-flow li img { max-width:100%; height:42px; object-fit:contain; }
  #appView .sv-flow li span { font-size:13px; font-weight:600; }
  #appView .sv-flow li small { font-size:11.5px; color:#8B8177; }
  #appView .sv-flow .sv-dot { width:22px; height:22px; border-radius:50%; display:grid; place-items:center; background:#E9E2D6; color:#fff; font-size:12px; font-weight:800; }
  #appView .sv-flow li.is-done { background:#F5FBF7; border-color:#BFE0CB; }
  #appView .sv-flow li.is-done .sv-dot { background:#2f8a52; }
  #appView .sv-flow li.is-cur { border-color:#a9783a; box-shadow:0 0 0 1px #a9783a inset; }
  #appView .sv-flow li.is-cur .sv-dot { background:#a9783a; }
  #appView .sv-wait { color:#8B8177 !important; font-weight:500 !important; }
  #appView .sv-log { list-style:none; margin:0; padding:0; display:grid; gap:6px; font-size:13px; }
  #appView .sv-log small { display:block; color:#6F655A; }
  #appView .sv-retbar { position:sticky; bottom:12px; z-index:60; width:100%; display:grid; grid-template-columns:1fr auto; gap:8px 16px; align-items:end;
    padding:14px 16px; border-radius:16px; background:#fff; border:1px solid #E3C79E; box-shadow:0 12px 40px #392e2238; box-sizing:border-box; }
  #appView .sv-retbox { display:grid; gap:4px; }
  #appView .sv-retbox label { font-size:13px; font-weight:700; }
  #appView .sv-retbox textarea { width:100%; resize:vertical; padding:8px 10px; border:1px solid #D9CBB4; border-radius:10px; font:inherit; font-size:14px; box-sizing:border-box; }
  #appView .sv-retacts { display:flex; gap:8px; flex-wrap:wrap; }
  #appView .sv-retbar small { grid-column:1 / -1; color:#8B8177; font-size:12px; }
  #appView .danger-solid { background:#a3321f !important; border-color:#a3321f !important; color:#fff !important; font-weight:700; }
  @media (max-width: 900px) {
    #appView .sv-grid, #appView .sv-retbar { grid-template-columns:1fr; }
    #appView .sv-hero { flex-direction:column; }
    #appView .sv-total { justify-items:start; text-align:left; min-width:0; }
  }
  @media (max-width: 760px) {
    #appView .sg-tk { flex-direction:column; gap:10px; }
    #appView .sg-tk-amt { justify-items:start; text-align:left; border-left:0; border-top:1px dashed #EFE9DD; padding:10px 0 0; min-width:0; grid-template-columns:1fr auto; align-items:center; }
    #appView .sg-tk-amt > span:first-child { grid-column:1 / -1; }
    #appView .sv-facts { grid-template-columns:1fr; }
    #appView .sv-retbar { bottom:76px; }
  }
}
.sg-ask textarea { width:100%; box-sizing:border-box; padding:8px 10px; border:1px solid #D9CBB4; border-radius:10px; font:inherit; font-size:14px; resize:vertical; }

/* Lãnh đạo sửa trực tiếp (14/11/2026): thanh trên đầu phiếu + bảng "Lãnh đạo đã sửa" (trước → sau) */
@media screen {
  #appView .sg-top { margin:0 0 14px; }
  #appView .sg-topbar { display:flex; align-items:center; gap:16px; flex-wrap:wrap; padding:14px 18px; border-radius:14px; border:1px solid #E3C79E; background:#FDF6EA; }
  #appView .sg-topbar > div { flex:1; min-width:240px; display:grid; gap:3px; }
  #appView .sg-topbar b { font-size:15px; }
  #appView .sg-topbar span { font-size:13px; color:#5B5045; line-height:1.5; }
  #appView .sg-topbar.is-edit { border-color:#a9783a; box-shadow:0 0 0 1px #a9783a inset; }
  #appView .sg-topbar.is-wait { background:#F4F1EC; border-color:#E2DACD; }
  #appView .sg-topbar.is-done { background:#FFF6F3; border-color:#F0CDBF; }
  #appView .sg-note > div + div { margin-top:6px; }
  #appView .sg-chg { width:100%; margin-top:6px; border-collapse:collapse; font-size:13px; background:#fff; }
  #appView .sg-chg th { padding:7px 10px; background:#FAF6EF; color:#6F655A; font-size:12px; font-weight:700; text-align:left; border-bottom:1px solid #EFE9DD; }
  #appView .sg-chg td { padding:7px 10px; border-bottom:1px solid #F3EEE6; vertical-align:top; color:#25211C; }
  #appView .sg-chg .sg-from { color:#8B8177; text-decoration:line-through; text-decoration-color:#C9B9A4; }
  #appView .sg-chg .sg-to { color:#1f6b3a; font-weight:700; }
  #appView .sv-alert .tbl-wrap { margin-top:6px; }
}

/* Chia đôi màn khi phiếu bị trả lại (14/11/2026): trái = ý kiến trả lại của lãnh đạo (dính khi cuộn), phải = form sửa phiếu */
@media screen {
  #appView .sg-split { display:grid; grid-template-columns:minmax(300px, 30%) minmax(0, 1fr); gap:16px; align-items:start; }
  #appView .sg-main { min-width:0; }
  #appView .sg-aside { position:sticky; top:12px; align-self:start; max-height:calc(100vh - 24px); min-width:0; }
  #appView .sg-aside-in { display:grid; gap:12px; max-height:calc(100vh - 24px); overflow:auto; padding:16px; border:1px solid #F0CDBF; border-radius:14px; background:#FFFBF8; box-sizing:border-box; }
  #appView .sg-aside-h { display:flex; align-items:center; justify-content:space-between; gap:8px; }
  #appView .sg-aside-h b { font-size:16px; }
  #appView .sg-aside-who { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:13px; color:#5B5045; }
  #appView .sg-aside-reason { padding:10px 12px; border-radius:10px; background:#fff; border:1px solid #F3E3DA; }
  #appView .sg-aside-reason small { color:#8B8177; font-size:12px; }
  #appView .sg-aside-reason p { margin:2px 0 0; font-size:14px; font-weight:600; white-space:pre-wrap; }
  #appView .sg-aside-edit { margin:0; font-size:13px; color:#5B2A20; }
  #appView .sg-aside-prog { display:grid; gap:4px; font-size:12.5px; color:#6F655A; }
  #appView .sg-aside-prog i { display:block; height:6px; border-radius:99px; background:#F1E6DA; overflow:hidden; }
  #appView .sg-aside-prog em { display:block; height:100%; background:#2f8a52; border-radius:99px; }
  #appView .sg-aside-list { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
  #appView .sg-aside-list li { border:1px solid #EFE9DD; border-radius:10px; background:#fff; }
  #appView .sg-aside-list li.is-note { border-left:3px solid #a9783a; }
  #appView .sg-aside-list li.is-edited { border-left:3px solid #2f8a52; }
  #appView .sg-aside-list li.is-done { opacity:.6; }
  #appView .sg-aside-list li.is-done b { text-decoration:line-through; }
  #appView .sg-aside-list label { display:flex; gap:10px; align-items:flex-start; padding:10px 12px; cursor:pointer; }
  #appView .sg-aside-list input { margin-top:3px; flex:none; width:16px; height:16px; accent-color:#2f8a52; }
  #appView .sg-aside-list label > span { display:grid; gap:2px; min-width:0; font-size:13px; }
  #appView .sg-aside-list small { font-size:11px; color:#8B8177; text-transform:uppercase; letter-spacing:.03em; font-weight:700; }
  #appView .sg-aside-list b { font-size:13.5px; overflow-wrap:anywhere; }
  #appView .sg-aside-list .sg-from { color:#8B8177; text-decoration:line-through; }
  #appView .sg-aside-list .sg-to { color:#1f6b3a; font-weight:700; }
  #appView .sg-aside-foot { margin:0; font-size:12.5px; color:#6F655A; }
  #appView .sg-aside-open { display:none; }
  /* Thu gọn: khung trái thành nút dọc nhỏ, form chiếm hết bề ngang */
  #appView .sg-split.is-closed { grid-template-columns:44px minmax(0, 1fr); }
  #appView .sg-split.is-closed .sg-aside-in { display:none; }
  #appView .sg-split.is-closed .sg-aside-open { display:flex; align-items:center; justify-content:center; width:44px; min-height:180px; height:auto; padding:12px 0; writing-mode:vertical-rl; transform:rotate(180deg);
    border:1px solid #F0CDBF; border-radius:12px; background:#FFF6F3; color:#9B2F23; font-weight:700; font-size:13px; cursor:pointer; }
  @media (max-width: 1100px) {
    #appView .sg-split, #appView .sg-split.is-closed { grid-template-columns:minmax(0, 1fr); }
    #appView .sg-aside { position:static; max-height:none; }
    #appView .sg-aside-in { max-height:min(46vh, 420px); }
    #appView .sg-split.is-closed .sg-aside-open { writing-mode:horizontal-tb; transform:none; width:100%; min-height:40px; }
  }
}

/* Khung ý kiến trả lại: mỗi mục 2 nút xếp chồng "Đã sửa" / "Kiểm tra"; Kiểm tra → cuộn tới chỗ cần sửa trên form + nháy viền đỏ (14/11/2026) */
@media screen {
  #appView .sg-aside-list li { display:flex; align-items:stretch; gap:10px; padding:10px 10px 10px 12px; }
  #appView .sg-ai-body { flex:1; min-width:0; display:grid; gap:2px; font-size:13px; }
  #appView .sg-ai-acts { flex:none; display:grid; grid-template-rows:1fr 1fr; gap:6px; width:92px; }
  #appView .sg-ai-acts button { width:100%; height:auto !important; min-height:30px; padding:4px 8px; border-radius:8px; font-size:12.5px; font-weight:700; white-space:nowrap; cursor:pointer; }
  #appView .sg-ai-done { border:1px solid #CFE5D7 !important; background:#fff !important; color:#1f6b3a !important; }
  #appView .sg-ai-done:hover { background:#F1F8F3 !important; }
  #appView .sg-ai-done.is-on { background:#2f8a52 !important; border-color:#2f8a52 !important; color:#fff !important; }
  #appView .sg-ai-go { border:1px solid #F0CDBF !important; background:#FFF6F3 !important; color:#9B2F23 !important; }
  #appView .sg-ai-go:hover { background:#FDE9E3 !important; }
  #appView .sg-ai-go[disabled] { opacity:.45; cursor:not-allowed; }
  #appView .sg-aside-list li.is-done .sg-ai-body { opacity:.55; }
  #appView .sg-aside-list li.is-done { opacity:1; }
  @keyframes sgFlash { 0%, 100% { box-shadow:0 0 0 2px #d63a2a, 0 0 0 6px #d63a2a33; } 50% { box-shadow:0 0 0 2px #d63a2a00, 0 0 0 6px #d63a2a00; } }
  @keyframes sgFlashTd { 0%, 100% { background:#FDE3DC; } 50% { background:transparent; } }
  #appView .sg-flash { animation:sgFlash .55s ease-in-out 5; border-radius:10px; position:relative; z-index:2; }
  #appView tr.sg-flash { animation:none; box-shadow:none; }
  #appView tr.sg-flash > td { animation:sgFlashTd .55s ease-in-out 5; box-shadow:inset 0 2px 0 #d63a2a, inset 0 -2px 0 #d63a2a; }
  #appView tr.sg-flash > td:first-child { box-shadow:inset 2px 2px 0 #d63a2a, inset 0 -2px 0 #d63a2a; }
  #appView tr.sg-flash > td:last-child { box-shadow:inset -2px 2px 0 #d63a2a, inset 0 -2px 0 #d63a2a; }
}
