:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --line: #d9ded5;
  --text: #1f2a28;
  --muted: #65716d;
  --primary: #176b5b;
  --primary-strong: #0e4f42;
  --accent: #c46a1a;
  --danger: #a4382f;
  --shadow: 0 4px 14px rgba(31, 42, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

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

button {
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  padding: 0.68rem 0.95rem;
}

button:hover {
  background: var(--primary-strong);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0.62rem 0.7rem;
}

textarea {
  resize: vertical;
}

label span {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

main,
.app-header,
.tabs {
  width: min(1320px, calc(100% - 32px));
  margin-inline: auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 0 1rem;
}

.app-header h1,
h2,
h3,
p {
  margin: 0;
}

.app-header h1 {
  font-size: clamp(1.8rem, 2.6vw, 2.7rem);
  letter-spacing: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-actions,
.section-heading,
.form-actions,
.inline-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 1.1rem;
}

.status-pill,
.priority {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 28px;
  border-radius: 999px;
  background: #e7eee9;
  color: var(--primary-strong);
  font-size: 0.84rem;
  font-weight: 750;
  padding: 0.22rem 0.65rem;
}

.tabs {
  display: flex;
  gap: 0.45rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.2rem;
}

.tab {
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 0.85rem 1rem;
}

.tab:hover,
.tab.is-active {
  background: var(--surface);
  color: var(--primary-strong);
}

.tab.is-active {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.tab-panel {
  display: none;
  padding-bottom: 2rem;
}

.tab-panel.is-active {
  display: block;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-heading p,
.admin-login p {
  color: var(--muted);
}

.overview-grid,
.admin-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.8fr;
  gap: 1rem;
}

.admin-grid {
  display: block;
}

.surface {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.surface h3 {
  margin-bottom: 0.85rem;
  font-size: 1.06rem;
}

.calendar-surface {
  margin-bottom: 1rem;
}

.contact-surface {
  box-shadow: none;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.calendar-toolbar h3 {
  margin: 0;
  text-align: center;
  text-transform: capitalize;
}

.calendar-actions {
  display: flex;
  gap: 0.5rem;
}

.calendar-weekdays,
.month-calendar {
  display: grid;
}

.calendar-weekdays {
  grid-template-columns: 180px repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #eef2ee;
}

.calendar-weekdays span {
  min-height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.month-calendar {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.weekend-row {
  display: grid;
  grid-template-columns: 180px repeat(2, minmax(0, 1fr));
  min-height: 150px;
  border-bottom: 1px solid var(--line);
}

.weekend-row:last-child {
  border-bottom: 0;
}

.weekend-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  border-right: 1px solid var(--line);
  background: #f4f6f2;
  padding: 0.75rem;
}

.weekend-label span {
  color: var(--muted);
  font-size: 0.9rem;
}

.calendar-day {
  min-height: 135px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fffaf3;
  color: var(--text);
  padding: 0.75rem;
  text-align: left;
}

.calendar-day:hover {
  background: #f5faf6;
}

.calendar-day:last-child {
  border-right: 0;
}

.calendar-day.is-muted {
  background: #f4f6f2;
  color: var(--muted);
}

.calendar-day.is-weekend {
  background: #fff9f1;
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.day-title {
  font-weight: 800;
}

.is-today .day-title {
  color: var(--accent);
}

.day-events {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.calendar-event,
.calendar-more {
  overflow: hidden;
  border-radius: 6px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  padding: 0.24rem 0.36rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-event {
  background: var(--primary);
}

.machine-event {
  background: #5e6478;
}

.calendar-more {
  background: #e7eee9;
  color: var(--primary-strong);
}

.calendar-empty {
  color: var(--muted);
  font-size: 0.88rem;
}

.contact-list {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.2fr) minmax(110px, 0.8fr);
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 0.62rem 0.75rem;
}

.contact-row:last-child {
  border-bottom: 0;
}

.contact-row strong {
  color: var(--primary-strong);
}

.contact-row span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.assignment-list,
.machine-list,
.technician-list,
.compact-list {
  display: grid;
  gap: 0.75rem;
}

.admin-section .compact-list {
  max-width: 980px;
}

.item-card,
.compact-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 0.85rem;
}

.item-card header,
.compact-row header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.item-card strong,
.compact-row strong {
  display: block;
}

.meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.note {
  margin-top: 0.5rem;
  color: var(--text);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 1rem;
}

.priority.hoch {
  background: #f8e3de;
  color: var(--danger);
}

.priority.niedrig {
  background: #eceef5;
  color: #445078;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.82rem 0.9rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef2ee;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
}

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

.admin-login {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.admin-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary-strong);
  white-space: nowrap;
}

.admin-tab:hover,
.admin-tab.is-active {
  background: var(--primary);
  color: #fff;
}

.admin-section {
  display: none;
  box-shadow: none;
}

.admin-section.is-active {
  display: block;
}

.inline-form {
  align-items: end;
}

.stack-form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 980px;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.split.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.check-row input {
  width: auto;
}

.check-row span {
  margin: 0;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary-strong);
}

.secondary-button:hover {
  background: #eef2ee;
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #842920;
}

.row-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 36px;
  padding: 0.42rem 0.7rem;
}

@media (max-width: 980px) {
  .overview-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .app-header,
  .section-heading,
  .admin-login,
  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-form {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  main,
  .app-header,
  .tabs {
    width: min(100% - 20px, 1320px);
  }

  .tabs {
    overflow-x: auto;
  }

  .split,
  .split.three {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .calendar-weekdays,
  .month-calendar {
    min-width: 760px;
  }

  .calendar-surface {
    overflow-x: auto;
  }

  .contact-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
