:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2631;
  --text: #e6edf3;
  --muted: #8b949e;
  --border: #2f3844;
  --accent: #2ea043;
  --accent-hover: #3fb950;
  --danger: #f85149;
  --warning: #d29922;
  --shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background: radial-gradient(circle at top, #1a202d 0%, var(--bg) 45%);
  color: var(--text);
}

.page {
  width: min(700px, 100% - 24px);
  margin: 18px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

h1, h2 {
  margin: 0;
}

h1 {
  font-size: 1.45rem;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, #141920 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.login-card {
  margin-top: 20vh;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section-gap {
  margin-top: 12px;
}

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

.card-header h2 {
  margin-bottom: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat-tile {
  background: #10161f;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-tile.warning {
  border-left-color: var(--warning);
}

.stat-tile.critical {
  border-left-color: var(--danger);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.result-card {
  background: #10161f;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.result-key {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
}

.result-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.result-meta strong {
  color: var(--text);
  font-weight: 600;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.badge.status-active {
  border-color: rgba(46, 160, 67, 0.5);
  color: var(--accent-hover);
}

.badge.status-expired,
.badge.status-disabled {
  border-color: rgba(248, 81, 73, 0.5);
  color: #ffb2ad;
}

.badge.flag-warning {
  border-color: rgba(210, 153, 34, 0.5);
  color: #e3b341;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

input, select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1rem;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn {
  border: 1px solid var(--border);
  background: #242c38;
  color: var(--text);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.97rem;
  cursor: pointer;
  min-height: 44px;
}

.btn:hover {
  background: #2b3645;
}

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

.btn-primary {
  border-color: #2a7f3a;
  background: var(--accent);
  color: #06120a;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.result {
  margin-top: 12px;
  background: #121923;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.result p {
  margin: 6px 0;
}

.hidden {
  display: none;
}

.activity-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-list li {
  background: #10161f;
  border: 1px solid #273242;
  border-radius: 8px;
  padding: 10px;
}

.ok {
  color: var(--accent-hover);
  font-weight: 700;
  margin-right: 6px;
}

.alert {
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0 12px;
}

.alert.error {
  background: rgba(248, 81, 73, 0.14);
  border: 1px solid rgba(248, 81, 73, 0.48);
  color: #ffb2ad;
}

.toast-container {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #111926;
  min-width: 240px;
}

.toast.success {
  border-color: rgba(46, 160, 67, 0.5);
}

.toast.error {
  border-color: rgba(248, 81, 73, 0.5);
}

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

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
