/* VgV-Referenztool – Design-Tokens übernommen von move2notion */
:root {
  --primary: #6366f1;
  --primary-d: #4f46e5;
  --success: #00c853;
  --warning: #ff9800;
  --danger: #f44336;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #333333;
  --text-light: #666666;
  --radius: 12px;
  --radius-s: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, .1);
  --shadow-h: 0 4px 16px rgba(0, 0, 0, .15);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 28px; margin: 0 0 4px; }
h3 { margin: 0 0 8px; font-weight: 600; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }
main.container { flex: 1; padding-top: 40px; padding-bottom: 40px; }
footer { color: var(--text-light); font-size: 13px; padding: 20px 0; border-top: 1px solid var(--border); }

/* Navbar */
.navbar { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 3px 10px rgba(0, 0, 0, .07); }
.navbar-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.navbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 34px; height: 34px; border-radius: 8px; display: block; }
.brand-word { font-size: 20px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-item { color: var(--text); font-weight: 500; padding: 6px 12px; border-radius: 8px; }
.nav-item:hover { background: #f0f1fe; text-decoration: none; }
.nav-item.active { background: #eef2ff; color: var(--primary-d); }
.nav-user { color: var(--text-light); font-size: 14px; margin-left: 8px; }

/* Brand-Mark */
.brand-mark { display: inline-block; width: 22px; height: 22px; border-radius: 6px; background: var(--primary); }
.brand-mark-lg { width: 56px; height: 56px; border-radius: 14px; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.card-grid .card { transition: box-shadow .2s, transform .2s; }
.card-grid .card:hover { box-shadow: var(--shadow-h); transform: translateY(-2px); }
.card-grid + .card-grid { margin-top: 24px; }   /* Abstand zwischen gestapelten Karten-Reihen */

.page-head { margin-bottom: 28px; }
.muted { color: var(--text-light); }
.small { font-size: 13px; }
.center { text-align: center; }
.soon { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--primary); border: 1px solid var(--primary); border-radius: 20px; padding: 2px 10px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 20px; background: #eef2ff; color: var(--primary-d); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  padding: 10px 20px; border: 1px solid transparent; border-radius: var(--radius-s); font-size: 14px;
  font-weight: 500; line-height: 1.25; font-family: inherit; color: #fff; background: var(--primary);
  transition: all .2s; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-h); }
.btn-primary { background: var(--primary); }
.btn-secondary { background: var(--text-light); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-large { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--text); }
input:hover, select:hover, textarea:hover { border-color: #cfd2d7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-s); margin-bottom: 20px; font-size: 14px; }
.alert-danger { background: #fdecea; color: #b71c1c; }
.alert-warning { background: #fff4e5; color: #8a5300; }

/* Login */
.login-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 100%; max-width: 420px; }
.login-head { text-align: center; margin-bottom: 24px; }
.login-head h1 { font-size: 28px; font-weight: 800; margin-top: 12px; }
.login-head .brand-mark-lg { margin: 0 auto; }
.ms-logo { display: inline-grid; grid-template-columns: 9px 9px; grid-gap: 2px; }
.ms-logo span { width: 9px; height: 9px; display: block; }
.breakglass { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.breakglass summary { cursor: pointer; color: var(--text-light); font-size: 13px; }
.breakglass .form { margin-top: 14px; }

@media (max-width: 768px) {
  .navbar-inner { flex-direction: column; gap: 12px; align-items: flex-start; }
  .card-grid { grid-template-columns: 1fr; }
}

/* --- M2a: Firmen + Stammdaten --- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
/* Navbar-Text-Links werden über .nav-item / .nav-logout gestylt (siehe Navbar-Block oben) */
.company-card { display: flex; flex-direction: column; gap: 14px; }
.company-head { display: flex; align-items: center; gap: 14px; }
.company-logo { max-width: 120px; max-height: 56px; object-fit: contain; border-radius: 6px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); display: inline-block; }
.card-actions { display: flex; gap: 10px; align-items: center; margin-top: auto; }
.card-actions form { margin: 0; }
.form-card { max-width: 720px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.logo-preview { margin-bottom: 10px; }
.lookup-list { list-style: none; padding: 0; margin: 0 0 14px; }
.lookup-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.lookup-add { display: flex; gap: 8px; }
.lookup-add input { flex: 1; }
.htmx-request { opacity: .6; }

/* --- M2b: Projekte --- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-light); font-weight: 600; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.ta-right { text-align: right; }
.status { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 20px; }
.status-draft { background: #eef2ff; color: #4f46e5; }
.status-released { background: #e7f7ed; color: #0a7d33; }
.status-blocked { background: #fdecea; color: #b71c1c; }
.status-assigned { background: #fff4e5; color: #8a5300; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--text-light); }
.kv dd { margin: 0; }
.kv dd.pre { white-space: pre-wrap; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 8px 16px 16px; margin-bottom: 20px; }
.fieldset legend { padding: 0 8px; color: var(--text-light); font-weight: 600; }
.form-card-wide { max-width: 880px; }
.page-actions { margin-top: 24px; }
textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 14px; resize: vertical; }

/* --- M2b-2: Bilder / Cropper --- */
.cropper-stage { max-height: 380px; margin-bottom: 14px; }
.cropper-img { max-width: 100%; display: block; }
.img-crop-preview { max-width: 100%; border-radius: 8px; margin-bottom: 12px; display: block; }
.img-thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.img-thumb { height: 84px; border-radius: 6px; border: 1px solid var(--border); object-fit: cover; }
.mt-8 { margin-top: 8px; }

/* --- M2b-3: Beteiligte + Leistungsbilder --- */
.party-block { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.party-block:last-child { border-bottom: none; }
.party-block h4 { margin: 0 0 10px; font-size: 14px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.check input { width: auto; }
.svc-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.svc-row select, .svc-row input { width: auto; flex: 1; min-width: 0; }
.svc-row select { flex: 2; }
.svc-row .btn { flex: 0 0 auto; }

/* --- M2c: Lebensläufe --- */
.cv-photo { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; margin-bottom: 12px; border: 1px solid var(--border); }
.pre { white-space: pre-wrap; margin: 0; }

/* Dashboard-Kacheln als Links + Emoji-Icon (move2notion-Stil) */
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; }
.card-icon { font-size: 40px; line-height: 1; margin-bottom: 12px; }

/* Color-Picker (Firmenfarben) */
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="text"] { flex: 1; }
.color-swatch { width: 44px; height: 44px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; flex: 0 0 auto; }

/* --- Sanfte Seitenübergänge (Cross-Document View Transitions) – Progressive Enhancement --- */
@view-transition { navigation: auto; }

/* Navbar bleibt während des Wechsels ruhig stehen (eigener Snapshot, keine Animation) */
.navbar { view-transition-name: navbar; }

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* Slide-up nur bei echten Seitenwechseln (Typ 'page', via pageswap/pagereveal gesetzt);
   HTMX-Teil-Updates (ohne Typ) bekommen den dezenten UA-Cross-Fade. */
html:active-view-transition-type(page)::view-transition-old(root) { animation: vt-out .15s ease both; }
html:active-view-transition-type(page)::view-transition-new(root) { animation: vt-in .25s ease both; }
::view-transition-old(navbar), ::view-transition-new(navbar) { animation: none; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root),
  ::view-transition-old(navbar), ::view-transition-new(navbar) { animation: none !important; }
}
