:root {
  --bg: #edf7ff;
  --card: #ffffff;
  --line: #c8dff2;
  --line-strong: #8db8d6;
  --text: #123047;
  --muted: #547086;
  --accent: #2d7db8;
  --accent-soft: #d8ecfa;
  --danger: #a23232;
  --success: #1f7b53;
  --shadow: 0 10px 24px rgba(26, 79, 116, 0.08);
  --compact-gap: 8px;
  --compact-pad: 10px;
  --section-pad: 11px;
  --card-pad: 9px;
  --input-height: 36px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DejaVu Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(126, 196, 241, 0.2), transparent 28rem),
    linear-gradient(180deg, #f5fbff 0%, var(--bg) 100%);
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid rgba(141, 184, 214, 0.55);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.topbar-link.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.topbar-link.status-ok {
  border-color: rgba(31, 123, 83, 0.4);
  background: rgba(31, 123, 83, 0.12);
  color: var(--success);
}

.topbar-link.status-warning {
  border-color: rgba(184, 128, 45, 0.4);
  background: rgba(184, 128, 45, 0.12);
  color: #9a5f00;
}

.topbar-link.status-critical {
  border-color: rgba(162, 50, 50, 0.4);
  background: rgba(162, 50, 50, 0.12);
  color: var(--danger);
}

.topbar-link.status-unknown {
  border-color: rgba(84, 112, 134, 0.35);
  background: rgba(84, 112, 134, 0.12);
  color: var(--muted);
}

.restart-form {
  margin: 0;
}

.eyebrow,
.config-path,
.hint,
.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

h1 {
  margin: 1px 0 3px;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.primary-save,
.secondary-button,
.outline-button,
.danger-button,
.toggle-mask {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  min-height: 34px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}

.primary-save {
  background: linear-gradient(180deg, #4fa7df, var(--accent));
  color: #fff;
  min-width: 0;
}

.secondary-button,
.outline-button,
.toggle-mask {
  background: var(--card);
  color: var(--text);
}

.outline-button {
  border-color: rgba(45, 125, 184, 0.55);
}

.danger-button {
  background: #fff6f6;
  color: var(--danger);
  border-color: rgba(162, 50, 50, 0.35);
}

main {
  padding-top: 8px;
}

.status,
.errors {
  margin-bottom: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.status.success {
  border-color: rgba(31, 123, 83, 0.3);
  color: var(--success);
}

.status.error {
  border-color: rgba(162, 50, 50, 0.25);
  color: var(--danger);
}

.status.warning {
  border-color: rgba(184, 128, 45, 0.25);
  color: #9a5f00;
}

.errors {
  border-color: rgba(162, 50, 50, 0.25);
}

.hidden {
  display: none;
}

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

.status-overview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.status-overview.ok {
  border-color: rgba(31, 123, 83, 0.35);
  background: linear-gradient(180deg, rgba(232, 248, 239, 0.96), rgba(255, 255, 255, 0.98));
}

.status-overview.alert {
  border-color: rgba(162, 50, 50, 0.35);
  background: linear-gradient(180deg, rgba(255, 238, 238, 0.98), rgba(255, 255, 255, 0.98));
}

.status-overview-dot {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  background: #b7c8d5;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.status-overview.ok .status-overview-dot {
  background: var(--success);
}

.status-overview.alert .status-overview-dot {
  background: var(--danger);
}

.status-overview-text {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.status-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 12px;
}

.status-card.ok {
  border-color: rgba(31, 123, 83, 0.35);
}

.status-card.warning {
  border-color: rgba(184, 128, 45, 0.35);
}

.status-card.down {
  border-color: rgba(162, 50, 50, 0.35);
}

.status-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.status-card h2 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.status-summary {
  margin: 10px 0 8px;
  font-weight: 600;
}

.status-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.status-chip.ok {
  background: rgba(31, 123, 83, 0.14);
  color: var(--success);
}

.status-chip.warning {
  background: rgba(184, 128, 45, 0.14);
  color: #9a5f00;
}

.status-chip.down {
  background: rgba(162, 50, 50, 0.14);
  color: var(--danger);
}

.status-card-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-restart-form {
  margin: 0;
}

.log-panel {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.log-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.log-panel pre {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #f5fbff;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.4;
  max-height: 280px;
  overflow: auto;
}

.copy-source {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.copy-button.is-copied {
  border-color: rgba(31, 123, 83, 0.35);
  color: var(--success);
}

.section {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 8px 11px;
  cursor: pointer;
}

.section summary::-webkit-details-marker {
  display: none;
}

.section-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.section-body {
  padding: 0 var(--section-pad) var(--section-pad);
}

.section-error-list {
  margin: 0 0 0.9rem;
  padding-left: 1rem;
  color: var(--danger);
}

.section-warning-list {
  margin: 0 0 0.9rem;
  padding-left: 1rem;
  color: #9a5f00;
}

.grid,
.compact-grid {
  display: grid;
  gap: var(--compact-gap);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid-3 {
  display: grid;
  gap: var(--compact-gap);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.path-grid {
  display: grid;
  gap: var(--compact-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field,
.wide-field {
  display: grid;
  gap: 4px;
}

.wide-field {
  margin-top: 6px;
}

.compact-field {
  margin-top: 0;
}

label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--input-height);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 64px;
  resize: vertical;
}

.inline-toggle,
.mask-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.input-with-suffix input {
  flex: 1 1 auto;
}

.field-suffix {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.camera-list {
  display: grid;
  gap: var(--compact-gap);
}

.camera-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--card-pad);
  background: linear-gradient(180deg, rgba(216, 236, 250, 0.4), rgba(255, 255, 255, 0.95));
}

.camera-summary {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
}

.camera-summary-text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.camera-body {
  padding-top: 8px;
}

.camera-title {
  margin: 0;
  font-size: 0.96rem;
}

.camera-grid {
  display: grid;
  gap: var(--compact-gap);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.camera-wide {
  margin-top: var(--compact-gap);
}

.model-grid {
  display: grid;
  gap: var(--compact-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--compact-gap);
}

.model-card,
.model-upload,
.model-pending {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--card-pad);
  background: linear-gradient(180deg, rgba(216, 236, 250, 0.22), rgba(255, 255, 255, 0.96));
  margin-bottom: var(--compact-gap);
}

.model-card h3,
.model-upload h3,
.model-pending h3 {
  margin: 0 0 6px;
  font-size: 0.94rem;
}

.model-card p,
.model-upload p,
.model-pending p {
  margin: 4px 0;
}

.model-form {
  display: flex;
  align-items: center;
  gap: var(--compact-gap);
  flex-wrap: wrap;
}

.compact-copy-button {
  min-width: auto;
}

.auth-page {
  max-width: 34rem;
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.auth-card {
  width: min(100%, 28rem);
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.auth-submit {
  width: 100%;
}

.auth-pin-field {
  width: min(100%, 15rem);
}

.auth-pin-field input {
  max-width: 100%;
}

.camera-actions,
.section-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox-row input {
  width: auto;
}

.field-help {
  font-size: 11px;
  line-height: 1.3;
}

@media (max-width: 820px) {
  .form-grid-3,
  .form-grid-2,
  .path-grid,
  .camera-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .restart-form {
    width: 100%;
  }

  .primary-save,
  .secondary-button,
  .outline-button {
    width: 100%;
  }

  .page {
    padding: 8px;
  }
}

/* BW-CONFIG-COMPACT-START */

:root {
  --input-height: 32px;
}

/* Feineres, kompakteres Schriftbild */
body {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 400;
}

h1 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 600;
}

h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 600;
}

h3,
legend {
  margin-top: 0;
  margin-bottom: 5px;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
}

p {
  margin-top: 3px;
  margin-bottom: 6px;
}

/* Seitenbreite und Außenabstände */
main,
.container,
.page,
.shell,
.content {
  max-width: 1400px;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Karten und Formularbereiche */
section,
fieldset,
.card,
.panel {
  margin-top: 6px;
  margin-bottom: 6px;
  padding: 10px;
  border-radius: 8px;
}

/* Formularraster */
.grid,
.form-grid,
.form-row,
.fields,
.row,
.toolbar,
.actions {
  gap: 7px;
}

/* Feldbeschriftungen bewusst nicht fett */
label,
.label {
  margin-bottom: 2px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 400;
}

/* Kompakte Eingabefelder */
input:not([type="checkbox"]):not([type="radio"]),
select,
button,
.button,
.btn {
  min-height: 32px;
  height: 32px;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 400;
}

textarea {
  min-height: 58px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 400;
}

button,
.button,
.btn {
  width: auto;
  padding-left: 10px;
  padding-right: 10px;
  font-weight: 500;
}

/* Checkboxen bleiben klein */
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0 5px 0 0;
}

/* Hilfetexte */
small,
.help,
.hint,
.description,
.muted {
  font-size: 11px;
  line-height: 1.25;
}

/* Ein-/ausklappbare Bereiche */
details {
  margin-top: 5px;
  margin-bottom: 5px;
}

summary {
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 500;
}

/* Tabellen */
table {
  font-size: 12px;
}

th,
td {
  padding: 5px 7px;
}

/* Smartphone: kompakt, aber noch gut antippbar */
@media (max-width: 820px) {
  main,
  .container,
  .page,
  .shell,
  .content {
    padding: 6px;
  }

  section,
  fieldset,
  .card,
  .panel {
    padding: 8px;
  }

  .grid,
  .form-grid,
  .form-row,
  .fields,
  .row {
    gap: 6px;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  button,
  .button,
  .btn {
    min-height: 38px;
    height: 38px;
    font-size: 14px;
  }

  textarea {
    min-height: 68px;
    font-size: 14px;
  }
}

/* BW-CONFIG-COMPACT-END */
