/* aegis-admin uses the FraxionSM teal/navy palette to read as part of the same
   product family as genesis-admin. The brand element (.aegis-brand*) keeps its own
   hardcoded colors because the SVG icon and wordmark were designed together. */

:root {
  --gx-teal: #008897;
  --gx-teal-dark: #006d7a;
  --gx-teal-light: #03C3D8;
  --gx-navy: #383E54;
  --gx-navy-dark: #2c3142;
  --gx-success: #0B9E00;
  --gx-error: #C33;
  --gx-warning: #FE9B2B;
  --gx-info: #0262AD;
  --gx-bg: #F5F5F5;
  --gx-border: #E7E7E7;
  --gx-text: #383E54;
  --gx-text-muted: #A7A7A7;
  --gx-sidebar-width: 240px;
  --gx-header-height: 76px;
  --bs-primary: var(--gx-teal);
  --bs-primary-rgb: 0, 136, 151;
  --bs-link-color: var(--gx-teal);
  --bs-link-hover-color: var(--gx-teal-dark);
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--gx-bg) !important;
  font-family: -apple-system, "Segoe UI", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif !important;
  color: var(--gx-text);
  font-size: 14px;
  display: flex;
  flex-direction: column;
}

.app-shell {
  display: flex;
  flex: 1;
  min-height: 100vh;
}

aside.app-sidebar {
  width: var(--gx-sidebar-width);
  background: var(--gx-navy-dark) !important;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  background: #fff;
  border-bottom: 1px solid var(--gx-border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: var(--gx-header-height);
  box-sizing: border-box;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
  list-style: none;
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: rgba(255, 255, 255, 0.85) !important;
  text-decoration: none !important;
  padding: 0.55rem 1.5rem;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff !important;
}
.sidebar-link.active {
  background: rgba(0, 136, 151, 0.18);
  color: var(--gx-teal-light) !important;
  border-left-color: var(--gx-teal);
}

.sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar-icon svg { display: block; }

.sidebar-toggle {
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gx-text-muted);
  padding: 1rem 1.5rem 0.5rem;
  cursor: pointer;
}
.sidebar-toggle .sidebar-label { flex: 1 1 auto; }
.sidebar-toggle:hover { color: rgba(255, 255, 255, 0.75); }
.sidebar-toggle.active { color: var(--gx-teal-light); }
.sidebar-toggle::after {
  content: "▾";
  margin-left: auto;
  font-size: 12px;
  opacity: 0.6;
}
.sidebar-toggle[aria-expanded="false"]::after { content: "▸"; }

.sidebar-group {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-group.is-collapsed { display: none; }

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.5rem;
  color: rgba(255, 255, 255, 0.85) !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar-sublink:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff !important;
}
.sidebar-sublink.active {
  background: rgba(0, 136, 151, 0.18);
  color: var(--gx-teal-light) !important;
  border-left-color: var(--gx-teal);
}

.app-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

header.app-header {
  height: var(--gx-header-height);
  background: #fff;
  border-bottom: 1px solid var(--gx-border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}
header.app-header .nav-link,
header.app-header .navbar-text,
header.app-header a {
  color: var(--gx-navy) !important;
  text-decoration: none;
}
header.app-header .nav-link {
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
}

main.app-main {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  min-width: 0;
}

h1, h2, h3, h4, h5, h6 { color: var(--gx-navy); font-weight: 600; }
h1 { font-size: 1.5rem; margin-bottom: 1rem; }

a { color: var(--gx-teal); text-decoration: none; }
a:hover { color: var(--gx-teal-dark); }

.btn { border-radius: 0.375rem !important; font-size: 0.875rem; }
.btn-primary {
  --bs-btn-bg: var(--gx-teal);
  --bs-btn-border-color: var(--gx-teal);
  --bs-btn-hover-bg: var(--gx-teal-dark);
  --bs-btn-hover-border-color: var(--gx-teal-dark);
  --bs-btn-active-bg: var(--gx-teal-dark);
  --bs-btn-active-border-color: var(--gx-teal-dark);
  --bs-btn-disabled-bg: var(--gx-teal);
  --bs-btn-disabled-border-color: var(--gx-teal);
  background-color: var(--gx-teal) !important;
  color: #fff !important;
  border-color: var(--gx-teal) !important;
}
.btn-primary:not([disabled]):hover {
  background-color: var(--gx-teal-dark) !important;
  border-color: var(--gx-teal-dark) !important;
}
.btn-outline-primary {
  color: var(--gx-teal) !important;
  border-color: var(--gx-teal) !important;
}
.btn-outline-primary:hover {
  background-color: var(--gx-teal) !important;
  color: #fff !important;
}
.btn-outline-warning { color: #b45309 !important; border-color: #b45309 !important; }
.btn-outline-warning:hover { background-color: #b45309 !important; color: #fff !important; }
.btn-outline-success { color: #047857 !important; border-color: #047857 !important; }
.btn-outline-success:hover { background-color: #047857 !important; color: #fff !important; }
.btn-outline-danger { color: #b91c1c !important; border-color: #b91c1c !important; }
.btn-outline-danger:hover { background-color: #b91c1c !important; color: #fff !important; }
.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 136, 151, 0.25);
}

.card {
  border: 1px solid var(--gx-border);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.table {
  background: #fff;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.table thead th {
  background: #fff;
  border-bottom: 2px solid var(--gx-border);
  color: var(--gx-text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
}
.table tbody td {
  padding: 0.65rem 1rem;
  border-bottom-color: #f2e8e8;
  vertical-align: middle;
}
.table-hover tbody tr:hover { background-color: #FAFAFA; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gx-navy);
}
.form-control, .form-select {
  border-color: var(--gx-border);
  font-size: 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--gx-teal);
  box-shadow: 0 0 0 0.2rem rgba(0, 136, 151, 0.15);
}
.required-mark { color: var(--gx-error); margin-left: 0.15rem; font-weight: 700; }
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gx-text-muted);
  margin: 1.25rem 0 0.5rem;
}
.form-section-title:first-child { margin-top: 0; }
.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  border-top: 1px solid var(--gx-border);
  padding-top: 1rem;
  margin-top: 1.5rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.status-pill--active {
  background: rgba(11, 158, 0, 0.12);
  color: var(--gx-success);
  border-color: rgba(11, 158, 0, 0.25);
}
.status-pill--inactive {
  background: rgba(167, 167, 167, 0.15);
  color: var(--gx-text-muted);
  border-color: rgba(167, 167, 167, 0.35);
}

.dt-action-cell { white-space: nowrap; text-align: right; }
.dt-actions {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}
.dt-actions .btn { padding: 0.25rem 0.45rem; line-height: 1; }
.dt-actions .btn svg { display: block; }

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  color: var(--gx-navy);
  background: rgba(0, 136, 151, 0.08);
  padding: 0.1rem 0.3rem;
  border-radius: 0.2rem;
}

/* DataTables */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border-radius: 0.5rem;
  border: 1px solid var(--gx-border);
  padding: 0.375rem 0.75rem;
  line-height: 1.25;
  height: 2.25rem;
}
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
  font-weight: 600;
  color: var(--gx-navy);
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  display: flex;
  align-items: center;
}
.dataTables_wrapper .dataTables_filter { justify-content: flex-end; }
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.dataTables_wrapper .dataTables_length select {
  width: auto;
  min-width: 5.5rem;
  padding-right: 2.25rem;
}
.dataTables_wrapper .dataTables_filter input { width: 260px; }
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { padding-top: 0.5rem; }

.dt-nowrap th, .dt-nowrap td { white-space: nowrap; }
.dt-ellipsis {
  display: inline-block;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
.dt-code-nowrap {
  display: inline-block;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
table.dataTable {
  border-collapse: separate !important;
  border-spacing: 0;
  border-radius: 0.5rem;
  overflow: hidden;
}
table.dataTable thead th {
  background: #fff;
  color: var(--gx-text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--gx-border) !important;
}
table.dataTable tbody td {
  border-top: 0 !important;
  border-bottom: 1px solid #eef2f7;
}
.dataTables_wrapper .dataTables_paginate .pagination { gap: 0.25rem; }
.dataTables_wrapper .dataTables_paginate .page-link {
  border-radius: 0.5rem !important;
  color: var(--gx-teal);
}
.dataTables_wrapper .dataTables_paginate .page-link:hover { color: var(--gx-teal-dark); }
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
  background-color: var(--gx-teal);
  border-color: var(--gx-teal);
}

/* Aegis brand element — composite SVG icon + HTML wordmark */
.aegis-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none !important;
}

.aegis-brand__icon {
  width: 48px;
  height: 48px;
  background: #1f2a44;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aegis-brand__icon svg { width: 32px; height: 32px; display: block; }

.aegis-brand__wordmark {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

.aegis-brand__title {
  font-size: 1.4rem;
  font-weight: 700;
  font-style: italic;
  color: #1f2a44 !important;
  letter-spacing: -0.01em;
}

.aegis-brand__x { color: #0EA5C0 !important; font-weight: 700; }
.aegis-brand__aegis { color: #0EA5C0 !important; font-weight: 400; font-style: italic; }

.aegis-brand__tagline {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #94a3b8;
  text-transform: uppercase;
  margin-top: 2px;
}
