@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;500&family=Roboto+Mono:wght@500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..24,400,0,0&display=block');

:root {
  --bg: #F5F7F9;
  --ink: #1B2733;
  --ink-soft: #6B7A88;
  --card: #FFFFFF;
  --line: #E2E8EE;
  --sidebar: #16212C;
  --sidebar-ink: #C4CEDA;
  --green: #4F9D69;
  --amber: #E8B339;
  --red: #D1495B;
  --danger-bg: #FBEAEC;
  --danger-ink: #9C3245;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
}

a { color: inherit; }

/* ---------- App-Layout mit Sidebar ---------- */

body.gg-app {
  display: flex;
  min-height: 100vh;
}

.gg-sidebar {
  position: relative;
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 20px 20px 28px;
  transition: width 0.2s ease, padding 0.2s ease;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 32px;
  transition: flex-direction 0.2s ease;
}

.gg-sidebar .brand {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: white;
  white-space: nowrap;
  transition: font-size 0.2s ease;
}

.nav-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.16);
  background: transparent;
  color: var(--sidebar-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.nav-toggle:hover { background: rgba(255,255,255,0.08); }
.nav-toggle:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.nav-toggle svg { width: 15px; height: 15px; transition: transform 0.2s ease; }

.sidebar-links {
  display: flex;
  flex-direction: column;
  max-height: 400px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.2s ease, opacity 0.15s ease;
}

/* ---------- Eingeklappter Zustand: Querbalken über volle Breite ---------- */

body.gg-app.nav-collapsed { flex-direction: column; }

body.nav-collapsed .gg-sidebar {
  width: 100%;
  height: 68px;
  min-height: 0;
  padding: 20px 28px;
  flex-shrink: 0;
}
body.nav-collapsed .sidebar-head { margin-bottom: 0; }
body.nav-collapsed .nav-toggle { right: 28px; }
body.nav-collapsed .nav-toggle svg { transform: rotate(180deg); }
body.nav-collapsed .sidebar-links { max-height: 0; opacity: 0; pointer-events: none; }
body.nav-collapsed .gg-main { margin: 0 auto; }

.navlink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--sidebar-ink);
  text-decoration: none;
}

.navlink.active { background: rgba(255,255,255,0.08); color: white; }
.navlink:hover { background: rgba(255,255,255,0.06); }
.navlink.logout { margin-top: 24px; }
.navlink:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; flex-shrink: 0; }

.gg-main {
  flex: 1;
  padding: 48px 48px 140px;
  max-width: 980px;
}

.gg-main h1 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 30px;
  margin: 0 0 8px;
}

.gg-main .sub {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0 0 32px;
}

/* ---------- Statistik-Chips ---------- */

.chips { display: flex; gap: 12px; margin-bottom: 36px; flex-wrap: wrap; }

.chip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  font-family: 'Roboto Mono', monospace;
}

.chip b { color: var(--ink); font-family: 'Sora', sans-serif; }

/* ---------- Kachel-Grid (Dashboard) ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.tile:hover, .tile:focus-visible {
  box-shadow: 0 10px 24px rgba(27,39,51,0.09);
  transform: translateY(-2px);
  outline: none;
}

.tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.tile .bar {
  height: 4px;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
}

.tile-body { padding: 24px 22px 26px; }

.tile h2 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 17px;
  margin: 0 0 8px;
}

.tile p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}

/* ---------- Karten / Platzhalter-Seiten ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
}

.placeholder {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 48px 32px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Formulare ---------- */

form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 18px 0 6px;
}

form input[type="text"],
form input[type="password"],
form input[type="number"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  background: var(--bg);
}

form textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  resize: vertical;
}

form textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

form input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

button, .btn {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 14px;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  margin-top: 24px;
}

button:hover, .btn:hover { opacity: 0.92; }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.alert {
  background: var(--danger-bg);
  color: var(--danger-ink);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  margin-top: 18px;
}

/* ---------- Anmeldung / Einrichtung ---------- */

body.gg-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.auth-card .brand {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 24px;
}

.auth-card h1 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 24px;
  margin: 0 0 8px;
}

.auth-card .sub {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

/* ---------- Icon-Buttons (Material Symbols) ---------- */

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0 !important;
  margin: 0 !important;
  text-decoration: none !important;
  border-radius: 8px;
  flex-shrink: 0;
}

a.icon-btn, button.btn-link.icon-btn {
  background: transparent;
  color: var(--ink);
  border: none;
}
a.icon-btn:hover, button.btn-link.icon-btn:hover { background: rgba(27,39,51,0.07); }

.icon-btn.btn-link-danger { color: var(--danger-ink); }
.icon-btn.btn-link-danger:hover { background: var(--danger-bg); }

button.icon-btn:not(.btn-link):not(.btn-secondary) {
  background: var(--ink);
  color: white;
}
button.icon-btn:not(.btn-link):not(.btn-secondary):hover { opacity: 0.92; }

.icon-btn.btn-secondary {
  border: 1px solid var(--line);
  background: var(--card);
}
.icon-btn.btn-secondary:hover { background: var(--bg); }

.gg-table-actions .icon-btn { width: 32px; height: 32px; }
.gg-table-actions .icon-btn .material-symbols-outlined { font-size: 18px; }

/* ---------- Seitenkopf mit Aktion ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-head h1 { margin: 0 0 8px; }
.page-head .sub { margin: 0; }

/* ---------- Flash-Meldung ---------- */

.flash {
  background: #EAF5EE;
  color: #2C6B3F;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 24px;
}

/* ---------- Tabelle ---------- */

.gg-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.gg-table th, .gg-table td {
  text-align: left;
  padding: 14px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.gg-table th {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--bg);
}

.gg-table tr:last-child td { border-bottom: none; }

.gg-table-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.gg-table-actions form { display: inline; }

/* ---------- Buttons & Links ---------- */

.btn-secondary {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 13.5px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  margin-top: 12px;
}

.btn-secondary:hover { background: var(--bg); }
.btn-secondary.btn-small { padding: 6px 12px; font-size: 13px; margin-top: 10px; }

.btn-link {
  background: none;
  border: none;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.btn-link-danger { color: var(--danger-ink); }

/* ---------- Formular-Karten ---------- */

.card + .card { margin-top: 20px; }
.gg-table + .card, .placeholder + .card { margin-top: 28px; }

.card-head { margin-bottom: 4px; }

.card-head h2 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 17px;
  margin: 0 0 4px;
}

.card-head .sub { margin: 0 0 18px; font-size: 13.5px; }

.tb-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 18px 16px;
  margin-top: 16px;
}

.tb-block:first-child { margin-top: 0; }

.tb-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tb-block-head strong { font-family: 'Sora', sans-serif; font-size: 14px; }

.kriterien-textarea {
  width: 100%;
  resize: none;
  overflow: hidden;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
}

.kriterien-textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.hint {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.ns-typ-choice {
  display: flex;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--ink);
}

.ns-block { display: flex; flex-direction: column; }
.ns-block[hidden] { display: none; }

.ns-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.ns-row:last-child { border-bottom: none; }

.ns-stufe-label {
  flex: 0 0 90px;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
}

.ns-row input[data-ns-percent] {
  width: 90px;
  flex: 0 0 90px;
  margin: 0;
}

.ns-fixed {
  flex: 0 0 90px;
  font-family: 'Roboto Mono', monospace;
  font-size: 13px;
  color: var(--ink-soft);
}

.ns-punkte {
  flex: 1;
  text-align: right;
  font-family: 'Roboto Mono', monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 28px;
}

.form-actions button { margin-top: 0; }

.alert ul { margin: 0; padding-left: 18px; }

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  body.gg-app { flex-direction: column; }
  .gg-sidebar { width: 100%; padding: 18px 24px; }
  .gg-main { padding: 32px 24px 120px; }
  .grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .ns-row { flex-wrap: wrap; }
  .ns-punkte { flex: 1 1 100%; text-align: left; margin-top: 2px; }
  .gg-table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}
