/* ============================================================
   Meta-Admin – Optik angelehnt an das Shopify-Admin (Polaris).
   Dunkle Topbar · helle Sidebar · weiße Karten auf Hellgrau.
   ============================================================ */
:root {
  --bg:        #f1f2f4;   /* Seitenhintergrund */
  --karte:     #ffffff;
  --rand:      #e3e3e3;
  --rand-stark:#c9cccf;
  --text:      #303030;   /* Polaris Text */
  --text-sub:  #616161;
  --topbar:    #1a1a1a;
  --nav-aktiv: #ebebeb;
  --primary:   #303030;
  --primary-h: #1a1a1a;
  --gruen:     #29845a;
  --fokus:     #005bd3;   /* Polaris Fokus-Blau */
  --radius:    12px;
  --radius-s:  8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.ic { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  height: 56px; padding: 0 1rem;
  background: var(--topbar); color: #e3e3e3;
}
.topbar-brand { display: flex; align-items: center; gap: .55rem; min-width: 200px; }
.brand-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: #fff; color: #1a1a1a; font-weight: 700; font-size: 15px;
}
.brand-name { color: #fff; font-weight: 600; }
.topbar-search {
  flex: 1; max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.11); border-radius: var(--radius-s);
  padding: 0 .7rem; height: 34px; color: #b5b5b5;
}
.topbar-search input {
  flex: 1; background: none; border: none; outline: none;
  color: #fff; font-size: 14px;
}
.topbar-search input::placeholder { color: #b5b5b5; }
.topbar-user { display: flex; align-items: center; gap: .6rem; min-width: 200px; justify-content: flex-end; }
.user-name { color: #cfcfcf; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: #4a4a4a; color: #fff; font-weight: 600; font-size: 13px;
}

/* ---------- Layout ---------- */
.layout { display: flex; align-items: flex-start; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 56px;
  width: 232px; flex: 0 0 232px;
  height: calc(100vh - 56px);
  background: #fbfbfb; border-right: 1px solid var(--rand);
  padding: .75rem .6rem;
  display: flex; flex-direction: column;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-fuss { margin-top: auto; padding-top: .5rem; border-top: 1px solid var(--rand); }
.nav-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .6rem; border-radius: var(--radius-s);
  color: #4a4a4a; text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: #f1f1f1; color: var(--text); }
.nav-item.aktiv { background: var(--nav-aktiv); color: var(--text); font-weight: 600; }
.nav-item.leise { color: #9a9a9a; }
.nav-item.leise:hover { background: #f1f1f1; }

/* ---------- Hauptbereich ---------- */
.inhalt { flex: 1; min-width: 0; padding: 1.5rem; max-width: 1000px; margin: 0 auto; }
.seiten-kopf { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.seiten-kopf h1 { margin: 0; font-size: 20px; font-weight: 700; }
.unterzeile { margin: .15rem 0 0; color: var(--text-sub); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; text-decoration: none;
  border: none; cursor: pointer;
  padding: .5rem .9rem; border-radius: var(--radius-s);
  font-size: 13px; font-weight: 600;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.2);
}
.btn-primary:hover { background: var(--primary-h); }
.btn-leise {
  display: inline-flex; align-items: center;
  background: #fff; color: var(--text); text-decoration: none;
  border: 1px solid var(--rand-stark); border-radius: var(--radius-s);
  padding: .32rem .6rem; font-size: 12.5px; font-weight: 500;
}
.btn-leise:hover { background: #f7f7f7; }
.btn-leise.aus { color: #b5b5b5; border-style: dashed; cursor: default; }
.icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--radius-s);
  background: #fff; border: 1px solid var(--rand-stark); color: #8a8a8a; cursor: pointer;
}
.icon-btn:hover { color: #c4292f; border-color: #f0b4b6; background: #fff5f5; }

/* ---------- Karten ---------- */
.karte {
  background: var(--karte); border: 1px solid var(--rand);
  border-radius: var(--radius); margin-bottom: 1rem;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
  overflow: hidden;
}
.karte-kopf { display: flex; align-items: center; gap: .6rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--rand); }
.karte-kopf h2 { margin: 0; font-size: 14px; font-weight: 600; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  background: #e3e3e3; color: #4a4a4a; border-radius: 10px; font-size: 12px; font-weight: 600;
}
.leer { padding: 1.5rem 1.1rem; color: var(--text-sub); }

/* ---------- Ressourcen-Liste ---------- */
.liste { list-style: none; margin: 0; padding: 0; }
.zeile { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.1rem; border-bottom: 1px solid #f1f1f1; }
.zeile:last-child { border-bottom: none; }
.zeile:hover { background: #fafafa; }
.z-avatar {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: var(--radius-s);
  background: #e6efe9; color: var(--gruen); font-weight: 700;
}
.z-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.z-name { font-weight: 600; color: var(--text); }
.z-domain { color: var(--text-sub); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z-status { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-sub); font-size: 12.5px; flex: 0 0 auto; }
.z-status-aus { color: #9a9a9a; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gruen); }
.dot-grau { background: #c9cccf; }
.z-metrik { flex: 0 0 auto; text-align: right; line-height: 1.25; }
.m-oben { font-size: 12.5px; color: var(--text-sub); }
.m-zahl { font-size: 17px; font-weight: 700; color: var(--text); }
.m-unten { font-size: 11.5px; color: #9a9a9a; }
.z-aktionen { display: flex; align-items: center; gap: .4rem; flex: 0 0 auto; }
.z-loeschen { margin: 0; }

/* ---------- Formular ---------- */
.formular { padding: 1.1rem; }
.feld-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.feld { display: flex; flex-direction: column; gap: .35rem; font-size: 13px; font-weight: 500; color: var(--text); }
.opt { color: #9a9a9a; font-weight: 400; }
.feld input {
  padding: .5rem .7rem; font-size: 14px;
  background: #fff; color: var(--text);
  border: 1px solid var(--rand-stark); border-radius: var(--radius-s);
}
.feld input:focus { outline: 2px solid var(--fokus); outline-offset: 0; border-color: transparent; }
.formular-fuss { display: flex; justify-content: flex-end; }

/* ---------- Login (heller Polaris-Look) ---------- */
.login-seite { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-box {
  width: 100%; max-width: 400px; background: var(--karte);
  border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 2rem;
}
.login-box h1 { margin: 0 0 .25rem; font-size: 20px; }
.login-box h2 { margin: .5rem 0; font-size: 14px; color: var(--text-sub); font-weight: 500; }
.hinweis { color: var(--text-sub); font-size: 13px; }
.fehler { background: #fff0f0; color: #c4292f; border: 1px solid #f0b4b6; padding: .6rem .8rem; border-radius: var(--radius-s); font-size: 13px; }
.login-box form label { display: block; margin: .9rem 0; font-size: 13px; font-weight: 500; }
.login-box form input {
  width: 100%; margin-top: .35rem; padding: .55rem .7rem; font-size: 14px;
  background: #fff; border: 1px solid var(--rand-stark); border-radius: var(--radius-s); color: var(--text);
}
.login-box form input:focus { outline: 2px solid var(--fokus); border-color: transparent; }
.login-box .btn { width: 100%; margin-top: .5rem; padding: .6rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-s); font-weight: 600; font-size: 14px; cursor: pointer; }
.login-box .btn:hover { background: var(--primary-h); }

/* ---------- Mobil ---------- */
@media (max-width: 800px) {
  .topbar-brand, .topbar-user { min-width: 0; }
  .user-name { display: none; }
  .layout { flex-direction: column; }
  .sidebar {
    position: static; width: 100%; flex-basis: auto; height: auto;
    flex-direction: row; flex-wrap: wrap; gap: 4px;
    border-right: none; border-bottom: 1px solid var(--rand);
  }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-fuss { margin: 0; padding: 0; border: none; }
  .nav-item { padding: .45rem .6rem; }
  .inhalt { padding: 1rem; }
  .feld-reihe { grid-template-columns: 1fr; }
  .zeile { flex-wrap: wrap; }
  .z-status { order: 3; }
  .metrik-gitter { grid-template-columns: repeat(2, 1fr); }
  .zwei-spalten { grid-template-columns: 1fr; }
}

/* ---------- Live-Indikator (Dashboard-Karte) ---------- */
.m-live { font-size: 11.5px; color: var(--gruen); font-weight: 600; margin-top: 2px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gruen); margin-right: 3px; vertical-align: middle; animation: puls 1.6s ease-in-out infinite; }
@keyframes puls { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Statistik-Seite ---------- */
.projekt-wahl { margin: 0; }
.projekt-wahl select {
  padding: .5rem .7rem; font-size: 14px; color: var(--text);
  background: #fff; border: 1px solid var(--rand-stark); border-radius: var(--radius-s); cursor: pointer;
}
.projekt-wahl select:focus { outline: 2px solid var(--fokus); border-color: transparent; }

.metrik-gitter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 1rem; }
.metrik-kachel { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1rem; }
.mk-label { font-size: 12.5px; color: var(--text-sub); margin-bottom: .4rem; }
.mk-zahl { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.live-kachel { background: #f0f8f3; border-color: #cfe6d8; }
.live-kachel .mk-label { color: var(--gruen); font-weight: 600; }
.live-kachel .mk-zahl { color: var(--gruen); }

.verlauf { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 1.1rem; }
.v-saeule { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.v-balken { width: 100%; max-width: 34px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.v-tag { font-size: 10.5px; color: #9a9a9a; margin-top: 5px; }

.zwei-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.balkenliste { list-style: none; margin: 0; padding: .6rem 1.1rem 1rem; }
.balkenliste li { margin: .55rem 0; }
.bl-kopf { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.bl-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-wert { color: var(--text-sub); font-weight: 600; padding-left: .5rem; }
.bl-spur { height: 7px; background: #eef0f2; border-radius: 4px; overflow: hidden; }
.bl-fuell { height: 100%; background: var(--primary); border-radius: 4px; }

.ziel-liste { list-style: none; margin: 0; padding: .4rem 1.1rem 1rem; }
.ziel-liste li { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid #f1f1f1; }
.ziel-liste li:last-child { border-bottom: none; }
.ziel-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-s); background: #eef0f2; color: var(--text-sub); flex: 0 0 auto; }
.ziel-name { flex: 1; font-size: 13px; }
.ziel-wert { font-size: 17px; font-weight: 700; }

.fuss-hinweis { color: #9a9a9a; font-size: 12px; margin-top: 1rem; }

/* ---------- Finanzen ---------- */
.fin-gitter { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.gewinn-kachel { background: #f0f8f3; border-color: #cfe6d8; }
.gewinn-kachel .mk-label { color: var(--gruen); font-weight: 600; }
.gewinn-kachel .mk-zahl { color: var(--gruen); }
.mk-zahl.minus { color: var(--rot); }
.mk-sub { font-size: 11.5px; color: #9a9a9a; margin-top: 5px; }

.fin-tabelle { width: 100%; border-collapse: collapse; font-size: 13px; }
.fin-tabelle th { text-align: left; font-weight: 500; color: var(--text-sub); font-size: 12px; padding: .5rem 1.1rem; border-bottom: 1px solid var(--rand); }
.fin-tabelle td { padding: .6rem 1.1rem; border-bottom: 1px solid #f1f1f1; vertical-align: top; }
.fin-tabelle tr:last-child td { border-bottom: none; }
.fin-tabelle .r { text-align: right; white-space: nowrap; }
.fin-tabelle .grau { color: #9a9a9a; }
.fin-tabelle .notiz { display: block; font-size: 11.5px; color: #9a9a9a; margin-top: 2px; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.pill-gruen { background: #e6efe9; color: var(--gruen); }
.pill-blau  { background: #e6f0fb; color: #185fa5; }
.pill-grau  { background: #eef0f2; color: #616161; }

.fin-form { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.1rem; border-top: 1px solid var(--rand); align-items: center; }
.fin-form input, .fin-form select {
  padding: .45rem .6rem; font-size: 13px; color: var(--text);
  background: #fff; border: 1px solid var(--rand-stark); border-radius: var(--radius-s);
}
.fin-form input:focus, .fin-form select:focus { outline: 2px solid var(--fokus); border-color: transparent; }
.fin-form input[name=kunde], .fin-form input[name=bezeichnung] { flex: 1; min-width: 140px; }
.fin-form input[name=notiz] { flex: 1; min-width: 120px; }
.fin-form input[name=netto] { width: 100px; }
.fin-form input[name=mwst] { width: 72px; }
.fin-form .btn-primary { margin-left: auto; }

@media (max-width: 800px) {
  .fin-tabelle { font-size: 12px; }
  .fin-tabelle th, .fin-tabelle td { padding: .5rem .6rem; }
  .fin-form .btn-primary { margin-left: 0; }
}

/* ---------- Finanz-Diagramm ---------- */
.legende { font-size: 12px; color: var(--text-sub); display: inline-flex; align-items: center; margin-left: auto; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px; vertical-align: middle; }
.lg-ein { background: var(--gruen); }
.lg-aus { background: #c9cccf; }
.diagramm { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding: 1.2rem 1.3rem; }
.d-monat { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.d-paar { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 100%; width: 100%; }
.d-balken { width: 26px; max-width: 42%; border-radius: 4px 4px 0 0; min-height: 2px; }
.d-ein { background: var(--gruen); }
.d-aus { background: #c9cccf; }
.d-label { font-size: 11px; color: #9a9a9a; margin-top: 6px; }

/* ---------- Verträge / Firmendaten ---------- */
.hinweis-box { background: #fff8e6; border: 1px solid #f0d98c; color: #7a5c00; padding: .8rem 1rem; border-radius: var(--radius-s); font-size: 13px; margin-bottom: 1rem; }
details summary { outline: none; }
details summary::-webkit-details-marker { display: none; }
.firma-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; padding: 1.1rem; }
.firma-form label { display: flex; flex-direction: column; gap: .3rem; font-size: 12.5px; color: var(--text); }
.firma-form input { padding: .5rem .6rem; font-size: 13px; background: #fff; border: 1px solid var(--rand-stark); border-radius: var(--radius-s); }
.firma-form input:focus { outline: 2px solid var(--fokus); border-color: transparent; }
.firma-form .check { flex-direction: row; align-items: center; gap: .45rem; }
.firma-form .check input { width: auto; }
.firma-form .firma-fuss { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.fin-tabelle .nowrap { white-space: nowrap; }
.fin-tabelle .nowrap form { margin: 0; }
.fin-form input[type=file] { flex: 1; min-width: 200px; padding: .35rem; font-size: 13px; }

/* ---------- Diagramm-Zeitraum (Kalender) ---------- */
.diagramm-kopf { flex-wrap: wrap; row-gap: .5rem; }
.diagramm-kopf .legende { margin-left: 0; }
.zeitraum-form { display: flex; align-items: center; gap: .4rem; margin-left: auto; flex-wrap: wrap; }
.zeitraum-form input[type=date] { padding: .35rem .5rem; font-size: 12.5px; color: var(--text); background: #fff; border: 1px solid var(--rand-stark); border-radius: var(--radius-s); }
.zeitraum-form input[type=date]:focus { outline: 2px solid var(--fokus); border-color: transparent; }
.zeitraum-form .btn-leise { padding: .35rem .6rem; }
.bis-strich { color: var(--text-sub); }
button[disabled] { opacity: .5; cursor: not-allowed; }
