/* ============================================================
 * Anlagen-Service-Tool · Stylesheet
 * Übernimmt warmes Papier-Farbschema aus Service-Cockpit Mockup
 * ============================================================ */

:root {
  --bg: #F5F0E8;
  --paper: #FFFFFF;
  --bg-elev: #FBF8F3;
  --ink: #2C2620;
  --ink-soft: #574F47;
  --ink-mute: #8A7F73;
  --line: #E8E0D5;
  --line-soft: #F0EAE0;
  --accent: #C96442;
  --accent-d: #A04E33;
  --accent-soft: #F5E6DC;
  --green: #6B7F4F;
  --green-soft: #E8EFDC;
  --amber: #C5832A;
  --amber-soft: #F5E8CC;
  --red: #A8493A;
  --red-soft: #F2D9D2;
  --serif: "Source Serif 4", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 18px; line-height: 1.3; color: var(--ink); }
h3 { font-size: 15px; line-height: 1.3; font-weight: 600; }

/* ===== Header ===== */
header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .ico {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-d));
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
}
.brand .text {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.1;
}
.brand .text small {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-mute);
  margin-top: 2px;
}

.top-meta { font-size: 13px; color: var(--ink-mute); }

/* ===== Hauptmenue (volle Seitenbreite) ===== */
.mainnav {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 65px;
  z-index: 49;
  display: flex;
  width: 100%;
  overflow-x: auto;
}
.mainnav a {
  flex: 1 1 0;
  text-align: center;
  padding: 14px 12px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  border-right: 1px solid var(--line-soft);
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.mainnav a:last-child { border-right: none; }
.mainnav a:hover {
  background: var(--bg-elev);
  color: var(--ink);
  text-decoration: none;
}
.mainnav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}
.mainnav a.primary {
  color: var(--accent);
  font-weight: 600;
}
.mainnav a.primary.active {
  background: var(--accent);
  color: var(--paper);
  border-bottom-color: var(--accent-d);
}
@media (max-width: 640px) {
  .mainnav a { font-size: 12px; padding: 12px 8px; }
}

/* ===== Layout ===== */
main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 40px;
}

.footer {
  max-width: 1600px;
  margin: 40px auto 24px;
  padding: 0 40px;
  color: var(--ink-mute);
}

/* ===== Cards ===== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}

.card + .card { margin-top: 14px; }

.card h2 { margin-bottom: 4px; }
.card .sub { color: var(--ink-mute); font-size: 13px; margin-bottom: 14px; }

/* ===== Dashboard: Bereiche Grid ===== */
.areas-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 1200px) {
  .areas-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .areas-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .areas-grid { grid-template-columns: 1fr; }
}

.area-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.1s, border-color 0.1s, box-shadow 0.1s;
}
.area-card:hover {
  text-decoration: none;
  border-color: var(--ink-mute);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.area-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.area-card .area-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
}
.area-card .kpi {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--serif);
  color: var(--ink);
}
.area-card .kpi .unit {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 400;
  margin-left: 4px;
}
.area-card .meta {
  font-size: 12px;
  color: var(--ink-mute);
}

/* Ampel-Indikator */
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red   { background: var(--red); }
.dot.grey  { background: var(--ink-mute); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red   { background: var(--red-soft);   color: var(--red); }
.badge.grey  { background: var(--bg-elev);    color: var(--ink-mute); }

/* ===== Service-Hinweise (rechte Spalte / Liste) ===== */
.hints-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hint {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}
.hint.amber { border-color: var(--amber-soft); background: #FBF6E9; }
.hint.red   { border-color: var(--red-soft);   background: #FBEFEC; }
.hint .ico {
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent);
  font-size: 18px;
}
.hint .body { flex: 1; }
.hint .body .h { font-weight: 600; font-size: 13px; }
.hint .body .t { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* ===== Tabelle ===== */
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.t th, table.t td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
table.t th {
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg-elev);
}
table.t tr:last-child td { border-bottom: none; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
}
.btn:hover { background: var(--bg-elev); text-decoration: none; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}
.btn.primary:hover { background: var(--accent-d); }

/* ===== Forms ===== */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink-soft); }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-row { margin-bottom: 14px; }

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  font-size: 13px;
}
.back-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--ink-soft);
  text-decoration: none;
}
.back-btn:hover { color: var(--ink); text-decoration: none; }

/* ===== Detail-Layout (links/rechts) ===== */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
}
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* ===== Misc ===== */
.muted { color: var(--ink-mute); }
.spacer { height: 18px; }
.flex-row { display: flex; gap: 10px; align-items: center; }
.flex-row.between { justify-content: space-between; }

/* ===== Foto-Picker (grosser tappbarer Block) ===== */
.photo-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--paper);
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  font-family: var(--sans);
  -webkit-tap-highlight-color: var(--accent-soft);
}
.photo-picker:hover, .photo-picker:active {
  background: var(--accent-soft);
  border-color: var(--accent-d);
}
.photo-picker .photo-picker-icon { font-size: 28px; line-height: 1; }
.photo-picker .photo-picker-text {
  font-weight: 600;
  color: var(--accent);
  font-size: 15px;
}
.photo-picker .photo-picker-count {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* ===== Mobile-Optimierungen ===== */
@media (max-width: 700px) {
  /* Volle Seitenbreite — kein 40px Padding mehr */
  main { padding: 12px; }
  .footer { padding: 0 12px; }
  .card { padding: 14px; }

  /* Form-Cards mit inline max-width sollen auf Mobile voll genutzt werden */
  .card[style*="max-width"] { max-width: 100% !important; }

  /* Inputs gross und fingerfreundlich — 16px Schrift verhindert iOS Auto-Zoom */
  input, select, textarea {
    font-size: 16px;
    padding: 14px 14px;
    min-height: 50px;
  }
  textarea { min-height: 100px; }

  /* Labels lesbarer */
  label { font-size: 15px; margin-bottom: 8px; }
  .form-row { margin-bottom: 18px; }

  /* Buttons gross — auch fuer schmutzige Finger */
  .btn {
    padding: 14px 18px;
    min-height: 52px;
    font-size: 15px;
    -webkit-tap-highlight-color: var(--accent-soft);
  }
  .btn.primary {
    font-weight: 600;
    font-size: 16px;
    min-height: 56px;
  }

  /* Form-Submit + Abbrechen volle Breite gestapelt */
  .form-row + .flex-row.between {
    flex-direction: column-reverse;
    gap: 12px;
    align-items: stretch;
  }
  .form-row + .flex-row.between > * {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Foto-Picker noch grosszuegiger */
  .photo-picker { padding: 32px 16px; min-height: 90px; }
  .photo-picker .photo-picker-icon { font-size: 36px; }
  .photo-picker .photo-picker-text { font-size: 16px; }

  /* Headlines kompakter */
  h1 { font-size: 26px; }
  h2 { font-size: 17px; }

  /* Tabellen scrollen horizontal falls noetig (statt zu zerlaufen) */
  .card > table.t {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Menue-Buttons hoeher */
  .mainnav a { padding: 14px 10px; font-size: 12px; }
}
