:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-strong: #f9fbfb;
  --ink: #17201d;
  --muted: #69756f;
  --line: #dfe7e3;
  --green: #1f7a5a;
  --green-soft: #e5f3ed;
  --blue: #2764a2;
  --blue-soft: #e8f1fb;
  --amber: #a66710;
  --amber-soft: #fff3dc;
  --red: #b13a35;
  --red-soft: #fdebea;
  --shadow: 0 16px 40px rgba(37, 50, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #10231d;
  color: #eef7f1;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #d9f2e5;
  color: #163326;
  font-weight: 800;
}

.brand-title {
  font-size: 17px;
  font-weight: 750;
}

.brand-subtitle {
  margin-top: 2px;
  color: #b7c7bf;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #d7e4dd;
  text-decoration: none;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-panel {
  margin-top: 32px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.panel-label,
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .panel-label {
  color: #acc1b7;
}

.panel-value {
  color: #ffffff;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.content {
  width: 100%;
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.button:hover {
  border-color: #b7c7bf;
}

.button.primary {
  border-color: #1f7a5a;
  background: #1f7a5a;
  color: #ffffff;
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  text-decoration: none;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.section {
  margin-bottom: 26px;
}

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

.section-header.compact {
  margin-bottom: 10px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.workflow-card,
.table-surface,
.action-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 118px;
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 8px;
  font-size: 34px;
  font-weight: 780;
  line-height: 1;
}

.metric-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.action-band {
  margin-top: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-left: 4px solid var(--green);
}

.action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok,
.chip.ok {
  border-color: #b7dccd;
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.warn,
.chip.warn {
  border-color: #f1d7a8;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.danger,
.chip.danger {
  border-color: #efb8b5;
  background: var(--red-soft);
  color: var(--red);
}

.chip.info {
  border-color: #b9d3ed;
  background: var(--blue-soft);
  color: var(--blue);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.workflow-card {
  min-height: 240px;
  padding: 16px;
}

.action-card {
  display: flex;
  flex-direction: column;
  min-height: 235px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.action-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.action-card h3 {
  margin: 10px 0 8px;
}

.action-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.action-meta {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.workflow-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.workflow-title {
  font-size: 15px;
  font-weight: 760;
  line-height: 1.35;
}

.workflow-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.mini-stat {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.check-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.check-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--green);
}

.check-row.failed .check-dot {
  background: var(--red);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.table-surface {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

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

@media (max-width: 1180px) {
  .workflow-grid,
  .action-grid,
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .content {
    padding: 20px;
  }

  .topbar,
  .action-band,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-strip,
  .action-grid,
  .workflow-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Einstellungen ─────────────────────────────────────────── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 560px;
}

.settings-info {
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.settings-info .chip {
  display: inline-block;
  margin-right: 0.4rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.02em;
}

.form-input {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.form-hint code {
  background: var(--surface-alt, #f0f0f5);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.85em;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input-row .form-input {
  flex: 1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.25rem;
}

.save-status {
  font-size: 0.83rem;
  font-weight: 500;
  transition: opacity 0.3s;
}

.save-status.ok   { color: #22a85a; }
.save-status.error { color: #e05252; }

/* ── GuV ─────────────────────────────────────────────────── */
.guv-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.guv-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.guv-tab {
  min-height: 32px;
  padding: 0 13px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.guv-tab:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.guv-tab.active {
  background: var(--green);
  color: #ffffff;
}

.guv-custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.guv-date-input {
  width: 148px;
}

.guv-machine-select {
  width: auto;
  min-width: 180px;
  max-width: 280px;
}

.guv-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.guv-kpis .metric-value {
  font-size: 26px;
}

.guv-negative {
  color: var(--red);
}

.guv-table {
  margin-top: 14px;
}

.guv-status {
  margin-top: 8px;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .guv-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
