/* DayanCare demo — staff portal styles */
:root {
  --ink: #12312d;
  --muted: #5f7471;
  --line: #d9e4e1;
  --bg: #f4f8f7;
  --card: #ffffff;
  --brand: #0f7a6c;
  --brand-dark: #0b5c51;
  --accent: #e8a33d;
  --danger: #b4392f;
  --ok: #1f7a43;
  --warn-bg: #fff6e5;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
h2 { font-size: 1.35rem; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
h3 { font-size: 1.05rem; margin: 0 0 .75rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
code { font-size: .85em; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; white-space: nowrap; }
.loading { color: var(--muted); padding: 1rem 0; }
.empty { color: var(--muted); padding: 1.5rem 0; text-align: center; }

/* brand + top bar */
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; color: var(--brand-dark); }
.brand span { color: var(--accent); }
.brand small { font-weight: 500; font-size: .8rem; color: var(--muted); margin-left: .5rem; letter-spacing: 0; }
.brand.big { font-size: 2.2rem; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
  padding: .75rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: .6rem; }
.tabs { display: flex; gap: .25rem; padding: 0 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  border: 0; background: none; padding: .85rem 1rem; font: inherit; color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1.5rem 3rem; }

/* cards + layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.card.narrow { max-width: 640px; }
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1rem; align-items: start; }
.split .card { margin-bottom: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.toolbar h2 { margin: 0 auto 0 0; }
.week-nav { display: flex; align-items: center; gap: .35rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.back { margin-bottom: .75rem; }

/* buttons + forms */
.btn {
  font: inherit; font-size: .95rem; padding: .5rem 1rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); font-weight: 600; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { font-size: .85rem; padding: .3rem .7rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin: .6rem 0 .25rem; }
label.inline { display: flex; align-items: center; gap: .5rem; margin: 0; }
label.check { display: flex; align-items: center; gap: .4rem; margin: 0; font-weight: 500; }
input, select, textarea {
  font: inherit; font-weight: 400; width: 100%; padding: .5rem .65rem; margin-top: .25rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin: 0; }
.toolbar input, .toolbar select, .week-nav input, label.inline input { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login { width: 100%; max-width: 400px; }
.login .btn.primary { width: 100%; margin-top: 1rem; padding: .7rem; }
.demo-accounts { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: inherit; font-size: .85rem; padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.chip:hover { border-color: var(--brand); }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tbody tr:hover { background: #f8fbfa; }

/* badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: #e9efee; color: var(--ink); text-transform: capitalize; }
.badge.role { background: #e6f2f0; color: var(--brand-dark); }
.pop-professional { background: #e7eefb; color: #2b4f8f; }
.pop-elderly { background: #f6ecdc; color: #8a5a12; }
.pop-paediatric { background: #f3e6f3; color: #7a2f7a; }
.st-pending, .st-approved { background: #eef1f4; color: #44515c; }
.st-in_preparation, .st-labelled { background: #fff3d6; color: #8a6200; }
.st-sealed { background: #def1ea; color: #0b5c51; }
.st-out_for_delivery { background: #e2ecfb; color: #234f97; }
.st-delivered { background: #dcf3e3; color: var(--ok); }
.st-failed, .st-rejected { background: #fbe4e1; color: var(--danger); }

/* alerts + toast */
.alert { padding: .75rem 1rem; border-radius: 8px; margin: .75rem 0; }
.alert.error { background: #fbe4e1; color: var(--danger); }
.alert.warn { background: var(--warn-bg); color: #7a5600; }
#toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(150%);
  background: var(--ink); color: #fff; padding: .75rem 1.25rem; border-radius: 8px; max-width: 90vw;
  transition: transform .25s ease; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }

/* prescription file + approve form */
.file-view iframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 8px; }
.file-view img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.drug-row { border: 1px solid var(--line); border-radius: 8px; padding: .5rem 1rem 1rem; margin: 0 0 .75rem; }
.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: .75rem; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: .75rem; }
.slot { background: var(--bg); border-radius: 8px; padding: .5rem .6rem; }
.slot input[type=number] { margin-top: .4rem; }
.slot input:disabled { opacity: .45; }

/* pack detail */
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: .75rem 0; }
.stepper li { font-size: .8rem; padding: .3rem .7rem; border-radius: 999px; background: #eef1f4; color: var(--muted); text-transform: capitalize; }
.stepper li.done { background: #def1ea; color: var(--brand-dark); }
.stepper li.current { background: var(--brand); color: #fff; font-weight: 700; }
.stepper li.current.failed { background: var(--danger); }
.blister-wrap { overflow-x: auto; }
.blister { border-collapse: separate; border-spacing: 6px; min-width: 760px; width: 100%; }
.blister th { font-size: .85rem; color: var(--muted); font-weight: 600; text-align: center; }
.blister tbody th { text-align: left; white-space: nowrap; }
.blister td { background: #f0f7f5; border: 2px solid #cfe4df; border-radius: 12px; padding: .4rem; vertical-align: top; min-height: 60px; height: 64px; }
.pill { font-size: .75rem; background: #fff; border-radius: 6px; padding: .15rem .35rem; margin-bottom: .2rem; border: 1px solid #d5e7e2; }

/* label preview: 600×900 dots ≈ 2:3; font sizes = ZPL size ÷ 2 */
.label-row { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.label {
  width: 300px; min-height: 450px; background: #fff; border: 1px dashed #9fb3af; padding: 10px;
  font-family: "Arial Narrow", Arial, sans-serif; color: #000; box-shadow: 0 2px 8px rgba(0,0,0,.06);
  font-size: 13px; line-height: 1.25;
}
.label .l-head { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.label .l-name { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.label .l-line { margin-bottom: 3px; }
.label .l-bold { font-weight: 700; }
.label .l-warn { font-size: 12px; margin: 0 0 3px 8px; }
.label .l-id { font-size: 9px; word-break: break-all; }
.label .l-gap { height: 6px; }
.label-elderly { font-size: 20px; }
.label-elderly .l-head { font-size: 25px; }
.label-elderly .l-name { font-size: 22px; }
.label-elderly .l-warn { font-size: 19px; }
.label-elderly .l-id { font-size: 16px; }
.label-paediatric { font-size: 15px; }
.label-paediatric .l-name { font-size: 17px; }
.label-paediatric .l-warn { font-size: 14px; }
.label-paediatric .l-id { font-size: 11px; }
.zpl-box { flex: 1; min-width: 260px; }
.zpl { background: #0f1f1d; color: #c8f0e6; padding: 1rem; border-radius: 8px; font-size: .78rem; overflow-x: auto; white-space: pre; max-height: 420px; }

/* delivery */
.sig { width: 100%; max-width: 560px; height: auto; aspect-ratio: 560 / 200; border: 1px dashed #9fb3af; border-radius: 8px; touch-action: none; background: #fff; cursor: crosshair; display: block; }
.photo-prev { max-width: 240px; border-radius: 8px; border: 1px solid var(--line); margin-top: .5rem; display: block; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .table td { display: block; border: 0; padding: .2rem 0; }
  .right { text-align: left; }
  main { padding: 1rem; }
  .slots { grid-template-columns: 1fr; }
}

/* owner dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.tile-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tile-num { font-size: 2.6rem; font-weight: 800; color: var(--brand-dark); line-height: 1.1; margin: .35rem 0; }
.tile-sub { font-size: .85rem; color: var(--muted); }
.tile-warn { border-color: var(--accent); }
.tile-warn .tile-num { color: #8a5a12; }
