* {
    box-sizing: border-box;
}
html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Inter, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e8ecef;
    color: #2b2f34;
}
body {
    background-image: radial-gradient(circle at top left, rgba(66, 165, 245, 0.14), transparent 32%),
                      radial-gradient(circle at bottom right, rgba(0, 200, 140, 0.12), transparent 30%);
}
a {
    color: #2469e9;
    text-decoration: none;
}
button, input, textarea {
    font: inherit;
}
button {
    border: none;
    cursor: pointer;
}
.container {
    width: min(100%, 1160px);
    margin: 0 auto;
    padding: 24px;
}
.page-card {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}
.center-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.form-card {
    width: min(100%, 460px);
    padding: 36px 32px;
}
.form-card h1,
.form-card h2 {
    margin: 0 0 10px;
    font-size: 28px;
    color: #111827;
}
.form-card p {
    margin: 0 0 28px;
    color: #6b7280;
    line-height: 1.6;
}
.field {
    margin-bottom: 18px;
}
.field label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-size: 14px;
}
.field input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #111827;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
    outline: none;
    border-color: #2469e9;
    box-shadow: 0 0 0 4px rgba(36, 105, 233, 0.12);
}
.form-action {
    margin-top: 24px;
}
.btn-primary {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2469e9, #00b894);
    color: white;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.btn-secondary {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.form-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}
.form-footer a {
    color: #2469e9;
    font-weight: 600;
}
.hero-banner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}
.hero-banner .tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(36, 105, 233, 0.08);
    color: #1d4ed8;
    font-weight: 600;
    font-size: 13px;
}
.hero-banner h1 {
    font-size: clamp(2.3rem, 2.6vw, 3.4rem);
    margin: 0;
    line-height: 1.02;
}
.hero-banner p {
    max-width: 520px;
}
.dashboard {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 100vh;
    gap: 24px;
    padding: 24px;
}
.sidebar {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 28px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.sidebar .profile {
    display: flex;
    align-items: center;
    gap: 14px;
}
.avatar {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, #00b894, #2469e9);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
    font-size: 20px;
}
.sidebar h3 {
    margin: 0;
    font-size: 18px;
}
.sidebar p {
    margin: 0;
    color: #6b7280;
}
.search-box {
    border-radius: 18px;
    border: 1px solid #d1d5db;
    background: white;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}
.search-box input {
    border: none;
    outline: none;
    width: 100%;
    background: transparent;
    color: #111827;
}
.chat-item {
    display: flex;
    gap: 14px;
    align-items: center;
    border-radius: 20px;
    padding: 14px;
    background: white;
    border: 1px solid transparent;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.chat-item:hover {
    transform: translateY(-1px);
    background: #f8fbff;
    border-color: #dbeafe;
}
.chat-item.active {
    background: #c4e5ff;
}
.chat-item .circle {
    width: 50px;
    height: 50px;
    border-radius: 18px;
    background: #c7ddff;
    display: grid;
    place-items: center;
    color: #1e40af;
    font-weight: 700;
}
.chat-item .content {
    flex: 1;
    min-width: 0;
}
.chat-item .content h4 {
    margin: 0 0 6px;
    font-size: 15px;
}
.chat-item .content p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-item .meta {
    text-align: right;
}
.chat-item .meta span {
    display: block;
    color: #6b7280;
    font-size: 12px;
}
.chat-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.chat-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.chat-top h2 {
    margin: 0;
    font-size: 24px;
}
.chat-top .status {
    color: #6b7280;
    font-size: 14px;
}
.chat-card {
    background: #ffffff;
    border-radius: 28px;
    padding: 24px;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.message-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    display: grid;
    gap: 18px;
}
.message {
    max-width: 74%;
    padding: 16px 18px;
    border-radius: 24px;
    background: #f8fafc;
    line-height: 1.6;
    position: relative;
    color: #111827;
}
.message.out {
    margin-left: auto;
    background: linear-gradient(135deg, #2469e9, #00b894);
    color: white;
}
.message .meta {
    margin-top: 12px;
    font-size: 12px;
    color: inherit;
    opacity: 0.8;
}
.message.out .meta {
    opacity: 0.85;
}
.type-area {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
}
.type-area input[type="text"] {
    width: 100%;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    padding: 14px 18px;
    outline: none;
}
.type-area input[type="file"] {
    border: 1px solid #d1d5db;
    border-radius: 18px;
    padding: 10px 14px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
}
.type-area button {
    min-width: 132px;
    border-radius: 999px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #2469e9, #00b894);
    color: white;
    font-weight: 700;
}
@media (max-width: 980px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 560px) {
    .form-card {
        padding: 28px 20px;
    }
    .chat-top {
        flex-direction: column;
        align-items: flex-start;
    }
    .chat-top h2 {
        font-size: 22px;
    }
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    gap: 24px;
    padding: 24px;
}
.app-aside {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 28px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.app-aside .nav-title {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #64748b;
}
.app-aside h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
}
.app-aside p {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}
.app-nav {
    display: grid;
    gap: 10px;
}
.app-nav a {
    display: block;
    padding: 14px 18px;
    border-radius: 18px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.app-nav a:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
.app-nav a.active {
    background: linear-gradient(135deg, #2469e9, #00b894);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 18px 40px rgba(36, 105, 233, 0.18);
}
.app-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.dashboard-actions {
    display: flex;
    justify-content: flex-end;
}
.btn-small {
    padding: 10px 16px;
    border-radius: 999px;
    background: #2469e9;
    color: #ffffff;
    font-weight: 700;
    border: none;
    box-shadow: 0 10px 30px rgba(36, 105, 233, 0.18);
}
.panel-card {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: auto;
    z-index: 50;
}
.modal-overlay.hidden {
    display: none;
}
.modal-card {
    width: min(100%, 620px);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 28px;
    padding: 28px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
}
.modal-body {
    overflow: auto;
    max-height: calc(100vh - 180px);
    padding-right: 8px;
}
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.modal-close {
    border: none;
    background: #f8fafc;
    color: #111827;
    font-size: 24px;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    cursor: pointer;
}
.message-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}
.message-badge::before {
    content: none;
}
.badge-admin {
    background: #e0f2fe;
    color: #1d4ed8;
}
.badge-admin::before {
    content: '🛡';
}
.badge-user {
    background: #dcfce7;
    color: #166534;
}
.badge-user::before {
    content: '👤';
}
.badge-status-new {
    background: #fee2e2;
    color: #b91c1c;
}
.badge-status-new::before {
    content: '🆕';
}
.badge-status-replied {
    background: #d1fae5;
    color: #047857;
}
.badge-status-replied::before {
    content: '✅';
}
.message-content-preview {
    background: #f8fafc;
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 8px;
    white-space: pre-wrap;
}
.message-image-preview,
.reply-image-preview {
    margin-top: 12px;
}
.message-image-preview img,
.reply-image-preview img {
    width: 100%;
    max-width: 280px;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}
.panel-card h2,
.panel-card h3 {
    margin: 0 0 14px;
    color: #111827;
}
.panel-row {
    display: grid;
    grid-template-columns: 1.5fr 0.9fr;
    gap: 20px;
}
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.metric-box {
    background: #f8fafc;
    border-radius: 22px;
    padding: 20px;
}
.metric-box span {
    display: block;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
}
.metric-box strong {
    display: block;
    font-size: 2.2rem;
    color: #111827;
}
.table-wrapper {
    overflow-x: auto;
    margin-top: 16px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    text-align: left;
    vertical-align: middle;
}
.data-table th {
    color: #475569;
    background: #f8fafc;
    font-weight: 700;
}
.data-table tr:hover {
    background: #f8fafc;
}
.alert {
    border-radius: 18px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.alert-error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .panel-row {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 560px) {
    .form-card {
        padding: 28px 20px;
    }
    .app-aside {
        padding: 20px;
    }
    .chat-card {
        min-height: auto;
    }
}
