/* ===== Basis ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family-base);
  font-weight: 400;
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-text-size-adjust: 100%;
}

h1 {
  font-family: var(--font-family-base);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-primary);
}

h2,
h3,
h4 {
  font-family: var(--font-family-base);
  font-weight: 700;
  color: var(--color-anthracite);
}

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

.hidden {
  display: none !important;
}

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

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

/* ===== Buttons (CD) ===== */
.button-primary,
button.primary,
.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
  border: 1px solid var(--color-primary);
  font-family: var(--font-family-base);
  font-weight: 700;
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  min-height: 40px;
  cursor: pointer;
}

.button-primary:hover,
button.primary:hover,
.btn-primary:hover {
  background: var(--color-anthracite);
  border-color: var(--color-anthracite);
  color: var(--color-white);
}

.button-primary:disabled,
button.primary:disabled,
.btn-primary:disabled {
  background: rgba(95, 123, 142, 0.35);
  border-color: rgba(95, 123, 142, 0.35);
  color: var(--color-white);
  cursor: not-allowed;
}

.button-secondary,
.btn-secondary {
  background: var(--color-white);
  color: var(--color-anthracite);
  border: 1px solid var(--color-grey-blue);
  font-family: var(--font-family-base);
  font-weight: 700;
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  min-height: 40px;
  cursor: pointer;
}

.button-secondary:hover,
.btn-secondary:hover {
  background: var(--color-grey-blue);
  color: var(--color-white);
}

.button-danger,
button.danger {
  color: var(--color-primary);
  border: 1px solid rgba(230, 51, 42, 0.45);
  background: rgba(230, 51, 42, 0.06);
  font-family: var(--font-family-base);
  font-weight: 700;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  min-height: 40px;
  cursor: pointer;
}

.button-danger:hover,
button.danger:hover {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.button-small,
.btn-small,
.mini-button {
  padding: 6px 12px;
  min-height: 32px;
  font-size: var(--font-size-xs);
}

.btn {
  font-family: var(--font-family-base);
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  min-height: 40px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 12px 20px;
  font-size: var(--font-size-base);
}

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border-strong);
}

.btn-ghost:hover {
  background: var(--color-surface-soft);
  color: var(--color-anthracite);
}

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

button:not([class]),
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-anthracite);
  padding: 10px 18px;
  font-weight: 700;
  font-size: var(--font-size-sm);
  text-decoration: none;
  cursor: pointer;
}

button:not([class]):hover,
.button-link:hover {
  border-color: var(--color-grey-blue);
  color: var(--color-grey-blue);
}

button:focus-visible,
.button-primary:focus-visible,
.button-secondary:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== Formulare ===== */
input,
select,
textarea,
.input,
.select,
.textarea {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  color: var(--color-anthracite);
  background: var(--color-white);
  border: 1px solid var(--color-grey-blue);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 40px;
  width: 100%;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(230, 51, 42, 0.15);
}

label,
.label {
  display: grid;
  gap: 6px;
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-anthracite);
}

.form-error {
  color: var(--color-primary);
  font-family: var(--font-family-base);
  font-size: 13px;
  margin-top: 4px;
}

.input-error,
.field-error input,
.field-error select,
.field-error textarea {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(230, 51, 42, 0.15);
}

/* ===== Cards ===== */
.card {
  background: var(--color-white);
  border: 1px solid rgba(95, 123, 142, 0.25);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(28, 43, 57, 0.08);
  padding: var(--spacing-lg);
}

.card-highlight {
  border-left: 5px solid var(--color-primary);
}

.card-title {
  font-family: var(--font-family-base);
  font-weight: 700;
  color: var(--color-anthracite);
}

/* ===== Tabellen ===== */
.table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
}

.table th,
.data-table th {
  background: var(--color-grey-blue);
  color: var(--color-white);
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(95, 123, 142, 0.25);
}

.table td,
.data-table td {
  color: var(--color-anthracite);
  border-bottom: 1px solid rgba(95, 123, 142, 0.25);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.table tr:hover,
.data-table tbody tr:hover {
  background: rgba(95, 123, 142, 0.08);
}

.data-table tbody tr.selected {
  background: rgba(95, 123, 142, 0.12);
}

/* ===== Badges / Pills ===== */
.badge,
.pill {
  font-family: var(--font-family-base);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
}

.badge {
  background: var(--color-status-open-bg);
  color: var(--color-status-open-text);
}

.pill {
  background: var(--color-surface-soft);
  color: var(--color-anthracite);
}

.pill.good,
.badge.ok,
.badge.status-erledigt {
  background: var(--color-status-done-bg);
  color: var(--color-status-done-text);
  border: 1px solid var(--color-status-done-border);
}

.pill.warn,
.badge.warn,
.badge.status-in-bearbeitung,
.badge.status-rueckfrage {
  background: var(--color-status-progress-bg);
  color: var(--color-status-progress-text);
}

.pill.bad,
.badge.status-eingegangen {
  background: var(--color-status-open-bg);
  color: var(--color-status-open-text);
}

.badge.status-kritisch,
.pill.critical {
  background: var(--color-status-critical-bg);
  color: var(--color-status-critical-text);
}

/* ===== Navigation ===== */
.nav-item {
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-family-base);
  font-weight: 700;
  text-decoration: none;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--color-white);
  background: rgba(95, 123, 142, 0.35);
  border-color: rgba(95, 123, 142, 0.45);
}

.nav-item.active {
  color: var(--color-primary);
  background: var(--color-white);
  border-color: var(--color-white);
}

/* ===== Messages ===== */
.message {
  margin: 0;
  min-height: 1.2rem;
  font-size: var(--font-size-sm);
}

.message.error,
.auth-message.error {
  color: var(--color-primary);
}

.message.ok {
  color: var(--color-grey-blue);
}

.message.warn,
.auth-message.warn {
  color: var(--color-anthracite);
}

.message.info,
.auth-message.info {
  color: var(--color-grey-blue);
}

/* ===== Modals ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--spacing-md);
  background: rgba(28, 43, 57, 0.55);
}

.modal {
  width: min(520px, 100%);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(28, 43, 57, 0.2);
  padding: var(--spacing-md);
}

.modal h3,
.modal-header {
  margin: 0 0 0.4rem;
  color: var(--color-anthracite);
  font-weight: 700;
}

.modal-body {
  color: var(--color-anthracite);
  font-family: var(--font-family-base);
}

.modal-primary-action {
  background: var(--color-primary);
  color: var(--color-white);
}

/* ===== Headline accent (dezent) ===== */
.headline-frame {
  position: relative;
}

.headline-frame::before,
.headline-frame::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--color-anthracite);
  pointer-events: none;
}

.headline-frame::before {
  top: -4px;
  left: -4px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.headline-frame::after {
  bottom: -4px;
  right: -4px;
  border-bottom: 2px solid;
  border-right: 2px solid;
}
