html, body {
  height: 100%;
}
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0e11;
  color: #e5e7eb;
  margin: 0;
  display: flex;
  flex-direction: column;
}
main {
  padding-bottom: 48px !important;
}

a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }
header {
  background: #111827;
  border-bottom: 1px solid #1f2937;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 {
  margin: 0;
  font-size: 1.1rem;
}
header nav {
  display: flex;
  align-items: center;
}
header nav a {
  margin-left: 1rem;
  font-size: 0.9rem;
}
main {
  padding: 1.5rem;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
}
.card {
  background: #111827;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  border: 1px solid #1f2937;
  margin-bottom: 1rem;
}
.card h2 {
  font-size: 1rem;
  margin-top: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.muted { color: #6b7280; font-size: 0.85rem; }
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
th, td {
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid #1f2937;
}
th {
  color: #9ca3af;
  background: #020617;
}
tr:nth-child(even) td { background: #020617; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  border-radius: 0.45rem;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.9rem;
}
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 0.85rem;
  cursor: pointer;
}
button:hover, .btn:hover {
  background: #111827;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #4b5563;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.badge-ok { border-color: #16a34a; color: #4ade80; }
.badge-warn { border-color: #f97316; color: #fdba74; }
.badge-err { border-color: #f97373; color: #fecaca; }
.flash {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}
.flash-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid #f87171;
}
.flash-success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid #34d399;
}
form .field {
  margin-bottom: 0.7rem;
}
label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}
.text-right { text-align: right; }
.login-wrapper {
  max-width: 360px;
  margin: 8vh auto;
}


/* Legacy flash message support */
.flashes {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
}
.flashes li {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.flashes li.success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid #34d399;
}
.flashes li.danger, .flashes li.error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid #f87171;
}

/* Login page legacy helpers */
.login-box {
  max-width: 360px;
  margin: 8vh auto;
}
.login-box.card {
  padding: 1.25rem;
}
.label-row {
  margin-bottom: 0.7rem;
}
.label-row label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}
.actions {
  text-align: right;
}

/* Slight spacing for headings inside cards */
.card > h2,
.card > h3 {
  margin-top: 0;
}


/* Buttons */
.btn,
button {
  border-radius: 999px;
  border: 1px solid #374151;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  background: #111827;
  color: #e5e7eb;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover,
button:hover {
  background: #1f2937;
  border-color: #4b5563;
}
.btn:active,
button:active {
  transform: translateY(1px);
}
.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #e5e7eb;
}
.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.btn-secondary {
  background: #111827;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: #111827;
  border-color: #374151;
}
.btn-danger {
  background: #991b1b;
  border-color: #b91c1c;
}
.btn-danger:hover {
  background: #7f1d1d;
  border-color: #ef4444;
}
.btn-small {
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
}

/* Link-look button (for clickable table entries) */
.link-button {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  color: #60a5fa;
  cursor: pointer;
  font: inherit;
}
.link-button:hover {
  text-decoration: underline;
}

/* Dashboard stats + health */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.stat-tile {
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  background: #0f172a;
  border: 1px solid #1f2937;
}
.stat-label {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.15rem;
}
.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.db-overview-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.db-overview-block {
  flex: 1 1 320px;
}
.db-overview-list {
  margin: 0.25rem 0 0 0;
  padding-left: 1.1rem;
  line-height: 1.6;
}
.system-usage-card {
  flex: 1 1 360px;
  max-width: 460px;
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
.system-usage-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.gauge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.gauge-circle {
  --gauge-value: 0;
  --gauge-color: #60a5fa;
  width: 180px;
  aspect-ratio: 2 / 1;
  border-radius: 999px 999px 14px 14px;
  background: conic-gradient(from -180deg, var(--gauge-color) calc(var(--gauge-value) * 1%), rgba(255,255,255,0.08) 0);
  position: relative;
  border: 1px solid #1f2937;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  overflow: hidden;
}
.gauge-circle::after {
  content: "";
  position: absolute;
  inset: 10px 10px 0 10px;
  background: #0b0e11;
  border-radius: 999px 999px 12px 12px;
  box-shadow: inset 0 0 0 1px #1f2937;
}
.gauge-inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  transform: translateY(6%);
}
.gauge-value {
  font-size: 1.2rem;
  font-weight: 700;
}
.gauge-label {
  font-size: 0.8rem;
  color: #9ca3af;
}
.gauge-meta {
  font-size: 0.85rem;
  color: #e5e7eb;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.health-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.health-score {
  font-weight: 600;
  font-size: 0.95rem;
  color: #9ca3af;
}
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.health-tile {
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  background: #020617;
  border: 1px solid #1f2937;
}
.health-name {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}
.health-value {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.health-raw {
  font-size: 0.7rem;
  color: #6b7280;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid transparent;
}
.status-ok,
.status-ok.status-ok,
.status-ok.status-ok {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.6);
  color: #bbf7d0;
}
.status-error,
.status-error.status-error {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.6);
  color: #fecaca;
}
.status-disabled {
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
}

/* Map overall status class */
.status-ok,
.status-ok.status-ok,
.status-ok.status-ok,
.status-ok.status-ok {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.6);
  color: #bbf7d0;
}
.status-error,
.status-error.status-error {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.6);
  color: #fecaca;
}

/* Modal for price history chart */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}
.modal.open {
  display: block;
}
.modal.hidden {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
}
.modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 720px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.modal-body {
  padding-top: 0.5rem;
}
.modal-close {
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-close:hover {
  color: #e5e7eb;
}
.modal-controls {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.modal-controls .btn.active {
  box-shadow: 0 0 0 1px #2563eb;
}

/* Card actions alignment */
.card-actions {
  margin-top: 0.75rem;
  text-align: right;
}


/* Global footer */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;

  height: 38px;
  padding: 6px 14px;

  background: #0d1117;
  border-top: 1px solid #1f2937;

  display: flex;
  justify-content: space-between; /* Version rechts, Linkblock mittig */
  align-items: center;
  gap: 12px;

  font-size: 0.8rem;
  color: #9ca3af;

  z-index: 200;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
}

/* Logo ca. 22px hoch */
.footer-logo {
  height: 56px;
  width: auto;
  opacity: 0.9;
}

.footer-link {
  color: #60a5fa;
  text-decoration: none;
  font-size: 0.8rem;
}

.footer-link:hover {
  text-decoration: underline;
}

.footer-sep {
  color: #4b5563;
}

/* Version rechts */
.footer-right {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}

.brand-link { color: inherit; text-decoration: none; }
.brand-link:hover { text-decoration: underline; }
.site-footer { margin-top: 0; flex-shrink: 0; }

/* --- LOG PANEL --- */

.log-panel {
  margin-top: 1.5rem;
}

.log-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.log-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.log-toolbar-left label {
  margin-bottom: 0;
}

.log-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.log-output {
  background: #020617;
  border-radius: 0.5rem;
  border: 1px solid #1f2937;
  padding: 0.5rem 0.75rem;
  max-height: 420px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.3;
}

/* einzelne Zeilen */
.log-line {
  white-space: pre;
}

/* Level-Farben */
.log-level-error {
  color: #fecaca;
}
.log-level-warning {
  color: #facc15;
}
.log-level-info {
  color: #93c5fd;
}
.log-level-debug {
  color: #9ca3af;
}
.log-level-other {
  color: #e5e7eb;
}

.log-error {
  color: #fecaca;
}

/* Language dropdown */
.language-dropdown {
  position: relative;
  margin-left: 1rem;
}
.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  font-size: 0.8rem;
  cursor: pointer;
}
.language-toggle .language-caret {
  font-size: 0.7rem;
}
.language-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  min-width: 140px;
  background: #020617;
  border-radius: 0.5rem;
  border: 1px solid #1f2937;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
  padding: 0.25rem 0;
  display: none;
  z-index: 50;
}
.language-dropdown:hover .language-menu {
  display: block;
}
.language-option {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: #e5e7eb;
  text-decoration: none;
}
.language-option:hover {
  background: #111827;
}
.language-option.active {
  font-weight: 600;
}

/* Pagination */
.pagination {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}
.pagination a {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #374151;
  text-decoration: none;
  color: #e5e7eb;
}
.pagination span {
  color: #9ca3af;
}

.text-warn {
  color: #f59e0b;
  font-weight: 600;
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: #9ca3af;
}
.filter-bar input,
.filter-bar select {
  margin-top: 0.25rem;
}
