/* Shifokor panel app (/panel/). Layout and component rules follow SuperFlow's CRM panel (Mijozim):
   white cards on a soft slate background, one brand accent, a 240px sidebar, a sticky 64px top bar,
   page header + stat cards + content cards, generous radius, diffused shadows. Brand colour stays Shifokor teal. */
body.panelapp {
  --bg: #F1F5F9; --surface: #FFFFFF; --ink: #12262B; --muted: #55696E; --line: #E2E8F0;
  --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; --font-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --shadow-soft: 0 4px 20px rgba(15, 23, 42, 0.05); --r-card: 22px;
  padding: 0; background: var(--bg); font-size: 15px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.panelapp { --bg: #0B1517; --surface: #121F22; --ink: #E6F0EF; --muted: #93A9AC; --line: #22363A; --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.35); } }
:root[data-theme="dark"] body.panelapp { --bg: #0B1517; --surface: #121F22; --ink: #E6F0EF; --muted: #93A9AC; --line: #22363A; --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.35); }

/* shell */
.pshell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.pside { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); z-index: 40; }
.pbrand { display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 18px; color: var(--ink); text-decoration: none; flex: none; }
.pbrand img { width: 36px; height: 36px; }
.pbrand b { display: block; font: 800 1.1rem var(--font-display); }
.pbrand small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: -2px; }
.pside nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: grid; gap: 4px; align-content: start; }
.pside nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem; transition: background 0.15s, color 0.15s; }
.pside nav a .ic { width: 18px; height: 18px; flex: none; }
.pside nav a:hover { background: var(--accent-soft); color: var(--ink); }
.pside nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-soft); }
.pgroup { margin: 14px 12px 4px; font: 700 0.72rem var(--font-body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.puser { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.puser > div { flex: 1; min-width: 0; }
.puser b { display: block; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puser small { display: block; color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puser .pav { width: 36px; height: 36px; font-size: 0.85rem; flex: none; }
.pico { width: 38px; height: 38px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; }
.pico:hover { background: var(--accent-soft); color: var(--accent); }
.pmain { min-width: 0; display: flex; flex-direction: column; }
.ptop { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.ptitle { font: 700 1.05rem var(--font-display); }
.pmenu { display: none; }
.ptop .lang { border-color: var(--line); }
.ptop .lang button { color: var(--ink); }
.ptop .lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.pcontent { padding: 24px; width: 100%; max-width: 1240px; display: grid; gap: 20px; align-content: start; }

/* page header, stat cards, cards, empty states */
.phead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.phead h1, .pcontent > h1, .prohello h1 { margin: 0; font: 800 clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem) var(--font-display); letter-spacing: -0.02em; }
.phead p { margin: 4px 0 0; color: var(--muted); }
.pstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.pstat { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-soft); color: var(--ink); text-decoration: none; transition: transform 0.25s; }
a.pstat:hover { transform: translateY(-3px); }
.psi { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.psi .ic { width: 22px; height: 22px; }
.pstat small { display: block; color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.pstat b { display: block; font: 800 1.6rem/1.2 var(--font-display); margin-top: 2px; }
.pstat span.muted { display: block; font-size: 0.82rem; margin-top: 2px; }
.pcard { padding: 20px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-soft); }
.pcardh { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.pcardh h2 { margin: 0; font: 700 1.05rem var(--font-display); }
.pempty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 12px; }
.pempty > span { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); margin-bottom: 16px; }
.pempty > span .ic { width: 34px; height: 34px; }
.pempty h3 { margin: 0; font: 700 1.15rem var(--font-display); }
.pempty p { margin: 6px 0 16px; color: var(--muted); max-width: 40ch; }

/* the site's own cards and pages, inside the panel */
.pcontent .wrap { max-width: none; margin: 0; padding-left: 0; padding-right: 0; }
.pcontent .pad { padding-top: 0; padding-bottom: 0; }
.pcontent .band { margin: 0; border-radius: var(--r-card); padding-left: 24px; padding-right: 24px; }
.pcontent .dcard, .pcontent .procard, .pcontent .prostat, .pcontent .tlrow, .pcontent .wday, .pcontent .dtile { border-color: transparent; box-shadow: var(--shadow-soft); }
.pcontent .dcard { margin-bottom: 0; }
.pcontent .visits { margin-top: 0; }
.pcontent .prohello { margin-bottom: 0; }
.pcontent .prostats, .pcontent .protodo { margin-bottom: 0; }
.pcontent .accform { max-width: none; }
.pcontent .back { margin-top: 0; }

/* sign-in pages: the logo and one centred card */
.pbare { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 28px 16px 48px; }
.pbare > .pbrand { height: auto; margin-bottom: 20px; }
.pauth { width: 100%; max-width: 560px; }
.pauth .acc, .pauth .wrap { max-width: none !important; padding: 28px !important; margin: 0; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-soft); }
.pauth h1 { font: 800 1.6rem var(--font-display); }

/* phones: the sidebar slides in from the left */
@media (max-width: 900px) {
  .pshell { grid-template-columns: minmax(0, 1fr); }
  .pside { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform 0.22s ease-out; box-shadow: 0 0 40px rgba(0, 0, 0, 0.25); }
  .pshell.navopen .pside { transform: none; }
  .pshell.navopen::after { content: ""; position: fixed; inset: 0; background: rgba(8, 20, 22, 0.4); z-index: 35; }
  .pmenu { display: grid; }
  .ptop { padding: 0 12px; gap: 8px; }
  .ptop .btn.ghost.sm { display: none; }
  .pcontent { padding: 16px; gap: 16px; }
  .pstats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pstat { flex-direction: column; gap: 10px; padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .pside, a.pstat { transition: none; } }
.pauth .form { background: none; border: 0; box-shadow: none; padding: 0; }
.ptop { color: var(--ink); }
/* a dense working surface: card titles stay small, as in SuperFlow */
.pcontent h2, .pcontent .sechead h2, .pcontent .progrid h2 { font: 700 1.08rem var(--font-display); letter-spacing: 0; margin: 0; }
.pcontent .dcard h2 { margin-bottom: 6px; }
.pcontent .band .bhead { padding-block: 28px 30px; }
.pcontent .band h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); }
.ptitle { text-shadow: none; }

/* one site: on account pages the site's own header and footer step aside */
body.panelapp .top, body.panelapp .foot, body.panelapp .skip { display: none; }
/* sign out and "back to site" live in the menu, so they're always reachable (also behind Safari's bottom bar) */
.pside nav .pnavout { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 14px; background: none; color: var(--risk); font: 600 0.92rem var(--font-body); cursor: pointer; text-align: left; }
.pside nav .pnavout .ic { width: 18px; height: 18px; flex: none; }
.pside nav .pnavout:hover { background: var(--risk-soft); }
.pgroup:empty { margin: 10px 12px 6px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .pside { height: auto; } .pside nav { padding-bottom: 16px; } }
.pside { height: 100dvh; }
@media (max-width: 900px) { .pside { height: auto; } }
/* phones: a close button in the menu; the dark area behind it closes it too */
.pbrandrow { display: flex; align-items: center; padding-right: 10px; flex: none; }
.pbrandrow .pbrand { flex: 1; min-width: 0; }
.pclose { display: none; }
@media (max-width: 900px) { .pclose { display: grid; } }

/* clinic: branches, staff, invitations */
.brgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.brgrid .brform { grid-column: 1 / -1; }
.brcard .pcardh h2 { display: flex; align-items: center; gap: 8px; }
.brcard .pcardh h2 svg { width: 18px; height: 18px; color: var(--accent); }
.brcard .kv { grid-template-columns: 110px minmax(0, 1fr); font-size: 0.92rem; margin: 0 0 12px; }
.brcard .btns, .brform .btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.brform { margin-bottom: 16px; }
.stinv { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.stinv .fld { margin: 0; }
.stinv select, .strow select { width: 100%; }
.stlist { display: grid; gap: 4px; }
.strow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(120px, 180px) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.strow:first-child { border-top: 0; }
.strow .pav.sm { width: 40px; height: 40px; }
.strow .pav svg { width: 18px; height: 18px; }
.stmain { display: grid; min-width: 0; }
.stmain b, .stmain small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard.invcard { display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px solid var(--accent); background: var(--accent-soft); margin-bottom: 16px; }
.invcard p { margin: 4px 0 0; }
.invcard .btns { display: flex; gap: 8px; flex: none; }
.phead label.sel { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 760px) {
  .brgrid { grid-template-columns: minmax(0, 1fr); }
  .stinv { grid-template-columns: minmax(0, 1fr); }
  .strow { grid-template-columns: auto minmax(0, 1fr) auto; }
  .strow select { grid-column: 2 / -1; }
  .strow > .linkbtn, .strow > .btn { grid-column: 2 / -1; justify-self: start; }
  .pcard.invcard { flex-direction: column; align-items: stretch; }
}
.strow select, .phead label.sel select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 500 0.9rem var(--font-body); }

/* confirming the email */
.evcard { max-width: 560px; }
.evicon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.evicon svg { width: 28px; height: 28px; }
.evform .fld { max-width: 260px; }
.evcode { font: 700 1.6rem var(--font-display); letter-spacing: 0.4em; text-align: center; }
.evform .btns { display: flex; flex-wrap: wrap; gap: 10px; }
.pcard.evbanner { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--ochre) 40%, transparent); background: var(--ochre-soft); }
.evbanner .icobox { flex: none; margin: 0; background: var(--surface); color: var(--ochre); }
.evbanner > div { flex: 1; min-width: 0; }
.evbanner p { margin: 2px 0 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .pcard.evbanner { flex-wrap: wrap; } .evbanner .btn { width: 100%; } }

/* panel top bar: account menu */
.pacct { position: relative; }
.pacctbtn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 0.92rem var(--font-body); cursor: pointer; }
.pacctbtn:hover, .pacctbtn[aria-expanded="true"] { border-color: var(--accent); }
.pacctbtn .pav.sm { width: 30px; height: 30px; font-size: 0.75rem; }
.pacctbtn .ic { width: 16px; height: 16px; }
.pacct .menu { min-width: 240px; z-index: 60; }
@media (max-width: 600px) { .pacctname { display: none; } .pacctbtn { padding-right: 6px; } }

/* licence and diploma documents */
.docrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.docrow:first-child { border-top: 0; }
.docrow > .ic { width: 22px; height: 22px; color: var(--accent); }
.docadd { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.docadd select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.docpick { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }

/* the patient's health record */
.reclist { display: grid; }
.recitem { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.recitem:first-child { border-top: 0; padding-top: 0; }
.recdate { display: grid; justify-items: center; align-content: start; padding: 8px 4px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.recdate b { font-size: 1rem; text-align: center; }
.recdate small { font-size: 0.75rem; }
.recbody h3 { margin: 0 0 4px; font: 700 1rem var(--font-display); }
.recbody h3 small { font: 500 0.85rem var(--font-body); }
.recbody p { margin: 0 0 6px; }
.recadv, .recrx { margin: 8px 0 0; font-size: 0.93rem; overflow-wrap: anywhere; }
.recbody .btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
/* the printable summary */
.sumtools { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sumdoc { max-width: 760px; background: #fff; color: #111; border: 1px solid var(--line); border-radius: 18px; padding: clamp(18px, 4vw, 40px); }
.sumdoc h1 { font: 700 1.4rem var(--font-display); margin: 18px 0 12px; color: #111; }
.sumdoc h2 { font: 700 1.02rem var(--font-display); margin: 18px 0 6px; color: #111; }
.sumhead { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 2px solid #0F4C4F; }
.sumhead > div { display: grid; }
.sumhead small { color: #555; font-size: 0.8rem; }
.sumno { margin-left: auto; text-align: right; }
.sumtab { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 0.95rem; }
.sumtab th, .sumtab td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #e3e8e8; vertical-align: top; }
.sumtab th { width: 34%; color: #555; font-weight: 600; }
.sumtab.rx th { width: auto; }
.sumnote { margin-top: 22px; color: #555; border-top: 1px solid #e3e8e8; padding-top: 10px; }
@media print {
  .pside, .ptop, .noprint, .evbanner, .toast, #toast { display: none !important; }
  .pshell, .pmain, .pcontent { display: block !important; padding: 0 !important; margin: 0 !important; background: #fff !important; }
  body { background: #fff !important; }
  .sumdoc { border: 0; padding: 0; max-width: none; }
}
.sumtab th { text-transform: none; letter-spacing: 0; font-size: 0.92rem; }
.sumtab th { font-family: var(--font-body); }
