:root {
  --bg: #071127;
  --bg2: #0d1f3c;
  --card: #12244a;
  --text: #e8f4ff;
  --muted: #9eb8d6;
  --accent: #25bdf3;
  --accent2: #66d451;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #13487f, #071127 55%);
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: linear-gradient(180deg, #0d1f41, #08152d);
  border-right: 1px solid #224675;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px #04142966);
}

.brand h1 {
  margin: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sidebar-nav-spacer {
  height: 12px;
  margin: 2px 0 4px;
  border-top: 1px solid #23406a;
  opacity: 0.9;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid #255082;
  border-radius: 12px;
  background: linear-gradient(180deg, #102854, #0d1f41);
  color: #cedbf2;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.nav-btn:hover {
  border-color: #2f88d3;
  background: linear-gradient(180deg, #123267, #102954);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px #07122c66;
}

.nav-btn.active {
  border-color: #25bdf3;
  box-shadow: inset 0 0 0 1px #25bdf36e, 0 8px 20px #08234b74;
  background: linear-gradient(180deg, #15467e, #10325f);
  color: #ecf5ff;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #74e8ff, #25bdf3);
}

.nav-btn.update-available {
  border-color: #c7962f;
  background: linear-gradient(180deg, #3e2f14, #2f240f);
  color: #ffecc4;
  box-shadow: inset 0 0 0 1px #f6c75a38, 0 8px 20px #2d1d0680;
}

.nav-btn.update-available .nav-icon {
  border-color: #d3a240;
  background: linear-gradient(180deg, #5a441a, #433312);
}

.nav-btn.update-available:hover {
  border-color: #ffd46e;
  background: linear-gradient(180deg, #523d18, #3b2d12);
}

.nav-btn.update-available::before {
  background: linear-gradient(180deg, #ffe4a3, #e0ac3e);
}

.nav-btn.admin-nav {
  border-color: #5b4da1;
  background: linear-gradient(180deg, #1c2a58, #18224a);
  color: #d8d5ff;
}

.nav-btn.admin-nav .nav-icon {
  border-color: #7060c2;
  background: linear-gradient(180deg, #2a2e66, #212854);
}

.nav-btn.admin-nav:hover {
  border-color: #8b7ce0;
  background: linear-gradient(180deg, #24316a, #1f2a5a);
}

.nav-btn.admin-nav.active {
  border-color: #b9a7ff;
  box-shadow: inset 0 0 0 1px #b9a7ff69, 0 8px 20px #1a143a8a;
  background: linear-gradient(180deg, #332d73, #27235f);
  color: #f4eeff;
}

.nav-btn.admin-nav.active::before {
  background: linear-gradient(180deg, #ddd2ff, #b9a7ff);
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px solid #2f6ab2;
  background: linear-gradient(180deg, #123468, #0f2a54);
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.profile {
  margin-top: auto;
  border-top: 1px solid #223056;
  padding-top: 14px;
  color: #d7e4fa;
}

.profile-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.profile-email {
  margin-top: 2px;
  font-size: 12px;
  color: #a6bcda;
  word-break: break-all;
}

.profile-role {
  margin-top: 4px;
}

.mode-switch-block {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #2a588d;
  border-radius: 10px;
  background: #0d2244;
}

.mode-switch-label {
  font-size: 12px;
  color: #9eb8d6;
  margin-bottom: 6px;
}

.mode-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #3170ae;
  background: #0b1a36;
}

.mode-pill {
  padding: 7px 6px;
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
  color: #9db4d1;
}

.mode-toggle.easy .mode-pill:first-child,
.mode-toggle.dba .mode-pill:last-child {
  background: linear-gradient(180deg, #165a96, #124978);
  color: #eff8ff;
  font-weight: 700;
}

.mode-switch-block small {
  display: block;
  margin-top: 6px;
  color: #9bb5d4;
  font-size: 11px;
}

.role {
  color: var(--muted);
  margin-bottom: 10px;
}

.main {
  padding: 24px;
  height: 100vh;
  overflow-y: auto;
}

.card {
  background: color-mix(in oklab, var(--card), black 8%);
  border: 1px solid #2a588d;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat strong {
  font-size: 28px;
  display: block;
}

input,
select,
textarea,
button {
  background: #0f2750;
  color: var(--text);
  border: 1px solid #2f629c;
  border-radius: 10px;
  padding: 10px;
}

.field {
  display: grid;
  gap: 4px;
}

.field label {
  font-size: 12px;
  color: #b9c6dc;
}

.field small {
  font-size: 12px;
  color: #8fa0bf;
}

.toggle-check {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #d7e6fb;
  cursor: pointer;
  border: 1px solid #2e5d95;
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #102a50, #0d2344);
}

.toggle-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.toggle-ui {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #3f6ea9;
  background: #0c1f3f;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #b8d2ef;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-check input[type="checkbox"]:checked + .toggle-ui {
  background: linear-gradient(180deg, #1a67a8, #145386);
  border-color: #53c7f4;
}

.toggle-check input[type="checkbox"]:checked + .toggle-ui::after {
  transform: translateX(18px);
  background: #ecf8ff;
}

.toggle-copy {
  display: grid;
  gap: 2px;
}

.toggle-copy strong {
  font-size: 14px;
  font-weight: 650;
}

.toggle-copy small {
  color: #93acd0;
  font-size: 12px;
}

.toggle-field {
  margin-top: 2px;
  align-self: end;
}

.toggle-field .toggle-check {
  max-width: 520px;
}

.tips p {
  margin: 8px 0;
  color: #bfd0ea;
}

.dashboard-page h2 {
  margin-bottom: 4px;
}

.dashboard-subtitle {
  margin: 0 0 14px 0;
  color: #a8c2df;
  font-size: 14px;
}

.dashboard-kpis-grid .kpi-card {
  border-left: 4px solid #2f7eca;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px #0416344d;
}

.dashboard-kpis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-kpis-grid .kpi-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, #5bc2ff33, transparent 70%);
}

.dashboard-kpis-grid .kpi-card.ok {
  border-left-color: #2fa86f;
}

.dashboard-kpis-grid .kpi-card.warning {
  border-left-color: #f39c1f;
}

.dashboard-kpis-grid .kpi-card.alert {
  border-left-color: #ff5f6d;
}

.dashboard-targets-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.dashboard-targets-head h3 {
  margin: 0;
}

.dashboard-targets-head span {
  color: #9eb8d6;
  font-size: 13px;
}

.dashboard-target-search {
  min-width: 320px;
  max-width: 420px;
  width: 100%;
}

.dashboard-target-search input {
  width: 100%;
  height: 36px;
  padding: 8px 10px;
}

.kpi-orb {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 5px #ffffff0c;
}

.kpi-orb.blue {
  background: #33b5ff;
}

.kpi-orb.green {
  background: #33d986;
}

.kpi-orb.amber {
  background: #f2a43a;
}

.kpi-orb.red {
  background: #ff5570;
}

.kpi-label {
  color: #b9d2ed;
  font-weight: 500;
}

.dashboard-target-list {
  display: grid;
  gap: 10px;
  padding: 10px 4px 4px 0;
}

.dashboard-targets-card {
  box-shadow: 0 14px 34px #04163444;
}

.dashboard-target-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #2a5382;
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #0d2344, #0a1d38);
  box-shadow: inset 0 1px 0 #7ec8ff14;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-target-group {
  grid-template-columns: 1fr auto;
}

.dashboard-group-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid #264b76;
}

.dashboard-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #2b5483;
  background: #0c2344;
}

.dashboard-group-item > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-target-card:hover {
  transform: none;
  border-color: #3f79af;
  box-shadow: 0 8px 20px #03102566, inset 0 1px 0 #9ad6ff1f;
}

.target-main h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.target-main p {
  margin: 4px 0 0 0;
  color: #d5e7ff;
  font-size: 15px;
}

.target-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-chip.ok {
  color: #bbf7d0;
  background: #123827;
  border-color: #2f8f63;
}

.status-chip.alert {
  color: #fecaca;
  background: #401724;
  border-color: #bd4761;
}

.status-chip.warning {
  color: #ffe4af;
  background: #3e2b11;
  border-color: #c78824;
}

.details-btn {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid #4db8f1;
  background: linear-gradient(180deg, #2284c8, #1a67a1);
  color: #eaf5ff;
  box-shadow: 0 8px 16px #081d3d66;
}

.details-btn:hover {
  border-color: #85e4ff;
  filter: brightness(1.05);
}

.dashboard-empty {
  border: 1px dashed #34689f;
  border-radius: 10px;
  padding: 14px;
  color: #9fb9d8;
  text-align: center;
}

.query-insights-page .query-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(320px, 1fr);
  gap: 12px;
  align-items: end;
}

.query-category {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.query-category:hover {
  transform: translateY(-1px);
  border-color: #4da8ee;
}

.query-category h4 {
  margin: 0 0 2px 0;
}

.query-category small {
  color: #9bb5d4;
  display: block;
  margin-bottom: 8px;
}

.query-kpi {
  margin: 4px 0;
}

.query-kpi span {
  display: block;
  color: #9bb5d4;
  font-size: 12px;
}

.query-kpi strong {
  font-size: 14px;
}

.query-state {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  border: 1px solid transparent;
}

.query-state.danger {
  color: #fecaca;
  background: #3b1d23;
  border-color: #b64a4a;
}

.query-state.warn {
  color: #fde68a;
  background: #3c2d14;
  border-color: #9b7b2f;
}

.query-state.info {
  color: #bfdbfe;
  background: #172a4a;
  border-color: #3d67a7;
}

.query-state.ok {
  color: #bbf7d0;
  background: #133126;
  border-color: #2f8f63;
}

.query-list table tbody tr.active-row {
  background: #15345f70;
}

.query-list .table-link {
  display: inline-block;
  border: 0;
  background: transparent;
  color: #d7e7ff;
  padding: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.pagination {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.pagination-info {
  font-size: 12px;
  color: #9eb8d6;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-actions button {
  min-height: 30px;
  padding: 5px 10px;
}

.query-detail .sql-block {
  margin-top: 10px;
  background: #0a1c3a;
  border: 1px solid #2b578b;
  border-radius: 10px;
  padding: 10px;
  max-height: 360px;
  overflow: auto;
}

.query-detail .sql-block code {
  white-space: pre-wrap;
  word-break: break-word;
  color: #d4e7ff;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.query-tips {
  margin-top: 10px;
  border: 1px solid #2d5f92;
  border-radius: 10px;
  padding: 10px;
  background: #0d2141;
}

.query-tips h4 {
  margin: 0 0 8px 0;
}

.query-tips ul {
  margin: 0;
  padding-left: 16px;
}

.query-tips li {
  margin-bottom: 6px;
  color: #d2e3fb;
  font-size: 13px;
}

.query-hint {
  margin-top: 10px;
  color: #9eb8d6;
  font-size: 13px;
}

.targets-page h2 {
  margin-top: 4px;
  margin-bottom: 16px;
}

.target-form {
  margin-top: 12px;
  gap: 10px;
}

.owner-picker {
  display: grid;
  gap: 8px;
  position: relative;
}

.owner-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.owner-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid #4a8fd3;
  background: #184679;
  color: #e8f4ff;
  font-size: 12px;
  font-weight: 600;
}

.owner-search-shell {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
}

.owner-search-shell.open .owner-search-input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.owner-search-input {
  width: 100%;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.owner-search-toggle {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  min-width: 38px;
  font-weight: 700;
  padding: 0 10px;
}

.owner-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 2px);
  z-index: 10;
  border: 1px solid #3c73ac;
  border-radius: 0 0 10px 10px;
  background: #0f2549;
  box-shadow: 0 12px 26px #03112777;
  padding: 8px;
}

.owner-search-results {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.owner-result {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid #2d5d95;
  background: #112c52;
  color: #d9ebff;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.owner-result small {
  color: #9db9dc;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.owner-result.active {
  border-color: #52c7f8;
  background: #184679;
}

.owner-result-empty {
  border: 1px dashed #365e8e;
  border-radius: 10px;
  padding: 8px 10px;
  color: #9db9dc;
  font-size: 12px;
}

.primary-btn {
  font-weight: 650;
  letter-spacing: 0.01em;
  border-color: #3384cb;
  background: linear-gradient(180deg, #15528d, #114170);
  box-shadow: inset 0 1px 0 #5f8de144;
  padding: 6px 12px;
  min-height: 34px;
}

.primary-btn:hover {
  border-color: #62c7f7;
  background: linear-gradient(180deg, #1a63a9, #14558f);
}

.submit-field {
  align-self: end;
  margin-top: 2px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}

.field-full {
  grid-column: 1 / -1;
}

.secondary-btn {
  font-weight: 600;
  border-color: #3f6ea9;
  background: linear-gradient(180deg, #14365f, #102c4f);
  padding: 6px 12px;
  min-height: 34px;
}

.secondary-btn:hover {
  border-color: #69a9de;
}

.test-connection-result {
  margin-top: 10px;
  font-size: 13px;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
}

.test-connection-result.ok {
  color: #b9f3cf;
  border-color: #2f8f63;
  background: #123727;
}

.test-connection-result.fail {
  color: #fecaca;
  border-color: #b64a4a;
  background: #3a1c22;
}

.collapsible {
  padding-top: 12px;
}

.collapse-head {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -2px 0 0 0;
  padding: 0 2px 8px 2px;
}

.collapse-head::-webkit-details-marker {
  display: none;
}

.collapse-head h3 {
  margin: 0;
  font-size: 24px;
}

.collapse-head p {
  margin: 2px 0 0 0;
  color: #92a7cc;
  font-size: 12px;
}

.collapse-chevron {
  font-size: 22px;
  color: #89a7d8;
  transition: transform 0.2s ease;
}

details[open] .collapse-chevron {
  transform: rotate(180deg);
}

.targets-table table tbody tr:hover {
  background: #13234880;
}

.table-link {
  font-weight: 600;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  padding: 6px 10px;
  min-height: 32px;
  font-weight: 650;
  font-size: 13px;
  border: 1px solid transparent;
  color: #eaf4ff;
  background: #132d54;
  text-decoration: none;
}

.table-action-btn.details {
  border-color: #47c4f6;
  background: linear-gradient(180deg, #155c8f, #124a76);
}

.table-action-btn.details:hover {
  border-color: #8ce8ff;
  filter: brightness(1.06);
}

.table-action-btn.edit {
  border-color: #4f8ed4;
  background: linear-gradient(180deg, #184b7f, #143f69);
}

.table-action-btn.edit:hover {
  border-color: #7ec3ff;
  filter: brightness(1.06);
}

.table-action-btn.delete {
  border-color: #d36a85;
  background: linear-gradient(180deg, #5c1e32, #451626);
}

.table-action-btn.delete:hover {
  border-color: #ff93ad;
  filter: brightness(1.06);
}

.table-action-btn.toggle.enabled {
  border-color: #d38f3a;
  background: linear-gradient(180deg, #5a3513, #3f240f);
}

.table-action-btn.toggle.enabled:hover {
  border-color: #f4be6a;
  filter: brightness(1.06);
}

.table-action-btn.toggle.disabled {
  border-color: #3f6ea9;
  background: linear-gradient(180deg, #153963, #112d4d);
}

.table-action-btn.toggle.disabled:hover {
  border-color: #77b1eb;
  filter: brightness(1.06);
}

.danger-btn {
  margin-left: 8px;
  border-color: #7a2e43;
  background: linear-gradient(180deg, #3a1724, #2b1019);
}

.danger-btn:hover {
  border-color: #be3f63;
}

.small-btn {
  min-height: 30px;
  padding: 4px 10px;
}

button {
  cursor: pointer;
}

.logout-btn {
  width: 100%;
  margin-top: 8px;
  border-color: #374f8f;
  background: linear-gradient(180deg, #13224b, #101b3a);
}

.logout-btn:hover {
  border-color: #38bdf8;
}

.profile-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  border: 1px solid #3a63a1;
  border-radius: 10px;
  background: linear-gradient(180deg, #15315d, #11274c);
  color: #e7f2ff;
  min-height: 40px;
  font-weight: 650;
}

.profile-btn:hover {
  border-color: #58b0e8;
  background: linear-gradient(180deg, #1a427a, #15335f);
}

.profile-btn.active {
  border-color: #66c7f4;
  box-shadow: inset 0 0 0 1px #66c7f455;
}

.user-settings-page h2 {
  margin-top: 4px;
  margin-bottom: 4px;
}

.user-settings-card {
  max-width: 760px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #223056;
  padding: 8px 6px;
}

.error {
  color: #fecaca;
  border-color: #7f1d1d;
}

.admin-settings-page h2 {
  margin-top: 4px;
  margin-bottom: 4px;
}

.admin-settings-page h3 {
  margin-top: 0;
  margin-bottom: 2px;
}

.admin-page-subtitle {
  margin: 0 0 14px;
}

.admin-section-head {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #264671;
}

.admin-section-head p {
  margin: 4px 0 0;
  font-size: 13px;
}

.admin-user-form {
  gap: 10px;
}

.admin-field label {
  display: block;
  margin-bottom: 6px;
  color: #c6d7f1;
  font-size: 13px;
  font-weight: 600;
}

.admin-field input,
.admin-field select {
  width: 100%;
  min-height: 38px;
}

.admin-field textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 13px;
}

.smtp-mode-picker {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.smtp-mode-btn {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #3d6ca8;
  background: linear-gradient(180deg, #123258, #0f2a4c);
  color: #d4e8ff;
  font-weight: 650;
  font-size: 12px;
}

.smtp-mode-btn.active {
  border-color: #57cbf8;
  background: linear-gradient(180deg, #1a5f96, #164f7d);
  box-shadow: 0 0 0 2px #28bdf32d;
}

.admin-users-table-wrap table tbody .admin-user-row td {
  padding-top: 11px;
  padding-bottom: 11px;
  vertical-align: middle;
}

.user-col-id {
  width: 64px;
  color: #a8c0df;
}

.user-col-email {
  font-weight: 600;
}

.user-col-name-value {
  font-weight: 600;
}

.admin-inline-grid {
  display: grid;
  gap: 8px;
}

.admin-inline-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-inline-password {
  min-width: 190px;
}

.admin-user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-pill.role-admin {
  color: #e9dcff;
  border-color: #8f77e3;
  background: #31235d;
}

.role-pill.role-operator {
  color: #c7e7ff;
  border-color: #4e8dc8;
  background: #18375a;
}

.role-pill.role-viewer {
  color: #cde2f8;
  border-color: #4a6692;
  background: #192b49;
}

.admin-smtp-form {
  margin-top: 8px;
  gap: 10px;
}

.admin-subcard {
  border: 1px solid #2c598f;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #102748, #0e2342);
}

.admin-subcard h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.template-help-text {
  margin: 0 0 10px 0;
}

.template-vars-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.template-var-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #4d81bc;
  background: #15365f;
  color: #d9ebff;
  padding: 4px 10px;
  font-size: 12px;
}

.admin-test-recipient {
  min-width: 260px;
  max-width: 320px;
}

.muted {
  color: #9eb8d6;
}

.service-page .service-msg {
  margin-bottom: 10px;
}

.service-hero {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.service-hero.ok {
  border-color: #2f8f63;
  background: linear-gradient(90deg, #123827, #102e42);
}

.service-hero.update {
  border-color: #dfab3e;
  background: linear-gradient(90deg, #4a3511, #2f2452);
  box-shadow: 0 12px 28px #2b1f066b;
}

.service-hero-title {
  display: inline-block;
  font-size: 18px;
  margin-bottom: 3px;
}

.service-hero-sub {
  margin: 0;
}

.service-card {
  box-shadow: 0 10px 24px #0416343d;
}

.service-status-ok {
  color: #6ef0ad;
}

.service-status-update {
  color: #ffd77e;
}

.alerts-subtitle {
  margin-top: 2px;
  color: #a6c0df;
}

.alerts-kpis .alerts-kpi {
  display: grid;
  gap: 2px;
}

.alerts-kpi strong {
  font-size: 32px;
  line-height: 1;
}

.alerts-kpi.warning {
  border-color: #f39c1f;
  background: linear-gradient(180deg, #4e300f, #32200d);
  box-shadow: 0 10px 24px #c6771238, inset 0 1px 0 #ffd28030;
}

.alerts-kpi.alert {
  border-color: #ff5f6d;
  background: linear-gradient(180deg, #5a1627, #3b111c);
  box-shadow: 0 10px 24px #bf2f4f3f, inset 0 1px 0 #ff9aad2e;
}

.alerts-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding: 10px 3px 4px 0;
}

.standard-alerts-note {
  margin-bottom: 10px;
  color: #a7c0df;
  font-size: 13px;
}

.standard-alerts-table-wrap {
  overflow-x: auto;
}

.standard-alerts-table th,
.standard-alerts-table td {
  vertical-align: top;
  font-size: 13px;
}

.standard-alerts-table td code {
  color: #d7e8ff;
  background: #112846;
  border: 1px solid #355d91;
  border-radius: 6px;
  padding: 1px 6px;
}

.alert-item {
  border-radius: 12px;
  border: 1px solid #375d8f;
  background: #10294f;
  padding: 12px;
}

.alert-item.warning {
  border-color: #d38f2a;
  background: linear-gradient(180deg, #4a3012, #34220f);
}

.alert-item.alert {
  border-color: #d8526a;
  background: linear-gradient(180deg, #52202e, #38151f);
}

.alert-item:hover {
  transform: none;
}

.alert-item.is-open {
  box-shadow: 0 14px 28px #07163166;
}

.alert-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.alert-item-head small {
  color: #c3d5ef;
  margin-left: auto;
}

.alert-item p {
  margin: 4px 0;
  color: #d3e5fb;
}

.alert-message {
  font-size: 13px;
  color: #b6cae8;
}

.alert-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.alert-badge.warning {
  color: #ffe8bf;
  background: #5d370f;
  border-color: #e79f3a;
}

.alert-badge.alert {
  color: #ffe0e4;
  background: #5e1929;
  border-color: #f06a81;
}

.alert-details-grid {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #ffffff20;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.alert-details-grid div {
  display: grid;
  gap: 2px;
}

.alert-details-grid span {
  font-size: 11px;
  color: #b7cbe6;
}

.alert-details-grid strong {
  font-size: 13px;
  color: #edf4ff;
}

.alert-sql {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px;
  border-radius: 8px;
  background: #081a33a6;
  border: 1px solid #376097;
}

.alert-sql code {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

.alert-suggestions {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #3d689d;
  background: #0a1f3fb3;
}

.alert-suggestions h4 {
  margin: 0 0 6px 0;
  font-size: 13px;
}

.alert-suggestions ul {
  margin: 0;
  padding-left: 16px;
}

.alert-suggestions li {
  margin-bottom: 4px;
  color: #d4e7ff;
  font-size: 12px;
}

.alert-form .field-full {
  grid-column: 1 / -1;
}

.alert-form textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 13px;
}

.alert-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.alert-toast {
  pointer-events: auto;
  border-radius: 12px;
  border: 1px solid #3b669b;
  background: linear-gradient(180deg, #11305d, #0d2448);
  box-shadow: 0 16px 34px #03132782;
  padding: 10px 12px;
  animation: toastIn 0.22s ease;
}

.alert-toast.closing {
  animation: toastOut 0.22s ease forwards;
}

.alert-toast.warning {
  border-color: #db9125;
  background: linear-gradient(180deg, #4a2d0f, #35210d);
}

.alert-toast.alert {
  border-color: #e4556d;
  background: linear-gradient(180deg, #57202f, #3b1520);
}

.alert-toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.alert-toast-head strong {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.toast-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toast-view {
  border: 1px solid #5d80b1;
  background: #0f274b;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toast-close {
  border: 1px solid #5d80b1;
  background: #0f274b;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1;
  padding: 4px 7px;
}

.alert-toast-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.alert-toast-target {
  color: #b9cde8;
  font-size: 12px;
  margin-bottom: 4px;
}

.alert-toast-message {
  color: #dceafe;
  font-size: 12px;
}

.range-picker {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.range-picker .active {
  border-color: var(--accent);
}

.live-btn {
  font-weight: 800;
  letter-spacing: 0.04em;
  border-color: #2da55e;
  background: linear-gradient(180deg, #103725, #0d2a1d);
  color: #bdf7d3;
}

.live-btn.active {
  border-color: #4de08d;
  background: linear-gradient(180deg, #1b7a4a, #145f3a);
  box-shadow: 0 0 0 2px #2ee68f33;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 20% 15%, #1167a855, transparent),
    radial-gradient(900px 500px at 80% 90%, #31a76a44, transparent);
}

.login-card {
  width: min(460px, 95vw);
  display: grid;
  gap: 10px;
  border-color: #2f73bb;
  padding: 26px;
  background: linear-gradient(180deg, #132f58f0, #102847f0);
  box-shadow: 0 20px 50px #050b1f66;
  backdrop-filter: blur(6px);
  animation: loginEnter 0.5s ease;
}

.login-logo-wrap {
  margin: 2px auto 6px auto;
  width: 190px;
  display: grid;
  place-items: center;
  padding: 10px 10px 8px 10px;
  border-radius: 16px;
  border: 1px solid #2f6eb1;
  background:
    radial-gradient(circle at 50% 16%, #52cbff4f, transparent 62%),
    linear-gradient(180deg, #163965, #122d52);
  box-shadow: inset 0 1px 0 #8bd8ff40, 0 14px 28px #04163875;
}

.login-logo {
  width: 152px;
  margin: 0 auto;
  filter: drop-shadow(0 10px 22px #041c3eaa) saturate(1.08) contrast(1.04);
}

.login-eyebrow {
  font-size: 12px;
  color: #a8badb;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
}

.login-subtitle {
  margin: 0 0 2px 0;
  color: #9db0d2;
  font-size: 14px;
}

.input-shell {
  border: 1px solid #2f629c;
  border-radius: 12px;
  padding: 0;
  background: #0f2750;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.input-shell:focus-within {
  border-color: #25bdf3;
  box-shadow: 0 0 0 3px #25bdf32a;
  transform: translateY(-1px);
}

.input-shell input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 11px 12px;
  font-size: 15px;
}

.login-cta {
  margin-top: 4px;
  font-weight: 700;
  border-color: #2d97d9;
  background: linear-gradient(90deg, #1d7fc8, #1a65ad 70%, #2a9d6a);
  padding: 11px 12px;
}

.login-cta:hover {
  border-color: #6ee2a5;
  filter: brightness(1.05);
}

.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover,
.login-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e5edf7;
  -webkit-box-shadow: 0 0 0px 1000px #0e1731 inset;
  transition: background-color 9999s ease-out 0s;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #e5edf7;
  -webkit-box-shadow: 0 0 0px 1000px #0f1933 inset;
  transition: background-color 9999s ease-out 0s;
}

@keyframes loginEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.query {
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-kv span,
.overview-metrics span {
  display: block;
  font-size: 12px;
  color: #97a7c8;
}

.overview-kv strong,
.overview-metrics strong {
  font-size: 15px;
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pill {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill.primary {
  color: #4ade80;
}

.pill.standby {
  color: #f59e0b;
}

.lag-bad {
  color: #ef4444;
}

.partial-warning {
  margin-top: 12px;
  border: 1px solid #7f1d1d;
  border-radius: 10px;
  padding: 10px;
  color: #fecaca;
}

.partial-warning ul {
  margin: 8px 0 0 18px;
}

.easy-status {
  border-width: 1px;
}

.easy-status.ok {
  border-color: #1d8d5c;
  background: linear-gradient(180deg, #123b39, #112a31);
}

.easy-status.warning {
  border-color: #ad7f25;
  background: linear-gradient(180deg, #3a3214, #2d2610);
}

.easy-status.problem {
  border-color: #b54242;
  background: linear-gradient(180deg, #3f1d22, #2f1519);
}

.easy-badge-row {
  margin-top: 8px;
}

.easy-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.easy-badge.ok {
  color: #86efac;
  border-color: #2f8d5d;
}

.easy-badge.warning {
  color: #fde68a;
  border-color: #9a7a2e;
}

.easy-badge.problem {
  color: #fecaca;
  border-color: #b64a4a;
}

.easy-list {
  margin: 8px 0 10px 16px;
}

.owner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 12px;
  flex-wrap: wrap;
}

.target-db-switcher {
  max-width: 420px;
  margin-bottom: 10px;
}

.owner-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #3f7abc;
  background: #17355f;
  color: #d9ebff;
  font-size: 12px;
}

.chart-tooltip {
  background: #0f1934ee;
  border: 1px solid #2f4a8b;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 170px;
}

.chart-tooltip-time {
  font-size: 12px;
  color: #9cb2d8;
  margin-bottom: 6px;
}

.chart-tooltip-item {
  font-size: 14px;
  margin: 3px 0;
}

.chart-tooltip-item.c1 {
  color: #38bdf8;
}

.chart-tooltip-item.c2 {
  color: #22c55e;
}

.chart-tooltip-item.c3 {
  color: #f59e0b;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    height: auto;
  }
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }
  .dashboard-kpis-grid {
    grid-template-columns: 1fr;
  }
  .main {
    height: auto;
    overflow: visible;
  }
  .dashboard-target-search {
    min-width: 0;
  }
  .dashboard-targets-head {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-target-list {
    max-height: none;
    overflow: visible;
  }
}
