/* ── Variables ───────────────────────────────────────── */
:root {
  --bg:           #0d0f17;
  --surface:      #141622;
  --surface2:     #1c1f31;
  --surface3:     #242740;
  --border:       #2a2e45;
  --border-light: #343856;
  --text:         #e2e8f0;
  --text-muted:   #8892a4;
  --text-dim:     #555e75;
  --accent:       #dc2626;
  --accent-h:     #b91c1c;
  --accent-glow:  rgba(220,38,38,.2);

  --prio-low:     #22c55e;
  --prio-mid:     #f59e0b;
  --prio-high:    #ef4444;

  --s-open:       #dc2626;
  --s-wip:        #f97316;
  --s-wait:       #f59e0b;
  --s-done:       #22c55e;
  --s-reject:     #ef4444;

  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 24px rgba(0,0,0,.5);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }
img { max-width: 100%; }

/* ── Public layout ───────────────────────────────────── */
.public-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.public-header {
  text-align: center;
  margin-bottom: 2rem;
}
.public-header .logo { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.public-header .logo span { color: var(--accent); }
.public-header p { color: var(--text-muted); margin-top: .3rem; }
.public-nav { margin-top: .8rem; display: flex; gap: 1rem; justify-content: center; }
.public-nav a {
  font-size: .85rem;
  color: var(--text-muted);
  padding: .3rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: color .2s, border-color .2s;
}
.public-nav a:hover, .public-nav a.active {
  color: var(--accent);
  border-color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.2rem; margin-bottom: 1.4rem; color: var(--text); }

/* ── App layout (internal) ───────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 .5rem .5rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand span { color: var(--accent); }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 500; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-divider { height: 1px; background: var(--border); margin: .5rem 0; }
.sidebar-user {
  font-size: .8rem;
  color: var(--text-muted);
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  margin-top: auto;
}
.sidebar-user strong { color: var(--text); display: block; }

.main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  min-width: 0;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.page-title svg { width: 24px; height: 24px; color: var(--accent); }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .6rem .85rem;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-control::placeholder { color: var(--text-dim); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .2s, opacity .2s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); color: #fff; }
.btn-secondary { background: var(--surface3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--prio-high); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-success { background: rgba(34,197,94,.15); color: var(--prio-low); border: 1px solid rgba(34,197,94,.3); }
.btn-success:hover { background: rgba(34,197,94,.25); }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn svg { width: 15px; height: 15px; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.prio-low    { background: rgba(34,197,94,.12);  color: var(--prio-low); }
.prio-mittel { background: rgba(245,158,11,.12); color: var(--prio-mid); }
.prio-dringend { background: rgba(239,68,68,.12); color: var(--prio-high); }

.s-eingegangen       { background: rgba(220,38,38,.12);  color: var(--s-open); }
.s-in-arbeit         { background: rgba(249,115,22,.12); color: var(--s-wip); }
.s-warten            { background: rgba(245,158,11,.12); color: var(--s-wait); }
.s-erledigt          { background: rgba(34,197,94,.12);  color: var(--s-done); }
.s-abgelehnt         { background: rgba(239,68,68,.12);  color: var(--s-reject); }

/* ── Stat cards ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
}
.stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 2rem; font-weight: 700; margin-top: .2rem; line-height: 1; }
.stat-sub   { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Table ───────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.table-header h3 { font-size: 1rem; font-weight: 600; }
.table-filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .35rem .7rem;
  font-size: .82rem;
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  cursor: pointer;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td { padding: .75rem 1rem; font-size: .88rem; vertical-align: middle; }
.td-code { font-family: monospace; font-size: .85rem; color: var(--accent); font-weight: 600; }
.td-desc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.td-assigned { font-size: .82rem; color: var(--text-muted); }

/* ── Ticket detail ───────────────────────────────────── */
.ticket-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; }
@media (max-width: 900px) { .ticket-layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel-head {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.panel-body { padding: 1.2rem; }

.ticket-meta { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.ticket-desc {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: .92rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* History / notes */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-light);
  margin-top: .45rem;
  flex-shrink: 0;
}
.timeline-dot.status { background: var(--accent); }
.timeline-dot.note   { background: var(--prio-mid); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-meta { font-size: .78rem; color: var(--text-dim); margin-top: .2rem; }
.note-internal { border-left: 2px solid var(--prio-mid); padding-left: .75rem; }
.note-public   { border-left: 2px solid var(--accent); padding-left: .75rem; }

.images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.images-grid a img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: opacity .2s;
}
.images-grid a:hover img { opacity: .8; }

/* ── Login page ──────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-card .brand {
  text-align: center;
  margin-bottom: 2rem;
}
.login-card .brand h1 { font-size: 1.4rem; font-weight: 700; }
.login-card .brand h1 span { color: var(--accent); }
.login-card .brand p { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Alert ───────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  margin-bottom: 1rem;
}
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-info    { background: rgba(220,38,38,.1);  border: 1px solid rgba(220,38,38,.3);  color: #fca5a5; }

/* ── Ticket code result ──────────────────────────────── */
.code-result {
  text-align: center;
  padding: 2rem;
}
.code-result .code-box {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface2);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: monospace;
  color: var(--accent);
  letter-spacing: .1em;
  margin: 1rem 0;
}
.code-result p { color: var(--text-muted); font-size: .88rem; }

/* ── Upload zone ─────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  color: var(--text-muted);
  font-size: .88rem;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text);
}
.drop-zone input[type=file] { display: none; }

/* ── Team table ──────────────────────────────────────── */
.role-admin { color: var(--prio-high); font-weight: 600; }
.role-developer { color: #f97316; }

/* ── Modal ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  padding: 1rem;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 1rem; margin-bottom: 1.2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; }

/* ── Misc ────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.font-mono  { font-family: monospace; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.gap-2 { gap: .5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}
.empty-state p { margin-top: .5rem; font-size: .88rem; }

.page-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  transition: color .2s;
}
.page-back:hover { color: var(--text); }

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 700px) {
  .sidebar { display: none; }
  .main { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
