:root {
  --ams-bg: #f5f7fb;
  --ams-surface: #ffffff;
  --ams-border: #dde3ea;
  --ams-text: #172033;
  --ams-muted: #667085;
  --ams-sidebar: #171717;
  --ams-sidebar-soft: #232323;
  --ams-accent: #0f766e;
  --ams-accent-2: #2563eb;
  --ams-warning: #b7791f;
  --ams-danger: #b42318;
  --ams-radius: 8px;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  color: var(--ams-text);
  background: var(--ams-bg);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: var(--ams-sidebar);
  color: #fff;
  z-index: 1030;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 8px 10px 18px;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ams-accent);
}

.sidebar-nav {
  gap: 4px;
}

.sidebar-nav .nav-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c8d0d8;
  border-radius: 8px;
  padding: 10px 12px;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: var(--ams-sidebar-soft);
}

.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
}

.app-main {
  min-width: 0;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: var(--ams-surface);
  border-bottom: 1px solid var(--ams-border);
}

.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 700;
}

.page-kicker {
  color: var(--ams-muted);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.content {
  padding: 24px;
}

.user-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--ams-accent);
}

.user-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ams-muted);
  font-weight: 600;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, .12), rgba(37, 99, 235, .08)),
    var(--ams-bg);
}

.auth-card {
  width: min(100%, 430px);
  background: var(--ams-surface);
  border: 1px solid var(--ams-border);
  border-radius: var(--ams-radius);
  box-shadow: 0 18px 50px rgba(17, 24, 39, .12);
  padding: 28px;
}

.panel {
  background: var(--ams-surface);
  border: 1px solid var(--ams-border);
  border-radius: var(--ams-radius);
  box-shadow: 0 8px 24px rgba(17, 24, 39, .04);
}

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--ams-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-body {
  padding: 18px;
}

.metric-card {
  padding: 18px;
  min-height: 126px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.metric-value {
  margin: 12px 0 2px;
  font-size: 1.8rem;
  font-weight: 800;
}

.metric-label {
  color: var(--ams-muted);
  font-weight: 600;
}

.bg-accent {
  background: var(--ams-accent);
}

.bg-blue {
  background: var(--ams-accent-2);
}

.bg-warn {
  background: var(--ams-warning);
}

.bg-danger-ams {
  background: var(--ams-danger);
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.table > :not(caption) > * > * {
  vertical-align: middle;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.badge {
  font-weight: 700;
  border-radius: 999px;
  padding: .42rem .62rem;
}

.form-label {
  color: #344054;
  font-weight: 650;
}

.select2-container--default .select2-selection--single {
  min-height: 38px;
  border: 1px solid #dee2e6;
  border-radius: .375rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--ams-text);
  line-height: 36px;
  padding-left: .75rem;
  padding-right: 2rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
  height: 36px;
  margin-right: 24px;
}

.select2-dropdown {
  border-color: var(--ams-border);
}

.select2-search--dropdown .select2-search__field {
  border: 1px solid var(--ams-border);
  border-radius: .375rem;
  outline: none;
  padding: .375rem .5rem;
}

.required::after {
  content: " *";
  color: var(--ams-danger);
}

.timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.timeline-item {
  border: 1px solid var(--ams-border);
  border-radius: var(--ams-radius);
  padding: 12px 14px;
  background: #fff;
}

.text-muted-ams {
  color: var(--ams-muted);
}

.white-space-pre {
  white-space: pre-wrap;
}

.min-w-0 {
  min-width: 0;
}

@media (max-width: 991.98px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    left: -280px;
    width: 264px;
    transition: left .2s ease;
  }

  body.sidebar-open .app-sidebar {
    left: 0;
  }

  .topbar {
    padding: 12px 16px;
  }

  .content {
    padding: 16px;
  }
}

@media (max-width: 575.98px) {
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-actions {
    justify-content: flex-start;
  }
}
