@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
/* ============================================================
   MATERIAL / GOOGLE DESIGN-SYSTEM  ·  Design-Tokens (hell + dunkel)
   Farben/Abstände zentral hier ändern -> App passt sich überall an.
   ============================================================ */
:root{
  --bg:#f8f9fa; --surface:#ffffff; --surface-2:#f1f3f4; --surface-3:#e8eaed;
  --primary:#1a73e8; --primary-hover:#1b66c9; --primary-container:#e8f0fe; --on-primary-container:#174ea6;
  --text:#202124; --text-2:#5f6368; --text-3:#80868b;
  --outline:#dadce0; --outline-soft:#e8eaed;
  --danger:#d93025; --danger-container:#fce8e6;
  --blue-c:#e8f0fe; --blue-t:#1967d2; --green-c:#e6f4ea; --green-t:#137333;
  --yellow-c:#fef7e0; --yellow-t:#b06000; --grey-c:#f1f3f4; --grey-t:#5f6368; --red-c:#fce8e6; --red-t:#c5221f;
  --radius:12px; --radius-sm:8px; --pill:100px;
  --e1:0 1px 2px rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);
  --e2:0 1px 2px rgba(60,64,67,.3),0 2px 6px 2px rgba(60,64,67,.15);
  --e3:0 4px 8px 3px rgba(60,64,67,.15),0 1px 3px rgba(60,64,67,.3);
  --font:'Roboto','Segoe UI',system-ui,Arial,sans-serif;
  color-scheme:light;
}
:root[data-theme="dark"]{
  --bg:#202124; --surface:#292a2d; --surface-2:#35363a; --surface-3:#3c4043;
  --primary:#8ab4f8; --primary-hover:#aecbfa; --primary-container:#1f3a5f; --on-primary-container:#d2e3fc;
  --text:#e8eaed; --text-2:#9aa0a6; --text-3:#80868b;
  --outline:#5f6368; --outline-soft:#3c4043;
  --danger:#f28b82; --danger-container:#3a1512;
  --blue-c:#1f3a5f; --blue-t:#8ab4f8; --green-c:#0f3d24; --green-t:#81c995;
  --yellow-c:#3d3016; --yellow-t:#fdd663; --grey-c:#3c4043; --grey-t:#c4c7c5; --red-c:#3a1512; --red-t:#f28b82;
  --e1:0 1px 2px rgba(0,0,0,.3),0 1px 3px 1px rgba(0,0,0,.15);
  --e2:0 1px 2px rgba(0,0,0,.3),0 2px 6px 2px rgba(0,0,0,.15);
  --e3:0 4px 8px 3px rgba(0,0,0,.3),0 1px 3px rgba(0,0,0,.4);
  color-scheme:dark;
}

/* ── Reset & Base ────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 13.5px; -webkit-font-smoothing:antialiased; }

/* ── Layout: Navigations-Drawer (Material, hell) ─────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 248px;
  background: var(--surface); color: var(--text);
  padding: 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto;
  border-right: 1px solid var(--outline-soft);
}
.sidebar-logo { font-size: 18px; font-weight: 500; color: var(--text); padding: 6px 12px 14px; margin-bottom: 6px; display:flex; align-items:center; gap:8px; }
.sidebar-benutzer { font-size: 12px; color: var(--text-3); padding: 6px 12px; }
.nav-section { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; padding: 12px 16px 4px; font-weight: 500; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 16px; border-radius: var(--pill); cursor: pointer; font-size: 14px; font-weight:500; color: var(--text-2); border: none; background: none; width: 100%; text-align: left; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.aktiv { background: var(--primary-container); color: var(--on-primary-container); }
.nav-item i { font-size: 18px; }
.nav-item.logout { color: var(--danger); }
.nav-item.logout:hover { background: var(--danger-container); }
.nav-sidebar-bottom { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--outline-soft); }
.err-badge { background: var(--danger); color: #fff; font-size: 10px; font-weight: 500; padding: 1px 7px; border-radius: 99px; margin-left: auto; }

.main { margin-left: 248px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { padding: 0 24px; height:60px; border-bottom: 1px solid var(--outline-soft); display: flex; align-items: center; justify-content: space-between; background: var(--surface); box-shadow: var(--e1); position:sticky; top:0; z-index:10; }
.topbar-title { font-size: 20px; font-weight: 500; color:var(--text); }
.content { padding: 24px; flex: 1; }

/* ── Buttons (Material) ──────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 20px; border-radius: var(--pill); border: 1px solid var(--outline); background: var(--surface); font-size: 13.5px; font-weight:500; cursor: pointer; color: var(--text); font-family:inherit; transition: background .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); box-shadow: var(--e1); }
.btn-primary { background: var(--primary); color: #fff; border-color: transparent; box-shadow: var(--e1); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--e2); }
.btn-green { background: var(--green-t); color:#fff; border-color:transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-container); box-shadow:none; }
.btn-danger { border-color: transparent; color: var(--danger); background:transparent; }
.btn-danger:hover { background: var(--danger-container); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }

/* ── Cards (Elevation) ───────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--outline-soft); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--e1); }
.card-title { font-size: 12px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

/* ── Grid ────────────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }

/* ── Metrics / Stat-Kacheln ──────────────────────────────────── */
.metric { background: var(--surface); border:1px solid var(--outline-soft); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--e1); }
.metric-label { font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight:500; }
.metric-val { font-size: 26px; font-weight: 400; color:var(--text); }

/* ── Projekt-Karten ──────────────────────────────────────────── */
.karten-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.projekt-karte { background: var(--surface); border: 1px solid var(--outline-soft); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: box-shadow 0.15s; box-shadow: var(--e1); }
.projekt-karte:hover { box-shadow: var(--e2); }
.projekt-karte h3 { font-size: 15px; margin-bottom: 4px; color:var(--text); }
.projekt-karte .kunde { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.fortschritt { height: 6px; background: var(--surface-3); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.fortschritt-bar { height: 100%; border-radius: 99px; }

/* ── Badges → Material-Chips ─────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.badge-blau   { background: var(--blue-c); color: var(--blue-t); }
.badge-gruen  { background: var(--green-c); color: var(--green-t); }
.badge-grau   { background: var(--grey-c); color: var(--grey-t); }
.badge-amber  { background: var(--yellow-c); color: var(--yellow-t); }
.badge-rot    { background: var(--red-c); color: var(--red-t); }

/* ── Formulare (Material-Felder) ─────────────────────────────── */
.feld { margin-bottom: 14px; }
.feld label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; font-weight:500; }
.feld input, .feld select, .feld textarea { width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--outline); background: var(--surface); color: var(--text); font-size: 14px; font-family:inherit; transition: border .12s, box-shadow .12s; }
.feld input:focus, .feld select:focus, .feld textarea:focus { outline:none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-container); }
.feld textarea { resize: vertical; min-height: 60px; }
input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], select, textarea { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--outline); background: var(--surface); color: var(--text); font-size: 14px; font-family:inherit; }
input:focus, select:focus, textarea:focus { outline:none; }

/* ── Tabellen ────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; color:var(--text); }
th { text-align: left; padding: 11px 12px; color: var(--text-2); font-weight: 500; border-bottom: 1px solid var(--outline-soft); font-size: 12px; }
td { padding: 12px; border-bottom: 1px solid var(--outline-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Matrix ──────────────────────────────────────────────────── */
.matrix-scroll { overflow-x: auto; }
table.matrix { min-width: 100%; white-space: nowrap; border-collapse: collapse; }
table.matrix th, table.matrix td { border: 1px solid var(--outline-soft); padding: 0; }
table.matrix thead th { background: var(--surface-2); font-weight: 500; padding: 8px 12px; text-align: center; }
table.matrix thead th.pos-col { text-align: left; min-width: 260px; }
table.matrix tbody td.chk { text-align: center; padding: 8px; width: 80px; }
table.matrix input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
table.matrix .pos-name { padding: 0; }

/* ── Detail-Panel (Matrix aufgeklappt) ───────────────────────── */
.detail-panel { background: var(--surface-2); border-top: 1px solid var(--outline-soft); border-bottom: 1px solid var(--outline-soft); padding: 14px 16px; }
.detail-panel-titel { font-size: 11px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.fn-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--outline); cursor: pointer; margin: 3px; font-size: 12px; user-select: none; color:var(--text-2); }
.fn-chip.aktiv-sonder { background: var(--blue-c); border-color: transparent; color: var(--blue-t); }
.fn-chip.aktiv-warn   { background: var(--yellow-c); border-color: transparent; color: var(--yellow-t); }
.fn-chip.aktiv-neutral{ background: var(--green-c); border-color: transparent; color: var(--green-t); }
.fn-chip input { width: 12px; height: 12px; cursor: pointer; accent-color: var(--primary); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center; }
.modal-bg.offen { display: flex; }
.modal { background: var(--surface); border-radius: 28px; border: 1px solid var(--outline-soft); padding: 26px; width: 500px; max-width: 96vw; box-shadow: var(--e3); color:var(--text); }
.modal h3 { font-size: 20px; font-weight: 400; margin-bottom: 4px; }
.modal-sub { font-size: 13px; color: var(--text-2); margin-bottom: 1rem; }
.modal-aktionen { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1rem; }

/* Konflikt-Modal */
.konflikt-liste { border: 1px solid var(--outline-soft); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1rem; }
.konflikt-zeile { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--outline-soft); }
.konflikt-zeile:last-child { border-bottom: none; }
.konflikt-zeile.rot   { background: var(--red-c); }
.konflikt-zeile.amber { background: var(--yellow-c); }
.konflikt-pos    { font-size: 12.5px; font-weight: 500; }
.konflikt-detail { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.konflikt-aktion { font-size: 11px; margin-top: 3px; }
.confirm-row { display: flex; align-items: center; gap: 8px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); margin-bottom: 1rem; cursor: pointer; }
.confirm-row input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* ── Toast (Snackbar) ────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left:50%; transform:translateX(-50%); background: #323232; color: #fff; padding: 13px 20px; border-radius: var(--radius-sm); font-size: 13.5px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 999; box-shadow: var(--e3); }
.toast.show { opacity: 1; }

/* ── Fehlermeldungen ─────────────────────────────────────────── */
.err-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-bottom: 1px solid var(--outline-soft); }
.err-item:last-child { border-bottom: none; }
.err-icon { font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.err-titel { font-size: 13.5px; font-weight: 500; margin-bottom: 3px; }
.err-detail { font-size: 12.5px; color: var(--text-3); }

/* ── Sonstiges ───────────────────────────────────────────────── */
.leer { text-align: center; color: var(--text-3); padding: 2rem; }

/* ── Theme-Umschalter (Hell/Dunkel) ──────────────────────────── */
.theme-seg { display:flex; background: var(--surface-2); border-radius: var(--pill); padding:3px; margin: 4px 6px 8px; }
.theme-seg button { flex:1; border:none; background:none; font-family:inherit; font-size:12.5px; font-weight:500; color:var(--text-2); padding:7px 8px; border-radius:var(--pill); cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; }
.theme-seg button.on { background: var(--surface); color: var(--primary); box-shadow: var(--e1); }

/* ── Chiaves-Logo mit Cross-Fade beim Hell/Dunkel-Wechsel ───────── */
.chiaves-logo { position: relative; display: block; width: 100%; line-height: 0; }
.chiaves-logo img { display: block; width: 100%; height: auto; transition: opacity .45s ease; }
.chiaves-logo .logo-hell   { opacity: 1; }
.chiaves-logo .logo-dunkel { position: absolute; top: 0; left: 0; width: 100%; opacity: 0; }
:root[data-theme="dark"] .chiaves-logo .logo-hell   { opacity: 0; }
:root[data-theme="dark"] .chiaves-logo .logo-dunkel { opacity: 1; }
/* Sidebar-Logo füllt die Menüleiste (mit etwas Rand links/rechts) */
.sidebar-logo { padding: 14px 18px; }
/* Sanfter Übergang der Flächen beim Moduswechsel */
body, .sidebar, .topbar { transition: background-color .4s ease, color .4s ease, border-color .4s ease; }
