/* AgriWerk – helles, modernes Design. Systemschriften (offline-tauglich, CSP-safe). */
:root {
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-50:  #f0fdf4;
  --ink:       #0f172a;
  --muted:     #64748b;
  --line:      #e2e8f0;
  --bg:        #f6f9f7;
  --card:      #ffffff;
  --danger:    #dc2626;
  --radius:    14px;
  --shadow:    0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #dcfce7 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 110%, #e0f2fe 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: .6rem 1rem;
  font-size: .95rem; font-weight: 600; cursor: pointer; transition: .15s;
}
.btn-primary { background: linear-gradient(180deg, var(--green-500), var(--green-600)); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f8fafc; }

/* ---------- Auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.75rem;
}
.brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; }
.brand.small { gap: .5rem; margin-bottom: 1.5rem; }
.brand-mark {
  font-size: 1.6rem; background: var(--green-50); border: 1px solid #dcfce7;
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px;
}
.brand h1 { font-size: 1.25rem; margin: 0; }
.brand p { margin: .15rem 0 0; font-size: .82rem; }

.tabs { display: flex; gap: .4rem; background: #f1f5f9; padding: .3rem; border-radius: 12px; margin-bottom: 1.2rem; }
.tab { flex: 1; border: 0; background: transparent; padding: .55rem; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.form { display: flex; flex-direction: column; gap: .9rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; font-weight: 600; color: #334155; }
input, select {
  font: inherit; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
small { font-weight: 400; }
.error { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; padding: .6rem .8rem; border-radius: 10px; font-size: .85rem; margin-top: 1rem; }

/* ---------- Betriebsauswahl ---------- */
.tenant-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.tenant-item {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  text-align: left; width: 100%; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: .9rem 1rem;
  transition: .15s;
}
.tenant-item:hover { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(34,197,94,.12); transform: translateY(-1px); }
.tenant-name { font-weight: 700; color: var(--ink); }
.tenant-role { font-size: .75rem; font-weight: 700; color: var(--green-600); background: var(--green-50); padding: .2rem .55rem; border-radius: 999px; }
.tenant-box { font-size: .85rem; line-height: 1.4; padding-bottom: .2rem; }
.tenant-box a { color: var(--green-600); text-decoration: none; font-weight: 600; }
.tenant-box a:hover { text-decoration: underline; }

/* ---------- App-Layout ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  padding: 1.2rem 1rem; display: flex; flex-direction: column; gap: 1rem;
}
.nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav-item {
  text-align: left; border: 0; background: transparent; padding: .65rem .7rem;
  border-radius: 10px; font-size: .95rem; font-weight: 600; color: #475569; cursor: pointer;
}
.nav-item:hover { background: #f8fafc; }
.nav-item.active { background: var(--green-50); color: var(--green-600); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.user-box { font-size: .82rem; color: var(--muted); line-height: 1.4; }
.user-box strong { color: var(--ink); }

.content { padding: 1.5rem 2rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; }
.topbar h2 { margin: 0; font-size: 1.4rem; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); margin-bottom: 1.4rem; }
.panel h3 { margin: 0 0 1rem; }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.grid-form .wide { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .6rem; }

/* ---------- Karten ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.card h4 { margin: 0 0 .2rem; font-size: 1.05rem; }
.card .num { font-size: .78rem; color: var(--muted); }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; margin: .8rem 0 0; font-size: .84rem; }
.card dt { color: var(--muted); }
.badge { font-size: .72rem; font-weight: 700; padding: .2rem .5rem; border-radius: 999px; white-space: nowrap; }
.badge.active { background: var(--green-50); color: var(--green-600); }
.badge.maintenance { background: #fffbeb; color: #b45309; }
.badge.retired { background: #f1f5f9; color: var(--muted); }
.placeholder { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 3rem; text-align: center; color: var(--muted); }

/* ---------- Mobil ---------- */
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { border-top: 0; padding-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .content { padding: 1.2rem; }
  .grid-form { grid-template-columns: 1fr; }
}
