:root{
  --ahis-bg:#f4f6f8;
  --ahis-bg-elevated:#eef2f4;
  --ahis-surface:#ffffff;
  --ahis-surface-soft:#f8fafb;
  --ahis-surface-muted:#f2f5f7;
  --ahis-border:#d7dee5;
  --ahis-border-strong:#c3ced9;
  --ahis-text:#14304a;
  --ahis-text-soft:#3f556b;
  --ahis-text-muted:#66788a;
  --ahis-primary:#255c45;
  --ahis-primary-dark:#1d4736;
  --ahis-primary-soft:#e6f1eb;
  --ahis-secondary:#61758b;
  --ahis-secondary-soft:#edf2f7;
  --ahis-info:#2d617c;
  --ahis-info-soft:#e8f0f5;
  --ahis-success:#28724c;
  --ahis-success-soft:#e7f4ed;
  --ahis-warning:#a97212;
  --ahis-warning-soft:#fff4db;
  --ahis-danger:#b2483c;
  --ahis-danger-soft:#fdecea;
  --ahis-shadow-xs:0 1px 2px rgba(17, 39, 61, .04);
  --ahis-shadow-sm:0 10px 24px rgba(17, 39, 61, .06);
  --ahis-shadow-md:0 18px 48px rgba(17, 39, 61, .10);
  --ahis-radius-sm:10px;
  --ahis-radius:16px;
  --ahis-radius-lg:22px;
  --ahis-sidebar-w:284px;
  --ahis-topbar-h:64px;
  --ahis-space-1:.25rem;
  --ahis-space-2:.5rem;
  --ahis-space-3:.75rem;
  --ahis-space-4:1rem;
  --ahis-space-5:1.25rem;
  --ahis-space-6:1.5rem;
  --ahis-space-7:1.75rem;
  --ahis-space-8:2rem;
  --ahis-h1:clamp(1.55rem, 1.15rem + 1.1vw, 2.15rem);
  --ahis-h2:1.35rem;
  --ahis-h3:1.08rem;
}

*{box-sizing:border-box}
html,body{height:100%}
body.ahis-body{
  margin:0;
  color:var(--ahis-text);
  background:
    radial-gradient(1200px 640px at 88% -10%, rgba(34, 92, 69, .09), transparent 58%),
    radial-gradient(960px 520px at 6% 100%, rgba(45, 97, 124, .07), transparent 55%),
    linear-gradient(180deg, #f9fbfc 0%, var(--ahis-bg) 38%, #f3f6f8 100%);
  font-family:"Segoe UI", "Noto Sans", sans-serif;
  line-height:1.45;
}

h1,h2,h3,h4,h5,h6{
  color:#10293f;
  letter-spacing:-.015em;
}

a{
  color:var(--ahis-info);
  text-decoration:none;
}
a:hover{ color:#21495f; }

:focus-visible{
  outline:3px solid rgba(45, 97, 124, .35);
  outline-offset:2px;
}

.ahis-topbar{
  position:fixed;
  top:0;
  left:0;
  right:0;
  height:var(--ahis-topbar-h);
  z-index:1035;
  border-bottom:1px solid rgba(255,255,255,.18);
  background:linear-gradient(90deg,
    var(--ahis-flag-1, var(--ahis-primary)) 0%,
    var(--ahis-flag-1, var(--ahis-primary)) 33.33%,
    var(--ahis-flag-2, var(--ahis-info)) 33.33%,
    var(--ahis-flag-2, var(--ahis-info)) 66.66%,
    var(--ahis-flag-3, var(--ahis-primary-dark)) 66.66%,
    var(--ahis-flag-3, var(--ahis-primary-dark)) 100%
  );
  box-shadow:0 12px 28px rgba(8, 17, 28, .18);
  backdrop-filter:blur(10px);
}
.ahis-topbar-inner{
  height:100%;
  padding:0 .95rem;
}
.ahis-brand-org{
  display:block;
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.14em;
  opacity:.78;
  font-weight:700;
}
.ahis-flag-wrap{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:36px;
}
.ahis-flag{
  height:18px;
  width:auto;
  border-radius:2px;
  box-shadow:0 0 0 1px rgba(255,255,255,.16);
}
.ahis-flag-fallback{
  font-weight:700;
  font-size:.75rem;
  letter-spacing:.05em;
  color:#fff;
}
.ahis-topbar .ahis-brand,
.ahis-topbar .ahis-brand-name,
.ahis-topbar .ahis-brand-org,
.ahis-topbar .ahis-top-search i,
.ahis-topbar .ahis-top-search .form-control,
.ahis-topbar .ahis-btn,
.ahis-topbar .btn,
.ahis-topbar .dropdown-toggle,
.ahis-topbar .badge{
  color:#fff;
}
.ahis-topbar .ahis-top-search .form-control{
  background:rgba(255,255,255,.16);
  border-color:rgba(255,255,255,.24);
}
.ahis-topbar .ahis-top-search .form-control::placeholder{
  color:rgba(255,255,255,.78);
}
.ahis-topbar .ahis-btn,
.ahis-topbar .btn{
  border-color:rgba(255,255,255,.28);
  background:rgba(255,255,255,.08);
}
.ahis-top-search{
  position:relative;
  align-items:center;
  min-width:280px;
}
.ahis-top-search i{
  position:absolute;
  left:.75rem;
}
.ahis-top-search .form-control{
  padding-left:2.1rem;
  border-radius:999px;
}

.ahis-shell{
  display:flex;
  min-height:100vh;
  padding-top:var(--ahis-topbar-h);
}
.ahis-sidebar{
  width:var(--ahis-sidebar-w);
  flex:0 0 var(--ahis-sidebar-w);
  border-right:1px solid var(--ahis-border);
  background:linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(248,250,251,.98) 100%);
  position:fixed;
  left:0;
  top:var(--ahis-topbar-h);
  bottom:0;
  z-index:1030;
  box-shadow:18px 0 38px rgba(17, 39, 61, .06);
}
.ahis-sidebar-scroll{
  height:100%;
  overflow-y:auto;
  padding:1rem .75rem 1.15rem;
  scrollbar-width:thin;
  scrollbar-color:rgba(100,116,139,.35) transparent;
}
.ahis-sidebar-scroll::-webkit-scrollbar{
  width:8px;
}
.ahis-sidebar-scroll::-webkit-scrollbar-thumb{
  background:rgba(100,116,139,.28);
  border-radius:999px;
}
.ahis-sidebar-scroll::-webkit-scrollbar-track{
  background:transparent;
}
.nav-builder{
  display:flex;
  flex-direction:column;
  gap:.2rem;
}
.ahis-sidebar-title{
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.14em;
  font-weight:800;
  color:#6b7a8c;
  margin:.35rem .55rem .5rem;
  padding-top:.55rem;
}
.ahis-sidebar-title:first-child{
  margin-top:0;
  padding-top:0;
}
.ahis-sidebar-accordion .accordion-item{
  border:0;
  background:transparent;
}
.ahis-sidebar-accordion .accordion-button{
  border-radius:14px;
  background:transparent;
  color:var(--ahis-text);
  font-weight:600;
  box-shadow:none;
  padding:.68rem .78rem;
}
.ahis-sidebar-accordion .accordion-button:not(.collapsed){
  color:var(--ahis-primary-dark);
  background:var(--ahis-primary-soft);
}
.ahis-sidebar-accordion .accordion-body{
  padding:.45rem .2rem .55rem;
}
.ahis-nav-link{
  display:flex;
  align-items:center;
  gap:.72rem;
  border:1px solid transparent;
  border-left:3px solid transparent;
  border-radius:12px;
  color:#233247;
  text-decoration:none;
  padding:.62rem .7rem .62rem .58rem;
  margin-bottom:.18rem;
  transition:background-color .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease;
}
.ahis-nav-link:hover{
  background:#f5f8fa;
  border-color:#d9e2ea;
  color:#1c3045;
}
.ahis-nav-link.active{
  background:#eef4f8;
  border-color:#d5e0e8;
  border-left-color:#2f5d50;
  color:var(--ahis-primary-dark);
  box-shadow:inset 0 0 0 1px rgba(47,93,80,.04);
}
.ahis-nav-icon,
.menu-icon-pill,
.menu-icon-preview{
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:grid;
  place-items:center;
  border-radius:10px;
  border:1px solid var(--ahis-border);
  background:#fff;
  color:#203750;
  box-shadow:var(--ahis-shadow-xs);
}
.ahis-nav-label{
  font-size:.92rem;
  font-weight:600;
  line-height:1.3;
  flex:1;
}
.ahis-group-wrap{ margin:.14rem 0; }
.ahis-group-btn{
  width:100%;
  display:flex;
  align-items:center;
  gap:.72rem;
  border:1px solid transparent;
  border-left:3px solid transparent;
  border-radius:12px;
  background:transparent;
  color:#233247;
  text-align:left;
  padding:.62rem .68rem .62rem .58rem;
  transition:background-color .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease;
}
.ahis-group-btn:hover{
  background:#f5f8fa;
  border-color:#d9e2ea;
}
.ahis-group-btn.is-parent-active{
  background:#eef4f8;
  border-left-color:#2f5d50;
  color:#1f3850;
}
.ahis-group-icon{
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:grid;
  place-items:center;
  border:1px solid var(--ahis-border);
  border-radius:10px;
  background:#fff;
  color:#203750;
  box-shadow:var(--ahis-shadow-xs);
}
.ahis-group-label{
  flex:1;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:.92rem;
  font-weight:600;
  line-height:1.3;
}
.ahis-group-chevron{
  color:#64748b;
  font-size:.8rem;
}
.ahis-group-btn .ahis-group-chevron i{
  transition:transform .16s ease;
}
.ahis-group-btn.collapsed .ahis-group-chevron i{
  transform:rotate(-90deg);
}
.ahis-group-children{
  margin:.2rem 0 .32rem 1.08rem;
  padding-left:.5rem;
  border-left:1px solid #dbe4ec;
}
.ahis-sub-link.depth-1,
.ahis-group-wrap.depth-1 > .ahis-group-btn{ margin-left:.34rem; }
.ahis-sub-link.depth-2,
.ahis-group-wrap.depth-2 > .ahis-group-btn{ margin-left:.72rem; }
.ahis-sub-link.depth-3,
.ahis-group-wrap.depth-3 > .ahis-group-btn{ margin-left:1rem; }
.ahis-sub-link.depth-4,
.ahis-group-wrap.depth-4 > .ahis-group-btn{ margin-left:1.28rem; }

.ahis-main{
  flex:1;
  margin-left:var(--ahis-sidebar-w);
  min-width:0;
}
.ahis-container{
  padding:1.15rem 1rem 1.8rem;
}
.ahis-page{ width:100%; }
.ahis-surface{
  background:transparent;
  border:0;
  border-radius:0;
  box-shadow:none;
  padding:0;
}

.page-header,
.ahis-page-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:var(--ahis-space-5);
  background:
    linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(249,251,252,.96) 100%);
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius-lg);
  padding:1.25rem 1.35rem;
  margin-bottom:1rem;
  box-shadow:var(--ahis-shadow-sm);
  position:relative;
  overflow:hidden;
}
.page-header::before,
.ahis-page-header::before{
  content:"";
  position:absolute;
  inset:auto -2rem -3rem auto;
  width:220px;
  height:220px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(37, 92, 69, .10) 0%, rgba(37, 92, 69, 0) 68%);
  pointer-events:none;
}
.page-header h1,
.ahis-page-header h1{
  font-size:var(--ahis-h1);
  font-weight:750;
  margin:0 0 .22rem;
}
.page-header > div,
.ahis-page-header > div{
  position:relative;
  z-index:1;
}
.ahis-page-header__content{
  flex:1;
  min-width:0;
}
.ahis-page-header__actions,
.ahis-actions-bar__actions,
.ahis-filter-card__actions{
  display:flex;
  gap:.75rem;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
}
.page-header .text-muted,
.ahis-page-header .subtitle{
  color:var(--ahis-text-muted)!important;
}
.ahis-breadcrumb,
.page-header .small.text-muted{
  font-size:.76rem;
  color:var(--ahis-text-muted);
  text-transform:uppercase;
  letter-spacing:.14em;
  font-weight:700;
}

.page-form-limit{
  max-width:1280px;
}

.section-card,
.ahis-card,
.card{
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius);
  background:linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(251,252,253,.98) 100%);
  box-shadow:var(--ahis-shadow-sm);
}
.section-card > .card-header,
.ahis-card-header,
.card-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:1rem;
  padding:1rem 1.15rem;
  border-bottom:1px solid var(--ahis-border);
  background:linear-gradient(180deg, rgba(248,250,251,.94) 0%, rgba(243,246,248,.94) 100%);
  border-top-left-radius:calc(var(--ahis-radius) - 1px);
  border-top-right-radius:calc(var(--ahis-radius) - 1px);
  font-weight:650;
  color:#16334d;
}
.card-body{
  padding:1.15rem;
}
.card-footer{
  padding:1rem 1.15rem;
  border-top:1px solid var(--ahis-border);
  background:rgba(248,250,251,.8);
}

.section-title,
.card-title{
  margin:0;
  font-size:var(--ahis-h3);
  font-weight:700;
  color:#14304a;
}
.section-subtitle,
.card-subtitle{
  margin-top:.2rem;
  color:var(--ahis-text-muted);
  font-size:.9rem;
}

.ahis-stack{
  display:grid;
  gap:1rem;
}
.card-soft{
  background:var(--ahis-surface-soft);
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius);
}
.actions-bar,
.ahis-actions-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.85rem;
  flex-wrap:wrap;
  margin-bottom:1rem;
  padding:1rem 1.15rem;
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius);
  background:rgba(255,255,255,.92);
  box-shadow:var(--ahis-shadow-xs);
}
.filter-card{
  margin-bottom:1rem;
}
.filter-card .card-body{
  padding:1.1rem 1.15rem 1rem;
}
.ahis-filter-card .card-header{
  align-items:center;
}
.filter-card .form-label{
  margin-bottom:.45rem;
}
.filter-card .btn{
  min-width:120px;
}
.active-filter-list{
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  margin-top:.9rem;
}

.kpi-grid{
  display:grid;
  grid-template-columns:repeat(12, minmax(0, 1fr));
  gap:1rem;
}
.kpi-grid > *{ grid-column:span 12; }
.kpi-card{
  position:relative;
  overflow:hidden;
  min-height:100%;
}
.kpi-card .card-body{
  padding:1.15rem 1.2rem;
}
.kpi-card::after{
  content:"";
  position:absolute;
  inset:0 auto auto 0;
  width:100%;
  height:4px;
  background:linear-gradient(90deg, var(--ahis-primary) 0%, rgba(37, 92, 69, .28) 100%);
}
.kpi-title{
  margin-bottom:.35rem;
  color:var(--ahis-text-muted);
  font-size:.76rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.12em;
}
.kpi-value{
  font-size:clamp(1.8rem, 1.25rem + 1.1vw, 2.65rem);
  line-height:1.05;
  font-weight:780;
  color:#10293f;
}
.kpi-help{
  margin-top:.45rem;
  color:var(--ahis-text-soft);
  font-size:.88rem;
}
.kpi-box{
  height:100%;
  padding:1rem 1.05rem;
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius);
  background:linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,250,251,.98) 100%);
  box-shadow:var(--ahis-shadow-xs);
  text-align:center;
}
.kpi-box .kpi-value{
  font-size:1.7rem;
}
.kpi-label{
  margin-top:.35rem;
  color:var(--ahis-text-soft);
  font-weight:700;
  font-size:.92rem;
}
.kpi-icon{
  position:absolute;
  right:1rem;
  top:1rem;
  font-size:1.3rem;
  opacity:.18;
}
.kpi-teal::after{ background:linear-gradient(90deg, #2a6b73 0%, rgba(42,107,115,.28) 100%); }
.kpi-green::after{ background:linear-gradient(90deg, #2d6d4f 0%, rgba(45,109,79,.28) 100%); }
.kpi-amber::after{ background:linear-gradient(90deg, #a97212 0%, rgba(169,114,18,.28) 100%); }
.kpi-info::after{ background:linear-gradient(90deg, #2d617c 0%, rgba(45,97,124,.28) 100%); }
.kpi-red::after{ background:linear-gradient(90deg, #b2483c 0%, rgba(178,72,60,.28) 100%); }
.kpi-green-dark::after{ background:linear-gradient(90deg, #1d4736 0%, rgba(29,71,54,.28) 100%); }
.kpi-gray::after{ background:linear-gradient(90deg, #6b7b8c 0%, rgba(107,123,140,.28) 100%); }
.kpi-slate::after{ background:linear-gradient(90deg, #51667c 0%, rgba(81,102,124,.28) 100%); }
.kpi-amber-dark::after{ background:linear-gradient(90deg, #8e5f10 0%, rgba(142,95,16,.28) 100%); }
.kpi-teal-dark::after{ background:linear-gradient(90deg, #275660 0%, rgba(39,86,96,.28) 100%); }
.kpi-dark::after{ background:linear-gradient(90deg, #223548 0%, rgba(34,53,72,.28) 100%); }
.kpi-tricolor::after{
  background:linear-gradient(90deg, var(--ahis-success) 0%, var(--ahis-warning) 52%, var(--ahis-danger) 100%);
}

.chart-card .card-header,
.data-table-wrapper .card-header,
.activity-card .card-header{
  padding-bottom:.85rem;
}
.chart-wrap{
  min-height:300px;
  position:relative;
}
.chart-meta{
  font-size:.84rem;
  color:var(--ahis-text-muted);
}

.metric-chip,
.badge-status,
.badge{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.34rem .72rem;
  border-radius:999px;
  border:1px solid transparent;
  font-size:.79rem;
  font-weight:700;
  letter-spacing:.01em;
}
.metric-chip{
  background:var(--ahis-secondary-soft);
  color:#425a71;
  border-color:#d6e0e9;
}
.badge-status.status-success,
.badge.text-bg-success{
  background:var(--ahis-success-soft);
  color:var(--ahis-success);
  border-color:#cbe7d7;
}
.badge-status.status-warning,
.badge.text-bg-warning{
  background:var(--ahis-warning-soft);
  color:#7e5610;
  border-color:#f4d896;
}
.badge-status.status-danger,
.badge.text-bg-danger{
  background:var(--ahis-danger-soft);
  color:var(--ahis-danger);
  border-color:#f0c7c1;
}
.badge-status.status-info,
.badge.text-bg-info{
  background:var(--ahis-info-soft);
  color:var(--ahis-info);
  border-color:#cadde7;
}
.badge.text-bg-secondary,
.badge.text-bg-light{
  background:var(--ahis-secondary-soft);
  color:#4e6278;
  border-color:#d7e0e8;
}

.form-label{
  color:#203850;
  font-weight:650;
  font-size:.92rem;
}
.form-help,
.form-text,
.helptext{
  font-size:.82rem;
  color:var(--ahis-text-muted);
  margin-top:.35rem;
}
.ahis-form-grid{
  display:grid;
  grid-template-columns:repeat(12, minmax(0, 1fr));
  gap:1rem;
}
.ahis-form-field{
  grid-column:span 12;
}
.ahis-form-field--full{
  grid-column:1 / -1;
}
.ahis-form-summary{
  margin-bottom:1rem;
  padding:1rem 1.1rem;
  border:1px solid #f0c9c2;
  border-radius:var(--ahis-radius);
  background:#fff4f2;
  color:#7d2f27;
}
.ahis-form-summary-title{
  font-weight:750;
  margin-bottom:.4rem;
}
.ahis-form-section{
  margin-bottom:1rem;
}
.ahis-form-actions,
.sticky-actions,
.form-actions-footer{
  position:sticky;
  bottom:0;
  z-index:20;
  display:flex;
  justify-content:flex-end;
  gap:.75rem;
  flex-wrap:wrap;
  margin-top:1rem;
  padding:.95rem 1rem;
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius);
  background:rgba(255,255,255,.95);
  box-shadow:0 -4px 20px rgba(15,23,42,.06);
  backdrop-filter:blur(10px);
}

.form-control,
.form-select,
textarea,
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"]{
  min-height:calc(1.5em + .95rem + 2px);
  border:1px solid var(--ahis-border-strong);
  border-radius:12px;
  color:var(--ahis-text);
  background:#fff;
  padding:.52rem .78rem;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8);
}
textarea.form-control,
textarea{
  min-height:120px;
}
.form-control::placeholder,
.form-select::placeholder{
  color:#93a0ad;
}
.form-control:focus,
.form-select:focus,
textarea:focus,
select:focus,
input:focus{
  border-color:#7fa5b4;
  box-shadow:0 0 0 .24rem rgba(45, 97, 124, .14);
}
.form-check{
  display:flex;
  align-items:flex-start;
  gap:.7rem;
  padding:.85rem 1rem;
  border:1px solid var(--ahis-border);
  border-radius:14px;
  background:var(--ahis-surface-soft);
}
.form-check-input{
  margin-top:.15rem;
}
.form-check-label{
  color:var(--ahis-text);
  font-weight:600;
}
.text-danger,
.field-error{
  color:#9d3d35!important;
}
.invalid-feedback{
  display:block;
  font-size:.82rem;
}

.upload-card{
  display:flex;
  align-items:center;
  gap:1rem;
  padding:1rem;
  border:1px dashed var(--ahis-border-strong);
  border-radius:var(--ahis-radius);
  background:var(--ahis-surface-soft);
}
.upload-card-current{
  font-size:.88rem;
  color:var(--ahis-text-soft);
}

.theme-preview{
  padding:1rem;
  border:1px solid var(--ahis-border);
  border-radius:14px;
  background:linear-gradient(180deg, #fbfcfd 0%, #f5f8fa 100%);
}
.theme-preview-accent{
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  padding:.35rem .7rem;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.06);
  font-size:.8rem;
  font-weight:700;
}
.theme-preview-surface{
  min-height:88px;
  margin-top:.75rem;
  padding:.85rem;
  border:1px solid rgba(0,0,0,.08);
  border-radius:12px;
}
.builder-side-panel{
  padding:1rem;
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius);
  background:var(--ahis-surface-soft);
}
.bi-map-wrap{
  height:240px;
  border:1px solid var(--ahis-border);
  border-radius:14px;
  overflow:hidden;
}
.bi-preview-card{
  height:100%;
}
.bi-preview-empty,
.bi-map-empty{
  color:var(--ahis-text-muted);
  font-size:.88rem;
}
.code-block{
  display:block;
  padding:.85rem 1rem;
  border:1px solid var(--ahis-border);
  border-radius:12px;
  background:#f6f8fa;
  color:#19314a;
  white-space:pre-wrap;
  word-break:break-word;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.45rem;
  min-height:42px;
  padding:.58rem .95rem;
  border-radius:12px;
  font-weight:650;
  border:1px solid transparent;
  box-shadow:none;
  transition:background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.btn:hover{
  transform:translateY(-1px);
}
.btn-sm{
  min-height:34px;
  padding:.42rem .72rem;
  font-size:.875rem;
}
.btn-primary,
.btn-success{
  background:var(--ahis-primary);
  border-color:var(--ahis-primary);
  color:#fff;
}
.btn-primary:hover,
.btn-success:hover{
  background:var(--ahis-primary-dark);
  border-color:var(--ahis-primary-dark);
  color:#fff;
}
.btn-secondary{
  background:#eef3f6;
  border-color:#d6e0e7;
  color:#244258;
}
.btn-outline-primary{
  color:var(--ahis-primary);
  border-color:#a9c5b8;
  background:#fff;
}
.btn-outline-secondary{
  color:#485d72;
  border-color:#cad5df;
  background:#fff;
}
.btn-outline-danger{
  color:var(--ahis-danger);
  border-color:#dfb2ac;
  background:#fff;
}
.btn-danger{
  background:var(--ahis-danger);
  border-color:var(--ahis-danger);
  color:#fff;
}
.btn-link{
  color:var(--ahis-info);
}

.input-group{
  display:flex;
  width:100%;
}
.input-group > .form-control,
.input-group > .form-select{
  flex:1 1 auto;
}
.input-group > .input-group-text{
  border:1px solid var(--ahis-border-strong);
  border-right:0;
  border-radius:12px 0 0 12px;
  background:var(--ahis-surface-soft);
}
.input-group > .btn{
  border-top-left-radius:0;
  border-bottom-left-radius:0;
}

.btn-group{ display:inline-flex; }

.btn-close{
  width:2rem;
  height:2rem;
  border:0;
  border-radius:999px;
  background:rgba(98, 116, 139, .08);
  color:#5b6f84;
  position:relative;
}
.btn-close::before,
.btn-close::after{
  content:"";
  position:absolute;
  top:50%;
  left:50%;
  width:1rem;
  height:2px;
  background:currentColor;
}
.btn-close::before{ transform:translate(-50%, -50%) rotate(45deg); }
.btn-close::after{ transform:translate(-50%, -50%) rotate(-45deg); }

.alert,
.ahis-message{
  border:1px solid transparent;
  border-radius:14px;
  padding:.95rem 1rem;
  margin-bottom:.8rem;
  box-shadow:var(--ahis-shadow-xs);
}
.ahis-message{
  display:flex;
  gap:.85rem;
  align-items:flex-start;
}
.ahis-message__icon{
  width:2rem;
  height:2rem;
  flex:0 0 2rem;
  border-radius:999px;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.5);
}
.ahis-message__content{
  flex:1;
}
.alert-success{ background:var(--ahis-success-soft); border-color:#cae5d4; color:var(--ahis-success); }
.alert-error,
.alert-danger{ background:var(--ahis-danger-soft); border-color:#efc3bc; color:#8f3228; }
.alert-warning{ background:var(--ahis-warning-soft); border-color:#f0d18a; color:#7c550b; }
.alert-info{ background:var(--ahis-info-soft); border-color:#cadde7; color:#25526a; }

.data-table-wrapper,
.table-responsive{
  border-radius:14px;
}
.ahis-table-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  flex-wrap:wrap;
}
.ahis-table-search-wrap{
  max-width:280px;
}
.ahis-table-toolbar__meta{
  display:flex;
  gap:.75rem;
  align-items:center;
  flex-wrap:wrap;
}
.ahis-table-pagesize{
  width:90px;
}
.table-responsive{
  overflow:auto;
}
.table{
  width:100%;
  margin-bottom:0;
  border-collapse:separate;
  border-spacing:0;
  font-size:.92rem;
}
.table thead th{
  position:relative;
  background:linear-gradient(180deg, #f7f9fb 0%, #edf2f6 100%);
  color:#385067;
  border-bottom:1px solid var(--ahis-border-strong);
  padding:.9rem .9rem;
  font-size:.74rem;
  text-transform:uppercase;
  letter-spacing:.12em;
  font-weight:800;
  white-space:nowrap;
}
.table td{
  vertical-align:middle;
  padding:.9rem .9rem;
  border-bottom:1px solid #ebf0f4;
  color:#19314a;
  background:rgba(255,255,255,.94);
}
.table tbody tr:nth-child(even) td{
  background:rgba(248,250,251,.94);
}
.table tbody tr:hover td{
  background:#f3f7f5;
}
.table tfoot td,
.table .table-total td{
  background:#eef3f6;
  font-weight:700;
}
.table .num,
.col-num,
td.num,
th.num{
  text-align:right;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
.table-sticky thead th{
  position:sticky;
  top:0;
  z-index:2;
}

.menu-builder-table .menu-builder-section-row td{
  background:#eef3f9;
  color:#31435f;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
  font-size:.75rem;
}
.menu-tree-label{
  display:inline-flex;
  align-items:center;
  gap:.28rem;
  font-weight:560;
}
.menu-tree-label.depth-0{ padding-left:.15rem; }
.menu-tree-label.depth-1{ padding-left:1rem; }
.menu-tree-label.depth-2{ padding-left:2rem; }
.menu-tree-label.depth-3{ padding-left:3rem; }
.menu-tree-label.depth-4{ padding-left:4rem; }
.menu-tree-arrow{
  color:#627188;
  font-size:.8rem;
}

.modal-dialog{
  width:min(100%, 560px);
}
.modal-lg{ width:min(100%, 900px); }
.modal-dialog-centered{
  min-height:calc(100% - 3rem);
}
.modal-dialog-scrollable .modal-content{
  max-height:calc(100vh - 3rem);
}
.modal-dialog-scrollable .modal-body{
  overflow:auto;
}
.modal-content{
  background:#fff;
  border:1px solid var(--ahis-border);
  border-radius:20px;
  box-shadow:0 24px 60px rgba(15,23,42,.18);
  overflow:hidden;
}
.modal-header,
.modal-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:1rem 1.25rem;
}
.modal-header{
  border-bottom:1px solid var(--ahis-border);
  background:linear-gradient(180deg, rgba(248,250,251,.98) 0%, rgba(243,246,248,.98) 100%);
}
.modal-title{
  font-size:1.1rem;
  font-weight:750;
}
.modal-footer{
  border-top:1px solid var(--ahis-border);
  justify-content:flex-end;
  background:rgba(248,250,251,.85);
}
.modal-body{ padding:1.25rem; }
.modal-backdrop.show{
  opacity:.45;
}

.nav{
  display:flex;
  gap:.5rem;
  padding-left:0;
  list-style:none;
}
.nav-tabs,
.pbi-tabs{
  gap:.55rem;
  border-bottom:0;
  padding:.2rem;
  border-radius:18px;
  background:rgba(242,245,247,.88);
  overflow:auto;
  flex-wrap:nowrap;
}
.nav-tabs .nav-link,
.pbi-tabs .nav-link{
  border:1px solid transparent;
  border-radius:14px;
  background:transparent;
  color:var(--ahis-text-soft);
  padding:.7rem 1rem;
  font-weight:700;
  white-space:nowrap;
}
.nav-tabs .nav-link.active,
.pbi-tabs .nav-link.active{
  color:#fff;
  background:linear-gradient(135deg, var(--ahis-primary) 0%, #1f4d75 100%);
  border-color:transparent;
  box-shadow:0 10px 18px rgba(37,92,69,.18);
}
.tab-content > .tab-pane{ display:none; }
.tab-content > .active{ display:block; }

.empty-state{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:.45rem;
  min-height:150px;
  padding:1.25rem;
  border:1px dashed #c9d4dd;
  background:linear-gradient(180deg, #fbfcfd 0%, #f6f8fa 100%);
  border-radius:16px;
  color:var(--ahis-text-soft);
}
.empty-state-icon{
  width:3rem;
  height:3rem;
  border-radius:999px;
  display:grid;
  place-items:center;
  background:rgba(237,242,247,.9);
}
.empty-state i{
  font-size:1.4rem;
  color:#8ca0b2;
}
.empty-state-title{
  font-weight:750;
  color:#19314a;
}
.empty-state-subtitle{
  max-width:30rem;
  font-size:.9rem;
  color:var(--ahis-text-muted);
}

.activity-card{
  border-left:4px solid #d5dfe7;
}
.activity-item{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:.85rem;
  padding:.85rem 0;
}
.activity-item + .activity-item{
  border-top:1px solid #e8edf1;
}
.activity-marker{
  width:12px;
  height:12px;
  margin-top:.35rem;
  border-radius:50%;
  background:var(--ahis-primary);
  box-shadow:0 0 0 5px rgba(37,92,69,.12);
}

.progress-thin{ height:.55rem; }
.progress{
  background:#edf2f4;
  border-radius:999px;
}
.progress-bar{
  background:linear-gradient(90deg, var(--ahis-primary) 0%, #2d617c 100%);
}

.dash-head{
  border:1px solid var(--ahis-border);
  border-radius:var(--ahis-radius-lg);
  background:linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(248,250,251,.96) 100%);
  padding:1.15rem 1.25rem;
  margin-bottom:1rem;
  box-shadow:var(--ahis-shadow-sm);
}
.print-actions{
  display:flex;
  justify-content:flex-end;
  gap:.5rem;
  margin-bottom:.5rem;
}
.print-header{
  display:none;
  align-items:center;
  justify-content:space-between;
  margin-bottom:.75rem;
}
.print-header .title{
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.print-header .subtitle{
  font-size:.85rem;
  text-transform:uppercase;
}
.print-title{
  font-weight:800;
  text-align:center;
  margin:.4rem 0 .6rem;
}
.print-flag{
  height:20px;
  width:auto;
  border-radius:2px;
  border:1px solid #ddd;
}
.print-footer{
  display:none;
  margin-top:.75rem;
  font-size:.85rem;
}
.print-sign{
  margin-top:.75rem;
  display:flex;
  justify-content:space-between;
}
.page-number::before{
  content:"Page " counter(page) " / " counter(pages);
}

.box-title{
  margin:0 0 .85rem;
  font-weight:760;
  font-size:1.05rem;
  color:#17334d;
}
.portal-hero{
  display:grid;
  gap:1rem;
}
.portal-hero__eyebrow{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  width:max-content;
  padding:.45rem .8rem;
  border-radius:999px;
  background:var(--ahis-primary-soft);
  color:var(--ahis-primary-dark);
  font-weight:700;
  font-size:.8rem;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.portal-hero__title{
  margin:0;
  font-size:clamp(1.6rem, 1.15rem + 1vw, 2.2rem);
  font-weight:800;
}
.portal-hero__text{
  margin:0;
  color:var(--ahis-text-soft);
  max-width:48rem;
}
.portal-hero__grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:1rem;
}
.portal-metric{
  padding:1rem;
  border:1px solid var(--ahis-border);
  border-radius:16px;
  background:linear-gradient(180deg, #fff 0%, #f8fafb 100%);
}
.portal-metric__label{
  font-size:.76rem;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--ahis-text-muted);
}
.portal-metric__value{
  margin-top:.45rem;
  font-weight:800;
  color:var(--ahis-text);
}
.portal-theme-card{
  display:grid;
  gap:1rem;
}
.portal-theme-card__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
}
.portal-theme-card__label{
  color:var(--ahis-text-muted);
  font-weight:700;
}
.portal-theme-card__preview{
  min-height:140px;
  border-radius:18px;
  border:1px solid var(--ahis-border);
  background:
    radial-gradient(circle at 22% 20%, rgba(37,92,69,.18), transparent 30%),
    radial-gradient(circle at 82% 65%, rgba(45,97,124,.16), transparent 34%),
    linear-gradient(180deg, #f8fbfc 0%, #eef3f6 100%);
}
.empty-table-state{
  padding:1.25rem .5rem;
  text-align:center;
  color:var(--ahis-text-muted);
}
.subtle{
  color:var(--ahis-text-muted);
  font-size:.92rem;
}
.slicer-card{
  border:1px solid var(--ahis-border);
  background:#fff;
  padding:1rem;
  border-radius:var(--ahis-radius);
  box-shadow:var(--ahis-shadow-xs);
}
.tbl-darkhead thead th{
  background:linear-gradient(180deg, #f6f8fb 0%, #edf2f6 100%)!important;
  color:#385067!important;
}
.tbl-compact td,
.tbl-compact th{
  padding:.5rem .6rem;
}
.rate-badge{
  display:inline-flex;
  justify-content:flex-end;
  min-width:72px;
  padding:.22rem .48rem;
  border-radius:999px;
  font-weight:700;
  text-align:right;
}
.rate-red{
  background:#fde7e3;
  color:#96392f;
}
.rate-green{
  background:#e4f4ec;
  color:#286746;
}
.rate-neutral{
  background:#eef3f6;
  color:#476073;
}
.mini-bar{
  height:14px;
  background:#e5eaf0;
  border-radius:999px;
  overflow:hidden;
  border:1px solid #d6dee7;
}
.mini-bar > div{
  height:100%;
  background:#2d617c;
  width:0%;
}
.mini-bar.green > div{ background:#28724c; }
.mini-bar.orange > div{ background:#a97212; }
.mini-bar.red > div{ background:#b2483c; }
.badge-warn{
  display:inline-flex;
  align-items:center;
  padding:.28rem .56rem;
  border-radius:999px;
  background:var(--ahis-warning-soft);
  border:1px solid #f3d698;
  color:#7a530f;
  font-weight:700;
}

.sero-accent{ border-left:4px solid var(--ahis-primary); }
.badge-result-negatif{
  background:var(--ahis-success-soft);
  color:var(--ahis-success);
}
.badge-result-positif{
  background:var(--ahis-danger-soft);
  color:var(--ahis-danger);
}
.badge-result-douteux{
  background:var(--ahis-warning-soft);
  color:#7a530f;
}

@media (min-width: 768px){
  .ahis-form-field{ grid-column:span 6; }
  .kpi-grid > *{ grid-column:span 6; }
}

@media (min-width: 1200px){
  .kpi-grid > *{ grid-column:span 4; }
}

@media (max-width: 991.98px){
  .ahis-sidebar{
    transform:translateX(-100%);
    transition:transform .2s ease;
    box-shadow:0 20px 40px rgba(15,23,42,.18);
  }
  .ahis-sidebar.open{ transform:translateX(0); }
  .ahis-main{ margin-left:0; }
  body.ahis-sidebar-open::before{
    content:"";
    position:fixed;
    inset:var(--ahis-topbar-h) 0 0 0;
    background:rgba(15,23,42,.45);
    z-index:1025;
  }
  .page-header,
  .ahis-page-header,
  .actions-bar,
  .ahis-actions-bar{
    flex-direction:column;
    align-items:stretch;
  }
  .ahis-page-header__actions,
  .ahis-actions-bar__actions,
  .ahis-filter-card__actions{
    justify-content:flex-start;
  }
  .filter-card .btn{
    min-width:0;
  }
  .portal-hero__grid{
    grid-template-columns:1fr;
  }
}

@media (max-width: 767.98px){
  .ahis-container{
    padding:.85rem .75rem 1.25rem;
  }
  .page-header,
  .ahis-page-header{
    padding:1rem;
    border-radius:18px;
  }
  .card-body,
  .card-header,
  .card-footer{
    padding-right:1rem;
    padding-left:1rem;
  }
  .btn,
  .btn-sm{
    width:100%;
  }
  .ahis-table-search-wrap{
    max-width:none;
    width:100%;
  }
  .btn-group,
  .d-flex.gap-2,
  .d-flex.gap-3{
    width:100%;
    flex-wrap:wrap;
  }
  .nav-tabs,
  .pbi-tabs{
    padding:.3rem;
  }
  .table thead th,
  .table td{
    padding:.72rem .7rem;
  }
  .ahis-form-actions,
  .sticky-actions,
  .form-actions-footer{
    position:static;
  }
}

@media print{
  body *{ visibility:hidden!important; }
  .print-area,
  .print-area *{ visibility:visible!important; }
  .print-area{
    position:absolute;
    left:0;
    top:0;
    width:100%;
    border:none!important;
    box-shadow:none!important;
  }
  body{
    background:#fff!important;
  }
  .table{ font-size:.8rem; }
  .print-header{ display:flex; }
  .print-title{ display:block; }
  .print-footer{ display:block; }
  body{ counter-reset:page; }
  table{ page-break-inside:auto; }
  tr{ page-break-inside:avoid; page-break-after:auto; }
  thead{ display:table-header-group; }
  tfoot{ display:table-footer-group; }
  @page{ size:A4 landscape; margin:12mm; }
}
