/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f5f5;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Navbar */
.navbar {
    background: #1e293b;
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 48px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 8px; flex: 1; overflow-x: auto; }
.nav-links a { color: #cbd5e1; font-size: 13px; padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
.nav-links a:hover { background: #334155; color: #fff; text-decoration: none; }
.nav-group { display: flex; align-items: center; gap: 4px; }
.nav-label { color: #64748b; font-size: 11px; text-transform: uppercase; margin-left: 12px; white-space: nowrap; }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; white-space: nowrap; font-size: 13px; }
.nav-user a { color: #f87171; }

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.table th { background: #f8fafc; text-align: left; padding: 10px 14px; font-size: 12px; color: #64748b; text-transform: uppercase; border-bottom: 1px solid #e2e8f0; }
.table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }

/* Forms */
.form { max-width: 680px; background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #374151; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group input[type="checkbox"] { width: auto; margin-right: 6px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; color: #1e293b; }
.stat-label { font-size: 13px; color: #64748b; margin-top: 4px; }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h3 { font-size: 16px; margin-bottom: 8px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-open, .badge-pending { background: #fef3c7; color: #92400e; }
.badge-closed, .badge-done, .badge-completed, .badge-resolved { background: #d1fae5; color: #065f46; }
.badge-in_progress, .badge-investigating { background: #dbeafe; color: #1e40af; }
.badge-cancelled { background: #f3f4f6; color: #6b7280; }
.badge-low { background: #e0f2fe; color: #0369a1; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-high { background: #fed7aa; color: #c2410c; }
.badge-urgent, .badge-critical { background: #fecaca; color: #dc2626; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Checklist */
.checklist-item {
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
}
.checklist-item.done { opacity: 0.7; }
.checklist-item.done span { text-decoration: line-through; }
.checklist-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checklist-desc { font-size: 13px; color: #64748b; margin-top: 4px; margin-left: 28px; }

/* Messages */
.messages-list { max-height: 500px; overflow-y: auto; margin-bottom: 16px; }
.message { padding: 10px 14px; margin-bottom: 8px; border-radius: 8px; max-width: 75%; }
.message-inbound { background: #f1f5f9; margin-right: auto; }
.message-outbound { background: #dbeafe; margin-left: auto; }
.message-content { font-size: 14px; }
.message-meta { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.message-form { display: flex; gap: 8px; align-items: flex-end; }
.message-form .form-group { flex: 1; margin-bottom: 0; }

/* Login */
.login-container {
    max-width: 380px;
    margin: 100px auto;
    padding: 32px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
}
.login-container h1 { margin-bottom: 24px; font-size: 24px; color: #1e293b; }
.login-container .form { box-shadow: none; padding: 0; }

/* Utilities */
.text-muted { color: #94a3b8; }
.text-sm { font-size: 12px; }

/* Responsive */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 8px 16px; }
    .nav-links { order: 3; width: 100%; }
    .form-row { flex-direction: column; gap: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
