:root{
  --navy:#202a42;
  --navy-2:#182238;
  --teal:#009da8;
  --teal-soft:#e7fbfd;
  --green:#57cb7a;
  --red:#ee4266;
  --bg:#eef5f8;
  --surface:#ffffff;
  --text:#17263d;
  --muted:#718093;
  --line:#e5edf2;
  --line-soft:#f1f5f8;
  --shadow:0 10px 28px rgba(25,42,70,.07);
}

*{box-sizing:border-box}
html,body,#app{min-height:100%}
body{
  margin:0;
  font-family:Inter,Segoe UI,Arial,sans-serif;
  color:var(--text);
  background:
    linear-gradient(rgba(239,246,249,.92),rgba(239,246,249,.92)),
    url("/assets/radiology-suite-bg.png") center/cover fixed no-repeat;
  font-size:13px;
  line-height:1.45;
}
button,input,select,textarea{font:inherit}
button{cursor:pointer;border:0;white-space:nowrap}

.login-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:
    linear-gradient(rgba(8,28,55,.72),rgba(8,28,55,.72)),
    url("/assets/radiology-suite-bg.png") center/cover no-repeat;
}
.login-card{
  width:min(430px,100%);
  background:#fff;
  border-radius:8px;
  padding:38px;
  box-shadow:0 22px 70px rgba(0,0,0,.25);
}
.login-card img{display:block;width:86px;margin:0 auto 18px}
.login-card h1{text-align:center;margin:0 0 26px;font-size:26px;font-weight:800}
.field{display:block;margin-bottom:15px}
.field span{display:block;margin-bottom:7px;color:#5f6d7d;font-weight:700}
.field input,.field select,.field textarea{
  width:100%;
  border:1px solid #dce7ee;
  border-radius:5px;
  padding:11px 12px;
  background:#fff;
  color:var(--text);
  outline:none;
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--teal);box-shadow:0 0 0 3px rgba(0,157,168,.12)}
.primary{background:var(--teal);color:#fff;border-radius:5px;padding:10px 16px;font-weight:800}
.wide{width:100%}
.error{color:var(--red);min-height:20px}

.shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:238px minmax(0,1fr);
  grid-template-rows:72px minmax(0,1fr);
}
.top{
  grid-column:1/3;
  background:var(--navy);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
  box-shadow:0 2px 14px rgba(0,0,0,.18);
  z-index:5;
}
.brand{display:flex;align-items:center;gap:13px}
.brand img{width:50px;height:50px;object-fit:contain;background:#fff;border-radius:8px;padding:5px}
.brand strong{font-size:18px;line-height:1.1;font-weight:800}
.brand span{display:block;color:#cbd5df;margin-top:3px;font-size:12px}
.account{display:flex;align-items:center;gap:12px}
.avatar{width:34px;height:34px;border-radius:50%;background:#edf3f7;color:var(--navy);display:grid;place-items:center;font-weight:900}

.side{
  background:rgba(255,255,255,.98);
  border-right:1px solid var(--line);
  padding:18px 12px;
  box-shadow:4px 0 18px rgba(29,48,74,.04);
}
.nav{
  display:block;
  width:100%;
  text-align:left;
  padding:12px 14px;
  border-radius:6px;
  background:transparent;
  color:#778597;
  font-weight:800;
  margin-bottom:7px;
  letter-spacing:0;
}
.nav:hover{background:#f2f7fa;color:var(--text)}
.nav.active{background:var(--teal-soft);color:var(--teal)}

.main{
  min-width:0;
  padding:22px;
  overflow:auto;
}
.page-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}
.page-head h1{
  font-size:21px;
  margin:0;
  font-weight:900;
  color:#0e2038;
}
.muted{color:var(--muted)}

.panel{
  background:rgba(255,255,255,.96);
  border:1px solid var(--line);
  border-radius:7px;
  padding:18px;
  margin-bottom:18px;
  box-shadow:var(--shadow);
}
.cards{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:14px}
.card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:7px;
  padding:14px 16px;
  min-height:76px;
}
.card span{color:var(--muted);font-weight:700}
.card strong{display:block;font-size:23px;margin-top:5px}
.modalities{display:flex;gap:9px;flex-wrap:wrap;margin-top:12px}
.chip{background:#eff9fb;color:var(--teal);font-weight:900;border-radius:999px;padding:7px 11px}

.toolbar{display:grid;grid-template-columns:repeat(4,1fr) auto;gap:12px;align-items:end}
.table-wrap{
  width:100%;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:7px;
  background:#fff;
}
table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:#fff;
  min-width:1280px;
}
th,td{
  text-align:left;
  border-bottom:1px solid var(--line-soft);
  padding:8px 10px;
  vertical-align:middle;
  color:#253550;
}
th{
  position:sticky;
  top:0;
  z-index:2;
  background:#fbfdfe;
  color:#5d6b7c;
  font-weight:900;
  font-size:12px;
  text-transform:none;
}
td{font-size:12.5px}
tbody tr:hover{background:#fbfdff}
tbody tr:last-child td{border-bottom:0}
td:nth-child(1){font-weight:700;color:#1e2c44}
td:nth-child(2){font-family:Consolas,Menlo,monospace;font-size:12px;color:#33445f}
td:nth-child(8),td:nth-child(9),td:nth-child(10){white-space:nowrap}

.status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:82px;
  border-radius:999px;
  padding:5px 10px;
  font-size:11px;
  font-weight:900;
  background:#edf3f7;
  color:#667789;
}
.status.assigned{background:#fff4dc;color:#9a6800}
.status.finalized{background:#def8e8;color:#107835}
.status.unassigned{background:#edf3f7;color:#667789}

.actions{display:flex;gap:7px;align-items:center;flex-wrap:nowrap}
.small{
  background:#eef8fa;
  color:var(--teal);
  font-weight:900;
  border-radius:5px;
  padding:7px 10px;
  min-height:30px;
  font-size:12px;
  transition:.15s ease;
}
.small:hover,.primary:hover{filter:brightness(.96)}
.small.dark{background:var(--navy);color:#fff}
.small.green{background:var(--green);color:#fff}

.progress{
  height:6px;
  width:142px;
  background:#e8f0f5;
  border-radius:999px;
  overflow:hidden;
  margin-bottom:6px;
}
.bar{height:100%;width:0;background:var(--teal);transition:width .2s}

.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:13px}
.full{grid-column:1/-1}
.hidden{display:none!important}
.report-box{min-height:230px}
.modal{
  position:fixed;
  inset:0;
  background:rgba(14,24,38,.55);
  display:grid;
  place-items:center;
  padding:20px;
  z-index:20;
}
.dialog{
  background:#fff;
  border-radius:8px;
  width:min(760px,100%);
  padding:23px;
  box-shadow:0 24px 70px rgba(0,0,0,.25);
}
.dialog-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.dialog-head h2{margin:0;font-size:20px}

@media(max-width:1000px){
  .shell{grid-template-columns:1fr;grid-template-rows:72px auto 1fr}
  .top{grid-column:1}
  .side{display:flex;overflow:auto;padding:10px}
  .nav{min-width:max-content;margin:0 6px 0 0}
  .main{padding:16px}
  .cards,.toolbar,.form-grid{grid-template-columns:1fr}
  .brand strong{font-size:16px}
}

/* final compact clinical table polish */
.panel h2{font-size:16px;margin:0 0 12px;font-weight:900;color:#16243a}
.main .panel:has(.table-wrap){padding:12px}
.table-wrap table th:nth-child(1),.table-wrap table td:nth-child(1){min-width:190px}
.table-wrap table th:nth-child(2),.table-wrap table td:nth-child(2){min-width:190px}
.table-wrap table th:nth-child(3),.table-wrap table td:nth-child(3){min-width:95px}
.table-wrap table th:nth-child(4),.table-wrap table td:nth-child(4){min-width:95px}
.table-wrap table th:nth-child(5),.table-wrap table td:nth-child(5){min-width:90px}
.table-wrap table th:nth-child(6),.table-wrap table td:nth-child(6){min-width:150px}
.table-wrap table th:nth-child(8),.table-wrap table td:nth-child(8){min-width:105px}
.table-wrap table th:nth-child(9),.table-wrap table td:nth-child(9){min-width:165px}
.table-wrap table th:nth-child(10),.table-wrap table td:nth-child(10){min-width:150px}
td .small.green{width:132px;text-align:center}
.small.dark{background:#1d2944}
.page-head{margin-bottom:14px}
.panel{margin-bottom:14px}

/* NBNC enterprise compact polish */
body{
  font-family:"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size:13px;
  font-weight:400;
  letter-spacing:0;
}
.main{padding:18px 20px}
.page-head h1{font-size:20px;font-weight:800}
.panel{padding:12px;margin-bottom:12px;border-radius:6px}
.cards{gap:12px}
.card{padding:12px 14px;min-height:70px}
.card strong{font-size:22px;font-weight:750}
.table-wrap{border-radius:6px}
table{min-width:1260px}
th{
  padding:8px 10px;
  font-size:12px;
  font-weight:750;
  color:#637084;
}
td{
  padding:7px 10px;
  font-size:12.5px;
  font-weight:400;
  color:#24334b;
}
td:nth-child(1){
  font-weight:400!important;
  color:#24334b!important;
}
td:nth-child(2){
  font-family:"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size:12.2px;
}
tbody tr{height:44px}
.status{
  min-width:76px;
  padding:4px 9px;
  font-size:11px;
  font-weight:750;
}
.actions{gap:6px}
.small,.primary{
  border-radius:5px;
  min-height:28px;
  padding:6px 9px;
  font-size:12px;
  font-weight:750;
  line-height:1.1;
}
td .small.green{
  width:auto;
  min-width:112px;
  max-width:136px;
}
.download-cell{
  display:grid;
  grid-template-columns:116px 48px;
  align-items:center;
  gap:8px;
  min-width:174px;
}
.download-progress{
  display:flex;
  flex-direction:column;
  gap:3px;
}
.progress{
  width:116px;
  height:5px;
  margin:0;
}
.progress-label{
  font-size:10.5px;
  color:#6d7b8d;
  line-height:1;
}
.download-progress.complete{
  display:none;
}
.small.green.download-complete{
  background:#eef8f1;
  color:#208447;
}
.dialog .primary{
  min-height:34px;
  padding:9px 13px;
}

/* NBNC action fix compact controls */
.download-cell{grid-template-columns:104px 104px;gap:8px}
.progress{width:104px}
td .small.green{min-width:104px;max-width:118px}
.small,.primary{font-size:12px;padding:6px 9px;min-height:28px}
.dialog .primary{min-height:32px;padding:8px 12px}
.error{font-size:12px;color:#ee4266}

/* NBNC download icon button */
.download-cell{
  grid-template-columns:112px 34px;
  gap:7px;
}
.download-icon-btn,
td .download-icon-btn.small.green{
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
  height:34px;
  min-height:34px;
  padding:0!important;
  border-radius:50%;
  display:inline-grid;
  place-items:center;
  background:#15a8e5!important;
  color:#fff!important;
  box-shadow:0 2px 7px rgba(21,168,229,.18);
}
.download-icon-btn svg{
  width:19px;
  height:19px;
  fill:#fff;
  display:block;
}
.download-icon-btn.download-complete{
  background:#58c878!important;
}
.download-icon-btn:disabled{
  opacity:.8;
  cursor:wait;
}

/* NBNC compact table/layout final pass */
.main{
  padding:16px 18px!important;
}
.page-head{
  margin-bottom:10px!important;
}
.page-head h1{
  font-size:19px!important;
}
.cards{
  gap:10px!important;
  margin-bottom:10px!important;
}
.card{
  min-height:58px!important;
  padding:10px 13px!important;
  border-radius:6px!important;
}
.card span{
  font-size:12px!important;
  line-height:1.1!important;
}
.card strong{
  font-size:21px!important;
  margin-top:3px!important;
  line-height:1.1!important;
}
.panel{
  padding:10px!important;
  margin-bottom:10px!important;
  border-radius:6px!important;
}
.panel h2{
  font-size:15px!important;
  margin:0 0 8px!important;
}
.chip{
  padding:5px 9px!important;
  font-size:12px!important;
}
.table-wrap{
  border-radius:6px!important;
}
table{
  min-width:1180px!important;
  table-layout:fixed!important;
}
th,td{
  padding:6px 8px!important;
}
th{
  font-size:11.5px!important;
  line-height:1.1!important;
}
td{
  font-size:12px!important;
  line-height:1.15!important;
  height:38px!important;
}
tbody tr{
  height:38px!important;
}
.table-wrap table th:nth-child(1),.table-wrap table td:nth-child(1){width:190px!important;min-width:190px!important}
.table-wrap table th:nth-child(2),.table-wrap table td:nth-child(2){width:190px!important;min-width:190px!important}
.table-wrap table th:nth-child(3),.table-wrap table td:nth-child(3){width:82px!important;min-width:82px!important}
.table-wrap table th:nth-child(4),.table-wrap table td:nth-child(4){width:92px!important;min-width:92px!important}
.table-wrap table th:nth-child(5),.table-wrap table td:nth-child(5){width:78px!important;min-width:78px!important}
.table-wrap table th:nth-child(6),.table-wrap table td:nth-child(6){width:145px!important;min-width:145px!important}
.table-wrap table th:nth-child(7),.table-wrap table td:nth-child(7){width:90px!important;min-width:90px!important}
.table-wrap table th:nth-child(8),.table-wrap table td:nth-child(8){width:98px!important;min-width:98px!important}
.table-wrap table th:nth-child(9),.table-wrap table td:nth-child(9){width:176px!important;min-width:176px!important}
.table-wrap table th:nth-child(10),.table-wrap table td:nth-child(10){width:122px!important;min-width:122px!important}
td{
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
td:nth-child(9),td:nth-child(10){
  overflow:visible!important;
}
.status{
  min-width:72px!important;
  padding:3px 8px!important;
  font-size:10.5px!important;
}
.actions{
  gap:5px!important;
}
.small,.primary{
  min-height:26px!important;
  padding:5px 8px!important;
  font-size:11.5px!important;
  border-radius:5px!important;
}
.download-cell{
  display:grid!important;
  grid-template-columns:84px 30px 30px!important;
  align-items:center!important;
  gap:6px!important;
  min-width:150px!important;
}
.download-progress{
  display:contents!important;
}
.progress{
  width:84px!important;
  height:5px!important;
  margin:0!important;
}
.progress-label{
  font-size:10.5px!important;
  line-height:1!important;
  min-width:28px!important;
  color:#667789!important;
}
.download-progress.complete .progress,
.download-progress.complete .progress-label{
  display:none!important;
}
.download-icon-btn,
td .download-icon-btn.small.green{
  width:30px!important;
  min-width:30px!important;
  max-width:30px!important;
  height:30px!important;
  min-height:30px!important;
}
.download-icon-btn svg{
  width:17px!important;
  height:17px!important;
}

/* Keep download icon fixed after completion */
td:nth-child(9) .download-cell{
  grid-template-columns:86px 28px 28px!important;
  width:150px!important;
  min-width:150px!important;
  max-width:150px!important;
}
td:nth-child(9) .download-progress.complete{
  display:contents!important;
}
td:nth-child(9) .download-progress.complete .progress,
td:nth-child(9) .download-progress.complete .progress-label{
  visibility:hidden!important;
  display:block!important;
}
td:nth-child(9) .download-progress.complete .progress{
  width:86px!important;
  height:5px!important;
}
td:nth-child(9) .download-progress.complete .progress-label{
  width:28px!important;
  min-width:28px!important;
}
td:nth-child(9) .download-icon-btn{
  grid-column:3!important;
}

/* NBNC final download button size/layout fix */
table.study-table tr,
.table-wrap table tr {
  height: 42px !important;
}

table.study-table th,
table.study-table td,
.table-wrap table th,
.table-wrap table td {
  padding-top: 7px !important;
  padding-bottom: 7px !important;
  font-size: 13px !important;
  line-height: 1.25 !important;
}

td:nth-child(9) {
  width: 150px !important;
  min-width: 150px !important;
  max-width: 150px !important;
}

td:nth-child(9) .download-cell {
  display: grid !important;
  grid-template-columns: 88px 34px !important;
  align-items: center !important;
  gap: 8px !important;
  width: 130px !important;
  min-width: 130px !important;
  max-width: 130px !important;
}

td:nth-child(9) .download-progress {
  display: grid !important;
  grid-template-columns: 64px 24px !important;
  align-items: center !important;
  gap: 4px !important;
  width: 88px !important;
  min-width: 88px !important;
  max-width: 88px !important;
}

td:nth-child(9) .progress {
  width: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  height: 5px !important;
}

td:nth-child(9) .progress-label {
  width: 24px !important;
  font-size: 10px !important;
  color: #6f7d8d !important;
  line-height: 1 !important;
}

td:nth-child(9) .download-icon-btn,
td:nth-child(9) button[id^="dl-"] {
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  padding: 0 !important;
  border-radius: 6px !important;
  background: #12a8df !important;
  color: #fff !important;
  display: inline-grid !important;
  place-items: center !important;
  overflow: hidden !important;
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

td:nth-child(9) .download-icon-btn svg,
td:nth-child(9) button[id^="dl-"] svg {
  width: 15px !important;
  height: 15px !important;
  stroke: #fff !important;
  stroke-width: 2.6 !important;
}

td:nth-child(9) button[id^="dl-"]:not(:has(svg))::before {
  content: "↓";
  font-size: 17px !important;
  line-height: 1 !important;
  font-weight: 800 !important;
}

td:nth-child(9) .download-progress.complete {
  visibility: hidden !important;
  display: grid !important;
}

td:nth-child(10) .actions,
td:nth-child(10) {
  white-space: nowrap !important;
}

td:nth-child(10) .small {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 10px !important;
  border-radius: 5px !important;
  font-size: 12px !important;
}

/* NBNC report action buttons only */
.report-downloads {
  display: flex !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
}

.report-downloads .small,
.study-download-mini {
  min-height: 28px !important;
  height: 28px !important;
  padding: 0 9px !important;
  border-radius: 5px !important;
  font-size: 12px !important;
  line-height: 28px !important;
  white-space: nowrap !important;
}

/* NBNC report buttons single-line fix */
.report-downloads.single-line {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.report-downloads.single-line .small {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 8px !important;
  font-size: 11px !important;
  line-height: 28px !important;
  white-space: nowrap !important;
}

.report-downloads.single-line .small.dark {
  min-width: 54px !important;
}

.table-wrap table th:last-child,
.table-wrap table td:last-child {
  min-width: 360px !important;
  width: 360px !important;
}

/* NBNC dashboard/study assign table width fix only */
.study-list-wrap {
  width: 100% !important;
  overflow-x: auto !important;
}

.study-list-table {
  width: 100% !important;
  min-width: 1320px !important;
  table-layout: fixed !important;
}

.study-list-table th,
.study-list-table td {
  height: 36px !important;
  padding: 6px 9px !important;
  line-height: 1.25 !important;
  vertical-align: middle !important;
}

.study-list-table th:nth-child(1),
.study-list-table td:nth-child(1) { width: 15% !important; }
.study-list-table th:nth-child(2),
.study-list-table td:nth-child(2) { width: 14% !important; }
.study-list-table th:nth-child(3),
.study-list-table td:nth-child(3) { width: 8% !important; }
.study-list-table th:nth-child(4),
.study-list-table td:nth-child(4) { width: 8% !important; }
.study-list-table th:nth-child(5),
.study-list-table td:nth-child(5) { width: 7% !important; }
.study-list-table th:nth-child(6),
.study-list-table td:nth-child(6) { width: 13% !important; }
.study-list-table th:nth-child(7),
.study-list-table td:nth-child(7) { width: 8% !important; }
.study-list-table th:nth-child(8),
.study-list-table td:nth-child(8) { width: 8% !important; }
.study-list-table th:nth-child(9),
.study-list-table td:nth-child(9) { width: 11% !important; }
.study-list-table th:nth-child(10),
.study-list-table td:nth-child(10) { width: 8% !important; }

.study-list-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.study-list-table td:nth-child(9),
.study-list-table td:nth-child(10) {
  overflow: visible !important;
}

.study-list-table .actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

/* NBNC dashboard/study assign search filters */
.nbnc-filter-panel {
  padding: 12px 14px !important;
}

.nbnc-filter-grid {
  display: grid !important;
  grid-template-columns: minmax(220px, 1.4fr) 150px 150px auto !important;
  align-items: end !important;
  gap: 12px !important;
}

.nbnc-filter-grid .field {
  margin-bottom: 0 !important;
}

.nbnc-filter-grid .field span {
  font-size: 12px !important;
  margin-bottom: 5px !important;
}

.nbnc-filter-grid input,
.nbnc-filter-grid select {
  height: 34px !important;
  padding: 6px 9px !important;
  font-size: 13px !important;
}

.nbnc-filter-actions {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  white-space: nowrap !important;
}

.nbnc-filter-actions .primary,
.nbnc-filter-actions .small {
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 14px !important;
}

.study-list-wrap,
.study-list-table {
  width: 100% !important;
}

.study-list-table {
  table-layout: fixed !important;
}

.study-list-table th:last-child,
.study-list-table td:last-child {
  width: 150px !important;
  min-width: 150px !important;
}

@media (max-width: 1100px) {
  .nbnc-filter-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* NBNC 50 row pagination for dashboard and study assign */
.nbnc-pager {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 4px 0 !important;
  color: #6f7d8d !important;
  font-size: 12px !important;
}

.nbnc-pager-buttons {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.nbnc-pager-buttons .small {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 10px !important;
}

.nbnc-pager-buttons .small:disabled {
  opacity: .45 !important;
  cursor: not-allowed !important;
}
