/* Demo Polyclinic HIS v4.2 - deliberately legacy ASP.NET-era look (SIMULATION) */
* { box-sizing: border-box; }
html { background: #c9d3de; }
body {
  margin: 0; background: #c9d3de; color: #1b1b1b;
  font: 12px/1.35 Tahoma, "Segoe UI", Verdana, Arial, sans-serif;
}
a { color: #0b3d91; }
.ar { display: block; font-family: Tahoma, "Geeza Pro", "Segoe UI", Arial, sans-serif; font-size: 11px;
      color: #5a6a7d; font-weight: normal; line-height: 1.25; }
.muted { color: #8a96a3; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
code { font-family: Consolas, monospace; background: #eef2f6; padding: 0 3px; }

/* ---------------------------------------------------- simulation strip (NOT part of the HIS) */
.simbar { background: #151a22; color: #e8ecf2; border-bottom: 3px solid #ffd21f;
          font: 13px/1.3 -apple-system, "Segoe UI", system-ui, sans-serif; position: sticky; top: 0; z-index: 50; }
.simbar-in { max-width: 1240px; margin: 0 auto; padding: 8px 12px; display: flex; align-items: center; gap: 10px;
             flex-wrap: wrap; }
.sim-tag { background: #ffd21f; color: #111; font-weight: 800; font-size: 11px; letter-spacing: .08em;
           padding: 4px 8px; border-radius: 3px; }
.sim-lbl { color: #9aa6b6; font-size: 12px; }
.sim-select { background: #232b37; color: #fff; border: 1px solid #3a4658; border-radius: 6px; padding: 6px 8px;
              font: 13px -apple-system, "Segoe UI", sans-serif; max-width: 360px; }
.sim-btn { background: #2a3444; color: #fff; border: 1px solid #435169; border-radius: 6px; padding: 7px 12px;
           font: 600 13px -apple-system, "Segoe UI", sans-serif; cursor: pointer; text-decoration: none;
           white-space: nowrap; }
.sim-btn:hover { background: #35425a; }
.sim-primary { background: #ffd21f; color: #111; border-color: #ffd21f; font-size: 14px; padding: 8px 16px; }
.sim-primary:hover { background: #ffe060; }
.sim-ghost { background: transparent; }
.sim-spacer { flex: 1; }
.sim-link { color: #9cc4ff; text-decoration: none; font-size: 12px; white-space: nowrap; }
.sim-link:hover { text-decoration: underline; }
.sim-planted { font-size: 12px; color: #c7d0dc; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sim-chip { display: inline-flex; align-items: center; gap: 6px; background: #3a1f24; color: #ffc9cf;
            border: 1px solid #7d3440; border-radius: 12px; padding: 2px 4px 2px 9px; font-size: 12px; }
.sim-chip.clean { background: #16311f; color: #b9f0c8; border-color: #2c6b3e; padding-right: 9px; }
.sim-chip button { background: #5a2a33; color: #fff; border: 0; border-radius: 10px; font-size: 11px;
                   padding: 1px 7px; cursor: pointer; }
.sim-chip button:hover { background: #7d3440; }
.sim-chip .rid { font-weight: 700; }
.sim-toast { position: fixed; right: 16px; bottom: 16px; background: #151a22; color: #fff; border-left: 4px solid #ffd21f;
             padding: 10px 14px; border-radius: 6px; font: 13px -apple-system, "Segoe UI", sans-serif;
             box-shadow: 0 6px 24px rgba(0,0,0,.3); z-index: 60; max-width: 420px; }
.sim-trace { max-width: 1240px; margin: 10px auto 0; background: #151a22; color: #dfe6ee; border-top: 3px solid #ffd21f;
             padding: 10px 14px; font: 12px/1.5 -apple-system, "Segoe UI", sans-serif; border-radius: 0 0 4px 4px; }
.sim-trace .sim-tag { margin-right: 8px; }
.sim-trace table { border-collapse: collapse; margin-top: 6px; }
.sim-trace td, .sim-trace th { padding: 2px 10px 2px 0; text-align: left; font-weight: normal; }
.sim-trace th { color: #9aa6b6; }
.sim-trace .yes { color: #ff8f9c; font-weight: 700; }
.sim-trace .no { color: #7fd99a; }

/* ---------------------------------------------------- HIS chrome */
#his { max-width: 1240px; margin: 10px auto 24px; background: #f4f6f9; border: 1px solid #7a8ca3;
       box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.his-top { display: flex; align-items: center; gap: 12px; padding: 8px 12px; color: #fff;
           background: linear-gradient(#2e6db4, #1c4a86); border-bottom: 1px solid #0f305a; }
.his-logo { width: 38px; height: 38px; border: 2px solid #fff; border-radius: 4px; display: flex; align-items: center;
            justify-content: center; font: bold 16px Georgia, serif; background: #0f305a; }
.his-title { flex: 1; }
.his-name { font: bold 16px Tahoma, "Segoe UI", sans-serif; text-shadow: 0 1px 0 #0f305a; }
.his-name-ar { font-size: 12px; opacity: .9; text-align: left; }
.sim-marker { display: inline-block; margin-left: 6px; background: #ffd21f; color: #111; font-size: 11px; padding: 1px 6px;
              border-radius: 2px; text-shadow: none; vertical-align: 2px; letter-spacing: .04em; }
.his-user { font-size: 11px; text-align: right; line-height: 1.6; }
.fake-link { text-decoration: underline; cursor: default; }
.his-tabs { display: flex; gap: 2px; padding: 6px 8px 0; background: #b7c6d8; border-bottom: 1px solid #7a8ca3; }
.tab { display: block; padding: 4px 14px 3px; background: linear-gradient(#e7edf4, #c8d4e2); border: 1px solid #7a8ca3;
       border-bottom: 0; border-radius: 4px 4px 0 0; color: #1b2b40; text-decoration: none; font-weight: bold;
       font-size: 12px; text-align: center; }
.tab .ar { font-size: 10px; color: #4d5f75; }
.tab.active { background: #f4f6f9; position: relative; top: 1px; color: #0b3d91; }
.tab.disabled { color: #8795a6; cursor: not-allowed; font-weight: normal; }
.tab.disabled .ar { color: #9aa6b4; }
a.tab:hover:not(.active) { background: linear-gradient(#f3f6fa, #d6e0ec); }
.his-crumb { padding: 5px 12px; font-size: 11px; color: #3e4d60; background: #e6ebf1; border-bottom: 1px solid #c3cdd9; }
.his-crumb span { color: #8a96a3; margin: 0 3px; }
.his-body { padding: 10px 12px 12px; }
.his-foot { padding: 6px 12px; font-size: 10px; color: #5d6b7c; background: #e6ebf1; border-top: 1px solid #c3cdd9; }
.his-msg { background: #fff8d6; border: 1px solid #e3cc6a; padding: 5px 8px; margin: 0 0 8px; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #2e6db4;
            padding-bottom: 4px; margin-bottom: 8px; }
.pagehead h1 { margin: 0; font: bold 15px Tahoma, "Segoe UI", sans-serif; color: #1c4a86; }
.pagehead h1 .ar { display: inline; font-size: 12px; margin-left: 8px; }
.pagehead-r { font-size: 11px; color: #506177; }
.req { color: #c00; margin-left: 2px; }

/* ---------------------------------------------------- form */
table.cols { width: 100%; border-collapse: collapse; }
table.cols td.col { vertical-align: top; width: 50%; padding: 0; }
table.cols td.col + td.col { padding-left: 10px; }
fieldset { border: 1px solid #9fb3cc; margin: 0 0 10px; padding: 6px 8px 8px; background: #fff; }
legend { font-weight: bold; color: #1c4a86; background: #dfe8f3; border: 1px solid #9fb3cc; padding: 1px 8px;
         font-size: 12px; }
legend .ar { display: inline; margin-left: 6px; color: #4d5f75; }
table.frm { width: 100%; border-collapse: collapse; }
table.frm th { text-align: left; font-weight: normal; color: #253649; padding: 3px 6px 3px 0; vertical-align: top;
               white-space: nowrap; width: 1%; }
table.frm td { padding: 3px 10px 3px 0; vertical-align: top; }
table.frm label { font-weight: bold; font-size: 12px; }
table.frm label .ar { font-size: 10.5px; }
table.frm th .req { vertical-align: top; }
table.frm.wide th { width: 190px; }
.txt, .ddl, .txa { font: 12px Tahoma, "Segoe UI", sans-serif; border: 1px solid #7f9db9; background: #fff; color: #000;
                   padding: 2px 3px; height: 21px; border-radius: 0; }
.txa { height: auto; width: 100%; resize: vertical; min-height: 38px; }
.ddl { height: 21px; padding: 1px; max-width: 100%; }
.txt:focus, .ddl:focus, .txa:focus { outline: 1px solid #f0c000; background: #fffde8; }
.w-full { width: 100%; } .w-lg { width: 300px; } .w-md { width: 150px; } .w-sm { width: 110px; } .w-xs { width: 46px; }
.date { width: 88px; }
.cal { display: inline-block; width: 16px; height: 16px; vertical-align: -4px; margin-left: 3px;
       background: linear-gradient(#c33 0 4px, #fff 4px); border: 1px solid #8a8a8a; }
.dx-label { color: #2e4b6d; font-size: 11px; margin-left: 6px; }
.elig-msg { font-size: 11px; margin-left: 6px; }
.elig-msg.ok { color: #1c7a2e; } .elig-msg.bad { color: #b00020; } .elig-msg.busy { color: #555; }
table.vitals th { width: auto; }

.btn { display: inline-block; font: 12px Tahoma, "Segoe UI", sans-serif; color: #111; text-decoration: none;
       background: linear-gradient(#fbfbfb, #dcdcdc); border: 1px solid #707070; border-radius: 3px; padding: 4px 12px;
       cursor: pointer; line-height: 1.3; }
.btn:hover { background: linear-gradient(#eaf6fd, #bee6fd); border-color: #3c7fb1; }
.btn:disabled { color: #999; cursor: default; background: #eee; border-color: #bbb; }
.btn-sm { padding: 1px 6px; font-size: 11px; }
.btn-primary { background: linear-gradient(#4f8fd6, #245fa8); color: #fff; border-color: #163f73; font-weight: bold; }
.btn-primary:hover { background: linear-gradient(#5c9be0, #2b6bb7); border-color: #163f73; }
.lnk { background: none; border: 0; color: #9a2b2b; cursor: pointer; font-size: 14px; padding: 0 4px; }

/* grid */
table.grid { width: 100%; border-collapse: collapse; border: 1px solid #9fb3cc; }
table.grid th { background: linear-gradient(#e9eff6, #cfdbe8); border: 1px solid #9fb3cc; padding: 3px 4px; text-align: left;
                font-size: 11.5px; color: #1b2b40; vertical-align: bottom; }
table.grid th .ar { font-size: 10px; }
table.grid td { border: 1px solid #d3dce7; padding: 2px 3px; }
table.grid tr.alt td { background: #f3f7fb; }
table.grid td.rn { text-align: center; color: #506177; width: 22px; }
table.grid td.rx { width: 22px; text-align: center; }
table.grid .txt { width: 100%; height: 20px; }
table.grid { table-layout: fixed; }
table.grid.list, table.grid.ro { table-layout: auto; }
.num { text-align: right; }
.grid-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 12px; }
.hint { color: #5d6b7c; font-size: 11px; }
.total { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.total label { font-weight: bold; }
.total label .ar { display: inline; margin-left: 4px; }
.total-box { font-weight: bold; background: #fffbe6; }
.actions { display: flex; align-items: center; gap: 8px; padding: 8px 0 2px; border-top: 1px solid #c3cdd9; margin-top: 4px; }
.actions .btn { padding: 5px 14px; }
.actions-note { color: #5d6b7c; font-size: 11px; margin-left: auto; text-align: right; }
.actions-note .ar { font-size: 10px; }

/* list */
table.grid.list td, table.grid.ro td { padding: 4px 6px; }
table.grid.list tbody tr:hover td { background: #fff7cc; }
table.grid.list tr.empty td { text-align: center; color: #5d6b7c; padding: 18px; }
table.grid.ro tr.denied td { background: #fde8ea; }
table.grid tfoot td { background: #eef3f8; border-top: 2px solid #9fb3cc; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: 11px; font-weight: bold; border: 1px solid; }
.b-ok { background: #e3f4e6; color: #1c6b2c; border-color: #8cc79a; }
.b-bad { background: #fde8ea; color: #a1122a; border-color: #e59aa6; }
.b-part { background: #fff1d6; color: #8a5300; border-color: #e7b964; }
.b-err { background: #efe4f7; color: #5b1f82; border-color: #b595cf; }
.b-pend { background: #eef2f6; color: #3e4d60; border-color: #aab7c6; }
.b-draft { background: #f4f4f4; color: #666; border-color: #bbb; font-weight: normal; }
tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: #fff1a8; } to { background: transparent; } }

/* detail status box */
.statusbox { border: 1px solid #9fb3cc; background: #fff; margin: 0 0 10px; padding: 8px 10px; border-left-width: 6px; }
.st-head { font-weight: bold; color: #1c4a86; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.st-head .ar { display: inline; margin-left: 6px; text-transform: none; }
.st-line { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: bold; margin-top: 4px; }
.st-ar { font-size: 12px; color: #4d5f75; margin-top: 2px; text-align: left; }
.st-icon { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.st-pend { border-left-color: #7f93ab; }
.st-pend .st-icon { border: 3px solid #b7c6d8; border-top-color: #2e6db4; animation: spin .8s linear infinite; }
.st-ok { border-left-color: #2f9a45; background: #f1faf3; } .st-ok #lblStatus { color: #1c6b2c; } .st-ok .st-icon { background: #2f9a45; }
.st-bad { border-left-color: #c21f3a; background: #fdf1f3; } .st-bad #lblStatus { color: #a1122a; } .st-bad .st-icon { background: #c21f3a; }
.st-part { border-left-color: #d98a00; background: #fff8e8; } .st-part #lblStatus { color: #8a5300; } .st-part .st-icon { background: #d98a00; }
.st-err { border-left-color: #6d2c96; background: #f7f0fb; } .st-err #lblStatus { color: #5b1f82; } .st-err .st-icon { background: #6d2c96; }
.st-draft { border-left-color: #999; } .st-draft .st-icon { background: #bbb; }
@keyframes spin { to { transform: rotate(360deg); } }
table.kv { width: 100%; border-collapse: collapse; }
table.kv th { text-align: left; font-weight: bold; width: 150px; padding: 3px 8px 3px 0; vertical-align: top; color: #253649; }
table.kv th .ar { font-size: 10px; }
table.kv td { padding: 3px 0; vertical-align: top; border-bottom: 1px dotted #d3dce7; }
