/* HausPortal Design-System – kein Framework, nur sauberes CSS */
:root {
  --primary: #2563eb;
  --primary-dark: color-mix(in srgb, var(--primary) 82%, black);
  --primary-soft: color-mix(in srgb, var(--primary) 12%, white);
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e3e8f0;
  --text: #16223a;
  --muted: #66738c;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 33, 61, 0.08), 0 8px 24px rgba(20, 33, 61, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1150px; margin: 0 auto; padding: 0 18px;
  display: flex; align-items: center; gap: 18px; height: 60px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand img { height: 34px; width: auto; }
.brand .dot { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a {
  padding: 8px 13px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14.5px;
}
.nav a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userbox .who { text-align: right; line-height: 1.2; }
.userbox .who .name { font-weight: 600; font-size: 14px; }
.userbox .who .role { color: var(--muted); font-size: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
}
main.content { max-width: 1150px; margin: 0 auto; padding: 26px 18px 60px; width: 100%; flex: 1; }
.footer {
  border-top: 1px solid var(--border); padding: 18px; text-align: center;
  color: var(--muted); font-size: 13px; background: var(--surface);
}

/* ---------- Auth-Seiten ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 400px; max-width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 30px; box-shadow: var(--shadow);
}
.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 20px; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 14px; }

/* ---------- Komponenten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 19px; }
.card .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 23px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }

label.field { display: block; margin-bottom: 13px; }
label.field span.lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 600; font-size: 15px;
  background: var(--primary); color: #fff; border: none; border-radius: 9px; padding: 10px 17px;
  cursor: pointer; transition: filter .12s; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn.sec { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.sec:hover { background: var(--bg); color: var(--text); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, #fff); }
.btn.small { padding: 6px 11px; font-size: 13.5px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: wait; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.b-NEW { background: #dbeafe; color: #1d4ed8; }
.b-IN_PROGRESS { background: #fef3c7; color: #b45309; }
.b-WAITING { background: #ede9fe; color: #6d28d9; }
.b-DONE { background: #dcfce7; color: #15803d; }
.b-CLOSED { background: #e5e7eb; color: #4b5563; }
.b-HIGH, .b-URGENT, .b-invited { background: #fee2e2; color: #b91c1c; }
.b-LOW, .b-active { background: #dcfce7; color: #15803d; }
.b-neutral { background: var(--bg); color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; gap: 14px; align-items: center; padding: 13px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; flex-wrap: wrap;
}
.item:hover { border-color: var(--primary); }
.item .grow { flex: 1; min-width: 180px; }
.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.empty {
  text-align: center; color: var(--muted); padding: 34px 20px; background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--radius);
}

table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.tbl th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg); }

/* Ticket-Detail */
.msg { display: flex; gap: 12px; margin-bottom: 14px; }
.msg .avatar { width: 32px; height: 32px; font-size: 13px; flex: none; }
.msg .bubble { background: var(--bg); border-radius: 10px; padding: 10px 14px; max-width: 720px; }
.msg .bubble.meta { background: transparent; color: var(--muted); font-size: 13px; padding-top: 2px; }
.msg .bubble .by { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.msg .bubble .time { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.msg .body { white-space: pre-wrap; word-break: break-word; }

.split { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.subtask { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.subtask:last-child { border-bottom: none; }
.subtask .done-true { text-decoration: line-through; color: var(--muted); }

.toast-stack { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: #16223a; color: #fff; border-radius: 10px; padding: 12px 18px; font-size: 14px;
  box-shadow: var(--shadow); max-width: 380px; animation: slidein .2s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 18px; }
.modal { background: var(--surface); border-radius: 14px; width: 560px; max-width: 100%; max-height: 88vh; overflow: auto; padding: 24px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 12px; }
.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.aushang { border-left: 4px solid var(--primary); padding-left: 16px; }
.aushang .body { white-space: pre-wrap; }
.pinned { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, white); }
.docicon { width: 38px; height: 38px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); border-radius: 9px; font-weight: 700; font-size: 11px; }
code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.pre-wrapped { white-space: pre-wrap; word-break: break-all; }
