:root {
  --ah-app-bg: #f5f7fb;
  --ah-app-surface: #ffffff;
  --ah-app-text: #1f2937;
  --ah-app-muted: #667085;
  --ah-app-primary: #1d3557;
  --ah-app-primary-2: #2f6fed;
  --ah-app-border: #dfe5ef;
  --ah-app-shadow: 0 10px 28px rgba(16, 24, 40, 0.12);
  --ah-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--ah-app-bg);
  color: var(--ah-app-text);
  -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

input,
select,
textarea,
.form-control,
.btn {
  min-height: 42px;
}

.table-responsive,
#stu-table-outer,
.card-body {
  max-width: 100%;
}

table {
  max-width: 100%;
}

img,
video,
canvas {
  max-width: 100%;
}

.ah-install-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ah-app-primary), var(--ah-app-primary-2));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(47, 111, 237, 0.22);
  cursor: pointer;
  white-space: nowrap;
}

.ah-install-btn:hover,
.ah-install-btn:focus {
  color: #fff;
  text-decoration: none;
  filter: brightness(1.04);
}

.ah-install-btn.is-visible {
  display: inline-flex;
}

.ah-install-btn i {
  font-size: 14px;
}

.ah-install-banner {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + var(--ah-safe-bottom));
  z-index: 2147483000;
  display: none;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--ah-app-shadow);
  backdrop-filter: blur(12px);
}

.ah-install-banner.is-visible {
  display: flex;
}

.ah-install-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  object-position: center;
  padding: 4px;
  flex: 0 0 auto;
  background: #eef3fb;
}

.ah-install-copy {
  min-width: 0;
  flex: 1;
}

.ah-install-title {
  margin: 0 0 2px;
  color: var(--ah-app-text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.ah-install-text {
  margin: 0;
  color: var(--ah-app-muted);
  font-size: 12px;
  line-height: 1.35;
}

.ah-install-progress {
  display: none;
  margin-top: 8px;
}

.ah-install-banner.is-preparing .ah-install-progress {
  display: block;
}

.ah-install-progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.ah-install-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ah-app-primary), var(--ah-app-primary-2));
  transition: width 0.18s ease;
}

.ah-install-progress-label {
  display: block;
  margin-top: 4px;
  color: var(--ah-app-muted);
  font-size: 11px;
  font-weight: 700;
}

.ah-install-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.ah-install-now,
.ah-install-close {
  min-height: 36px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ah-install-now {
  border: 0;
  padding: 8px 12px;
  background: var(--ah-app-primary);
  color: #fff;
}

.ah-install-now[disabled] {
  opacity: 0.72;
  cursor: wait;
}

.ah-install-close {
  width: 36px;
  border: 1px solid var(--ah-app-border);
  background: #fff;
  color: var(--ah-app-muted);
}

.ah-ios-help {
  position: fixed;
  inset: auto 14px calc(14px + var(--ah-safe-bottom)) 14px;
  z-index: 2147483000;
  display: none;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--ah-app-shadow);
  color: var(--ah-app-text);
  font-size: 13px;
  line-height: 1.5;
}

.ah-ios-help.is-visible {
  display: block;
}

.ah-ios-help button {
  float: right;
  min-height: 32px;
  border: 1px solid var(--ah-app-border);
  border-radius: 8px;
  background: #fff;
  color: var(--ah-app-muted);
  font-weight: 700;
}

@media (display-mode: standalone) {
  .ah-install-btn,
  .ah-install-banner {
    display: none !important;
  }
}

@media (max-width: 767px) {
  body {
    padding-bottom: var(--ah-safe-bottom);
  }

  .content-body,
  main,
  section[role="main"] {
    overflow-x: hidden;
  }

  .card,
  .panel,
  .modal-content {
    border-radius: 8px !important;
  }

  .card-body {
    padding: 12px !important;
  }

  .table-responsive,
  #stu-table-outer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table,
  #datatable-tabletools {
    min-width: 720px;
  }

  .site-navbar,
  .header {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .ah-install-banner {
    align-items: flex-start;
  }

  .ah-install-actions {
    flex-direction: column;
  }

  .ah-install-btn span {
    display: none;
  }
}
