:root {
  --ecs-primary: #3780a5;
  --ecs-primary-dark: #307183;
  --ecs-primary-tint: #bfd9e0;
  --ecs-surface: #ffffff;
  --ecs-surface-muted: #f7f7f7;
  --ecs-row-tint: #f1f6f8;
  --ecs-border: #c9cdd5;
  --ecs-text: #1f2933;
  --ecs-success: #449d44;
  --ecs-danger: #d9534f;
  --ecs-warning: #fae88c;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: Verdana, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ecs-text);
  background: var(--ecs-surface-muted);
}

.ecs-topbar {
  background-color: var(--ecs-primary) !important;
  border-bottom: 1px solid var(--ecs-primary-dark);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.ecs-topbar .navbar-brand {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
}

.ecs-topbar .nav-link {
  color: rgba(255, 255, 255, 0.92) !important;
  border-radius: 0.2rem;
  padding: 0.3rem 0.55rem;
}

.ecs-topbar .nav-link:hover,
.ecs-topbar .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.16);
}

.ecs-topbar .nav-link.active {
  color: #fff !important;
  background: var(--ecs-primary-dark);
}

.ecs-app {
  padding: 0.75rem 0.9rem 1rem;
}

.ecs-page-title {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 1.35rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.ecs-page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ecs-page-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.ecs-help-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.ecs-help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.ecs-inline-help-btn {
  width: 1rem;
  height: 1rem;
  border: 0;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ecs-primary-tint);
  color: var(--ecs-primary-dark);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.ecs-inline-help-btn:hover,
.ecs-inline-help-btn:focus {
  background: var(--ecs-primary);
  color: #fff;
}

.ecs-help-content {
  color: var(--ecs-text);
}

.ecs-help-summary {
  margin-bottom: 0.9rem;
}

.ecs-help-section + .ecs-help-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ecs-border);
}

.ecs-help-section-title {
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.ecs-help-list {
  padding-left: 1.1rem;
}

.ecs-help-list li + li {
  margin-top: 0.35rem;
}

.ecs-filter-bar .card-body {
  padding: 0.65rem 0.75rem;
}

.ecs-filter-bar .form-label {
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.ecs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.form-control-sm,
.form-select-sm,
.btn-sm {
  min-height: 30px;
  font-size: 0.78rem;
}

.btn-sm {
  line-height: 1.2;
}

.card.ecs-card {
  border: 1px solid var(--ecs-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.table.ecs-table {
  font-size: 0.78rem;
  margin-bottom: 0;
}

.table.ecs-table > :not(caption) > * > * {
  padding: 0.28rem 0.45rem;
  vertical-align: middle;
}

.table.ecs-table thead.table-dark th {
  background-color: var(--ecs-primary);
  border-color: var(--ecs-primary-dark);
}

.table.ecs-table.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: var(--ecs-row-tint);
}

.ecs-table-nowrap td,
.ecs-table-nowrap th {
  white-space: nowrap;
}

.ecs-table-wrap {
  border: 1px solid var(--ecs-border);
  border-radius: 0.3rem;
  background: var(--ecs-surface);
}

.ecs-sort-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0;
}

.ecs-sort-btn:hover {
  text-decoration: underline;
}

.ecs-sortable {
  cursor: pointer;
  user-select: none;
}

.ecs-kv-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.35rem 0.6rem;
}

.ecs-kv-grid .label {
  font-weight: 600;
  color: #495057;
  text-align: right;
}

.ecs-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.ecs-muted-small {
  font-size: 0.75rem;
  color: #59636e;
}

.section-title {
  margin: 0.5rem 0 0.25rem;
  font-weight: 600;
}

.ecs-truncate {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecs-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
.ecs-modal-card {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.ecs-modal-card {
  width: min(1100px, 96vw);
}

}

.ecs-modal-card .modal-header,
.ecs-modal-card .modal-footer {
  padding: 0.75rem 1rem;
  border-color: #dee2e6;
}

.ecs-modal-card .modal-body {
  padding: 1rem;
  max-height: 70vh;
  overflow: auto;
}

.ecs-status-red {
  background-color: var(--ecs-danger) !important;
  color: #fff !important;
}

.ecs-status-yellow {
  background-color: var(--ecs-warning) !important;
  color: #111 !important;
}

.ecs-status-green {
  background-color: var(--ecs-success) !important;
  color: #fff !important;
}

.badge-pill {
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
}

.badge-p1 {
  background: #dc3545;
  color: #fff;
}

.badge-p2 {
  background: #fd7e14;
  color: #000;
}

.badge-p3 {
  background: #ffc107;
  color: #000;
}

.badge-p4 {
  background: #0dcaf0;
  color: #000;
}

.badge-p5 {
  background: #6c757d;
  color: #fff;
}

@media (max-width: 600px) {
  .ecs-app {
    padding: 0.55rem;
  }

  .ecs-page-title {
    font-size: 1.2rem;
  }

  .ecs-kv-grid {
    grid-template-columns: 1fr;
  }

  .ecs-kv-grid .label {
    text-align: left;
  }

  .ecs-page-title-row {
    align-items: flex-start;
  }
}
