:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cbd5e1;

  --text: #1f2937;
  --text-muted: #6b7280;

  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-hover: #1d4ed8;

  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;

  --sidebar-width: 240px;
  --sidebar-width-collapsed: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Seitenleiste */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.25rem;
  transition: width 0.2s ease;
}

.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.toggle-btn {
  align-self: flex-end;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: background 0.15s ease;
}

.toggle-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.toggle-btn svg {
  width: 18px;
  height: 18px;
}

.sidebar.collapsed .toggle-btn {
  align-self: center;
}

.sidebar.collapsed .toggle-btn .chevron {
  transform: rotate(180deg);
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.menu-item:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.menu-item .icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.menu-item .icon svg {
  width: 19px;
  height: 19px;
}

.menu-item .label {
  font-size: 0.9rem;
  font-weight: 500;
}

.sidebar.collapsed .menu-item {
  justify-content: center;
  padding: 0.6rem;
}

.sidebar.collapsed .menu-item .label,
.sidebar.collapsed .menu-user .label {
  display: none;
}

.menu-spacer {
  flex: 1;
}

.menu-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
}

.menu-user .icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-user .icon svg {
  width: 19px;
  height: 19px;
}

.sidebar.collapsed .menu-user {
  justify-content: center;
  padding: 0.6rem;
}

/* Inhalt */

.content {
  flex: 1;
  padding: 2.5rem 2rem;
  min-width: 0;
}

.content h1 {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.content h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.content .subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Tabellen */

.table-wrap {
  margin-top: 1.5rem;
  max-width: 960px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.table-wrap-wide {
  max-width: 1200px;
}

.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.status-table th,
.status-table td {
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.status-table tbody tr:last-child td {
  border-bottom: none;
}

.status-table th {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-table td a {
  color: var(--accent);
  text-decoration: none;
}

.status-table td a:hover {
  text-decoration: underline;
}

.status-table td code {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
  font-size: 0.82rem;
}

.status-loading {
  color: var(--text-muted);
  white-space: normal;
}

.status-table td.commands-cell {
  white-space: normal;
}

.status-table tr.row-notable td {
  background: #fef2f2;
}

.status-table tr.raw-row td {
  padding-top: 0;
  white-space: normal;
  background: var(--surface-muted);
}

.status-table tr.raw-row pre {
  max-width: none;
}

/* Statuspunkte und Marken */

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 0.5rem;
  vertical-align: middle;
  background: var(--border-strong);
}

.dot.up { background: var(--ok); }
.dot.down { background: var(--bad); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  margin: 0.1rem 0.3rem 0.1rem 0;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.chip.active {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.chip.inactive {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.chip.unknown {
  background: #f1f5f9;
  color: var(--text-muted);
}

.chip-time {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

/* Formulare */

.admin-form {
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.admin-form label,
.form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

input, select, .status-table input, .status-table select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 0.45rem 0.6rem;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}

.admin-form input {
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.status-table input {
  width: 100%;
}

.btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #fff;
  padding: 0.45rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

.btn.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn.btn-secondary:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--text-muted);
}

.btn.btn-danger {
  background: var(--surface);
  color: var(--bad);
  border-color: #fecaca;
}

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

.form-error {
  color: var(--bad);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  font-size: 0.86rem;
  margin: 0 0 0.75rem;
}

/* Panels und Ausgaben */

.ssh-panel {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 0.25rem 0 1rem;
}

.ssh-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.ssh-panel .form-row {
  margin-bottom: 1rem;
}

.ssh-panel .table-wrap {
  margin-top: 0.5rem;
}

.ssh-panel ol {
  margin: 0.5rem 0 0.75rem;
  padding-left: 1.2rem;
  line-height: 1.7;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ssh-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.7rem;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  color: var(--text);
  max-width: 640px;
}

.ssh-output.ok { border-color: #bbf7d0; }

.ssh-output.error {
  border-color: #fecaca;
  color: #b91c1c;
}

/* Syslog-Status */

.syslog-status {
  margin: 1rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.syslog-status strong {
  color: var(--text);
  margin-right: 0.5rem;
}

.log-details {
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 0.5rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
}

.log-details:hover {
  text-decoration: underline;
}

/* Anmeldung */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #eef2f9 0%, #f8fafc 100%);
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 2.25rem 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.4rem;
}

.login-brand svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex-shrink: 0;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.login-card .subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.login-card .admin-form {
  max-width: none;
}

.login-card .btn {
  align-self: stretch;
  text-align: center;
  padding: 0.6rem;
  font-size: 0.92rem;
  margin-top: 0.25rem;
}
