:root { --navy: #0B2E7A; --navy2: #123b94; --orange: #F7931E; --bg: #f3f5f9; --line: #dde3ee; --text: #1d2433; --muted: #6b7486; --ok: #1f8a4c; --warn: #c47a00; --bad: #c62828; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
a { color: var(--navy); }
h1 { font-size: 22px; margin: 0; color: var(--navy); }
h3 { margin: 0 0 10px; color: var(--navy); font-size: 16px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy), #1e56c4); }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: 360px; max-width: calc(100vw - 24px); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-card img { width: 100%; max-height: 120px; object-fit: contain; margin-bottom: 6px; }
.login-card h2 { text-align: center; color: var(--navy); margin: 4px 0 18px; font-weight: 600; }
.err { color: var(--bad); min-height: 18px; text-align: center; }

/* layout */
#app { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { background: #fff; padding: 12px; }
.brand img { width: 100%; max-height: 84px; object-fit: contain; display: block; }
.side nav { display: flex; flex-direction: column; padding: 10px 0; flex: 1; }
.side nav a { color: #dfe6f7; text-decoration: none; padding: 11px 20px; border-left: 4px solid transparent; }
.side nav a:hover { background: var(--navy2); color: #fff; }
.side nav a.active { background: var(--navy2); color: #fff; border-left-color: var(--orange); font-weight: 600; }
.who { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.who .link { color: var(--orange); }
main { flex: 1; padding: 22px 28px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }

/* controls */
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #c8d0df; border-radius: 6px; width: 100%; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9cdf5; border-color: var(--navy); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 4px; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.btn { text-decoration: none; display: inline-block; border: 1px solid #c8d0df; background: #fff; color: var(--text); padding: 8px 14px; border-radius: 6px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { background: #f0f3f9; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy2); }
.btn.orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn.danger { color: var(--bad); border-color: #f0c4c4; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.wide { width: 100%; padding: 11px; }
.link { background: none; border: 0; color: var(--navy); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 150px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th { background: #eef2fa; color: var(--navy); text-align: left; padding: 9px 10px; font-size: 12.5px; border-bottom: 2px solid var(--line); position: sticky; top: 0; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #fafbfe; }
.tbl .r, .r { text-align: right; white-space: nowrap; }
.tbl .c { text-align: center; }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.empty { text-align: center; color: var(--muted); padding: 30px !important; }

/* line editor */
.lines td { padding: 5px; vertical-align: top; }
.lines input, .lines textarea { padding: 6px 8px; }
.lines textarea { min-height: 38px; font-size: 12.5px; }
.lines .num { width: 90px; text-align: right; }
.lines .qty { width: 64px; text-align: right; }
.totals { margin-left: auto; width: 340px; }
.totals td { padding: 6px 10px; }
.totals tr.grand td { background: var(--navy); color: #fff; font-weight: 700; font-size: 15px; }
.words { color: var(--navy); font-style: italic; margin-top: 6px; }

/* badges & kpis */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef2fa; color: var(--navy); }
.badge.Paid, .badge.Won { background: #e3f5ea; color: var(--ok); }
.badge.Due, .badge.Lost { background: #fde8e8; color: var(--bad); }
.badge.Part, .badge.Follow-up { background: #fff3df; color: var(--warn); }
.badge.Sent { background: #e6efff; color: #1e56c4; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; border-top: 4px solid var(--navy); }
.kpi.o { border-top-color: var(--orange); } .kpi.g { border-top-color: var(--ok); } .kpi.r { border-top-color: var(--bad); }
.kpi .v { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bars div { flex: 1; max-width: 90px; text-align: center; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars span.b { background: var(--navy); border-radius: 4px 4px 0 0; display: block; min-height: 2px; }
.bars span.t { color: var(--text); font-weight: 600; }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(10,20,40,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: #fff; border-radius: 12px; padding: 20px; width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: #222; color: #fff; padding: 11px 18px; border-radius: 8px; transition: .25s; z-index: 60; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); }
.hint { color: var(--muted); font-size: 12.5px; }
.nw { white-space: nowrap; }

.nbadge { background: #fff; color: var(--navy); border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 700; margin-left: 6px; }
.nbadge.hot { background: var(--orange); color: #fff; }
.desk3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1200px) { .desk3 { grid-template-columns: 1fr; } }
.desk h4 { margin: 4px 0 8px; color: var(--navy); }
.ditem { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ditem .row { flex-wrap: nowrap; }
.badge.AMC { background: #efe6ff; color: #6a3fc1; } .badge.Renewal { background: #e6f6ff; color: #0b6a99; } .badge.Open { background: #fff3df; color: var(--warn); }

.appname { margin: 6px 0 0 !important; font-size: 26px; } .appname span { color: var(--orange); }
.appsub { text-align: center; color: var(--muted); margin: 2px 0 18px; }
.credit { text-align: center; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; line-height: 1.6; }
.brand .bd { text-align: center; color: var(--navy); font-size: 17px; margin-top: 4px; } .brand .bd b { color: var(--orange); }
.madeby { font-size: 11px; color: #9fb0d8; padding: 0 20px 12px; line-height: 1.4; }
.about td { padding: 4px 10px 4px 0; }

.mainwrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.licbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 28px; font-size: 14px; }
.licbar.warn { background: #fff3df; color: #7a4a00; border-bottom: 1px solid #f5d9a8; }
.licbar.bad { background: #fde8e8; color: #8a1c1c; border-bottom: 1px solid #f3c2c2; }
.lb-btn { background: var(--orange); color: #fff; text-decoration: none; padding: 6px 14px; border-radius: 6px; font-weight: 600; white-space: nowrap; }
.licbar.bad .lb-btn { background: var(--bad); }
.licstate { border-left: 6px solid; background: #f7f9fd; border-radius: 8px; padding: 14px 16px; }
.licstate .ls1 { font-size: 24px; font-weight: 700; } .licstate .ls2 { margin-top: 4px; font-size: 15px; }
.iid { font-family: Consolas, monospace; font-size: 18px; letter-spacing: 2px; color: var(--navy); }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan { border: 2px solid var(--line); border-radius: 12px; padding: 18px; text-align: center; position: relative; overflow: hidden; }
.plan.best { border-color: var(--orange); }
.plan .ribbon { position: absolute; top: 12px; right: -34px; transform: rotate(35deg); background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 36px; }
.plan .pn { font-size: 18px; font-weight: 700; color: var(--navy); } .plan .pp { font-size: 28px; font-weight: 700; margin: 8px 0 4px; } .plan .pp span { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan .btn { margin-top: 12px; text-align: center; }
.tl { display: flex; gap: 0; overflow-x: auto; padding: 8px 4px 4px; }
.tl-i { flex: 1; min-width: 150px; position: relative; padding-top: 26px; text-align: center; }
.tl-i::before { content: ''; position: absolute; top: 9px; left: 0; right: 0; height: 4px; background: #d3ddf2; }
.tl-i:first-child::before { left: 50%; } .tl-i:last-child::before { right: 50%; }
.tl-i.past::before { background: var(--navy); }
.tl-dot { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid #b9c7e6; }
.tl-i.past .tl-dot { background: var(--navy); border-color: var(--navy); }
.tl-i.now .tl-dot { background: var(--orange); border-color: var(--orange); box-shadow: 0 0 0 5px rgba(247,147,30,.25); }
.tl-i.due .tl-dot { border-color: var(--bad); } .tl-i.remind .tl-dot { border-color: var(--orange); } .tl-i.licence .tl-dot { border-color: var(--ok); }
.tl-d { font-weight: 700; font-size: 13px; color: var(--navy); } .tl-t { font-size: 13px; color: var(--muted); margin-top: 2px; padding: 0 6px; }

.steps { margin: 0 0 14px 18px; line-height: 1.9; }

/* patient receipts */
.badge.Cancelled { background: #eee; color: #777; text-decoration: line-through; }
tr.cx td { color: #999; }
.pchips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 8px; }
.pchip { background: #e6efff; border: 1px solid #b9cdf5; color: #1e56c4; border-radius: 16px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.pchip:hover { background: #d6e4ff; }
.rsum { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.rsum span { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; }
.paybox { background: #f6f9ff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }

/* ---------------------------------------------------------------- client branding */
.brand .bd { font-weight: 700; font-size: 15px; line-height: 1.25; } .brand .btg { text-align: center; color: var(--muted); font-size: 11.5px; font-style: italic; margin-top: 3px; line-height: 1.3; }
.appname { font-size: 22px !important; color: var(--navy); text-align: center; line-height: 1.25; }
.side nav a { display: flex; align-items: center; gap: 10px; position: relative; } .side nav a i { font-style: normal; width: 22px; text-align: center; flex: none; }
.mtop, .scrim { display: none; }

/* ---------------------------------------------------------------- screen sizes */
/* big monitors: use the space */
@media (min-width: 1600px) { body { font-size: 15px; } .side { width: 250px; } main { padding: 26px 40px; } .kpi .v { font-size: 25px; } }
/* small laptop / tablet landscape: icon menu */
@media (max-width: 1100px) and (min-width: 761px) {
  .side { width: 70px; } .side nav a { justify-content: center; padding: 12px 6px; } .side nav a i { font-size: 20px; width: auto; }
  .side nav a .t, .brand .bd, .brand .btg, .who span, .madeby { display: none; } .brand { padding: 8px; } .who { padding: 10px 6px; justify-content: center; }
  .side nav a .nbadge { position: absolute; top: 4px; right: 4px; margin: 0; }
  main { padding: 18px 18px; }
}
/* phone & tablet portrait: top bar + slide-in menu */
@media (max-width: 760px) {
  body { font-size: 15px; }
  #app { display: block; }
  .mtop { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
  .mtop img { height: 32px; max-width: 90px; object-fit: contain; background: #fff; border-radius: 5px; padding: 2px; }
  .mtop .mt { min-width: 0; line-height: 1.2; } .mtop b, .mtop span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .mtop span { font-size: 11.5px; opacity: .85; font-style: italic; }
  .burger { background: none; border: 0; color: #fff; font-size: 26px; padding: 2px 6px; cursor: pointer; line-height: 1; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: 270px; max-width: 85vw; z-index: 45; transform: translateX(-102%); transition: transform .2s ease; overflow-y: auto; }
  body.navopen .side { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  body.navopen .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 44; }
  .side nav a { padding: 13px 20px; }
  main { padding: 14px 12px 60px; }
  h1 { font-size: 19px; } .top { align-items: flex-start; } .top > .row { width: 100%; }
  input, select, textarea { font-size: 16px; }
  .filters input, .filters select { flex: 1 1 140px; min-width: 0; width: 100%; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .card { padding: 12px; overflow-x: auto; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; } .kpi { padding: 10px 12px; } .kpi .v { font-size: 18px; }
  .totals { width: 100%; } .lines { min-width: 640px; }
  .tbl td, .tbl th { padding: 7px 8px; }
  .modal { padding: 0; place-items: end center; } .modal-box { width: 100% !important; max-width: 100% !important; max-height: 92vh; border-radius: 14px 14px 0 0; padding: 16px; }
  .plans { grid-template-columns: 1fr; } .licbar { padding: 8px 12px; flex-wrap: wrap; }
  .toast { bottom: 14px; max-width: 92vw; }
}
/* print the screen without the menu */
@media print { .side, .mtop, .scrim, .licbar { display: none !important; } main { padding: 0; } }

/* ---------------------------------------------------------------- camp registration */
.wide2 { grid-column: span 2; } @media (max-width: 420px) { .wide2 { grid-column: auto; } }
.lab { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; } .chk { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; margin: 0; } .chk input { width: auto; margin: 0; }
.sechead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; } .sechead h3 { margin: 0; }
input.auto { background: #f3f6fb; color: var(--navy); font-weight: 600; }
.pform { display: flex; gap: 16px; align-items: flex-start; }
.phbox { display: flex; flex-direction: column; align-items: center; flex: none; }
.phbox .ph { width: 96px; height: 116px; border: 1px dashed #b6c1d8; border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 12px; overflow: hidden; background: #f7f9fd; }
.phbox .ph img { width: 100%; height: 100%; object-fit: cover; }
.savebar { position: sticky; bottom: 0; background: rgba(243,245,249,.96); padding: 10px 0; display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); z-index: 5; }
.tbl.fe td { padding: 3px 4px; } .tbl.fe input, .tbl.fe select { padding: 5px 6px; font-size: 13px; min-width: 70px; }
@media (max-width: 760px) { .pform { flex-direction: column; align-items: stretch; } .phbox { flex-direction: row; gap: 10px; } .phbox .ph { width: 72px; height: 88px; }
  .savebar { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -2px 10px rgba(0,0,0,.12); }
  .savebar .btn { flex: 1; } }

@media (max-width: 760px) { .tbl .hm { display: none; } }
/* multi-company login: company code */
.cochip{background:#eef3ff;border:1px solid #d5e0fb;border-radius:8px;padding:8px 12px;font-size:13px;color:#33405e;margin:4px 0 10px;text-align:left}
.cochip b{color:#0B2E7A;letter-spacing:1px}
.cohint{font-size:12.5px;margin:-4px 0 8px;min-height:0;color:#6b7590;text-align:left}.cohint.bad{color:#c62828}
