*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Dark Mode (Standard) */
:root {
  --blue: #3b82f6;
  --blue-hover: #2563eb;
  --blue-light: rgba(59,130,246,.12);
  --green: #22c55e;
  --orange: #f97316;
  --gray: #94a3b8;
  --border: #1e2d42;
  --bg: #0d1520;
  --card-bg: #151e2d;
  --white: #151e2d;
  --text: #e2e8f0;
  --text-muted: #64748b;
  --input-bg: #0f1825;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --topbar-bg: #0f1623;
}

/* Light Mode */
[data-theme="light"] {
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-light: #eff6ff;
  --green: #16a34a;
  --orange: #ea580c;
  --gray: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --white: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --input-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
  --topbar-bg: #ffffff;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
.topbar-logo .name { color: var(--text); }

/* Topbar */
.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 10;
}
.topbar-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar-logo .icon { width: 32px; height: 32px; background: var(--blue); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; }
.topbar-logo .name { font-weight: 700; font-size: 15px; color: var(--text); }
.topbar-logo .sub { font-size: 11px; color: var(--text-muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* Layout */
.page { max-width: 800px; margin: 0 auto; padding: 28px 16px; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 800; flex: 1; }

/* Card */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-title { font-size: 14px; font-weight: 700; flex: 1; }
.card-body { padding: 20px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all .15s; text-decoration: none; line-height: 1.4; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-secondary { background: var(--card-bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--input-bg); border-color: #4b5563; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-new { background: rgba(248,113,113,.15); color: #f87171; }
.badge-open { background: rgba(74,222,128,.15); color: #4ade80; }
.badge-pending { background: rgba(251,191,36,.15); color: #fbbf24; }
.badge-closed { background: rgba(148,163,184,.12); color: #94a3b8; }
[data-theme="light"] .badge-new { background: #fee2e2; color: #dc2626; }
[data-theme="light"] .badge-open { background: #dcfce7; color: #16a34a; }
[data-theme="light"] .badge-pending { background: #ffedd5; color: #ea580c; }
[data-theme="light"] .badge-closed { background: #f3f4f6; color: #6b7280; }

/* Filter tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 5px; padding: 5px 13px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text-muted); text-decoration: none; transition: all .15s; }
.tab:hover { border-color: var(--blue); color: var(--blue); }
.tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Ticket list */
.ticket-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .1s; }
.ticket-item:last-child { border-bottom: none; }
.ticket-item:hover { background: #f9fafb; }
.ticket-info { flex: 1; min-width: 0; }
.ticket-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.ticket-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.ticket-number { font-family: monospace; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.ticket-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* Article */
.article { padding: 18px; border-bottom: 1px solid var(--border); }
.article:last-child { border-bottom: none; }
.article.internal { display: none; } /* Kunden sehen keine internen Notizen */
.article-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.article-author { flex: 1; }
.article-author-name { font-weight: 700; font-size: 13px; }
.article-author-role { font-size: 11px; color: var(--text-muted); }
.article-time { font-size: 11px; color: var(--text-muted); }
.article-body { font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.article-agent-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--blue-light); color: var(--blue); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }

/* Reply */
.reply-box { border-top: 2px solid var(--blue); padding: 18px; }
.reply-box label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 7px; }
textarea.reply-input { width: 100%; min-height: 100px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; font-family: inherit; resize: vertical; outline: none; transition: border-color .15s; background: var(--input-bg); color: var(--text); }
textarea.reply-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 5px; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: inherit; color: var(--text); background: var(--input-bg); outline: none; transition: border-color .15s; }
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* Alert */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; border: 1px solid transparent; }
.alert-success { background: rgba(74,222,128,.12); color: #4ade80; border-color: rgba(74,222,128,.25); }
.alert-danger { background: rgba(248,113,113,.12); color: #f87171; border-color: rgba(248,113,113,.25); }
[data-theme="light"] .alert-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
[data-theme="light"] .alert-danger { background: #fee2e2; color: #dc2626; border-color: #fecaca; }

/* Login page */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #0a0f1e 0%, #0f1623 100%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { background: var(--card-bg); border-radius: 12px; width: 100%; max-width: 380px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); border: 1px solid var(--border); }
.login-header { background: #0f1623; padding: 30px 28px; text-align: center; }
.login-logo { width: 50px; height: 50px; background: var(--blue); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: #fff; margin: 0 auto 12px; }
.login-header h1 { color: #fff; font-size: 19px; font-weight: 700; }
.login-header p { color: rgba(255,255,255,.6); font-size: 13px; margin-top: 3px; }
.login-body { padding: 26px 28px 28px; background: var(--card-bg); }

/* Empty state */
.empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty svg { width: 44px; height: 44px; opacity: .25; margin-bottom: 12px; }
.empty h3 { font-size: 15px; font-weight: 700; color: #4b5563; margin-bottom: 6px; }
.empty p { font-size: 13px; }

/* Status progress */
.status-bar { display: flex; align-items: center; gap: 0; margin: 16px 0; }
.status-step { flex: 1; text-align: center; position: relative; }
.status-step::before { content: ''; display: block; height: 3px; background: var(--border); position: absolute; top: 11px; left: -50%; right: 50%; }
.status-step:first-child::before { display: none; }
.status-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); background: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 5px; position: relative; z-index: 1; }
.status-dot.active { background: var(--blue); border-color: var(--blue); }
.status-dot.done { background: var(--green); border-color: var(--green); }
.status-dot svg { width: 11px; height: 11px; color: #fff; }
.status-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.status-label.active { color: var(--blue); }
.status-label.done { color: var(--green); }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mt-3 { margin-top: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
