:root{
  --pc-primary:#0F5F59;      /* teal - from the myRehab360 logo */
  --pc-primary-dark:#0A4B45;
  --pc-accent:#FFA51F;       /* orange - from the myRehab360 logo */
  --pc-bg:#f4f7f6;
  --pc-sidebar:#0A2E2A;
  --pc-sidebar-hover:#0F5F59;
  --pc-text:#1f2937;
  --pc-muted:#6b7280;
  --pc-radius:14px;
}
*{box-sizing:border-box}
body{
  background:var(--pc-bg);
  color:var(--pc-text);
  font-family:'Segoe UI',Roboto,-apple-system,sans-serif;
  font-size:14.5px;
}
a{text-decoration:none}

/* ---------- Layout ---------- */
.pc-wrapper{display:flex;min-height:100vh}
.pc-sidebar{
  width:250px;background:var(--pc-sidebar);color:#e6f4f2;
  flex-shrink:0;position:fixed;top:0;bottom:0;left:0;overflow-y:auto;
  transition:transform .25s ease; z-index:1030;
}
.pc-sidebar .brand{
  padding:22px 20px;font-size:1.25rem;font-weight:700;color:#fff;
  display:flex;align-items:center;gap:10px;border-bottom:1px solid rgba(255,255,255,.08);
}
.pc-sidebar .brand .dot{width:10px;height:10px;background:#FFA51F;border-radius:50%;display:inline-block}
.pc-sidebar .brand .brand-logo-box{background:#fff;border-radius:10px;padding:8px 14px;display:inline-flex;align-items:center;box-shadow:0 2px 8px rgba(0,0,0,.15)}
.pc-sidebar .nav-section{padding:14px 20px 6px;font-size:.72rem;letter-spacing:.08em;color:#7fbdb6;text-transform:uppercase}
.pc-sidebar a.nav-link{
  color:#cfe9e5;padding:11px 20px;display:flex;align-items:center;gap:12px;font-size:.92rem;
  border-left:3px solid transparent;
}
.pc-sidebar a.nav-link:hover{background:rgba(255,255,255,.06);color:#fff}
.pc-sidebar a.nav-link.active{background:var(--pc-sidebar-hover);color:#fff;border-left-color:#FFA51F;font-weight:600}
.pc-sidebar a.nav-link i{width:18px;text-align:center}

.pc-main{margin-left:250px;flex:1;min-width:0;display:flex;flex-direction:column}
.pc-topbar{
  background:#fff;padding:14px 26px;display:flex;justify-content:space-between;align-items:center;
  box-shadow:0 1px 3px rgba(0,0,0,.06);position:sticky;top:0;z-index:1020;
}
.pc-topbar .page-title{font-size:1.15rem;font-weight:700;color:var(--pc-text)}
.pc-content{padding:26px}

/* ---------- Cards ---------- */
.pc-card{background:#fff;border-radius:var(--pc-radius);border:1px solid #eef1f0;box-shadow:0 2px 10px rgba(15,23,22,.04)}
.pc-card .pc-card-header{padding:16px 20px;border-bottom:1px solid #f0f2f1;font-weight:700;display:flex;justify-content:space-between;align-items:center}
.pc-card .pc-card-body{padding:20px}

.stat-card{border-radius:var(--pc-radius);padding:20px;color:#fff;position:relative;overflow:hidden}
.stat-card i{font-size:2rem;opacity:.35;position:absolute;right:16px;top:16px}
.stat-card .stat-value{font-size:1.7rem;font-weight:800}
.stat-card .stat-label{font-size:.82rem;opacity:.9}
.bg-teal{background:linear-gradient(135deg,#0F5F59,#0A3833)}
.bg-blue{background:linear-gradient(135deg,#2563eb,#1e3a8a)}
.bg-amber{background:linear-gradient(135deg,#FFA51F,#C97A0A)}
.bg-rose{background:linear-gradient(135deg,#e11d48,#881337)}

/* ---------- Tables ---------- */
.table-clean thead th{
  background:#f3f6f5;color:#374151;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;
  border-bottom:2px solid #e5e7eb;font-weight:700;
}
.table-clean td, .table-clean th{vertical-align:middle;padding:12px 14px}
.table-clean tbody tr:hover{background:#f8fbfa}

/* ---------- Misc ---------- */
.btn-primary{background:var(--pc-primary);border-color:var(--pc-primary)}
.btn-primary:hover{background:var(--pc-primary-dark);border-color:var(--pc-primary-dark)}
.text-primary-pc{color:var(--pc-primary)}
.text-accent-pc{color:var(--pc-accent)}
.bg-accent-pc{background:var(--pc-accent)}
.btn-accent-pc{background:var(--pc-accent);border-color:var(--pc-accent);color:#fff}
.btn-accent-pc:hover{background:#E08F0F;border-color:#E08F0F;color:#fff}
.avatar-circle{
  width:38px;height:38px;border-radius:50%;background:var(--pc-primary);color:#fff;
  display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.9rem;
}
.login-page{
  min-height:100vh;display:flex;align-items:center;justify-content:center;
  background:radial-gradient(circle at top left,#0A3833,#0A2E2A 60%);
}
.login-card{background:#fff;border-radius:18px;overflow:hidden;box-shadow:0 20px 50px rgba(0,0,0,.3);max-width:900px;width:100%}
.login-side{background:linear-gradient(160deg,#0F5F59,#0A2E2A);color:#fff;padding:50px 40px}
.pain-scale span{display:inline-block;width:26px;height:26px;line-height:26px;text-align:center;border-radius:50%;font-size:.75rem;margin-right:3px}
.progress-thin{height:6px;border-radius:6px}
.timeline{border-left:2px solid #e5e7eb;margin-left:10px;padding-left:20px}
.timeline .t-item{position:relative;padding-bottom:22px}
.timeline .t-item::before{content:'';position:absolute;left:-26px;top:4px;width:12px;height:12px;border-radius:50%;background:var(--pc-primary);border:2px solid #fff;box-shadow:0 0 0 2px var(--pc-primary)}

@media(max-width:991px){
  .pc-sidebar{transform:translateX(-100%)}
  .pc-sidebar.show{transform:translateX(0)}
  .pc-main{margin-left:0}
}
@media(max-width:576px){
  /* Bootstrap's grid columns are flex items, which by default won't shrink
     below their content's natural width (min-width:auto) - if a stat card's
     icon + label need more horizontal room than half a narrow phone screen
     allows, the whole row is forced wider than the viewport, causing
     horizontal overflow/cut-off content site-wide. This is the standard,
     correct fix: explicitly allow columns to shrink, and trim the stat
     card's own content sizing so it comfortably fits at 2-per-row. */
  .row > [class*="col-"]{ min-width:0 }
  .stat-card{ padding:14px }
  .stat-card i{ font-size:1.3rem; right:10px; top:10px }
  .stat-card .stat-value{ font-size:1.3rem }
  .stat-card .stat-label{ font-size:.72rem }
}

/* =====================================================================
   App view (phones, < 768px): top app bar, bottom tab bar, card tiles.
   Desktop and tablet layouts are unchanged.
   ===================================================================== */
.topbar-back, .topbar-logo, .topbar-search, .m-bottom-nav, .pc-backdrop { display:none }
.avatar-circle{ position:relative }
.avatar-online{ display:none }
.min-w-0{ min-width:0 }

@media (max-width:767.98px){
  body{ background:#F3F7F6; padding-bottom:calc(64px + env(safe-area-inset-bottom)) }
  .pc-main{ margin-left:0 }

  /* Top app bar */
  .pc-topbar{ position:sticky; top:0; z-index:1030; height:62px; padding:0 14px; background:#fff;
    border-bottom:1px solid #E7EEEC; box-shadow:none }
  .pc-topbar .page-title{ font-size:1.18rem; font-weight:700; color:#0A3833 }
  .pc-topbar .btn-light{ background:transparent; border:0; font-size:1.25rem; color:#0A3833; padding:6px }
  .pc-topbar #notifBellBtn{ font-size:1.2rem; color:#0A3833 }
  .pc-topbar #notifBellBtn + .dropdown-menu{ width:calc(100vw - 24px) !important; max-width:360px }
  .avatar-circle{ width:40px; height:40px; font-size:.9rem; font-weight:700; background:#D9EDE9; color:#0F5F59 }
  .avatar-online{ display:block; position:absolute; right:1px; bottom:1px; width:10px; height:10px; border-radius:50%; background:#22C55E; border:2px solid #fff }
  .pc-topbar.is-home .topbar-logo{ display:block }
  .pc-topbar.is-home .topbar-logo img{ height:34px; width:auto }
  .pc-topbar.is-home .page-title{ display:none }
  .pc-topbar.is-home .topbar-search{ display:inline-flex; font-size:1.2rem; color:#0A3833; padding:6px }
  .pc-topbar.is-inner .topbar-menu{ display:none !important }
  .pc-topbar.is-inner .topbar-back{ display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; color:#0A3833; font-size:1.1rem; text-decoration:none }

  /* Content */
  .pc-content{ padding:14px 14px 20px }
  .pc-main > .text-center.text-muted.small{ display:none } /* copyright line */
  .pc-card{ border-radius:16px; border:1px solid #E7EEEC; box-shadow:0 1px 3px rgba(10,56,51,.04) }
  .pc-card-header{ flex-wrap:wrap; gap:8px; padding:14px 16px; font-size:.98rem }
  .pc-card-body{ padding:14px 16px }
  .form-label{ font-size:.86rem; font-weight:600; color:#0A3833 }
  .form-control, .form-select{ border-radius:12px; min-height:48px; border-color:#DCE5E3; font-size:1rem }
  textarea.form-control{ min-height:auto }
  .form-control-sm, .form-select-sm{ min-height:38px; border-radius:10px }
  .pc-content .btn:not(.btn-sm):not(.btn-close){ border-radius:12px; padding:.6rem 1rem }
  .pc-content .btn-sm{ border-radius:10px }
  .table-clean th{ font-size:.72rem }
  .table-responsive{ -webkit-overflow-scrolling:touch }

  /* Stacked appointment-type choice */
  .appt-type-group{ flex-direction:column; gap:8px }
  .appt-type-group > .btn{ border-radius:12px !important; margin:0 !important; padding:.7rem 1rem; font-weight:600; font-size:1.02rem }
  .appt-type-group > .btn-check:checked + .btn{ background:#0F5F59; border-color:#0F5F59; color:#fff }
  .appt-type-group > .btn-outline-primary{ color:#0F5F59; border-color:#0F5F59; border-width:1.5px }

  /* Sidebar becomes a drawer opened from the menu / More tab */
  .pc-sidebar{ z-index:1050; width:280px; transform:translateX(-100%); transition:transform .22s ease; box-shadow:none }
  .pc-sidebar.show{ transform:translateX(0); box-shadow:8px 0 30px rgba(0,0,0,.25) }
  body.menu-open .pc-backdrop{ display:block; position:fixed; inset:0; background:rgba(5,25,23,.45); z-index:1045 }
  body.menu-open{ overflow:hidden }

  /* Bottom tab bar */
  .m-bottom-nav{ display:flex; position:fixed; left:0; right:0; bottom:0; z-index:1040; background:#fff;
    border-top:1px solid #E3EAE8; padding:6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .m-bottom-nav a{ flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; text-decoration:none;
    color:#7A8A87; font-size:.72rem; font-weight:500; padding:4px 0 }
  .m-bottom-nav a i{ font-size:1.2rem }
  .m-bottom-nav a.active{ color:#0F5F59; font-weight:700 }

  /* Dashboard: app home */
  .m-hero{ position:relative; overflow:hidden; border-radius:18px; padding:20px 18px; color:#fff;
    background:linear-gradient(135deg,#1C7A70 0%,#0F5F59 55%,#0B4C47 100%); box-shadow:0 8px 22px rgba(15,95,89,.25) }
  .m-hero:after{ content:""; position:absolute; right:-40px; top:-30px; width:210px; height:210px; border-radius:50%; background:rgba(255,255,255,.07) }
  .m-hero .hi{ font-size:1rem; opacity:.95 }
  .m-hero .nm{ font-size:1.32rem; font-weight:800; line-height:1.15; margin:2px 0 }
  .m-hero .rl{ font-size:.92rem; opacity:.9 }
  .m-hero .dt{ position:relative; z-index:1; display:flex; align-items:center; gap:10px; text-align:left }
  .m-hero .dt i{ font-size:2.3rem }
  .m-hero .dt b{ display:block; font-size:1.02rem }
  .m-stat-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:14px 0 18px }
  .m-stat{ border-radius:14px; padding:12px 4px 10px; text-align:center; text-decoration:none; color:#0A3833; display:block }
  .m-stat i{ font-size:1.25rem }
  .m-stat b{ display:block; font-size:1.45rem; font-weight:800; line-height:1.2; margin-top:4px }
  .m-stat span{ display:block; font-size:.7rem; line-height:1.2; color:#33504c }
  .m-sec-head{ display:flex; justify-content:space-between; align-items:center; margin:4px 0 10px }
  .m-sec-head h5{ font-weight:800; font-size:1.15rem; margin:0; color:#0A3833 }
  .m-sec-head a, .m-sec-head button{ font-size:.88rem; font-weight:600; color:#0F5F59; text-decoration:none; background:none; border:0; padding:0 }
  .m-actions{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:18px }
  .m-action{ border-radius:14px; padding:12px 4px; text-align:center; text-decoration:none; color:#0A3833; font-size:.76rem; line-height:1.2; font-weight:500 }
  .m-action .ic{ width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; margin:0 auto 7px; color:#fff; font-size:1.15rem; box-shadow:0 3px 8px rgba(0,0,0,.12) }
  .m-actions .m-extra{ display:none }
  .m-actions.expanded .m-extra{ display:block }
  .m-appt-empty{ background:#fff; border:1px dashed #D6E2DF; border-radius:14px; padding:22px; text-align:center; color:#6b7a77 }
  .m-appt-empty i{ font-size:1.6rem; color:#8a9895; display:block; margin-bottom:8px }
  .m-appt{ background:#fff; border:1px solid #E7EEEC; border-radius:14px; padding:12px 14px; display:flex; gap:12px; align-items:center; margin-bottom:8px; text-decoration:none; color:inherit }
  .m-appt .tm{ min-width:62px; text-align:center; border-right:1px solid #EEF2F1; padding-right:10px; font-weight:700; color:#0F5F59; font-size:.92rem; line-height:1.15 }
  .m-appt .tm small{ display:block; font-weight:500; color:#8a9895; font-size:.7rem }
  .m-appt .who{ flex:1; min-width:0 }
  .m-appt .who b{ display:block; color:#0A3833; font-size:.95rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
  .m-appt .who span{ font-size:.78rem; color:#6b7a77 }
  .dash-switch{ flex-wrap:nowrap !important; overflow-x:auto; padding-bottom:4px; scrollbar-width:none }
  .dash-switch::-webkit-scrollbar{ display:none }
  .dash-switch a{ white-space:nowrap; flex:0 0 auto }
}
@media (max-width:767.98px){
  /* Patients list header: count + Export PDF on the first line, Add Patient below */
  .pc-card-header:has(.patients-head-actions){ display:grid; grid-template-columns:1fr auto; align-items:center; row-gap:12px }
  .patients-head-actions{ display:contents !important }
  .patients-head-actions .ph-export{ grid-column:2; grid-row:1; border-radius:10px; padding:.4rem .8rem }
  .patients-head-actions .ph-add{ grid-column:1; grid-row:2; justify-self:start; border-radius:10px; padding:.5rem 1rem; font-weight:600 }
}
@media (max-width:767.98px){
  .table-responsive td, .table-responsive th{ white-space:nowrap }
  .table-clean td{ padding-top:.85rem; padding-bottom:.85rem }
  .pc-topbar.is-home .topbar-logo img{ height:40px }
}
@media (max-width:767.98px){ .pc-sidebar{ overflow-y:auto; height:100%; padding-bottom:calc(20px + env(safe-area-inset-bottom)) } }

/* Card headers: title (and its icon/badge) on the left, the last action (link/button) on the right. */
.pc-card-header{ justify-content:flex-start; gap:6px }
.pc-card-header > :last-child:not(:first-child):not(.badge):not(span.text-muted){ margin-left:auto }

/* Card headers: specificity fix (title left, last action right) */
.pc-card .pc-card-header{ justify-content:flex-start; gap:6px }
.pc-card .pc-card-header > :last-child:not(:first-child):not(.badge):not(span.text-muted){ margin-left:auto }

@media (max-width:767.98px){
  /* Data tables become stacked cards on phones */
  .m-cards-wrap{ overflow:visible !important }
  table.m-cards, table.m-cards tbody, table.m-cards tr, table.m-cards td{ display:block; width:100% }
  table.m-cards thead{ display:none }
  table.m-cards{ border:0; margin-bottom:0 }
  table.m-cards tbody tr{ background:#fff; border:1px solid #E7EEEC; border-radius:14px; margin:0 0 10px; padding:6px 12px;
    box-shadow:0 1px 2px rgba(10,56,51,.04) }
  .pc-card-body.p-0 table.m-cards, .pc-card > .table-responsive table.m-cards{ padding:10px 10px 2px }
  table.m-cards td{ border:0 !important; padding:6px 0 !important; display:flex; justify-content:space-between; align-items:center;
    gap:12px; text-align:right; white-space:normal !important; min-height:0; font-size:.9rem }
  table.m-cards td + td{ border-top:1px dashed #EEF2F1 !important }
  table.m-cards td::before{ content:attr(data-label); flex:0 0 38%; text-align:left; font-size:.7rem; font-weight:700;
    letter-spacing:.04em; text-transform:uppercase; color:#7A8A87 }
  table.m-cards td[data-label=""]::before{ display:none }
  table.m-cards td[data-label=""]{ justify-content:flex-end; flex-wrap:wrap }
  table.m-cards td:first-child{ font-weight:600; color:#0A3833 }
  table.m-cards td > .form-control, table.m-cards td > .form-select, table.m-cards td > input, table.m-cards td > select, table.m-cards td > textarea{ flex:1; min-width:0; text-align:left }
  table.m-cards tr.m-empty{ background:transparent; border:0; box-shadow:none }
  table.m-cards tr.m-empty td{ display:block; text-align:center; color:#6b7a77 }
  table.m-cards tfoot, table.m-cards tfoot tr, table.m-cards tfoot td{ display:block; width:100% }

  /* Speech / OT section menus: one swipeable row of chips */
  .sp-subnav .card-body{ flex-wrap:nowrap !important; overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch }
  .sp-subnav .card-body::-webkit-scrollbar{ display:none }
  .sp-subnav .btn, .sp-subnav span{ white-space:nowrap; flex:0 0 auto }
  .sp-subnav{ border-radius:14px; border-color:#E7EEEC }

  /* Page headings inside pages */
  .pc-content h4{ font-size:1.2rem } .pc-content h5{ font-size:1.05rem }
}
