/* Full-size professional medical layout */

:root{
  --ahms-primary:#0ea5a2;
  --ahms-primary-soft:rgba(14,165,162,0.12);
  --ahms-text:#0f172a;
  --ahms-text-muted:#4b5563;
  --ahms-surface:#f9fbfb;
  --ahms-surface-alt:#ffffff;
  --ahms-sidebar-bg:#0b1f24;
  --ahms-sidebar-card:#102932;
  --ahms-sidebar-border:rgba(255,255,255,0.05);
  --ahms-border:#e2e8f0;
  --ahms-shadow:0 12px 34px rgba(15, 23, 42, 0.14);
}

*,*::before,*::after{
  box-sizing:border-box;
}

html,body{
  height:100%;
  margin:0;
  padding:0;
}

body.app-body{
  min-height:100vh;
  font-family:"Avenir Next","Segoe UI","Helvetica Neue",Arial,sans-serif;
  background:linear-gradient(160deg,#ecfdfd 0%,#f4fbfb 50%,#ffffff 100%);
  color:var(--ahms-text);
}

body.app-body h1,
body.app-body h2,
body.app-body h3,
body.app-body h4{
  font-family: "Georgia","Times New Roman",serif;
  letter-spacing:-0.02em;
}

.report-container{
  width:100%;
  max-width:100%;
  margin:0 auto;
  padding:2rem clamp(1rem,3vw,2.5rem);
}
/* Medical body chart */
.medical-body-chart{
  border:1px solid rgba(14,165,162,0.25);
  border-radius:1.25rem;
  padding:1.25rem;
  background:rgba(255,255,255,0.75);
  backdrop-filter:blur(6px);
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:420px;
}
.medical-body-chart__image{
  display:block;
  width:100%;
  height:90%;
  max-height:90%;
  object-fit:contain;
}

/* APP SHELL */
.app-shell{
  width:100%;
}

.app-sidebar{
  width:280px;
  min-width:280px;
  flex:0 0 280px;
  background:var(--ahms-sidebar-bg);
  color:#ffffff;
  padding:1.5rem 1.25rem;
  border-right:1px solid rgba(255,255,255,0.08);
  overflow-y:auto;
  position:relative;
}

.app-sidebar::-webkit-scrollbar{
  width:6px;
}
.app-sidebar::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,0.12);
  border-radius:999px;
}

.sidebar-shell{
  min-height:100%;
}

.app-sidebar small,
.app-sidebar span,
.app-sidebar p{
  color:rgba(255,255,255,0.8);
}

.app-sidebar .nav{
  gap:.25rem;
  padding-top:1rem;
}

/* Announcements */
.announcements-card{
  border:1px solid var(--ahms-border);
  background:var(--ahms-surface-alt);
  box-shadow:0 10px 24px rgba(15,23,42,0.08);
}

.announcements-header{
  background:linear-gradient(135deg,rgba(14,165,162,0.12),rgba(14,165,162,0.02));
}

.announcements-header__icon{
  width:36px;
  height:36px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(14,165,162,0.16);
  color:#0f766e;
}

.announcements-count{
  font-size:0.75rem;
  color:var(--ahms-text-muted);
}

.announcements-list__item{
  border:0;
}

.announcement-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:0.75rem;
  padding:0.65rem 0;
  color:var(--ahms-text);
  text-decoration:none;
}

.announcement-item:hover,
.announcement-item:focus{
  text-decoration:none;
  background:var(--ahms-primary-soft);
  border-radius:0.75rem;
  padding-left:0.75rem;
  padding-right:0.75rem;
}

.announcement-item__title{
  font-weight:600;
  letter-spacing:0.01em;
}

.announcement-item__chevron{
  color:#94a3b8;
}

.announcement-modal-body{
  color:var(--ahms-text);
  line-height:1.6;
}

.sidebar-nav{
  padding-bottom:1.5rem;
}

.sidebar-section{
  border:1px solid var(--ahms-sidebar-border);
  border-radius:1rem;
  background:linear-gradient(180deg,rgba(255,255,255,0.04),rgba(255,255,255,0.02));
  overflow:hidden;
}

.sidebar-section__title{
  display:flex;
  align-items:center;
  gap:.55rem;
  border-bottom:1px solid var(--ahms-sidebar-border);
  width:100%;
  background:transparent;
  color:inherit;
  border-left:none;
  border-right:none;
  border-top:none;
  text-align:left;
  cursor:pointer;
}

.sidebar-section__title:hover{
  background:rgba(255,255,255,0.04);
}

.sidebar-section__title:focus-visible{
  outline:2px solid rgba(14,165,162,0.7);
  outline-offset:-2px;
}

.sidebar-section__index{
  width:1.35rem;
  height:1.35rem;
  border-radius:999px;
  background:rgba(14,165,162,0.2);
  color:#d6fffe;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:.72rem;
  font-weight:700;
}

.sidebar-section__label{
  letter-spacing:.08em;
  color:rgba(255,255,255,0.7);
}

.sidebar-section__count{
  color:rgba(255,255,255,0.6);
  font-size:.72rem;
}

.sidebar-section__chevron{
  color:rgba(255,255,255,0.65);
  transition:transform .2s ease;
}

.sidebar-section__items{
  max-height:1200px;
  overflow:hidden;
  transition:max-height .22s ease;
}

.sidebar-section.is-collapsed .sidebar-section__items{
  max-height:0;
}

.sidebar-section.is-collapsed .sidebar-section__chevron{
  transform:rotate(-90deg);
}

.app-sidebar .nav-item{
  list-style:none;
}

.app-sidebar .nav-link{
  color:rgba(255,255,255,0.88);
  padding:.62rem .85rem;
  border-radius:.75rem;
  transition:background .2s ease, color .2s ease, transform .2s ease;
  margin:.15rem .35rem;
  text-decoration:none;
}

.app-sidebar .nav-link:hover{
  background:rgba(255,255,255,0.08);
  color:#fff;
  transform:translateX(2px);
}

.app-sidebar .nav-link.active{
  background:rgba(14,165,162,0.25);
  color:#ffffff;
}

.app-sidebar .nav-link__icon{
  width:1.45rem;
  height:1.45rem;
  border-radius:.45rem;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,0.07);
  color:rgba(255,255,255,0.92);
  flex:0 0 auto;
  margin-top:1px;
}

.app-sidebar .nav-link.active .nav-link__icon{
  background:rgba(14,165,162,0.45);
  color:#ffffff;
}

.app-sidebar .nav-link__text{
  min-width:0;
  display:flex;
  flex-direction:column;
  line-height:1.15rem;
}

.app-sidebar .nav-link__main{
  color:inherit;
  font-size:.92rem;
}

.app-sidebar .nav-link__sub{
  color:rgba(255,255,255,0.62);
  font-size:.74rem;
  margin-top:.08rem;
  line-height:1rem;
}

.sidebar-footer{
  background:transparent;
}
.sidebar-footer small,
.sidebar-footer span{
  color:rgba(255,255,255,0.7);
}
.sidebar-footer .dropdown-menu{
  border-radius:1rem;
}
.sidebar-footer .dropdown-menu-dark{
  background:rgba(15,30,38,0.96);
  border:1px solid rgba(255,255,255,0.05);
}
.sidebar-footer .dropdown-item{
  border-radius:.75rem;
}
.sidebar-footer .dropdown-item:hover{
  background:rgba(255,255,255,0.08);
}
.sidebar-footer .dropdown-divider{
  border-color:rgba(255,255,255,0.1);
}
.app-sidebar .card{
  background:rgba(255,255,255,0.08);
  color:#ffffff;
  border-radius:1rem;
  box-shadow:none;
}
.app-sidebar .card p,
.app-sidebar .card h6{
  color:#ffffff;
}
.app-sidebar .card .btn{
  border-radius:.75rem;
}

/* MAIN */
.app-main{
  background:transparent;
  padding:5px;
  box-shadow:none;
}
.app-main.app-main--regular{
  padding:16px;
}

.app-main__header{
  padding-bottom:1.5rem;
  gap:1rem;
}
.app-main__header{
  padding-bottom:1.5rem;
  gap:1rem;
}
.nav-menu-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border-radius:999px;
  background:transparent;
  color:var(--ahms-text);
  border:none;
  text-decoration:none;
  transition:background .2s ease, transform .2s ease;
}
.nav-menu-toggle:hover,
.nav-menu-toggle:focus{
  background:rgba(14,165,162,0.12);
  transform:translateY(-1px);
  color:var(--ahms-text);
}
.nav-menu-toggle i{
  font-size:1.25rem;
}
@media (min-width:768px){
  .nav-menu-toggle{display:none!important;}
}

.app-main__title h1{
  font-weight:600;
  color:var(--ahms-text);
}

.app-main__content{
  background:transparent;
  padding:0;
  border-radius:0;
  box-shadow:none;
  overflow:auto;
}

.app-main__content > .alert:first-child{
  margin-top:0;
}

.branch-context-select{
  min-width:220px;
}

.app-footer{
  color:var(--ahms-text-muted);
}

.template-canvas-wrap{
  overflow:auto;
  padding:12px;
  background:#f8fafc;
}

#templateCanvas{
  background:#ffffff;
  border:1px solid #e2e8f0;
}

.template-block{
  padding:2px 4px;
}

.template-preview-wrap{
  border:1px solid #e2e8f0;
  border-radius:.75rem;
  background:#ffffff;
  overflow:hidden;
  min-height:420px;
}

#previewFrame{
  width:100%;
  height:520px;
  border:none;
}

.template-toolbar{
  padding:12px 14px;
  border-radius:1rem;
  background:linear-gradient(135deg,#f8fafc,#e2e8f0);
  border:1px solid rgba(15,23,42,0.08);
}

.template-tool{
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  border-radius:.75rem;
}

.template-tool i{
  font-size:1.1rem;
}

.template-panel{
  position:sticky;
  top:1rem;
}

.template-status{
  background:#f1f5f9;
  border-radius:.5rem;
  padding:.35rem .75rem;
}

.nav-tabs .nav-link{
  border-radius:.75rem .75rem 0 0;
}

.tab-content{
  background:#ffffff;
  border:1px solid rgba(15,23,42,0.08);
  border-top:none;
  border-radius:0 0 1rem 1rem;
  padding:1rem;
}

.nav-pills .nav-link{
  border-radius:.75rem;
}

/* BREADCRUMB */
.breadcrumb{
  --bs-breadcrumb-divider:'›';
  font-size:.85rem;
}
.breadcrumb-item + .breadcrumb-item::before{
  color:var(--ahms-text-muted);
}

/* ALERTS */
.alert{
  border-radius:.75rem;
  border:none;
  box-shadow:0 12px 30px rgba(15,23,42,0.12);
}

/* GLOBAL CARDS */
body.app-body .app-main .card{
  border-radius:1.25rem;
  border:1px solid rgba(15,23,42,0.08);
  box-shadow:0 10px 30px rgba(15,23,42,0.08);
  background:#ffffff;
}
body.app-body .app-main .card-header{
  background:transparent;
  border-bottom:1px solid rgba(15,23,42,0.06);
}
body.app-body .app-main .card-body{
  padding:1.5rem;
}

/* KPI CARDS */
.card.kpi{
  border:none;
  border-radius:1rem;
  background:#fff;
  box-shadow:var(--ahms-shadow);
}
.card.kpi .card-body{
  padding:1.25rem 1.5rem;
}
.card.kpi i{
  color:var(--ahms-primary);
}

/* OFFCANVAS */
.offcanvas{
  width:280px;
  background:var(--ahms-sidebar-bg);
  color:#fff;
}
.offcanvas .offcanvas-header{
  background:rgba(255,255,255,0.04);
}
.offcanvas .btn-close{
  filter:invert(1) grayscale(1);
}
.offcanvas .nav-link{
  color:rgba(255,255,255,0.88);
}
.offcanvas .nav-link.active{
  background:rgba(14,165,162,0.25);
  color:#fff;
}

/* RESPONSIVE */
@media (max-width:991.98px){
  .app-main{
    padding:5px;
  }
  .app-main.app-main--regular{
    padding:12px;
  }
  .app-main__content{
    padding:0;
  }
}

@media (max-width:767.98px){
  .app-shell{
    flex-direction:column;
  }
  .app-main{
    padding:5px;
  }
  .app-main.app-main--regular{
    padding:10px;
  }
  .app-main__content{
    padding:0;
  }
}

.admission-document-viewer{
  height:72vh;
}

#admissionDocumentViewFrame{
  width:100%;
  height:100%;
  border:0;
}

.announcement-body img{
  max-width:100%;
  height:auto;
}

/* LINE Flex message preview (admin viewer) */
.line-flex-preview{
  max-width:520px;
}
.line-flex-bubble{
  border:1px solid rgba(0,0,0,.125);
  border-radius:12px;
  overflow:hidden;
  background:#fff;
}
.line-flex-bubble-section{
  padding:12px 14px;
}
.line-flex-bubble-header{
  background:rgba(0,0,0,.02);
  border-bottom:1px solid rgba(0,0,0,.06);
}
.line-flex-bubble-footer{
  background:rgba(0,0,0,.02);
  border-top:1px solid rgba(0,0,0,.06);
}
.line-flex-box{
  display:flex;
  gap:8px;
}
.line-flex-box-vertical{
  flex-direction:column;
}
.line-flex-box-horizontal,
.line-flex-box-baseline{
  flex-direction:row;
  align-items:baseline;
}
.line-flex-text{
  color:#111;
  line-height:1.25;
}
.line-flex-text-wrap{
  white-space:pre-wrap;
  word-break:break-word;
}
.line-flex-text-bold{
  font-weight:700;
}
.line-flex-text-sm{ font-size:.875rem; }
.line-flex-text-md{ font-size:1rem; }
.line-flex-text-lg{ font-size:1.125rem; }
.line-flex-text-xl{ font-size:1.25rem; }
.line-flex-text-align-center{ text-align:center; }
.line-flex-text-align-end{ text-align:end; }
.line-flex-image{
  max-width:100%;
  height:auto;
  border-radius:8px;
}
.line-flex-separator{
  margin:10px 0;
  border:0;
  border-top:1px solid rgba(0,0,0,.08);
}

@media (max-width:576px){
  .admission-document-viewer{
    height:60vh;
  }
}

.owner-dashboard {
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --cloud: #f8fafc;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
.owner-dashboard h1,
.owner-dashboard h2,
.owner-dashboard h3 {
  font-family: "Georgia", "Times New Roman", serif;
  letter-spacing: -0.02em;
}
.owner-hero {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.15), rgba(96, 165, 250, 0.15) 45%, rgba(252, 211, 77, 0.2));
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 24px;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.owner-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -90px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.18) 0%, rgba(15, 118, 110, 0) 70%);
  pointer-events: none;
}
.owner-kpi {
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  background: #fff;
  position: relative;
  overflow: hidden;
}
.owner-kpi .card-body {
  padding: 24px;
}
.owner-kpi::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 4px solid rgba(15, 118, 110, 0.35);
  pointer-events: none;
}
.owner-kpi[data-kpi="branches"]::before { border-top-color: rgba(15, 118, 110, 0.45); }
.owner-kpi[data-kpi="patients"]::before { border-top-color: rgba(56, 189, 248, 0.5); }
.owner-kpi[data-kpi="admissions"]::before { border-top-color: rgba(99, 102, 241, 0.5); }
.owner-kpi[data-kpi="alerts"]::before { border-top-color: rgba(249, 115, 22, 0.6); }
.owner-kpi[data-kpi="alertsAck"]::before { border-top-color: rgba(16, 185, 129, 0.55); }
.owner-kpi[data-kpi="finance"]::before { border-top-color: rgba(234, 179, 8, 0.55); }
.owner-kpi .kpi-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--muted);
}
.owner-kpi .kpi-value {
  font-size: 2.2rem;
  font-weight: 700;
}
.owner-kpi .kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.2rem;
}
.owner-kpi[data-kpi="patients"] .kpi-icon { background: rgba(56, 189, 248, 0.2); color: #0284c7; }
.owner-kpi[data-kpi="admissions"] .kpi-icon { background: rgba(99, 102, 241, 0.2); color: #4338ca; }
.owner-kpi[data-kpi="alerts"] .kpi-icon { background: rgba(249, 115, 22, 0.2); color: #ea580c; }
.owner-kpi[data-kpi="alertsAck"] .kpi-icon { background: rgba(16, 185, 129, 0.2); color: #059669; }
.owner-kpi[data-kpi="finance"] .kpi-icon { background: rgba(234, 179, 8, 0.2); color: #b45309; }
.owner-panel {
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--cloud);
  padding: 24px;
  height: 100%;
}
.owner-dashboard .row {
  --bs-gutter-x: 1.75rem;
  --bs-gutter-y: 1.75rem;
}
.owner-panel h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.owner-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.owner-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.75rem;
}

@media print {
  nav, .navbar, .sidebar, .btn, .modal, .alert { display: none !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
