/* ==========================================================================
   Dr Ritu Hospital ERP — App Stylesheet
   Designed & Developed by Sandronix (https://sandronix.in)
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --navy: #0f6f74;
  --navy-dark: #0b4f53;
  --orange: #e0286d;
  --orange-dark: #b81d58;
  --brown: #8a4b3a;

  --bg: #f4f6fb;
  --white: #ffffff;
  --ink: #1a2238;
  --muted: #667085;
  --line: #e4e8f0;
  --hover: #f7f8fc;

  --green: #15803d;
  --green-bg: #e7f6ec;
  --red: #b91c1c;
  --red-bg: #fdecec;
  --amber: #b45309;
  --amber-bg: #fef3e2;
  --blue: #1d4ed8;
  --blue-bg: #e8eefd;

  --radius: 12px;
  --shadow: 0 10px 30px -12px rgba(11, 79, 83, 0.2);
  --sidebar-w: 248px;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--navy);
  text-decoration: none;
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--navy-dark);
}

[hidden] {
  display: none !important;
}

/* ---------- 3. Login ---------- */
.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
}

.login__card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px;
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow);
  text-align: center;
}

.login__logo {
  width: 110px;
  margin: 0 auto 14px;
}

.login__card h1 {
  font-size: 1.3rem;
}

.login__card p {
  margin-bottom: 22px;
  color: var(--muted);
}

.login__card form {
  display: grid;
  gap: 14px;
  text-align: left;
}

.login__credit {
  margin-top: 22px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- 4. App layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--navy-dark);
  color: #c4cde3;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__brand img {
  width: 54px;
  height: 54px;
  padding: 2px;
  border-radius: 50%;
  background: var(--white);
}

.sidebar__brand strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--white);
}

.sidebar__brand span {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffb766;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #c4cde3;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link svg {
  flex: none;
  width: 19px;
  height: 19px;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

.nav-link.is-active {
  background: var(--orange);
  color: var(--white);
}

.sidebar__foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  color: #8592b3;
}

.sidebar__foot a {
  color: #ffb766;
  font-weight: 600;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

.topbar__title {
  font-size: 1.1rem;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  font: inherit;
}

.user-chip__avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 600;
}

.user-chip__name {
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
}

.user-chip__name small {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: capitalize;
}

.topbar__right {
  position: relative;
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 240px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.user-menu__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--hover);
}

.user-menu__head small {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: capitalize;
}

.user-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.user-menu__item:hover {
  background: var(--hover);
}

.user-menu__item--danger {
  border-top: 1px solid var(--line);
  color: var(--red);
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--navy);
  cursor: pointer;
}

.view {
  padding: 24px;
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--orange);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--orange-dark);
}

.btn--navy {
  background: var(--navy);
  color: var(--white);
}

.btn--navy:hover {
  background: var(--navy-dark);
}

.btn--light {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

.btn--light:hover {
  background: var(--hover);
}

.btn--danger {
  border-color: #f5c2c2;
  background: var(--white);
  color: var(--red);
}

.btn--danger:hover {
  background: var(--red-bg);
}

.btn--wa {
  border-color: #b6e8c8;
  background: #effaf3;
  color: #128c4b;
}

.btn--wa:hover {
  background: #dff5e7;
}

.btn--ai {
  background: linear-gradient(120deg, #6d28d9, #db2777);
  color: var(--white);
}

/* topbar global search */
.gsearch {
  position: relative;
  width: min(380px, 40vw);
}

.gsearch .input {
  padding-left: 36px;
  background: var(--bg);
}

.gsearch > svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.gsearch__kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.7rem;
  color: var(--muted);
}

.gsearch__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.gsearch__item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.gsearch__item:hover,
.gsearch__item.is-active {
  background: var(--hover);
}

/* licence screen */
.lic-card textarea {
  min-height: 110px;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}

/* lab result entry & clinical charts */
.flag-H,
.flag-L {
  font-weight: 700;
  color: var(--red);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.timeline {
  display: grid;
}

.timeline__item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.timeline__item small {
  color: var(--muted);
}

.checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ai-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(120deg, #f3e8ff, #fce7f3);
  color: #5b21b6;
  font-size: 0.86rem;
}

@media (max-width: 1100px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .gsearch {
    width: auto;
    flex: 1;
  }

  .gsearch__kbd {
    display: none;
  }

  .checks {
    grid-template-columns: 1fr;
  }
}

.btn--sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn--block {
  width: 100%;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--orange-dark);
}

/* ---------- 6. Cards, toolbar, tabs ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.card__head h3 {
  font-size: 0.98rem;
}

.card__body {
  padding: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar__spacer {
  flex: 1;
}

.toolbar .input {
  width: auto;
  min-width: 160px;
}

.toolbar .search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  width: fit-content;
  max-width: 100%;
  scrollbar-width: none;
}

.tab {
  padding: 8px 16px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.tab.is-active {
  background: var(--navy);
  color: var(--white);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

/* let grid children shrink so wide tables scroll inside instead of stretching the page */
.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

.card__head {
  flex-wrap: wrap;
}

/* ---------- 7. Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.stat__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--blue-bg);
  color: var(--navy);
}

.stat__icon svg {
  width: 22px;
  height: 22px;
}

.stat__icon--orange { background: var(--amber-bg); color: var(--orange-dark); }
.stat__icon--green  { background: var(--green-bg); color: var(--green); }
.stat__icon--red    { background: var(--red-bg);   color: var(--red); }

.stat__label {
  font-size: 0.78rem;
  color: var(--muted);
}

.stat__value {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--navy-dark);
}

.stat__sub {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- 8. Tables ---------- */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #f9fafc;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--hover);
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}

.table .actions .btn + .btn {
  margin-left: 4px;
}

.cell-main {
  font-weight: 500;
}

.cell-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}

/* ---------- 9. Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge--green { background: var(--green-bg); color: var(--green); }
.badge--red   { background: var(--red-bg);   color: var(--red); }
.badge--amber { background: var(--amber-bg); color: var(--amber); }
.badge--blue  { background: var(--blue-bg);  color: var(--blue); }

.token {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
}

/* ---------- 10. Forms ---------- */
.form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 5px;
}

.field > span {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.86rem;
}

.input:focus {
  outline: 2px solid rgba(232, 137, 28, 0.45);
  border-color: var(--orange);
}

textarea.input {
  min-height: 80px;
  resize: vertical;
}

.section-title {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brown);
}

.policy-card {
  padding: 14px 16px;
  border: 1px solid #f2c48d;
  border-radius: 10px;
  background: var(--amber-bg);
}

.policy-card .kv {
  grid-template-columns: 120px 1fr;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}

/* ---------- 11. Patient picker ---------- */
.picker {
  position: relative;
}

.picker__results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.picker__item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.picker__item:hover {
  background: var(--hover);
}

.picker__chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #f2c48d;
  border-radius: 9px;
  background: var(--amber-bg);
}

/* ---------- 12. Bill editor ---------- */
.bill-lines td {
  padding: 6px 6px;
}

.bill-lines .input {
  padding: 7px 9px;
}

.bill-lines .w-qty  { width: 80px; }
.bill-lines .w-rate { width: 110px; }
.bill-lines .w-gst  { width: 70px; }

.totals {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
}

.totals__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.totals__row--grand {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy-dark);
}

/* ---------- 12b. Purchases & distributors ---------- */
.ways {
  display: grid;
  gap: 10px;
}

.way {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.way:hover {
  border-color: var(--orange);
  background: var(--amber-bg);
}

.way__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--blue-bg);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
}

.way b {
  font-weight: 600;
  color: var(--navy-dark);
}

.way small {
  display: block;
  color: var(--muted);
}

.dist-list {
  display: grid;
}

.dist {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.dist:hover {
  background: var(--hover);
}

.dist__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #f6d9e8;
  color: #7a1f52;
  font-size: 0.85rem;
  font-weight: 700;
}

.dist__main {
  flex: 1;
  min-width: 0;
}

.dist__main small {
  display: block;
  color: var(--muted);
}

.dist__amt {
  font-weight: 600;
  text-align: right;
  color: var(--green);
  white-space: nowrap;
}

.dist__amt small {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}

.dist__amt.is-due,
.is-due {
  color: var(--red);
}

.pur-split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.pur-preview {
  position: sticky;
  top: 80px;
  overflow: hidden;
}

.bill-preview {
  display: block;
  width: 100%;
  height: 75vh;
  border: 0;
  object-fit: contain;
  background: #f1f3f8;
}

.pur-lines {
  display: grid;
}

.pur-line,
.pur-item {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.pur-line__top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pur-line__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.pur-line__grid .input {
  padding: 7px 9px;
}

.pur-line__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--hover);
  font-size: 0.82rem;
  color: var(--muted);
}

.pur-line__foot b {
  color: var(--navy-dark);
}

.pur-item__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.pur-item__grid small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.pur-item__grid .num {
  text-align: right;
}

.pur-view {
  display: grid;
  gap: 16px;
  max-width: 860px;
}

.pur-billto {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pur-pay {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 16px 18px;
  background: #f4f8e8;
}

.pur-pay small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.pur-pay b {
  font-size: 1.15rem;
}

.pur-pay .num {
  text-align: right;
}

.pur-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

/* ---------- 13. Profile ---------- */
.profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-size: 1.3rem;
  font-weight: 600;
}

.profile h2 {
  font-size: 1.2rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.82rem;
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 12px;
  font-size: 0.86rem;
}

.kv dt {
  color: var(--muted);
}

/* ---------- 14. Bars (mini charts) ---------- */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding-top: 10px;
}

.bars__col {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}

.bars__bar {
  width: 100%;
  max-width: 38px;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: var(--orange);
}

.bars__label {
  font-size: 0.68rem;
  color: var(--muted);
}

.hbar {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.hbar__top {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
}

.hbar__track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--hover);
}

.hbar__fill {
  height: 100%;
  border-radius: 99px;
  background: var(--navy);
}

/* ---------- 15. Attendance ---------- */
.att {
  display: inline-flex;
  gap: 4px;
}

.att button {
  width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.att button.is-P { border-color: var(--green); background: var(--green); color: var(--white); }
.att button.is-A { border-color: var(--red);   background: var(--red);   color: var(--white); }
.att button.is-H { border-color: var(--amber); background: var(--amber); color: var(--white); }
.att button.is-L { border-color: var(--blue);  background: var(--blue);  color: var(--white); }
.att button.is-O { border-color: var(--muted); background: var(--muted); color: var(--white); }

/* ---------- 16. Modal & toast ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(11, 29, 69, 0.45);
}

.modal__box {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 32px);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.modal__box--wide {
  max-width: 880px;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal__head h3 {
  font-size: 1.02rem;
}

.modal__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--hover);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal__body {
  overflow-y: auto;
  padding: 20px;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  max-width: 360px;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--navy-dark);
  color: var(--white);
  font-size: 0.86rem;
  box-shadow: var(--shadow);
}

.toast--error {
  background: var(--red);
}

.loader {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

/* ---------- 17. Print ---------- */
.print-area {
  display: none;
}

.doc {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px;
  color: #000;
  font-size: 12.5px;
}

.doc__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--navy);
}

.doc__head img {
  width: 76px;
}

.doc__head h1 {
  font-size: 20px;
  color: var(--navy-dark);
}

.doc__head p {
  font-size: 11.5px;
  color: #444;
}

.doc__title {
  margin: 14px 0 10px;
  padding: 6px;
  background: #f1f3f8;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.doc__info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  margin-bottom: 12px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.doc th,
.doc td {
  padding: 6px 8px;
  border: 1px solid #ccc;
  text-align: left;
}

.doc th {
  background: #f1f3f8;
}

.doc .num {
  text-align: right;
}

.doc__section {
  margin: 12px 0;
}

.doc__section h4 {
  margin-bottom: 4px;
  font-size: 12.5px;
  color: var(--navy);
  text-transform: uppercase;
}

.doc__pre {
  white-space: pre-wrap;
}

.doc__sign {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
}

.doc__foot {
  margin-top: 24px;
  padding-top: 8px;
  border-top: 1px solid #ccc;
  font-size: 11px;
  text-align: center;
  color: #555;
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body {
    background: #fff;
  }

  .login,
  .app,
  .modal,
  .toast {
    display: none !important;
  }

  .print-area {
    display: block;
  }

  .doc {
    padding: 0;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 90;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.25s;
  }

  .sidebar.is-open {
    transform: none;
    box-shadow: var(--shadow);
  }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(11, 29, 69, 0.4);
  }

  .menu-btn {
    display: grid;
    place-items: center;
  }

  .grid-2,
  .pur-split {
    grid-template-columns: 1fr;
  }

  .pur-preview {
    position: static;
  }

  .bill-preview {
    height: 50vh;
  }

  .pur-line__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .pur-line__grid,
  .pur-item__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pur-billto {
    grid-template-columns: 1fr;
  }

  .pur-billto > div {
    text-align: left !important;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 0 12px;
  }

  .topbar__title {
    font-size: 0.98rem;
  }

  .user-chip__name {
    display: none;
  }

  .user-chip {
    padding: 4px;
  }

  .view {
    padding: 14px 12px;
  }

  .stats {
    gap: 10px;
  }

  .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px;
  }

  .stat__icon {
    width: 38px;
    height: 38px;
  }

  .stat__value {
    font-size: 1.1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar .search,
  .toolbar .input {
    flex: 1 1 100%;
    max-width: none;
  }

  .toolbar .btn {
    flex: 1;
  }

  .toolbar__spacer {
    display: none;
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal__box {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }

  .kv {
    grid-template-columns: 110px 1fr;
  }

  .doc__info {
    grid-template-columns: 1fr;
  }
}

/* ---------- v7: 4-column forms, ward board ---------- */
.form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid--4 .span-2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ward-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding: 16px; border-bottom: 1px solid var(--line, #e5e9f2); }
.ward { border: 1px solid var(--line, #e5e9f2); border-radius: 12px; padding: 12px; background: var(--bg-soft, #f7f9fc); }
.ward__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.ward__head span { color: var(--muted, #6b7280); font-size: 12px; }
.ward__beds { display: flex; flex-wrap: wrap; gap: 6px; }
.bedchip { min-width: 38px; padding: 5px 8px; border-radius: 8px; text-align: center; font-size: 12px; font-weight: 600;
  background: #e7f7ee; color: #157347; border: 1px solid #bfe8cf; }
.bedchip.is-occ { background: #fdecec; color: #b42318; border-color: #f6c7c3; }

/* ---------- v17: mobile hardening ---------- */
.main, .view, #view, .card, .card__body, .form, .field, .grid-3 > *, .grid-2 > *, .form-grid > * { min-width: 0; }
.input, select.input, textarea.input { min-width: 0; max-width: 100%; }
img, table { max-width: 100%; }
.tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > * { flex: 0 0 auto; white-space: nowrap; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.modal__body { overflow-x: hidden; }

@media (max-width: 600px) {
  html, body { overflow-x: hidden; }
  .view, #view { padding-left: 12px; padding-right: 12px; }
  .toolbar { gap: 8px; }
  .toolbar > .btn, .toolbar > a.btn { flex: 1 1 auto; justify-content: center; }
  .toolbar__spacer { display: none; }
  .toolbar .input, .toolbar select { min-width: 0; }
  .card__head { flex-wrap: wrap; gap: 8px; }
  .card__head > * { min-width: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; min-width: 0; }
  .stat__value { font-size: 1.15rem; word-break: break-word; }
  .form-grid--4 { grid-template-columns: 1fr; }
  .form-grid--4 .span-2 { grid-column: auto; }
  .picker > div { flex-wrap: wrap; }
  .picker .input { flex: 1 1 160px; }
  .table td, .table th { padding: 9px 10px; font-size: 13px; }
  .table .actions { white-space: normal; }
  .table .actions .btn { margin: 2px 0; }
  .bill-lines { min-width: 560px; }
  .modal__box, .modal__box--wide { max-width: 100%; width: 100%; }
  .modal__body { padding: 14px; }
  .modal__foot { flex-wrap: wrap; gap: 8px; }
  .modal__foot .btn { flex: 1 1 auto; }
  .ai-banner { font-size: 13px; }
  .ai-banner .input { max-width: 100% !important; flex: 1 1 100%; }
  .checks { grid-template-columns: 1fr 1fr; }
  .ward-board { grid-template-columns: 1fr; padding: 12px; }
  .user-menu { right: 0; left: auto; max-width: calc(100vw - 24px); }
  .gsearch .input { min-width: 0; }
  .topbar h1, #page-title { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.form { grid-template-columns: minmax(0, 1fr); }
.field { grid-template-columns: minmax(0, 1fr); }

/* ---------- v18: workflow notifications ---------- */
.bell { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--white); color: var(--navy); cursor: pointer; flex: 0 0 auto; }
.bell__count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.bell--hot { color: var(--orange); border-color: var(--orange); animation: bellPulse 1.6s ease-in-out infinite; }
.bell--hot svg { animation: bellRing 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes bellPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 40, 109, .45); } 50% { box-shadow: 0 0 0 7px rgba(224, 40, 109, 0); } }
@keyframes bellRing { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(14deg); } 88% { transform: rotate(-12deg); } 92% { transform: rotate(8deg); } 96% { transform: rotate(-4deg); } }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-link--hot:not(.is-active) { background: rgba(224, 40, 109, .14); }
.nav-link--hot:not(.is-active) .nav-badge { animation: bellPulse 1.6s ease-in-out infinite; }
.task-menu { width: 340px; max-height: 70vh; overflow-y: auto; }
.task-group { border-top: 1px solid var(--line); padding: 8px 0; }
.task-group__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 14px; font-size: 12px; font-weight: 700;
  color: var(--orange-dark); text-transform: uppercase; letter-spacing: .03em; }
.task-item { display: block; padding: 8px 14px; color: var(--ink); text-decoration: none; border-left: 3px solid var(--orange); margin: 4px 10px;
  border-radius: 8px; background: #fff4f8; }
.task-item:hover { background: #ffe6f0; }
.task-item b { display: block; font-size: 13px; }
.task-item small { color: var(--muted); font-size: 12px; }
.task-item--more { background: none; border-left-color: transparent; color: var(--navy); font-weight: 600; font-size: 13px; }
.row-hot td { background: #fff7ec; }
.row-hot td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.rx-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.rx-row .input { flex: 1 1 140px; width: auto; }
.rx-row [data-med], .rx-row [data-test] { flex: 3 1 240px; }
.rx-row [data-days] { flex: 0 0 80px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 16px; background: #e8f6f6; color: var(--navy);
  font-size: 13px; font-weight: 600; }
.chip button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--navy); }
.admit-check { background: #fff4f8; border: 1px dashed var(--orange); border-radius: 10px; padding: 10px 12px; }
@media (max-width: 600px) { .task-menu { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; } .bell { width: 36px; height: 36px; } }

/* ---------- v25: professional letterhead & print layout ---------- */
.doc { position: relative; font-family: var(--font); font-size: 12px; line-height: 1.45; color: #1a2238; }
.doc::before { content: ""; position: absolute; inset: 180px 0 0; background: url("../assets/logo.png") center 120px / 340px no-repeat;
  opacity: .045; pointer-events: none; z-index: 0; }
.doc > * { position: relative; z-index: 1; }
.lh { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-bottom: 10px; }
.lh__brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.lh__brand img { width: 74px; height: 74px; object-fit: contain; }
.lh__brand h1 { margin: 0; font-size: 23px; line-height: 1.1; color: var(--navy-dark); letter-spacing: .01em; }
.lh__tag { font-size: 11.5px; font-weight: 600; color: var(--orange); margin-top: 2px; }
.lh__depts { font-size: 10.5px; color: #555; margin-top: 3px; }
.lh__contact { text-align: right; font-size: 10.8px; color: #333; line-height: 1.55; max-width: 250px; }
.lh__emg { display: inline-block; margin-top: 3px; padding: 2px 9px; border-radius: 10px; background: var(--orange); color: #fff; font-weight: 700; font-size: 10px; }
.lh__band { height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--navy) 0 62%, var(--orange) 62% 100%); }
.lh__ids { font-size: 10.5px; color: #444; text-align: right; margin-top: 4px; }
.doc .doc__head { display: none; }
.doc__title { margin: 12px 0 12px; padding: 0; background: none; text-align: center; letter-spacing: 0; }
.doc__title span { display: inline-block; padding: 6px 26px; border-radius: 20px; background: var(--navy); color: #fff; font-size: 13px;
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.doc__info { gap: 5px 26px; padding: 10px 14px; border: 1px solid #d7e3e4; border-radius: 10px; background: #f6fbfb; margin-bottom: 14px; }
.doc__info b { color: var(--navy-dark); font-weight: 600; }
.doc table { margin: 6px 0 10px; }
.doc th, .doc td { padding: 6px 8px; border: 1px solid #d9e1e8; }
.doc th { background: var(--navy); color: #fff; font-weight: 600; font-size: 11.5px; }
.doc tr:nth-child(even) td { background: #f8fafc; }
.doc td[colspan] { background: #fff; }
.doc__section { margin: 14px 0; page-break-inside: avoid; }
.doc__section h4, .ds-sec h4 { margin: 0 0 6px; padding-bottom: 3px; border-bottom: 2px solid var(--orange); display: inline-block;
  font-size: 12px; color: var(--navy-dark); letter-spacing: .04em; }
.doc__sign { margin-top: 56px; gap: 24px; page-break-inside: avoid; }
.doc__sign > span { flex: 1; text-align: center; padding-top: 6px; border-top: 1px solid #333; font-size: 11.5px; max-width: 220px; }
.doc__foot { margin-top: 26px; padding-top: 8px; border-top: 2px solid var(--navy); text-align: center; }
.doc__foot-msg { font-size: 11.5px; font-weight: 600; color: var(--navy-dark); margin-bottom: 4px; }
.doc__foot-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 9.5px; color: #777; }
@media print {
  .doc, .doc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc::before { position: fixed; inset: 0; background-position: center; }
}

/* ---------- v25: role-wise dashboard ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; padding: 20px 22px;
  border-radius: 16px; color: #fff; background: linear-gradient(120deg, var(--navy-dark), var(--navy) 60%, #138a90); box-shadow: var(--shadow); }
.hero__greet { font-size: 1.35rem; font-weight: 700; }
.hero__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 13px; opacity: .92; }
.hero__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero .btn--light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
.hero .btn--navy { background: #fff; color: var(--navy-dark); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 14px; background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 6px 18px -14px rgba(11,79,83,.5); color: var(--ink); text-decoration: none; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kc); }
a.kpi:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -14px rgba(11,79,83,.6); }
.kpi__icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; color: var(--kc); background: var(--kb); }
.kpi__label { font-size: 12.5px; color: var(--muted); }
.kpi__value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.kpi__sub { font-size: 12px; color: var(--muted); }
.kpi--navy { --kc: var(--navy); --kb: #e6f3f3; } .kpi--pink { --kc: var(--orange); --kb: #fde8f0; } .kpi--green { --kc: #15803d; --kb: #e7f6ec; }
.kpi--amber { --kc: #b45309; --kb: #fef3e2; } .kpi--red { --kc: #b91c1c; --kb: #fdecec; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.work { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: var(--ink);
  background: #fff6fa; border: 1px solid #f7c6da; }
.work:hover { background: #ffecf4; }
.work__count { min-width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--orange); color: #fff; font-weight: 700; font-size: 1.05rem; }
.work__body { flex: 1; min-width: 0; } .work__body b { display: block; font-size: 13.5px; }
.work__body small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work__go { font-size: 12px; font-weight: 600; color: var(--orange-dark); white-space: nowrap; }
.work-empty { padding: 8px 2px; color: #15803d; font-weight: 600; }
.bars__val { font-size: 10px; color: var(--muted); text-align: center; min-height: 14px; }
.dept { margin-bottom: 12px; }
.dept__top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.dept__top small { color: var(--muted); font-weight: 500; }
.dept__dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.dept__track { height: 8px; border-radius: 6px; background: #eef2f6; overflow: hidden; }
.dept__track > div { height: 100%; border-radius: 6px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .hero { padding: 16px; } .hero__greet { font-size: 1.1rem; } .hero__actions { width: 100%; } .hero__actions .btn { flex: 1 1 auto; justify-content: center; }
  .kpis { gap: 10px; } .kpi { padding: 12px; gap: 10px; } .kpi__icon { width: 38px; height: 38px; } .kpi__value { font-size: 1.15rem; }
}

/* ---------- v26: test search, decline checks, lab panels ---------- */
.tsearch { position: relative; flex: 3 1 260px; }
.tsearch .input { width: 100%; }
.tsearch__list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 280px; overflow-y: auto;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.tsearch__item { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: 13.5px; }
.tsearch__item small { color: var(--muted); white-space: nowrap; }
.tsearch__item:hover, .tsearch__item.is-active { background: #e8f6f6; }
.tsearch__item--custom { border-top: 1px solid var(--line); color: var(--orange-dark); font-weight: 600; }
.decline-check { margin-top: 6px; font-size: 13px; color: #b45309; }
.panel-box { margin-bottom: 16px; }
.panel-table td, .panel-table th { padding: 6px 10px; }
.panel-table .input { padding: 6px 8px; max-width: 120px; }

/* ==========================================================================
   v27 — history timeline, MIS charts, TPA board, design polish
   ========================================================================== */
/* patient history */
.hist-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 12px; background: linear-gradient(135deg, #eef8f8, #fdf0f5); border: 1px solid #d7ecec; }
.tl__alert { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tl__alert .cell-sub { flex-basis: 100%; }
.tl { position: relative; padding-left: 8px; }
.tl::before { content: ""; position: absolute; left: 25px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--navy), var(--orange)); opacity: .25; }
.tl__item { position: relative; display: flex; gap: 14px; margin-bottom: 14px; }
.tl__dot { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--white);
  border: 2px solid var(--navy); font-size: 16px; z-index: 1; }
.tl__item--ipd .tl__dot { border-color: var(--orange); }
.tl__item--lab .tl__dot { border-color: var(--blue); }
.tl__card { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white);
  box-shadow: 0 4px 14px -10px rgba(11, 79, 83, .4); }
.tl__head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: .9rem; }
.tl__head span { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.tl__row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; padding: 3px 0; font-size: .82rem; border-top: 1px dashed var(--line); }
.tl__row b { color: var(--muted); font-weight: 500; }
.tl__row span { white-space: pre-line; overflow-wrap: anywhere; }

/* MIS month chart */
.mchart { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding: 8px 4px 0; overflow-x: auto; }
.mchart__col { flex: 1; min-width: 34px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.mchart__bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.mchart__in, .mchart__out { width: 42%; max-width: 16px; min-height: 2px; border-radius: 6px 6px 2px 2px; transition: height .5s ease; }
.mchart__in { background: linear-gradient(var(--navy), #2bb3a8); }
.mchart__out { background: linear-gradient(var(--orange), #f472b6); opacity: .85; }
.mchart__lbl { margin-top: 6px; font-size: .7rem; color: var(--muted); }
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }
.legend--in { background: var(--navy); }
.legend--out { background: var(--orange); }

/* TPA board */
.pipeline { display: flex; gap: 6px; padding: 14px 16px 6px; overflow-x: auto; }
.pipeline__step { flex: 1; min-width: 104px; padding: 10px 12px; border-radius: 10px; background: var(--hover); border: 1px solid var(--line);
  position: relative; text-align: center; }
.pipeline__step b { display: block; font-size: 1.25rem; color: var(--navy); }
.pipeline__step span { font-size: .72rem; color: var(--muted); }
.age { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 20px; font-size: .7rem; background: var(--blue-bg); color: var(--blue); }
.age--amber { background: var(--amber-bg); color: var(--amber); }
.age--red { background: var(--red-bg); color: var(--red); }
.docbar { width: 80px; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.docbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--navy)); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.check-grid .check { font-size: .84rem; }

/* ---------- design polish ---------- */
body { background: radial-gradient(1200px 500px at 100% -10%, #fbe7ef 0, transparent 60%),
  radial-gradient(900px 500px at -10% 0, #e3f3f2 0, transparent 55%), var(--bg); background-attachment: fixed; }
.sidebar { background: linear-gradient(180deg, #0d5f63 0%, var(--navy-dark) 55%, #083c3f 100%); box-shadow: 4px 0 24px -12px rgba(0,0,0,.35); }
.nav-link { position: relative; }
.nav-link:hover { background: rgba(255,255,255,.09); transform: translateX(2px); transition: background .15s, transform .15s, color .15s; }
.nav-link.is-active { background: linear-gradient(90deg, var(--orange), #f0508a); box-shadow: 0 8px 18px -8px rgba(224,40,109,.75); }
.card { border: 1px solid rgba(228,232,240,.8); box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 12px 32px -18px rgba(11,79,83,.25);
  transition: box-shadow .2s, transform .2s; }
.stat { transition: transform .2s, box-shadow .2s; }
.stat:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -18px rgba(11,79,83,.45); }
.btn--primary { background: linear-gradient(135deg, var(--orange), #f0508a); border-color: transparent; box-shadow: 0 6px 16px -8px rgba(224,40,109,.7); }
.btn--primary:hover { background: linear-gradient(135deg, var(--orange-dark), var(--orange)); }
.btn { transition: transform .12s, box-shadow .15s, background .15s; }
.btn:active { transform: translateY(1px) scale(.99); }
.tab.is-active { box-shadow: 0 6px 14px -8px rgba(15,111,116,.6); }
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15,111,116,.15); }
table tbody tr { transition: background .12s; }
.modal { backdrop-filter: blur(3px); }
.modal__box { animation: popIn .18s ease-out; }
#view > * { animation: fadeUp .25s ease-out both; }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9d3dd; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); background-clip: content-box; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 640px) { .tl__row { grid-template-columns: 1fr; gap: 0; } .tl::before { left: 23px; } }
/* v28 — GST toggle, lab steps */
.gst-toggle { padding: 10px 12px; border: 1px dashed var(--navy); border-radius: 10px; background: #f2fafa; }
.steps { display: flex; gap: 4px; flex-wrap: wrap; }
.steps__s { padding: 2px 8px; border-radius: 20px; font-size: .72rem; background: var(--hover); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.steps__s.is-done { background: var(--green-bg); color: var(--green); border-color: transparent; }
.steps__s.is-cur { background: var(--orange); color: #fff; border-color: transparent; font-weight: 600; }
.w-gst:disabled { opacity: .45; }
/* v29 — print with / without header */
.print-pick { max-width: 460px; }
.print-pick__opts { display: grid; gap: 10px; }
.print-pick__opt { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 14px 16px; border: 1.5px solid var(--line);
  border-radius: 12px; background: var(--white); cursor: pointer; font: inherit; color: var(--ink); }
.print-pick__opt span { font-size: .8rem; color: var(--muted); }
.print-pick__opt:hover, .print-pick__opt:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(15,111,116,.15); }
.print-pick__opt.is-def { border-color: var(--orange); background: #fff5f9; }
/* without header: hide the letterhead but keep its space blank for pre-printed paper */
.doc--plain .lh, .doc--plain .lh__band, .doc--plain .lh__ids { visibility: hidden; }
.dev-credit { margin-top: 4px; font-size: inherit; letter-spacing: 0; font-weight: inherit; }
.dev-credit a { color: #ffb766; font-weight: 700; text-decoration: none; }
.dev-credit a:hover { text-decoration: underline; }
.dev-credit { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; white-space: nowrap; }
.dev-socs { display: inline-flex; gap: 4px; flex: none; }
.dev-credit a.dev-soc { display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 50%;
  background: rgba(255,183,102,.15); color: #ffb766; transition: transform .15s, background .15s; }
.dev-credit a.dev-soc:hover { transform: translateY(-2px); background: #ffb766; color: #0b4f53; text-decoration: none; }
.login__credit .dev-credit { justify-content: center; }/* developer name: Khand, same height as the 20px icons */
.dev-credit > a:first-child { font: inherit; font-weight: 600; color: #ffb766; letter-spacing: 0; background: none; }