:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --surface-soft: #efe9df;
  --text: #171717;
  --muted: #6f6a63;
  --border: #ded6ca;
  --accent: #1f3a5f;
  --accent-warm: #bf6a4a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(23, 23, 23, 0.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: inherit; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.6); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }
.brand .mark { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 0.7rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.muted { color: var(--muted); }

.wrap { width: min(1100px, calc(100% - 2rem)); margin: 1.75rem auto; }
.wrap.narrow { width: min(640px, calc(100% - 2rem)); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.back { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.back:hover { color: var(--text); }

/* ---- Buttons ---- */
.btn, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1rem; border-radius: 999px; font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.btn { background: var(--text); color: var(--bg); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-soft); }
.btn-danger { background: transparent; border-color: rgba(176,0,32,0.4); color: #9b1c2e; }
.btn-danger:hover { background: rgba(176,0,32,0.08); }

/* ---- Stats + Suche ---- */
.stat-row { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.stat { color: var(--muted); font-size: 0.92rem; }
.stat b { color: var(--text); }
.search { margin: 1.25rem 0; }
.search input {
  width: 100%; padding: 0.7rem 1rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); font: inherit;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,58,95,0.12); }
.empty { padding: 2rem 0; }

/* ---- Projektkarten ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.pcard {
  display: block; padding: 1.1rem 1.2rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  text-decoration: none; transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.pcard:hover { transform: translateY(-3px); border-color: rgba(31,58,95,0.25); box-shadow: 0 16px 40px rgba(23,23,23,0.1); }
.pcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.pcard-head h3 { margin: 0; font-size: 1.1rem; min-width: 0; overflow-wrap: anywhere; }
.pcard-domain { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.88rem; }
.pcard-meta { margin: 0.9rem 0 0; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.open-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent-warm); margin-right: 0.4rem; vertical-align: middle; }

/* ---- Badges ---- */
.badge { flex-shrink: 0; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-live { background: #d7f0dc; color: #1c6b31; }
.badge-wip { background: #fde9c8; color: #8a5a00; }
.badge-offline { background: #eadfd4; color: #6f6a63; }
.badge-idee { background: #dbe5f2; color: var(--accent); }

/* ---- Projekt-Meta ---- */
.proj-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.proj-title h1 { margin: 0; font-size: 1.8rem; letter-spacing: -0.02em; }
.proj-domain { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.proj-actions { display: flex; align-items: center; gap: 0.5rem; }
.proj-actions form { margin: 0; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem 1.5rem; margin: 1.5rem 0; padding: 1.1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.meta-grid dt { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.meta-grid dd { margin: 0.2rem 0 0; font-weight: 600; word-break: break-word; }
.meta-grid a { color: var(--accent); text-decoration: none; }
.notes { margin: 1.25rem 0; padding: 1.1rem 1.25rem; border-left: 3px solid var(--accent-warm); background: var(--surface-soft); border-radius: 8px; color: #3f3a34; }

/* ---- Formular ---- */
.form { display: grid; gap: 1rem; margin-top: 1.25rem; }
.form label { display: grid; gap: 0.35rem; font-weight: 700; font-size: 0.9rem; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form input, .form select, .form textarea {
  padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); font: inherit; font-weight: 400;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,58,95,0.12); }
.form button { justify-self: start; padding: 0.7rem 1.4rem; border: 0; border-radius: 999px; background: var(--text); color: var(--bg); font: inherit; font-weight: 800; cursor: pointer; }

/* ---- Board ---- */
.board-title { margin: 2rem 0 0.75rem; font-size: 1.1rem; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem; }
.col { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; display: flex; flex-direction: column; }
.col-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0.1rem 0.25rem 0.6rem; }
.col-count { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 0.45rem; font-size: 0.72rem; color: var(--text); }
.col-cards { display: flex; flex-direction: column; gap: 0.5rem; min-height: 2.5rem; }
.card-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.55rem 0.6rem 0.55rem 0.7rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  cursor: grab;
}
.card-item.dragging { opacity: 0.5; }
.card-text { font-size: 0.92rem; flex: 1; cursor: text; }
.card-del { border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 0.1rem; }
.card-del:hover { color: #9b1c2e; }
.card-add { margin-top: 0.5rem; }
.card-add input { width: 100%; padding: 0.5rem 0.6rem; border: 1px dashed var(--border); border-radius: 10px; background: transparent; font: inherit; font-size: 0.9rem; }
.card-add input:focus { outline: none; border-style: solid; border-color: var(--accent); background: var(--surface); }

/* ---- Auth ---- */
.auth-body { min-height: 100vh; display: grid; place-items: center; }
.auth-card { width: min(360px, calc(100% - 2rem)); display: grid; gap: 0.9rem; padding: 1.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 0.25rem; }
.auth-card label { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.9rem; }
.auth-card input { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; font: inherit; }
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,58,95,0.12); }
.auth-card button { padding: 0.7rem; border: 0; border-radius: 999px; background: var(--text); color: var(--bg); font: inherit; font-weight: 800; cursor: pointer; }
.error { margin: 0; padding: 0.6rem 0.8rem; background: rgba(176,0,32,0.08); color: #9b1c2e; border-radius: 8px; font-size: 0.9rem; }

@media (max-width: 560px) {
  .form-2 { grid-template-columns: 1fr; }
}

/* ---- Live-Status-Punkte ---- */
.pcard-head-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.sdot { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex-shrink: 0; background: #c9c1b6; }
.sdot-up { background: #35b36a; box-shadow: 0 0 0 3px rgba(53,179,106,0.18); }
.sdot-down { background: #e0493b; box-shadow: 0 0 0 3px rgba(224,73,59,0.18); }
.sdot-unknown { background: #c9c1b6; animation: sdotpulse 1s ease-in-out infinite alternate; }
@keyframes sdotpulse { from { opacity: 0.4; } to { opacity: 1; } }

/* ---- Reiche Karten ---- */
.card-item { align-items: flex-start; }
.card-main { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.due { font-size: 0.7rem; font-weight: 800; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--surface-soft); color: var(--muted); border: 1px solid var(--border); }
.due-over { background: rgba(224,73,59,0.12); color: #b0271b; border-color: rgba(224,73,59,0.3); }
.has-note { font-size: 0.85rem; color: var(--muted); line-height: 1; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(23,23,23,0.45); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { width: min(440px, 100%); background: var(--surface); border-radius: var(--radius); padding: 1.5rem; display: grid; gap: 0.9rem; box-shadow: 0 24px 70px rgba(0,0,0,0.3); }
.modal-card h3 { margin: 0; }
.modal-card label { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.9rem; }
.modal-card input, .modal-card textarea { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-weight: 400; }
.modal-card input:focus, .modal-card textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,58,95,0.12); }
.modal-actions { display: flex; gap: 0.6rem; margin-top: 0.3rem; }

/* ---- Aufgaben-Seite ---- */
.task-group { margin: 1.5rem 0; }
.task-group h2 { display: flex; align-items: center; gap: 0.6rem; font-size: 1.1rem; margin: 0 0 0.6rem; }
.task-group h2 a { text-decoration: none; }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.task-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.task-done { flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; line-height: 1; }
.task-done:hover { border-color: #35b36a; color: #35b36a; }
.task-done:disabled { cursor: default; }
.task-title { flex: 1; min-width: 0; }
.task-col { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.action-group { display: flex; align-items: center; gap: 0.5rem; }

/* ---- Einstellungen ---- */
.set-card { margin: 1.25rem 0; padding: 1.25rem 1.4rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.set-card h2 { margin: 0 0 0.9rem; font-size: 1.1rem; }
.set-card .form { margin-top: 0; }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: 0.5rem; font-weight: 600; }
.check input { width: auto; }
.notice { margin: 0 0 1rem; padding: 0.6rem 0.9rem; border-radius: 8px; font-size: 0.9rem; }
.notice.ok { background: #d7f0dc; color: #1c6b31; }
.notice.err { background: rgba(176,0,32,0.08); color: #9b1c2e; }
.warn { margin: 0 0 0.9rem; padding: 0.6rem 0.9rem; background: #fde9c8; color: #8a5a00; border-radius: 8px; font-size: 0.88rem; }
.warn code { background: rgba(0,0,0,0.06); padding: 0 0.3rem; border-radius: 4px; }
.set-card textarea { width: 100%; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: 10px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88rem; }
.btn-danger-solid { justify-self: start; padding: 0.6rem 1.2rem; border: 0; border-radius: 999px; background: #9b1c2e; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }

/* ---- SQL-Ergebnis ---- */
.sql-results { margin-top: 1.1rem; display: grid; gap: 1rem; }
.sql-block { border-top: 1px solid var(--border); padding-top: 0.8rem; }
.sql-stmt { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; word-break: break-all; }
.table-scroll { overflow-x: auto; }
.sql-table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.sql-table th, .sql-table td { border: 1px solid var(--border); padding: 0.35rem 0.55rem; text-align: left; white-space: nowrap; }
.sql-table th { background: var(--surface-soft); }

/* ---- SSL-Warnung ---- */
.ssl-warn { margin-left: 0.5rem; padding: 0.05rem 0.4rem; border-radius: 999px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; background: #fde9c8; color: #8a5a00; }

/* ===== Sidebar-Layout (Academy-Schema) ===== */
.layout { display: flex; min-height: 100vh; align-items: stretch; }
.side {
  width: 240px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
}
.side__brand { display: flex; align-items: center; gap: 0.6rem; padding: 1.2rem 1.25rem; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; border-bottom: 1px solid var(--border); }
.side__brand .mark { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 0.7rem; }
.nav { flex: 1; padding: 0.75rem 0.6rem; overflow-y: auto; }
.nav__group { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 0.9rem 0.6rem 0.4rem; }
.nav a { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav a:hover { background: var(--surface-soft); }
.nav a.active { background: var(--accent); color: #fff; }
.nav__ico { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.side__foot { padding: 1rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.side__foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.side__user { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; }
.page { padding: 1.75rem clamp(1rem, 3vw, 2rem); max-width: 1120px; }
.page.narrow { max-width: 720px; }

/* ===== Panels ===== */
.panel { margin: 0 0 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.panel__head h2 { margin: 0; font-size: 1.05rem; }
.panel__body { padding: 1.25rem; }

/* ===== Settings-Abschnittsmenü (Tabs) ===== */
.set-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.set-tab { padding: 0.5rem 0.9rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer; }
.set-tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.set-section[hidden] { display: none; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .side { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
  .side__brand { border-bottom: 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.5rem 0.75rem; }
  .nav__group { display: none; }
  .nav a { padding: 0.45rem 0.7rem; }
  .side__foot { border-top: 0; }
}

/* ===== Datenbank-Seite ===== */
.db-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.db-table th, .db-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
.db-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.db-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }
.db-actions form { margin: 0; }
.btn-mini { padding: 0.3rem 0.7rem; border: 1px solid var(--text); border-radius: 999px; background: var(--text); color: var(--bg); font: inherit; font-weight: 700; font-size: 0.8rem; cursor: pointer; }
.btn-mini.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.ok-check { color: #1c6b31; font-weight: 800; }
.db-tables { margin: 0; padding-left: 1.1rem; columns: 2; }
.db-tables li { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; margin-bottom: 0.2rem; }
details.panel > summary.panel__head { cursor: pointer; list-style: none; }
details.panel > summary.panel__head::-webkit-details-marker { display: none; }
details.panel > summary.panel__head::after { content: "▸"; color: var(--muted); margin-left: auto; }
details.panel[open] > summary.panel__head::after { content: "▾"; }
.database .page { max-width: 1120px; }

/* ===== Karten: Tags + Details-Add ===== */
.tag-chip { display: inline-flex; align-items: center; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.01em; }
.card-add { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.card-add input { flex: 1; }
.card-add-details { flex-shrink: 0; width: 2rem; height: 2rem; border: 1px dashed var(--border); border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.card-add-details:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.modal-card label { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.9rem; }

/* ===== Projekt-Tabs (Board / Details) ===== */
.proj-tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--border); margin: 1rem 0 1.5rem; }
.proj-tab { padding: 0.5rem 0.95rem; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.proj-tab:hover { color: var(--text); }
.proj-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.danger-zone { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.danger-zone form { margin: 0; }

.pcard-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0 0; }
