/* reset & base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #f0f2f5;
    color: #1e2a3a;
}
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(145deg, #1e2a3a, #0f1a24);
    color: #eef2f5;
    padding: 2rem 1rem;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
}
.sidebar .logo {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sidebar nav a {
    display: block;
    color: #cfdfed;
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    transition: all 0.2s;
    font-weight: 500;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: #2c3e50;
    color: white;
}

/* main content */
.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
}
h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #0f1a24;
}

/* dashboard cards */
.dashboard-cards {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
}
.card {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    flex: 1;
}
.card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}
.card .stat {
    font-size: 2rem;
    font-weight: bold;
    color: #3498db;
}

/* login page */
.login-page {
    background: linear-gradient(135deg, #1e2a3a 0%, #0f1a24 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-card {
    background: white;
    padding: 2rem;
    border-radius: 32px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    width: 400px;
    text-align: center;
}
.login-card h1 {
    color: #1e2a3a;
    margin-bottom: 0.5rem;
}
.login-card h2 {
    font-size: 1.2rem;
    color: #5f6c7a;
    margin-bottom: 1.5rem;
    font-weight: normal;
}
.input-group {
    margin-bottom: 1rem;
}
.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d0d7de;
    border-radius: 28px;
    font-size: 1rem;
}
.btn-login, .btn-primary {
    background: #1e2a3a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 32px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: 0.2s;
}
.btn-login:hover, .btn-primary:hover {
    background: #2c3e50;
}
.error-message {
    background: #fee2e2;
    color: #c0392b;
    padding: 10px;
    border-radius: 20px;
    margin-bottom: 1rem;
}

/* chat layout */
.chat-layout {
    display: flex;
    gap: 1.5rem;
    background: white;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    min-height: 70vh;
}
.user-list-panel {
    width: 280px;
    background: #f9fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}
.user-list-panel h3 {
    padding: 1rem;
    background: #f1f5f9;
    margin: 0;
}
.user-list-scroll {
    flex: 1;
    overflow-y: auto;
}
.user-list-panel ul {
    list-style: none;
}
.user-list-panel li {
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.1s;
}
.user-list-panel li:hover, .user-list-panel li.active {
    background: #eef2ff;
}
.unread-badge {
    background: #e74c3c;
    color: white;
    border-radius: 30px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: bold;
}
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.chat-header {
    padding: 1rem;
    background: #f9fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: bold;
}
.messages-area {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 20px;
    word-wrap: break-word;
}
.message.user {
    background: #3498db;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.message.operator {
    background: #e9ecef;
    color: #1e2a3a;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.message small {
    font-size: 0.7rem;
    opacity: 0.7;
    display: block;
    margin-top: 5px;
}
.message-input-area {
    display: flex;
    gap: 12px;
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}
.message-input-area textarea {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 12px;
    resize: none;
    font-family: inherit;
}
.btn-send {
    background: #1e2a3a;
    color: white;
    border: none;
    border-radius: 40px;
    padding: 0 24px;
    cursor: pointer;
    font-weight: bold;
}
.btn-send:hover {
    background: #2c3e50;
}

/* tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.data-table th, .data-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}
.data-table th {
    background: #f1f5f9;
    font-weight: 600;
}
.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
}
.btn-danger:hover {
    background: #c0392b;
}

/* broadcast form */
.broadcast-form {
    background: white;
    border-radius: 28px;
    padding: 1.5rem;
}
.user-checkboxes {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 1rem;
    margin-top: 0.5rem;
}
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}
.form-group textarea {
    width: 100%;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    padding: 12px;
    font-family: inherit;
}
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.inline-form input, .inline-form select {
    padding: 10px 16px;
    border-radius: 40px;
    border: 1px solid #cbd5e1;
}
.btn {
    background: #ff6a00;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    display: inline-block;
}
.btn:hover {
    background: #e05a00;
    transform: scale(1.02);
}
.btn:active {
    transform: scale(0.98);
}
.source-filters {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.source-filters .btn.active {
    background: #ff6a00;
    color: white;
}
.source-filters .btn {
    background: white;
    color: #1e2a3a;
    border: 1px solid #cbd5e1;
}
.source-filters .btn:hover {
    background: #f0f2f5;
}
.source-group {
    background: #f9fafc;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.source-group h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}
.source-group .checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.5rem;
}