/* ============================================================
   Kims Health Care HMS — components.css
   Buttons, forms, cards, tables, badges, overlays, domain widgets
   ============================================================ */

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--red-600); color: #fff; }
.btn-primary:hover { background: var(--red-700); }
.btn-sec { background: var(--surface); color: var(--gray-700); border-color: var(--gray-300); }
.btn-sec:hover { background: var(--gray-50); color: var(--gray-900); }
.btn-ghost { color: var(--gray-500); }
.btn-ghost:hover { background: var(--gray-50); color: var(--gray-700); }
.btn-soft { background: var(--red-50); color: var(--red-700); }
.btn-soft:hover { background: var(--red-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--red-800); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #0F5F37; }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: var(--r-md); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm); color: var(--gray-500); }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-icon svg { width: 16.5px; height: 16.5px; }
.btn-block { width: 100%; }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--gray-700); }
.field > label .req { color: var(--red-600); }
.field .hint { font-size: var(--fs-xs); color: var(--gray-500); }
.field .err { font-size: var(--fs-xs); color: var(--danger); display: none; }
.field.invalid .err { display: block; }
.field.invalid .input, .field.invalid select.input, .field.invalid textarea.input { border-color: var(--red-400); }

.input {
  height: 38px; width: 100%;
  padding: 0 11px;
  border: 1px solid var(--gray-300); border-radius: var(--r-sm);
  background: var(--surface); font-size: 13.5px; color: var(--gray-900);
}
.input:focus { border-color: var(--red-400); box-shadow: var(--focus-ring); outline: none; }
.input:disabled, .input[readonly] { background: var(--gray-50); color: var(--gray-500); }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
select.input {
  appearance: none; -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7683' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-sm { height: 32px; font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
}
.form-section { margin-top: 22px; }
.form-section > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }

/* Checkbox / radio / toggle */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; color: var(--gray-700); }
.check input { width: 16px; height: 16px; accent-color: var(--red-600); cursor: pointer; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--gray-700); }
.toggle input { position: absolute; opacity: 0; }
.toggle .tk { width: 36px; height: 21px; background: var(--gray-300); border-radius: var(--r-full); position: relative; transition: background .15s ease; flex-shrink: 0; }
.toggle .tk::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s ease; box-shadow: var(--shadow-sm); }
.toggle input:checked + .tk { background: var(--red-600); }
.toggle input:checked + .tk::after { transform: translateX(15px); }

/* Search input (inline filters) */
.search { position: relative; }
.search input { padding-left: 33px; }
.search > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--gray-400); pointer-events: none; }

/* Filter row above tables/charts */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input, .filters select.input { width: auto; min-width: 120px; }
.filters .search input { width: 230px; }
@media (max-width: 640px) {
  .filters .search { width: 100%; }
  .filters .search input { width: 100%; }
}

/* Segmented control */
.seg { display: inline-flex; background: var(--gray-100); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button, .seg a {
  height: 30px; padding: 0 12px; border-radius: 5.5px;
  font-size: 12.5px; font-weight: 600; color: var(--gray-500);
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.seg button:hover, .seg a:hover { color: var(--gray-700); }
.seg .on { background: var(--surface); color: var(--gray-900); box-shadow: var(--shadow-sm); }

/* ---------------- Cards ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--gray-100); }
.card-h h3 { font-size: 14.5px; }
.card-h .t-sub { font-size: var(--fs-sm); }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--gray-100); display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .card-b { padding: 14px; }
  .card-h { padding: 12px 14px; }
}

/* KPI stat tile */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 15px 17px; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .k-label { font-size: 12.5px; font-weight: 600; color: var(--gray-500); }
.kpi .k-ico { width: 34px; height: 34px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi .k-ico svg { width: 17px; height: 17px; }
.kpi .k-val { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1; }
.kpi .k-sub { font-size: var(--fs-xs); color: var(--gray-500); margin-top: 4px; }
.kpi .k-delta { font-size: var(--fs-xs); font-weight: 700; }
.kpi .k-delta.up { color: var(--ok); }
.kpi .k-delta.down { color: var(--danger); }
.k-ico.red    { background: var(--red-50);    color: var(--red-600); }
.k-ico.blue   { background: var(--info-bg);   color: var(--info); }
.k-ico.green  { background: var(--ok-bg);     color: var(--ok); }
.k-ico.amber  { background: var(--warn-bg);   color: var(--warn); }
.k-ico.violet { background: var(--violet-bg); color: var(--violet); }
.k-ico.gray   { background: var(--gray-100);  color: var(--gray-500); }
@media (max-width: 480px) {
  .kpi { padding: 12px 13px; }
  .kpi .k-val { font-size: 21px; }
  .kpi .k-ico { display: none; }
}

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card .table-wrap { border-radius: 0 0 var(--r-md) var(--r-md); }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-500); background: var(--gray-25);
  padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: var(--gray-25); }
.table tbody tr.clickable { cursor: pointer; }
.table .t-right { text-align: right; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .cell-main { font-weight: 600; color: var(--gray-900); }
.table .cell-sub { font-size: var(--fs-xs); color: var(--gray-500); margin-top: 1px; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--gray-100); font-size: var(--fs-sm); color: var(--gray-500); flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; }
.pager button { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--gray-700); border: 1px solid transparent; }
.pager button:hover { background: var(--gray-100); }
.pager button.on { background: var(--red-600); color: #fff; }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------------- Badges / status pills ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650; line-height: 1;
  padding: 4.5px 9px; border-radius: var(--r-full);
  border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill-gray   { background: var(--gray-100);  color: var(--gray-700);  border-color: var(--gray-200); }
.pill-red    { background: var(--danger-bg); color: var(--danger);    border-color: var(--danger-border); }
.pill-green  { background: var(--ok-bg);     color: var(--ok);        border-color: var(--ok-border); }
.pill-amber  { background: var(--warn-bg);   color: var(--warn);      border-color: var(--warn-border); }
.pill-blue   { background: var(--info-bg);   color: var(--info);      border-color: var(--info-border); }
.pill-violet { background: var(--violet-bg); color: var(--violet);    border-color: var(--violet-border); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--gray-700);
  background: var(--gray-100); border-radius: var(--r-full); padding: 4px 10px;
}
.chip button { display: inline-flex; color: var(--gray-400); }
.chip button:hover { color: var(--danger); }
.chip button svg { width: 12px; height: 12px; }

/* ---------------- Avatar ---------------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--gray-400);
}
.avatar.sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.xl { width: 68px; height: 68px; font-size: 24px; }
.av-1 { background: #B85C6B; } .av-2 { background: #4E79A7; } .av-3 { background: #6B8E5A; }
.av-4 { background: #B0762B; } .av-5 { background: #7B6BA8; } .av-6 { background: #4A8E8B; }
.av-7 { background: #A85C8F; } .av-8 { background: #5F7186; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--gray-500);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.tabs button:hover, .tabs a:hover { color: var(--gray-700); }
.tabs .on { color: var(--red-700); border-bottom-color: var(--red-600); }
.tabs .count { font-size: 10.5px; font-weight: 700; background: var(--gray-100); color: var(--gray-500); border-radius: var(--r-full); padding: 1px 7px; }
.tabs .on .count { background: var(--red-50); color: var(--red-700); }

/* ---------------- Dropdown menu ---------------- */
.menu { position: relative; display: inline-flex; }
.menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 5px; z-index: 80; display: none;
}
.menu.open .menu-pop { display: block; }
.menu-pop button, .menu-pop a {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--gray-700); text-align: left; text-decoration: none;
}
.menu-pop button:hover, .menu-pop a:hover { background: var(--gray-50); color: var(--gray-900); }
.menu-pop svg { width: 15px; height: 15px; color: var(--gray-400); }
.menu-pop .danger { color: var(--danger); }
.menu-pop .danger svg { color: var(--danger); }
.menu-pop hr { margin: 5px 4px; }

/* ---------------- Modal ---------------- */
.modal-veil {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(23,27,32,.46);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px; overflow-y: auto;
  animation: fadeIn .14s ease;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  animation: popIn .16s ease;
}
.modal.wide { max-width: 780px; }
.modal.narrow { max-width: 420px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 0; }
.modal-h h3 { font-size: 16.5px; }
.modal-b { padding: 16px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@media (max-width: 640px) {
  .modal-veil { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.narrow { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; overflow-y: auto; }
}

/* Drawer (right side panel) */
.drawer-veil { position: fixed; inset: 0; z-index: 100; background: rgba(23,27,32,.42); animation: fadeIn .14s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 101;
  width: min(440px, 94vw); background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slideIn .18s ease;
}
.drawer-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--gray-100); }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-f { padding: 14px 20px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--gray-900); color: #fff;
  padding: 10px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 550; animation: toastIn .2s ease;
}
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.ok svg { color: #5BD48F; }
.toast.err svg { color: #FF8A8F; }
.toast.warn svg { color: #FFD066; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Empty state ---------------- */
.empty { text-align: center; padding: 44px 20px; color: var(--gray-500); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--gray-300); }
.empty h4 { color: var(--gray-700); font-size: 14.5px; margin-bottom: 3px; }
.empty p { font-size: var(--fs-sm); max-width: 340px; margin: 0 auto; }
.empty .btn { margin-top: 14px; }

/* ---------------- List rows (generic) ---------------- */
.rows { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--gray-100); }
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: var(--gray-25); }
.row-item.clickable { cursor: pointer; }

/* ---------------- Timeline ---------------- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--gray-100); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-dot {
  position: absolute; left: -24px; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--gray-300); z-index: 1;
}
.tl-item.red .tl-dot { border-color: var(--red-500); background: var(--red-50); }
.tl-item.green .tl-dot { border-color: var(--ok); background: var(--ok-bg); }
.tl-item.blue .tl-dot { border-color: var(--info); background: var(--info-bg); }
.tl-when { font-size: var(--fs-xs); color: var(--gray-500); }

/* ---------------- Steps / pipeline status ---------------- */
.steps { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 2px 0; }
.step { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.step .s-dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
  background: var(--gray-100); color: var(--gray-500); border: 1.5px solid var(--gray-200);
}
.step .s-lbl { font-size: 12.5px; font-weight: 600; color: var(--gray-500); }
.step.done .s-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done .s-lbl { color: var(--gray-700); }
.step.cur .s-dot { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.step.cur .s-lbl { color: var(--gray-900); }
.step-gap { width: 34px; height: 2px; background: var(--gray-200); margin: 0 8px; flex-shrink: 0; }
.step-gap.done { background: var(--ok); }

/* ---------------- Progress / meter ---------------- */
.meter { height: 8px; border-radius: var(--r-full); background: var(--gray-100); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--red-500); }
.meter.green > i { background: var(--ok); }
.meter.blue > i { background: var(--info); }
.meter.amber > i { background: #D98E04; }

/* ---------------- Patient context banner ---------------- */
.pt-banner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 16px 20px; margin-bottom: 18px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pt-banner .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--gray-500); }
.pt-banner .meta b { color: var(--gray-700); font-weight: 600; }
.alert-strip {
  display: flex; align-items: center; gap: 8px;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn);
  border-radius: var(--r-sm); padding: 8px 12px; font-size: var(--fs-sm); font-weight: 600;
}
.alert-strip.red { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert-strip.blue { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.alert-strip svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------------- Token / queue widgets ---------------- */
.token-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; height: 34px; padding: 0 10px;
  background: var(--gray-900); color: #fff; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 750; letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
.token-num.now { background: var(--red-600); }
.token-num.sm { min-width: 38px; height: 27px; font-size: 12.5px; }

/* Fullscreen queue board */
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 30px; border-bottom: 1px solid rgba(255,255,255,.1); }
.board-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; padding: 24px 30px; align-content: start; }
.board-cell { background: #1D2126; border: 1px solid rgba(255,255,255,.08); border-radius: var(--r-lg); padding: 22px 24px; }
.board-cell .dept { font-size: 15px; font-weight: 650; color: #B8C0CA; letter-spacing: .02em; }
.board-cell .big { font-size: 64px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.05; color: #fff; font-variant-numeric: tabular-nums; }
.board-cell .big.calling { color: #FF6B71; animation: pulse 1.1s ease infinite; }
.board-cell .next { color: #7A8592; font-size: 14px; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------------- Bed / ward map ---------------- */
.bed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.bed {
  border: 1.5px solid var(--gray-200); border-radius: var(--r-md);
  padding: 10px 12px; cursor: pointer; background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.bed:hover { border-color: var(--gray-300); box-shadow: var(--shadow-md); }
.bed .b-num { font-weight: 750; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.bed .b-sub { font-size: var(--fs-xs); color: var(--gray-500); margin-top: 3px; }
.bed.free { border-color: var(--ok-border); background: #FBFEFC; }
.bed.free .b-num { color: var(--ok); }
.bed.occ { border-color: var(--red-200); background: var(--red-25); }
.bed.occ .b-num { color: var(--red-700); }
.bed.clean { border-color: var(--warn-border); background: #FFFDF6; }
.bed.clean .b-num { color: var(--warn); }
.bed.maint { border-style: dashed; opacity: .75; }

/* Chemo chair schedule */
.chair-grid { display: grid; grid-template-columns: 88px 1fr; border-top: 1px solid var(--gray-100); }
.chair-grid .lane-h { padding: 10px 12px; font-weight: 700; font-size: 12.5px; border-bottom: 1px solid var(--gray-100); background: var(--gray-25); color: var(--gray-700); position: sticky; left: 0; }
.chair-lane { position: relative; border-bottom: 1px solid var(--gray-100); min-height: 54px; background:
  repeating-linear-gradient(to right, transparent 0, transparent calc(100%/10 - 1px), var(--gray-100) calc(100%/10 - 1px), var(--gray-100) calc(100%/10)); }
.chair-slot {
  position: absolute; top: 7px; bottom: 7px;
  border-radius: var(--r-sm); padding: 5px 9px; overflow: hidden; cursor: pointer;
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.3;
  border: 1px solid; box-shadow: var(--shadow-sm);
}
.chair-slot .who { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-sched { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.slot-active { background: var(--red-50); border-color: var(--red-200); color: var(--red-700); }
.slot-done { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.slot-hold { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

/* ---------------- Calendar ---------------- */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 9px 6px; text-align: center; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day { min-height: 96px; border-bottom: 1px solid var(--gray-100); border-right: 1px solid var(--gray-100); padding: 7px 8px; cursor: pointer; position: relative; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--gray-25); }
.cal-day .d-num { font-size: 12.5px; font-weight: 650; color: var(--gray-700); width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-day.dim .d-num { color: var(--gray-300); }
.cal-day.today .d-num { background: var(--red-600); color: #fff; }
.cal-day .d-evt { font-size: 10.5px; font-weight: 600; border-radius: 4px; padding: 1.5px 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day .d-more { font-size: 10px; color: var(--gray-500); font-weight: 600; margin-top: 2px; }
@media (max-width: 768px) {
  .cal-day { min-height: 58px; padding: 4px 5px; }
  .cal-day .d-evt { display: none; }
  .cal-day .d-count { position: absolute; bottom: 5px; left: 8px; font-size: 10px; font-weight: 700; color: var(--red-600); }
}

/* ---------------- Data lists / description ---------------- */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13.5px; }
.dl dt { color: var(--gray-500); }
.dl dd { color: var(--gray-900); font-weight: 550; }
@media (max-width: 480px) { .dl { grid-template-columns: 120px 1fr; } }

/* ---------------- Invoice / print ---------------- */
.inv-paper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 34px 38px; max-width: 860px; margin: 0 auto; }
.inv-total-row { display: flex; justify-content: flex-end; }
.inv-totals { width: 290px; font-size: 13.5px; }
.inv-totals .line { display: flex; justify-content: space-between; padding: 5px 0; color: var(--gray-700); }
.inv-totals .grand { border-top: 2px solid var(--gray-900); margin-top: 6px; padding-top: 9px; font-size: 16px; font-weight: 750; color: var(--gray-900); }
@media (max-width: 640px) { .inv-paper { padding: 20px 16px; } }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .tabbar, .page-actions, .no-print, .toasts, .scrim { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .card, .inv-paper { border: 0; box-shadow: none; }
  a { color: inherit; }
}

/* ---------------- Login-page extras ---------------- */
.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 480px) { .role-grid { grid-template-columns: 1fr; } }
.role-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 1.5px solid var(--gray-200); border-radius: var(--r-md);
  padding: 12px 14px; background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.role-card:hover { border-color: var(--red-300); box-shadow: var(--shadow-md); }
.role-card .r-ico {
  width: 40px; height: 40px; border-radius: var(--r-md); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red-50); color: var(--red-600);
}
.role-card .r-ico svg { width: 20px; height: 20px; }
.role-card b { font-size: 13.5px; display: block; }
.role-card span { font-size: var(--fs-xs); color: var(--gray-500); }

/* ---------------- Notification panel rows ---------------- */
.notif-row { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
.notif-row:last-child { border-bottom: 0; }
.notif-row.unread { background: var(--red-25); }
.notif-ico { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.notif-ico svg { width: 15px; height: 15px; }

/* ---------------- Misc ---------------- */
.divider-v { width: 1px; align-self: stretch; background: var(--border); }
.kbd { font-size: 11px; font-weight: 650; color: var(--gray-500); background: var(--gray-50); border: 1px solid var(--gray-200); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
