:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #152033;
    --muted: #667085;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ca8a04;
    --shadow: 0 18px 40px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 290px; background: #0f172a; color: #fff; padding: 24px; position: sticky; top: 0; height: 100vh; overflow-y:auto; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, #60a5fa, #2563eb); display:flex; align-items:center; justify-content:center; font-weight:800; }
.brand small { display:block; color:#cbd5e1; margin-top:3px; }
.menu { display:grid; gap:8px; }
.menu a { color:#e2e8f0; padding:12px 14px; border-radius:12px; display:flex; justify-content:space-between; align-items:center; gap:8px; font-weight:650; }
.menu a:hover { background:rgba(255,255,255,.09); text-decoration:none; }
.nav-badge { background:#ef4444; color:#fff; border-radius:999px; padding:2px 8px; font-size:12px; }
.content { flex:1; padding:28px; max-width:1440px; margin:0 auto; width:100%; }
.topbar { display:flex; justify-content:space-between; gap:18px; align-items:center; margin-bottom:22px; }
h1 { margin:0; font-size:28px; line-height:1.2; }
h2 { margin-top:0; font-size:20px; }
h3 { margin-bottom:8px; }
.user-pill { background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:10px 14px; display:flex; flex-direction:column; align-items:flex-end; box-shadow:var(--shadow); }
.user-pill small, .help { color:var(--muted); }
.card { background:var(--panel); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow); padding:22px; margin-bottom:18px; }
.auth-card { max-width:560px; }
.grid { display:grid; gap:18px; }
.grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:18px; }
.stat { background:var(--panel); border:1px solid var(--line); border-radius:18px; padding:18px; box-shadow:var(--shadow); }
.stat strong { display:block; font-size:28px; margin-bottom:4px; }
.form-row { display:grid; gap:14px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.form-group { margin-bottom:14px; }
label { display:block; font-weight:700; margin-bottom:7px; }
input, select, textarea { width:100%; border:1px solid #d0d5dd; border-radius:12px; padding:12px 13px; font:inherit; background:#fff; color:var(--text); }
textarea { min-height:140px; resize:vertical; }
input:focus, select:focus, textarea:focus { outline:3px solid rgba(37,99,235,.15); border-color:var(--primary); }
.btn { border:0; border-radius:12px; padding:11px 15px; font-weight:800; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:8px; text-decoration:none; }
.btn:hover { text-decoration:none; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-danger { background:var(--danger); color:#fff; }
.btn-secondary { background:#e2e8f0; color:#0f172a; }
.btn-success { background:var(--success); color:#fff; }
.actions, .section-head, .meta-line { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.section-head { justify-content:space-between; margin-bottom:14px; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th, td { padding:12px 10px; text-align:left; border-bottom:1px solid var(--line); vertical-align:top; }
th { color:#475467; font-size:13px; text-transform:uppercase; letter-spacing:.04em; }
tr:hover td { background:#f8fafc; }
.row-danger td { background:#fff1f2; }
.badge { display:inline-flex; align-items:center; padding:5px 10px; border-radius:999px; font-size:12px; font-weight:800; white-space:nowrap; }
.badge-red { background:#fee2e2; color:#991b1b; }
.badge-blue { background:#dbeafe; color:#1e40af; }
.badge-green { background:#dcfce7; color:#166534; }
.badge-gray { background:#e5e7eb; color:#374151; }
.badge-purple { background:#ede9fe; color:#5b21b6; }
.badge-orange { background:#ffedd5; color:#9a3412; }
.badge-yellow { background:#fef9c3; color:#854d0e; }
.alert { border-radius:14px; padding:13px 15px; margin-bottom:16px; border:1px solid; }
.alert ul { margin-bottom:0; }
.alert-success { background:#dcfce7; border-color:#86efac; color:#166534; }
.alert-danger { background:#fee2e2; border-color:#fecaca; color:#991b1b; }
.alert-warning { background:#fef9c3; border-color:#fde68a; color:#854d0e; }
.alert-info { background:#dbeafe; border-color:#bfdbfe; color:#1e40af; }
.ticket-message, .notification-item, .timeline-item { border:1px solid var(--line); border-radius:16px; padding:16px; margin-bottom:12px; background:#fff; }
.ticket-message.internal { background:#fffbeb; border-color:#fde68a; }
.notification-item.unread { border-color:#93c5fd; background:#eff6ff; }
.message-meta { display:flex; justify-content:space-between; gap:10px; color:var(--muted); font-size:13px; margin-bottom:8px; }
.message-body, .article-body { white-space:pre-wrap; line-height:1.55; }
.filters { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; align-items:end; }
.empty { color:var(--muted); text-align:center; padding:28px; }
.attach-list { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.attach-list a { background:#f1f5f9; border:1px solid var(--line); border-radius:999px; padding:6px 10px; font-size:13px; }
.checkline { display:flex; align-items:center; gap:8px; font-weight:700; margin-bottom:14px; }
.checkline input { width:auto; }
.kb-article { max-width:920px; }
@media (max-width: 980px) {
    .app-shell { flex-direction:column; }
    .sidebar { position:relative; height:auto; width:100%; }
    .menu { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .content { padding:18px; }
    .grid-2, .grid-3, .stats, .form-row, .filters { grid-template-columns:1fr; }
    .topbar { align-items:flex-start; flex-direction:column; }
    .user-pill { align-items:flex-start; }
}
