/* ======================================================================
   APP-UI (shared) — 1Grain.Connect interner Bereich
   Gemeinsame Inhalts-Komponenten aller internen Seiten (Aufträge, Kunden,
   Bewertungen): Tokens, Page-Head, Cards, Badges, Buttons, Tabellen,
   Pipeline, Detail-Grids, Leer-/Lade-/Fehlerzustände.

   Single Source of Truth: NICHT in Seiten-Stylesheets kopieren.
   Einheitensystem: rem (1rem = 16px); px nur für Border-/Icon-Maße.
   Ergänzt das App-Shell-Modul (assets/css/app-shell.css).
   ====================================================================== */

/* ===== 1. TOKENS ===== */
:root {
  --container-max: 73.125rem;    /* 1170px */
  --container-pad: 0.9375rem;    /* 15px */
  --navy: #253449;
  --navy-deep: #1a2e4a;
  --teal: #4aa0a0;
  --teal-soft: rgba(74, 160, 160, 0.12);
  --gold: #EAB85E;
  --ink: #0F1317;
  --light: #f6f6f6;
  --white: #ffffff;
  --border: #e3e7ec;
  --text-muted: #5b6774;
  --error: #d64545;
  --success: #2f9e6b;
  --font-head: 'Outfit', sans-serif;
  --font-content: 'Nunito Sans', sans-serif;
  --radius-card: 1rem;           /* 16px */
  --radius-field: 0.625rem;      /* 10px */
  --shadow-card: 0 8px 30px rgba(15, 19, 23, 0.08);
  --shadow-hover: 0 16px 40px rgba(15, 19, 23, 0.14);
}

/* ===== 2. BASE / RESET / CONTAINER ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-content);
  color: var(--ink);
  background: var(--light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font-family: var(--font-content); }
.svg-sprite { display: none; }
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  width: 100%;
}

/* ===== 3. PAGE HEAD (Eyebrow wie Hauptseiten-Labels, Teal) ===== */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.25rem; }
.page-eyebrow {
  font-size: 0.875rem;           /* 14px */
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.page-title {
  font-size: 2.25rem;            /* 36px */
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-top: 0.375rem;          /* 6px */
}
.page-intro {
  margin-top: 0.75rem;           /* 12px */
  max-width: 46rem;
  font-size: 1.0625rem;          /* 17px */
  line-height: 1.7;
  color: var(--text-muted);
}

/* ===== 4. BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;               /* 16px */
  font-weight: 700;
  color: var(--white);
  background: var(--teal);
  border: none;
  border-radius: 1.875rem;       /* 30px */
  padding: 0.625rem 1.25rem;     /* 10px 20px */
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: 0.6; pointer-events: none; }
.btn--ghost {
  color: var(--navy);
  background: transparent;
  border: 2px solid var(--navy);
  padding: calc(0.625rem - 2px) calc(1.25rem - 2px);
}
.btn--ghost:hover { filter: none; background: rgba(37, 52, 73, 0.06); }
.btn--sm { font-size: 0.875rem; padding: 0.375rem 0.875rem; } /* 14px / 6px 14px */
.btn--danger {
  color: var(--white);
  background: var(--error);
}
.btn--danger:hover { filter: brightness(1.08); }
.btn-icon { width: 16px; height: 16px; } /* Icon-Maß in px */

/* ===== 5. BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;                /* 5px */
  padding: 0.1875rem 0.5625rem;  /* 3px 9px */
  border-radius: 999px;
  font-size: 0.75rem;            /* 12px */
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}
.badge--open { color: #a06a12; background: rgba(234, 184, 94, 0.18); }
.badge--done { color: var(--success); background: rgba(47, 158, 107, 0.14); }
.badge--teal { color: var(--teal); background: var(--teal-soft); }
.badge--muted { color: var(--text-muted); background: rgba(91, 103, 116, 0.12); }

/* ===== 6. CARD / PANEL ===== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;               /* 24px */
}
.card + .card { margin-top: 1.25rem; }
.card-title {
  font-family: var(--font-head);
  font-size: 1.125rem;           /* 18px */
  font-weight: 600;
  color: var(--navy);
}
.card-sub { margin-top: 0.25rem; font-size: 0.9375rem; color: var(--text-muted); } /* 15px */
.section-title {
  font-family: var(--font-head);
  font-size: 1.375rem;           /* 22px */
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1rem;           /* 16px */
}

/* ===== 7. STAT-ROW (Kennzahlen) ===== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.875rem;                 /* 14px */
  margin-top: 1.5rem;
}
.stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  padding: 1rem 1.125rem;        /* 16px 18px */
}
.stat-value {
  font-family: var(--font-head);
  font-size: 1.75rem;            /* 28px */
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}
.stat-label {
  margin-top: 0.25rem;
  font-size: 0.8125rem;          /* 13px */
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ===== 8. PIPELINE (Offen | Erledigt) ===== */
.pipeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;                  /* 20px */
  margin-top: 1.5rem;
}
.pipeline-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;                  /* 12px */
  padding: 1rem;                 /* 16px */
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.55);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pipeline-col.is-drop { border-color: var(--teal); background: var(--teal-soft); }
.pipeline-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;        /* 8px */
  border-bottom: 1px solid var(--border);
}
.pipeline-col-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-size: 1.125rem;           /* 18px */
  font-weight: 600;
  color: var(--navy);
}
.pipeline-dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; } /* 10px */
.pipeline-dot--open { background: var(--gold); }
.pipeline-dot--done { background: var(--success); }
.pipeline-count {
  min-width: 1.75rem;            /* 28px */
  padding: 0.125rem 0.5rem;      /* 2px 8px */
  text-align: center;
  font-size: 0.8125rem;          /* 13px */
  font-weight: 700;
  color: var(--navy);
  background: rgba(37, 52, 73, 0.08);
  border-radius: 999px;
}
.pipeline-list { display: flex; flex-direction: column; gap: 0.75rem; min-height: 4rem; } /* 12px / 64px */
.pipeline-empty {
  padding: 1.5rem 0.75rem;       /* 24px 12px */
  text-align: center;
  font-size: 0.875rem;           /* 14px */
  color: var(--text-muted);
}

/* ===== 9. ORDER-CARD ===== */
.order-card {
  position: relative;
  display: block;
  padding: 0.875rem 1rem;        /* 14px 16px */
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  box-shadow: 0 2px 10px rgba(15, 19, 23, 0.05);
  cursor: grab;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.order-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.order-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.order-card.is-dragging { opacity: 0.5; cursor: grabbing; }
.order-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.625rem; }
.order-customer {
  font-family: var(--font-head);
  font-size: 1.0625rem;          /* 17px */
  font-weight: 600;
  color: var(--navy);
  line-height: 1.25;
}
.order-service { margin-top: 0.1875rem; font-size: 0.875rem; color: var(--text-muted); } /* 14px */
.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.75rem;         /* 6px 12px */
  margin-top: 0.625rem;          /* 10px */
  font-size: 0.8125rem;          /* 13px */
  color: var(--text-muted);
}
.order-value { font-weight: 700; color: var(--navy); }
.order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;           /* 12px */
  padding-top: 0.625rem;         /* 10px */
  border-top: 1px dashed var(--border);
}
.order-move {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;          /* 13px */
  font-weight: 700;
  color: var(--teal);
  background: transparent;
  border: none;
  padding: 0.25rem 0.375rem;     /* 4px 6px */
  border-radius: 0.375rem;       /* 6px */
  cursor: pointer;
}
.order-move:hover { background: var(--teal-soft); }
.order-move--done { color: var(--success); }

/* ===== 10. LISTE (Kunden/Reviews) ===== */
.list { display: flex; flex-direction: column; gap: 0.625rem; } /* 10px */
.list-row {
  display: flex;
  align-items: center;
  gap: 1rem;                     /* 16px */
  padding: 0.9375rem 1.125rem;   /* 15px 18px */
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
a.list-row:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); border-color: var(--teal); }
.list-main { flex: 1; min-width: 0; }
.list-name {
  font-family: var(--font-head);
  font-size: 1.0625rem;          /* 17px */
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}
.list-sub { margin-top: 0.125rem; font-size: 0.875rem; color: var(--text-muted); word-break: break-word; } /* 14px */
.list-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.375rem; text-align: right; }
.list-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.list-arrow { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; } /* Icon-Maß in px */

/* ===== 11. DETAIL-GRID / KEY-VALUE ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.875rem 1.5rem;          /* 14px 24px */
}
.detail-item { min-width: 0; }
.detail-label {
  font-size: 0.75rem;            /* 12px */
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.detail-value { margin-top: 0.125rem; font-size: 1rem; color: var(--ink); word-break: break-word; } /* 16px */
.detail-value--strong { font-weight: 700; color: var(--navy); }

/* ===== 11b. DETAIL-SEITE (gemeinsam für Auftrag/Kunde) ===== */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;                 /* 6px */
  font-size: 0.875rem;           /* 14px */
  font-weight: 700;
  color: var(--teal);
  text-decoration: none;
}
.detail-back:hover { text-decoration: underline; }
.detail-back-icon { width: 16px; height: 16px; } /* Icon-Maß in px */
.detail-head { margin-top: 1.25rem; margin-bottom: 1.5rem; } /* 20px / 24px */
.detail-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.detail-title { font-size: 2rem; font-weight: 600; color: var(--navy); margin-top: 0.625rem; } /* 32px / 10px */
.detail-badges { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.625rem; } /* 6px / 10px */
.detail-section + .detail-section { margin-top: 1.25rem; } /* 20px */
.detail-section-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; } /* 16px */
.detail-section-title { font-size: 1.125rem; font-weight: 600; color: var(--navy); } /* 18px */
.order-comment {
  margin-top: 1rem;              /* 16px */
  padding: 0.875rem 1rem;        /* 14px 16px */
  background: var(--light);
  border-radius: var(--radius-field);
  font-size: 0.9375rem;          /* 15px */
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ===== 11c. SUCHLEISTE ===== */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 1.5rem;            /* 24px */
}
.search-icon {
  position: absolute;
  left: 0.875rem;                /* 14px */
  width: 18px; height: 18px;     /* Icon-Maß in px */
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.6875rem 0.875rem 0.6875rem 2.5rem; /* 11px 14px 11px 40px */
  font-size: 1rem;               /* 16px — kein iOS Zoom */
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(74, 160, 160, 0.18);
}

/* ===== 11d. FELD / SELECT (Filter) ===== */
.field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; } /* 6px */
.field-label { font-size: 0.9375rem; font-weight: 600; color: var(--ink); } /* 15px */
.field-input {
  font-size: 1rem;               /* 16px */
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  padding: 0.6875rem 0.75rem;    /* 11px 12px */
  line-height: 1.4;
}
.field-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(74, 160, 160, 0.18);
}
select.field-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;        /* 36px — Platz für den Pfeil */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6774' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center; /* 12px */
  background-size: 1rem;         /* 16px */
  cursor: pointer;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;             /* 16px 20px */
}
.field--check { justify-content: flex-end; }
.field-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;                   /* 8px */
  font-size: 0.9375rem;          /* 15px */
  font-weight: 600;
  color: var(--ink);
}
.field-check input {
  width: 1.125rem;               /* 18px */
  height: 1.125rem;
  accent-color: var(--teal);
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;                 /* 10px */
  margin-top: 0.25rem;           /* 4px */
}
.detail-gap { margin-top: 1rem; } /* 16px */

/* ===== 12. STERNE ===== */
.stars { display: inline-flex; gap: 0.125rem; color: var(--gold); } /* 2px */
.star { width: 18px; height: 18px; } /* Icon-Maß in px */
.star--off { color: var(--border); }

/* ===== 13. ZUSTÄNDE (laden / leer / Fehler) ===== */
.state {
  padding: 2.5rem 1.25rem;       /* 40px 20px */
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;          /* 15px */
}
.state-title { font-family: var(--font-head); font-size: 1.25rem; color: var(--navy); } /* 20px */
.state-text { margin-top: 0.375rem; }
.state[hidden] { display: none; }
.spinner {
  width: 2rem;                   /* 32px */
  height: 2rem;
  margin: 0 auto 0.75rem;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }
.notice {
  margin-top: 1rem;              /* 16px */
  padding: 0.75rem 1rem;         /* 12px 16px */
  font-size: 0.875rem;           /* 14px */
  line-height: 1.6;
  border-radius: var(--radius-field);
}
.notice[hidden] { display: none; }
.notice--error { color: #b3261e; background: #fdeeec; border: 1px solid #f5c6c2; }
.notice--info { color: var(--teal); background: var(--teal-soft); border: 1px solid rgba(74, 160, 160, 0.28); }
.review-text {
  margin-top: 0.625rem;          /* 10px */
  padding: 0.875rem 1rem;        /* 14px 16px */
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 0.5rem;         /* 8px */
  font-size: 0.9375rem;          /* 15px */
  line-height: 1.65;
  color: var(--ink);
}

/* ===== 14. RESPONSIVE ===== */
@media (max-width: 47.9375em) { /* 767px */
  .page-title { font-size: 1.75rem; }    /* 28px */
  .detail-title { font-size: 1.625rem; } /* 26px */
  .page-intro { font-size: 1rem; }       /* 16px */
  .field-grid { grid-template-columns: 1fr; gap: 0.875rem; } /* 14px */
  .pipeline { grid-template-columns: 1fr; }
  .list-row { flex-direction: column; align-items: flex-start; gap: 0.625rem; }
  .list-side { align-items: flex-start; text-align: left; }
  .card { padding: 1.25rem; }            /* 20px */
}

/* ===== 15. MOTION-PREFERENZ ===== */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .order-card, .list-row { transition: none; }
}
