.admin-body .admin-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  position: relative;
  z-index: 1;
}

/* Sticky tab strip under site header (MEK-166 / MEK-163 IA) */
.admin-tabs-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 1.1rem;
  padding: 0.35rem 0 0;
  background: linear-gradient(
    180deg,
    rgba(6, 12, 10, 0.96) 0%,
    rgba(6, 12, 10, 0.88) 70%,
    rgba(6, 12, 10, 0) 100%
  );
  backdrop-filter: blur(6px);
}

.admin-tablist {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.admin-tab {
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.65rem 0.95rem 0.7rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
}

.admin-tab:hover {
  color: var(--ink);
}

.admin-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.admin-tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.admin-tabpanel[hidden] {
  display: none !important;
}

.admin-tabpanel > .panel:first-child,
.admin-tabpanel > .ops-hero:first-child {
  animation: fade-up 0.45s ease both;
}

@media (max-width: 720px) {
  .admin-tab {
    padding: 0.6rem 0.8rem 0.65rem;
    font-size: 0.88rem;
  }
}

.admin-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.85rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-sub {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.ops-hero {
  animation: fade-up 0.55s ease both;
}

.ops-hero-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.1rem;
}

.ops-hero-lede {
  margin-bottom: 0;
  max-width: 56ch;
}

.ops-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--line);
  background: rgba(10, 16, 14, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.health-pill::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(138, 160, 148, 0.2);
}

.health-pill[data-tone="ok"] {
  color: #04110a;
  background: var(--accent);
  border-color: transparent;
}

.health-pill[data-tone="ok"]::before {
  background: #04110a;
  box-shadow: none;
}

.health-pill[data-tone="warn"] {
  color: #2a1a00;
  background: #f0c060;
  border-color: transparent;
}

.health-pill[data-tone="warn"]::before {
  background: #2a1a00;
  box-shadow: none;
}

.health-pill[data-tone="err"] {
  color: #3a0d0d;
  background: #ff8f8f;
  border-color: transparent;
}

.health-pill[data-tone="err"]::before {
  background: #3a0d0d;
  box-shadow: none;
}

.dep-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.dep-card {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: linear-gradient(165deg, rgba(20, 32, 27, 0.9), rgba(10, 16, 14, 0.55));
  min-height: 6.2rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.dep-card:hover {
  border-color: rgba(61, 214, 140, 0.35);
  transform: translateY(-1px);
}

.dep-card[data-tone="ok"] {
  border-color: rgba(61, 214, 140, 0.28);
}

.dep-card[data-tone="warn"] {
  border-color: rgba(240, 192, 96, 0.4);
}

.dep-card[data-tone="err"] {
  border-color: rgba(255, 107, 107, 0.45);
}

.dep-card h3 {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dep-value {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.15;
}

.dep-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.35;
}

.ops-columns {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  margin: 1rem 0;
}

.ops-columns .panel {
  margin: 0;
  min-width: 0;
}

.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(255, 143, 143, 0.16);
  color: #ffb4b4;
  border: 1px solid rgba(255, 143, 143, 0.35);
}

.count-chip[data-tone="ok"] {
  background: rgba(61, 214, 140, 0.14);
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.35);
}

.count-chip[data-tone="warn"] {
  background: rgba(240, 192, 96, 0.16);
  color: #f0c060;
  border-color: rgba(240, 192, 96, 0.4);
}

.errors-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.error-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: start;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(255, 107, 107, 0.28);
  border-radius: 0.5rem;
  background: rgba(40, 14, 14, 0.35);
}

.error-card[data-kind="source"] {
  border-color: rgba(240, 192, 96, 0.35);
  background: rgba(40, 28, 8, 0.28);
}

.error-card-main {
  min-width: 0;
}

.error-card-title {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.error-card-msg {
  margin: 0;
  color: #ffd0d0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}

.error-card-meta {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.error-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.empty-state {
  margin-top: 0.75rem;
}

.table-group-row td {
  padding-top: 0.85rem;
  padding-bottom: 0.35rem;
  background: rgba(61, 214, 140, 0.06);
  border-left: 3px solid rgba(61, 214, 140, 0.45);
  font-size: 0.82rem;
}

.table-group-label {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.inventory-label {
  font-weight: 600;
}

.inventory-key {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
}

.inventory-ioc-count {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
}

.inventory-detail-row td {
  background: rgba(13, 21, 18, 0.55);
  padding: 0.65rem 0.85rem 0.9rem;
}

.inventory-l2-table {
  width: 100%;
  border-collapse: collapse;
}

.inventory-l2-table th,
.inventory-l2-table td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
}

.inventory-l2-table th {
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}

.row-muted td {
  color: var(--muted);
}

.row-clickable {
  cursor: pointer;
}

.row-clickable:hover td {
  background: rgba(61, 214, 140, 0.05);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 28rem;
  margin-top: 1rem;
}

.login-form label,
.source-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-form input,
.source-form input,
.source-form select,
.source-form textarea {
  background: #0d1512;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.55rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: normal;
}

.source-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.source-form label.checkbox {
  flex-direction: row;
  align-items: center;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9rem;
  color: var(--ink);
  gap: 0.5rem;
}

.source-form label:has(textarea),
.source-form .cta-row,
.source-form #form-hint {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid var(--line);
}

.badge.on {
  color: #04110a;
  background: var(--accent);
  border-color: transparent;
}

.badge.off {
  color: var(--muted);
}

.badge.err {
  color: #3a0d0d;
  background: #ff8f8f;
  border-color: transparent;
}

.badge.warn {
  color: #2a1a00;
  background: #f0c060;
  border-color: transparent;
}

.badge.ok {
  color: #04110a;
  background: #7dcea0;
  border-color: transparent;
}

.cell-muted {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.cell-error {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ffb4b4;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.ops-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.callout {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(125, 206, 160, 0.35);
  border-left: 3px solid var(--accent);
  background: rgba(10, 24, 18, 0.65);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.callout code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #d7efe2;
}

.whitelist-filters,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 0 0 0.85rem;
  align-items: end;
}

.whitelist-filters label,
.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.whitelist-filters select,
.filters select {
  min-width: 8rem;
}

.whitelist-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.whitelist-forms h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  grid-column: 1 / -1;
}

.whitelist-forms .source-form h3 {
  grid-column: auto;
}

.badge.muted {
  color: #d8e4dc;
  background: #24332c;
  border-color: transparent;
}

.danger-zone {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 120, 120, 0.28);
}

.btn.danger {
  background: #5a1d1d;
  border-color: #a33;
  color: #ffd6d6;
}

.btn.danger:hover:not(:disabled) {
  background: #742222;
}

.btn.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.danger-zone {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 120, 120, 0.28);
}

.btn.danger {
  background: #5a1d1d;
  border-color: #a33;
  color: #ffd6d6;
}

.btn.danger:hover:not(:disabled) {
  background: #742222;
}

.btn.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0.75rem 0 1.25rem;
}

.ops-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.github-path-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.65rem;
}

.github-cwd {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.github-tree-wrap {
  max-height: 260px;
  overflow: auto;
}

#ops-github-hint.hint-error {
  color: #f0a0a0;
  border-left: 3px solid rgba(255, 120, 120, 0.55);
  padding-left: 0.55rem;
}

#ops-github-tree tbody tr[data-dir="1"] {
  cursor: pointer;
}

#ops-github-tree tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.panel-head.tight {
  margin-bottom: 0.35rem;
}

.ops-dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.ops-dl dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.ops-dl dd {
  margin: 0;
  word-break: break-word;
}

.ops-error,
.ops-log {
  margin: 0;
  padding: 0.75rem;
  background: #0a100e;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 10rem;
  overflow: auto;
}

.ops-log {
  max-height: 22rem;
  min-height: 8rem;
  color: #cfe6d8;
}

@media (max-width: 960px) {
  .ops-columns { grid-template-columns: 1fr; }
  .dep-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .source-form { grid-template-columns: 1fr; }
  .ops-grid { grid-template-columns: 1fr; }
  .whitelist-forms { grid-template-columns: 1fr; }
  .ops-hero-top { flex-direction: column; }
  .error-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .dep-grid { grid-template-columns: 1fr; }
}
