/* ==========================================================================
   css/iba-1702-esn.css — 17.0.2 patch 14
   Windows of the site approval / Print ESN / Ready flow (js/iba-1702-esn.js).
   Clear glass box, light dim behind it (no blur behind pop-ups).
   Inside @layer iba-ui so the theme's layered rules cannot override it.
   ========================================================================== */
@layer iba-ui {
  html body #iba-esn.iba-esn-ov { position: fixed !important; inset: 0 !important; z-index: 2147482700 !important; display: flex !important; align-items: center !important; justify-content: center !important; padding: 18px !important; background: rgba(4, 12, 22, 0.36) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; font-family: Inter, Arial, sans-serif; }
  html body #iba-esn .iba-esn-box { width: min(560px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; border: 1px solid rgba(127, 227, 214, 0.38); background: linear-gradient(160deg, rgba(20, 44, 68, 0.66), rgba(8, 18, 30, 0.78)) !important; backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45); color: #F3EAD3; }
  html body #iba-esn .iba-esn-box.is-wide { width: min(860px, 100%); }
  html body #iba-esn .iba-esn-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid rgba(127, 227, 214, 0.22); }
  html body #iba-esn .iba-esn-head b { flex: 1; font-size: 16px; color: #fff; }
  html body #iba-esn .iba-esn-head b i { color: #7FE3D6; margin-right: 6px; }
  html body #iba-esn .iba-esn-x { width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.18) !important; background: rgba(255,255,255,0.08) !important; color: #fff !important; cursor: pointer; box-shadow: none !important; }
  html body #iba-esn .iba-esn-body { padding: 12px 18px 14px; overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
  html body #iba-esn .iba-esn-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid rgba(127, 227, 214, 0.18); }
  html body #iba-esn .iba-esn-sp { flex: 1; }
  html body #iba-esn .iba-esn-picked + .iba-esn-sp { display: none; }
  html body #iba-esn .iba-esn-sub { margin: 0 !important; font-size: 13px !important; line-height: 1.45 !important; color: #EBD8A8 !important; opacity: 1 !important; }
  html body #iba-esn .iba-esn-sub b { color: #fff !important; }
  html body #iba-esn .iba-esn-lab { display: block; margin: 4px 0 0 !important; font-size: 12px !important; font-weight: 700 !important; letter-spacing: .04em; text-transform: uppercase; color: #7FE3D6 !important; opacity: 1 !important; }
  html body #iba-esn .iba-esn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.10); background: rgba(255,255,255,0.05); }
  html body #iba-esn .iba-esn-grid small { display: block; font-size: 11px; color: #E3C98A; }
  html body #iba-esn .iba-esn-grid strong { display: block; font-size: 13.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html body #iba-esn .iba-esn-q,
  html body #iba-esn .iba-esn-note,
  html body #iba-esn .iba-esn-place { width: 100%; box-sizing: border-box; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.18) !important; background: rgba(6,14,24,0.45) !important; color: #F3EAD3 !important; font: inherit; font-size: 13.5px; }
  html body #iba-esn select.iba-esn-place { width: 150px !important; min-width: 150px !important; height: 32px !important; min-height: 0 !important; padding: 0 8px !important; font-size: 13px !important; line-height: 30px !important; }
  html body #iba-esn .iba-esn-place option { background: #10233a; color: #fff; }
  html body #iba-esn .iba-esn-people { display: flex; flex-direction: column; gap: 4px; max-height: 230px; overflow: auto; }
  html body #iba-esn .iba-esn-person { position: relative; display: block; width: 100%; text-align: left; padding: 7px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.10) !important; background: rgba(255,255,255,0.04) !important; color: #fff !important; cursor: pointer; font: inherit; box-shadow: none !important; }
  html body #iba-esn .iba-esn-person:hover { background: rgba(127, 227, 214, 0.10) !important; }
  html body #iba-esn .iba-esn-person.is-on { border-color: rgba(127, 227, 214, 0.75) !important; background: rgba(127, 227, 214, 0.16) !important; }
  html body #iba-esn .iba-esn-person b { display: block; font-size: 13.5px; }
  html body #iba-esn .iba-esn-person small { display: block; font-size: 12px; color: #EBD8A8; }
  html body #iba-esn .iba-esn-addtag { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: #7FE3D6; }
  html body #iba-esn .iba-esn-same,
  html body #iba-esn .iba-esn-new { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; vertical-align: middle; background: #E3C98A; color: #14293f; }
  html body #iba-esn .iba-esn-new { background: #7FE3D6; }
  html body #iba-esn .iba-esn-all { display: flex; align-items: center; gap: 8px; font-size: 12.5px !important; color: #EBD8A8 !important; opacity: 1 !important; cursor: pointer; text-transform: none !important; letter-spacing: 0 !important; }
  html body #iba-esn .iba-esn-picked { flex: 1; font-size: 13px; color: #EBD8A8 !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html body #iba-esn .iba-esn-picked b { color: #fff !important; }
  html body #iba-esn .iba-esn-err { min-height: 0; font-size: 13px; font-weight: 600; color: #FCA5A5; }
  html body #iba-esn .iba-esn-err:empty { display: none; }
  html body #iba-esn .iba-esn-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.2) !important; background: rgba(255,255,255,0.08) !important; color: #fff !important; font: inherit; font-size: 13.5px; font-weight: 700; white-space: nowrap; cursor: pointer; box-shadow: none !important; }
  html body #iba-esn .iba-esn-btn.is-go { border-color: rgba(127, 227, 214, 0.6) !important; background: linear-gradient(180deg, rgba(64,196,206,0.34), rgba(19,138,151,0.20)) !important; }
  html body #iba-esn .iba-esn-btn.is-small { height: 28px; padding: 0 10px; font-size: 12px; }
  html body #iba-esn .iba-esn-btn:disabled { opacity: .45; cursor: not-allowed; }
  html body #iba-esn .iba-esn-extra { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  html body #iba-esn .iba-esn-extra .iba-esn-btn { height: auto; min-width: 0; padding: 10px 12px; flex-direction: column; align-items: flex-start; text-align: left; gap: 3px; white-space: normal; }
  html body #iba-esn .iba-esn-extra .iba-esn-btn i { color: #7FE3D6; }
  html body #iba-esn .iba-esn-extra .iba-esn-btn small { font-size: 11.5px; font-weight: 500; color: #EBD8A8; }
  html body #iba-esn .iba-esn-scroll { overflow: auto; border: 1px solid rgba(127,227,214,0.18); border-radius: 12px; }
  html body #iba-esn .iba-esn-table { width: 100%; border-collapse: collapse; font-size: 13px; background: transparent !important; }
  html body #iba-esn .iba-esn-table th { background: rgba(16, 36, 56, 0.85) !important; color: #E3C98A !important; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 8px 10px; white-space: nowrap; }
  html body #iba-esn .iba-esn-table td { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: middle; color: #F3EAD3; background: transparent !important; }
  html body #iba-esn .iba-esn-table td.c { text-align: center; width: 36px; }
  html body #iba-esn .iba-esn-table td small { display: block; font-size: 11.5px; color: #EBD8A8; }
  html body #iba-esn .iba-esn-table tr.is-bad td { background: rgba(248, 113, 113, 0.10) !important; }
  html body #iba-esn .iba-esn-mono { font-family: "Courier New", monospace; font-weight: 700; white-space: nowrap; }
  html body #iba-esn .iba-esn-tick { width: 18px; height: 18px; accent-color: #2BB3A3; cursor: pointer; }
  html body #iba-esn .iba-esn-ok { color: #34D399; font-weight: 700; white-space: nowrap; }
  html body #iba-esn .iba-esn-bad { color: #FCA5A5; font-weight: 700; }
  html body #iba-esn .iba-esn-histbox:empty { display: none; }
  /* Print ESN: table + A4 preview */
  html body #iba-esn .iba-esn-printgrid { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: start; }
  html body #iba-esn .iba-esn-a4 { position: relative; width: 150px; height: 212px; border-radius: 4px; background: #fdfdfb; box-shadow: 0 6px 18px rgba(0,0,0,0.35); overflow: hidden; }
  html body #iba-esn .iba-esn-a4-cap { position: absolute; left: 8px; top: 6px; font-size: 10px; font-weight: 800; color: #9aa7b4; }
  html body #iba-esn .iba-esn-a4-s { position: absolute; width: 46px; height: 17px; box-sizing: border-box; border: 1.5px solid #0f6b2f; border-radius: 3px; background: #e8f5ec; color: #0f6b2f; font-size: 8.5px; font-weight: 800; line-height: 14px; text-align: center; overflow: hidden; white-space: nowrap; }
  html body #iba-esn .iba-esn-a4-s.is-L { left: 7px; bottom: 14px; }
  html body #iba-esn .iba-esn-a4-s.is-M { left: 52px; bottom: 14px; }
  html body #iba-esn .iba-esn-a4-s.is-RB { right: 7px; bottom: 14px; }
  html body #iba-esn .iba-esn-a4-s.is-RM { right: 7px; bottom: 30px; }
  html body #iba-esn .iba-esn-a4-s.is-RT { right: 7px; bottom: 46px; }
  html body #iba-esn .iba-esn-a4-s.is-clash { border-color: #c62828; background: #fdecea; color: #c62828; }
  @media (max-width: 640px) {
    html body #iba-esn.iba-esn-ov { align-items: flex-end !important; padding: 0 !important; }
    html body #iba-esn .iba-esn-box { border-radius: 18px 18px 0 0; max-height: 92vh; }
    html body #iba-esn .iba-esn-printgrid { grid-template-columns: minmax(0, 1fr); }
    html body #iba-esn .iba-esn-a4 { justify-self: center; }
    html body #iba-esn .iba-esn-extra { grid-template-columns: minmax(0, 1fr); }
    html body #iba-esn .iba-esn-foot { flex-wrap: wrap; }
  }
  /* Active Task: Ready before printing */
  html body #wd-activetask .iba-esn-ready-btn.is-locked { opacity: .45 !important; cursor: not-allowed !important; }
  html body #wd-activetask .iba-esn-approval-btn,
  html body #wd-activetask .iba-esn-print-btn,
  html body #wd-activetask .iba-esn-ready-btn,
  html body #wd-activetask .iba-esn-extra-btn { margin-left: 4px; white-space: nowrap; }
  /* 17.0.2 patch 16: Settings card (Super Admin) */
  html body #iba-esn-settings-card { grid-column: 1 / -1; }
  html body:not(.iba-is-super-admin) #iba-esn-settings-card { display: none !important; }
  html body #iba-esn-settings-card .iba-esn-card-sum { margin: 8px 0 4px; font-size: 13.5px; color: #EBD8A8 !important; }
  html body #iba-esn-settings-card .iba-esn-card-sum b { color: #fff !important; }
  html body #iba-esn-settings-card .iba-esn-card-bad { color: #FCA5A5 !important; font-weight: 700; }
}
