:root {
  --ahis-color-red: #D62828;
  --ahis-color-green: #2E7D32;
  --ahis-color-yellow: #F4C542;
  --ahis-color-offwhite: #F8F9FA;
  --ahis-color-gray-100: #F1F3F5;
  --ahis-color-gray-200: #E9ECEF;
  --ahis-color-gray-500: #6C757D;
  --ahis-color-text: #495057;
  --ahis-color-ink: #212529;
  --ahis-color-white: #FFFFFF;

  --ahis-font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ahis-font-size-xs: 0.75rem;
  --ahis-font-size-sm: 0.875rem;
  --ahis-font-size-md: 1rem;
  --ahis-font-size-lg: 1.125rem;
  --ahis-font-size-xl: 1.375rem;
  --ahis-font-size-xxl: 1.875rem;

  --ahis-line-height-tight: 1.2;
  --ahis-line-height-base: 1.5;

  --ahis-space-1: 0.25rem;
  --ahis-space-2: 0.5rem;
  --ahis-space-3: 0.75rem;
  --ahis-space-4: 1rem;
  --ahis-space-5: 1.5rem;
  --ahis-space-6: 2rem;

  --ahis-radius-sm: 0.5rem;
  --ahis-radius-md: 0.875rem;
  --ahis-radius-lg: 1.25rem;
  --ahis-radius-pill: 999px;

  --ahis-shadow-sm: 0 4px 14px rgba(33, 37, 41, 0.06);
  --ahis-shadow-md: 0 10px 24px rgba(33, 37, 41, 0.08);
  --ahis-shadow-lg: 0 18px 42px rgba(33, 37, 41, 0.12);

  --ahis-border-color: var(--ahis-color-gray-200);
  --ahis-body-bg: #F4F6F8;
  --ahis-card-bg: var(--ahis-color-white);
  --ahis-card-muted: #FBFCFD;
  --ahis-sidebar-bg: #F7F9FB;
  --ahis-sidebar-active: rgba(46, 125, 50, 0.10);
  --ahis-sidebar-hover: rgba(46, 125, 50, 0.06);
  --ahis-danger-soft: rgba(214, 40, 40, 0.10);
  --ahis-success-soft: rgba(46, 125, 50, 0.10);
  --ahis-warning-soft: rgba(244, 197, 66, 0.18);
  --ahis-info-soft: rgba(13, 110, 253, 0.10);
}

html {
  font-size: 16px;
}

body,
input,
button,
select,
textarea,
table {
  font-family: var(--ahis-font-family);
}

body {
  background: var(--ahis-body-bg);
  color: var(--ahis-color-text);
  line-height: var(--ahis-line-height-base);
}

h1,
h2,
h3,
h4,
h5,
h6,
.ahis-title {
  color: var(--ahis-color-ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: var(--ahis-line-height-tight);
}

h1,
.h1,
.page-title-xl {
  font-size: clamp(1.75rem, 1.2rem + 1.5vw, 2.4rem);
}

h2,
.h2,
.page-title-lg {
  font-size: clamp(1.4rem, 1.05rem + 0.9vw, 1.9rem);
}

h3,
.h3,
.page-title-md {
  font-size: clamp(1.15rem, 0.95rem + 0.6vw, 1.45rem);
}

.text-muted,
.ahis-muted {
  color: var(--ahis-color-text) !important;
  opacity: 0.82;
}

.card-ahis,
.panel-ahis,
.kpi-card,
.info-box,
.small-box {
  background: var(--ahis-card-bg);
  border: 1px solid var(--ahis-border-color);
  border-radius: var(--ahis-radius-lg);
  box-shadow: var(--ahis-shadow-sm);
}

.card-ahis .card-header,
.panel-ahis .card-header,
.card-ahis-header {
  background: transparent;
  border-bottom: 1px solid var(--ahis-border-color);
  padding: 1rem 1.25rem;
}

.card-ahis .card-body,
.panel-ahis .card-body {
  padding: 1.25rem;
}

.btn-ahis-primary,
.btn-ahis {
  --bs-btn-bg: var(--ahis-color-green);
  --bs-btn-border-color: var(--ahis-color-green);
  --bs-btn-hover-bg: #25662A;
  --bs-btn-hover-border-color: #25662A;
  --bs-btn-active-bg: #205824;
  --bs-btn-active-border-color: #205824;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  border-radius: var(--ahis-radius-md);
  font-weight: 700;
  min-height: 2.75rem;
  box-shadow: var(--ahis-shadow-sm);
}

.btn-ahis-secondary {
  --bs-btn-bg: var(--ahis-color-yellow);
  --bs-btn-border-color: var(--ahis-color-yellow);
  --bs-btn-hover-bg: #E4B92E;
  --bs-btn-hover-border-color: #E4B92E;
  --bs-btn-active-bg: #D5AA23;
  --bs-btn-active-border-color: #D5AA23;
  --bs-btn-color: var(--ahis-color-ink);
  --bs-btn-hover-color: var(--ahis-color-ink);
  border-radius: var(--ahis-radius-md);
  font-weight: 700;
  min-height: 2.75rem;
}

.btn-ahis-outline {
  border: 1px solid var(--ahis-border-color);
  border-radius: var(--ahis-radius-md);
  color: var(--ahis-color-ink);
  background: var(--ahis-color-white);
  font-weight: 700;
  min-height: 2.75rem;
}

.btn-ahis-danger {
  background: var(--ahis-color-red);
  border-color: var(--ahis-color-red);
  color: #fff;
  border-radius: var(--ahis-radius-md);
  font-weight: 700;
}

.form-ahis .form-control,
.form-ahis .form-select,
.form-ahis textarea,
.form-control,
.form-select {
  min-height: 2.75rem;
  border-radius: var(--ahis-radius-md);
  border-color: var(--ahis-border-color);
  color: var(--ahis-color-ink);
  box-shadow: none;
}

.form-ahis textarea,
textarea.form-control {
  min-height: 6rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--ahis-color-green);
  box-shadow: 0 0 0 0.2rem rgba(46, 125, 50, 0.12);
}

.form-label,
label {
  font-size: var(--ahis-font-size-sm);
  font-weight: 600;
  color: var(--ahis-color-ink);
}

.table-ahis,
.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: #FCFDFD;
  --bs-table-hover-bg: rgba(46, 125, 50, 0.05);
  color: var(--ahis-color-ink);
}

.table-ahis thead th,
.table thead th {
  background: var(--ahis-color-offwhite);
  color: var(--ahis-color-ink);
  font-size: 0.75rem;
  font-weight: 600;
  border-bottom-color: var(--ahis-border-color);
}

.table-ahis td,
.table-ahis th,
.table td,
.table th {
  border-color: var(--ahis-border-color);
  vertical-align: middle;
}

.badge-ahis,
.badge {
  border-radius: var(--ahis-radius-pill);
  font-weight: 600;
  padding: 0.24rem 0.56rem;
}

.badge-ahis-success {
  background: var(--ahis-success-soft);
  color: var(--ahis-color-green);
}

.badge-ahis-warning {
  background: var(--ahis-warning-soft);
  color: #7A5C00;
}

.badge-ahis-danger {
  background: var(--ahis-danger-soft);
  color: var(--ahis-color-red);
}

.badge-ahis-neutral {
  background: var(--ahis-color-gray-100);
  color: var(--ahis-color-ink);
}

.alert {
  border: 1px solid transparent;
  border-radius: var(--ahis-radius-md);
}

.alert-success {
  background: var(--ahis-success-soft);
  border-color: rgba(46, 125, 50, 0.16);
  color: #205824;
}

.alert-warning {
  background: var(--ahis-warning-soft);
  border-color: rgba(244, 197, 66, 0.36);
  color: #7A5C00;
}

.alert-danger {
  background: var(--ahis-danger-soft);
  border-color: rgba(214, 40, 40, 0.18);
  color: #9E1E1E;
}

.pagination .page-link {
  color: var(--ahis-color-green);
  border-color: var(--ahis-border-color);
  border-radius: 0.7rem;
  margin: 0 0.15rem;
}

.pagination .page-item.active .page-link {
  background: var(--ahis-color-green);
  border-color: var(--ahis-color-green);
}

.ahis-section-card {
  background: var(--ahis-card-bg);
  border: 1px solid var(--ahis-border-color);
  border-radius: var(--ahis-radius-lg);
  box-shadow: var(--ahis-shadow-sm);
  padding: 1.25rem;
}

.crud-page {
  max-width: 1200px;
  margin: 0 auto;
}

.crud-page-narrow {
  max-width: 880px;
  margin: 0 auto;
}

.crud-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.crud-title {
  margin-bottom: 0.35rem;
}

.crud-subtitle {
  margin-bottom: 0;
  color: var(--ahis-color-text);
}

.crud-toolbar,
.crud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.crud-card,
.crud-list-card,
.crud-form-card,
.crud-detail-card,
.crud-delete-card {
  background: var(--ahis-card-bg);
  border: 1px solid var(--ahis-border-color);
  border-radius: var(--ahis-radius-lg);
  box-shadow: var(--ahis-shadow-sm);
  overflow: hidden;
}

.crud-flag-bar {
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--ahis-color-red) 0 33.333%,
    var(--ahis-color-yellow) 33.333% 66.666%,
    var(--ahis-color-green) 66.666% 100%
  );
}

.crud-card-body {
  padding: 1.25rem;
}

.crud-meta-grid dt {
  color: var(--ahis-color-ink);
  font-weight: 800;
}

.crud-meta-grid dd {
  color: var(--ahis-color-text);
}

.crud-empty {
  text-align: center;
  color: var(--ahis-color-text);
  padding: 1.5rem 1rem;
}

.ahis-kpi {
  position: relative;
  overflow: hidden;
  padding: 1.1rem 1.15rem;
}

.ahis-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--ahis-color-green);
}

.ahis-kpi-title {
  color: var(--ahis-color-text);
  font-size: var(--ahis-font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ahis-kpi-value {
  color: var(--ahis-color-ink);
  font-size: clamp(1.5rem, 1.1rem + 1vw, 2.1rem);
  font-weight: 900;
}

.ahis-flag-bar {
  height: 4px;
  border-radius: var(--ahis-radius-pill);
  background: linear-gradient(
    90deg,
    var(--ahis-color-red) 0 33.333%,
    var(--ahis-color-yellow) 33.333% 66.666%,
    var(--ahis-color-green) 66.666% 100%
  );
}

.ahis-logo-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(73, 80, 87, 0.08);
  border-radius: 1rem;
  box-shadow: var(--ahis-shadow-sm);
}

.ahis-logo-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.ahis-login-shell,
.ahis-auth-surface {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--ahis-border-color);
  border-radius: 2rem;
  box-shadow: var(--ahis-shadow-lg);
}

.ahis-surface-muted {
  background: var(--ahis-card-muted);
}

@media (max-width: 991.98px) {
  .card-ahis .card-body,
  .panel-ahis .card-body,
  .ahis-section-card,
  .crud-card-body {
    padding: 1rem;
  }
}

@media (max-width: 575.98px) {
  .btn,
  .btn-ahis-primary,
  .btn-ahis-secondary,
  .btn-ahis-outline,
  .btn-ahis-danger {
    width: 100%;
  }

  .table-responsive {
    border-radius: var(--ahis-radius-md);
  }
}
