:root {
  color-scheme: dark;
  --color-bg: #0a0c14;
  --color-surface: #151827;
  --color-surface-alt: #1c1f33;
  --color-border: #2b2f47;
  --color-text: #eceef7;
  --color-text-muted: #9296b5;
  --color-primary: #818cf8;
  --color-primary-hover: #a5b4fc;
  --color-accent: #c084fc;
  --color-danger: #f87171;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 10px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3), 0 24px 48px rgba(0, 0, 0, 0.4);

  --status-laeuft-fg: #4ade80;
  --status-laeuft-bg: rgba(74, 222, 128, 0.14);
  --status-laeuft-border: rgba(74, 222, 128, 0.4);
  --status-ruestet-fg: #fbbf24;
  --status-ruestet-bg: rgba(251, 191, 36, 0.14);
  --status-ruestet-border: rgba(251, 191, 36, 0.4);
  --status-steht-fg: #f87171;
  --status-steht-bg: rgba(248, 113, 113, 0.14);
  --status-steht-border: rgba(248, 113, 113, 0.4);
  --status-wartung-fg: #60a5fa;
  --status-wartung-bg: rgba(96, 165, 250, 0.14);
  --status-wartung-border: rgba(96, 165, 250, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(129, 140, 248, 0.1), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(192, 132, 252, 0.08), transparent 45%),
    var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0 0 0.25rem; letter-spacing: -0.01em; color: var(--color-text); }

button, input, select, textarea, a {
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
  font-family: inherit;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 999px; }
* { scrollbar-color: var(--color-border) transparent; }

/* Brand mark */
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #14162b;
  box-shadow: 0 4px 14px rgba(129, 140, 248, 0.35);
}
.brand-icon svg { width: 22px; height: 22px; }
.brand-text h1 { line-height: 1.15; }

/* Auth pages */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: linear-gradient(180deg, var(--color-surface-alt), var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.auth-card .brand { margin-bottom: 1.5rem; }

.auth-subtitle {
  color: var(--color-text-muted);
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.auth-form input {
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  background: #0f111c;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.22);
}

button {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #14162b;
  box-shadow: 0 2px 8px rgba(129, 140, 248, 0.25);
}

button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(129, 140, 248, 0.4); }
button:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(129, 140, 248, 0.3); }

.form-error {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin: 0;
}

.link-button {
  background: none;
  color: var(--color-text-muted);
  padding: 0.3rem 0.6rem;
  text-decoration: underline;
  box-shadow: none;
  font-weight: 500;
}
.link-button:hover { background: none; color: var(--color-text); transform: none; box-shadow: none; }

/* Header */
.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.company-name {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.header-meta a { color: var(--color-primary-hover); text-decoration: none; font-weight: 600; }
.header-meta a:hover { text-decoration: underline; }

/* Board table */
.board-main, .edit-main { padding: 1.5rem; }

.table-scroll {
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.board-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
  font-size: 1.02rem;
}

.board-table th, .board-table td {
  padding: 1rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.board-table th {
  background: var(--color-surface-alt);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-weight: 700;
}

.board-table tbody tr:hover { background: var(--color-surface-alt); }
.board-table tbody tr:hover .sticky-col { background: var(--color-surface-alt); }
.board-table tbody tr:last-child td { border-bottom: none; }

.sticky-col {
  position: sticky;
  left: 0;
  background: var(--color-surface);
  font-weight: 700;
  font-size: 1.08rem;
  z-index: 1;
}

.board-table th.sticky-col { background: var(--color-surface-alt); z-index: 2; }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.status-badge[data-status="laeuft"], select[data-status="laeuft"] { background: var(--status-laeuft-bg); color: var(--status-laeuft-fg); border-color: var(--status-laeuft-border); }
.status-badge[data-status="ruestet"], select[data-status="ruestet"] { background: var(--status-ruestet-bg); color: var(--status-ruestet-fg); border-color: var(--status-ruestet-border); }
.status-badge[data-status="steht"], select[data-status="steht"] { background: var(--status-steht-bg); color: var(--status-steht-fg); border-color: var(--status-steht-border); }
.status-badge[data-status="wartung"], select[data-status="wartung"] { background: var(--status-wartung-bg); color: var(--status-wartung-fg); border-color: var(--status-wartung-border); }

.status-select {
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.status-select:focus { outline: none; border-color: currentColor; }

.employee-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.88rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
}

.chip-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  box-shadow: none;
}
.chip-remove:hover { background: none; color: var(--color-danger); transform: none; box-shadow: none; }

.empty-cell { color: var(--color-text-muted); }
.empty-state { text-align: center; color: var(--color-text-muted); padding: 2rem !important; }

.shift-cell { display: flex; flex-direction: column; gap: 0.4rem; min-width: 170px; }
.chip-list { display: flex; flex-wrap: wrap; }
.add-employee-select { font-size: 0.82rem; padding: 0.35rem; border: 1.5px dashed var(--color-border); border-radius: 8px; color: var(--color-text-muted); background: transparent; }
.add-employee-select:hover { border-color: var(--color-primary); color: var(--color-primary-hover); }

.remark-input {
  width: 100%;
  min-width: 170px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 0.45rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  resize: vertical;
  background: transparent;
}
.remark-input:hover { border-color: var(--color-border); }
.remark-input:focus { outline: none; border-color: var(--color-primary); background: #0f111c; box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.18); }

.remark-cell { white-space: pre-wrap; color: var(--color-text); max-width: 240px; }

/* News banner (durchlaufendes Laufband) */
.news-banner {
  position: sticky;
  bottom: 0;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #c026d3);
  color: #fdfdff;
  padding: 0.9rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.1rem;
  font-weight: 500;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.news-banner-label {
  flex-shrink: 0;
  margin-left: 1.5rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.news-banner-viewport {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  margin-right: 1.5rem;
}

.news-banner-track {
  display: inline-block;
  padding-left: 100%;
  white-space: nowrap;
  animation: news-marquee 24s linear infinite;
}

@keyframes news-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .news-banner-track { animation: none; padding-left: 0; }
}

/* Edit layout */
.edit-main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.date-form { margin-bottom: 1rem; }
.date-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); width: fit-content; }
.date-form input { padding: 0.45rem 0.7rem; border: 1.5px solid var(--color-border); border-radius: 10px; background: #0f111c; color: var(--color-text); }
.date-form input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2); }

.management-panels { display: flex; flex-direction: column; gap: 1.5rem; }

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.35rem;
  box-shadow: var(--shadow-md);
}

.panel h2 {
  font-size: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--color-border);
}

.master-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.master-item { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.65rem; border-radius: 10px; background: var(--color-surface-alt); }
.master-name { flex: 1; word-break: break-word; font-weight: 500; }
.master-item.inactive { opacity: 0.5; }
.master-actions { display: flex; gap: 0.4rem; }
.master-actions button { background: none; color: var(--color-text-muted); border: 1.5px solid var(--color-border); padding: 0.3rem 0.6rem; font-size: 0.78rem; box-shadow: none; font-weight: 600; }
.master-actions button:hover { background: var(--color-surface); border-color: var(--color-primary); color: var(--color-primary-hover); transform: none; box-shadow: none; }
.master-empty { color: var(--color-text-muted); font-size: 0.85rem; }

.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 120px; padding: 0.5rem 0.65rem; border: 1.5px solid var(--color-border); border-radius: 10px; background: #0f111c; color: var(--color-text); }
.inline-form input:focus, .inline-form select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2); }
.inline-form-stacked { display: flex; flex-direction: column; gap: 0.6rem; }
.inline-form-stacked textarea { padding: 0.55rem; border: 1.5px solid var(--color-border); border-radius: 10px; font-family: inherit; background: #0f111c; color: var(--color-text); }
.inline-form-stacked textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2); }
.panel-actions { display: flex; align-items: center; gap: 0.75rem; }
.save-status { color: var(--status-laeuft-fg); font-size: 0.85rem; font-weight: 600; }

/* Admin dashboard */
.admin-main { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; max-width: 900px; margin: 0 auto; }
.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.6rem; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
.admin-table th { color: var(--color-text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-table code { background: var(--color-surface-alt); padding: 0.15rem 0.4rem; border-radius: 5px; color: var(--color-primary-hover); }
.admin-main label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 0.75rem; max-width: 320px; }
.admin-main select { padding: 0.45rem 0.65rem; border: 1.5px solid var(--color-border); border-radius: 10px; background: #0f111c; color: var(--color-text); }
.admin-main select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2); }

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

@media (max-width: 600px) {
  .board-header { flex-direction: column; align-items: flex-start; position: static; }
  .board-main, .edit-main, .admin-main { padding: 1rem; }
}
