* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; }

.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #1a3a5c, #7c3aed); }
.login-card { background: #fff; border-radius: 16px; padding: 48px; width: 400px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-icon { font-size: 64px; margin-bottom: 16px; }
.login-card h2 { margin-bottom: 24px; color: #333; }
.login-card input { width: 100%; padding: 12px 16px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: #1a3a5c; box-shadow: 0 0 0 3px rgba(26,58,92,0.1); }
.login-card button { width: 100%; padding: 12px; background: #1a3a5c; color: #fff; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; }
.login-card button:hover { background: #15304d; }
.login-card button:disabled { opacity: 0.6; }
.captcha-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.captcha-row input { margin-bottom: 0; flex: 1; }
.captcha-img { width: 120px; height: 40px; flex-shrink: 0; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; background: #f0f2f5; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.captcha-img svg { width: 100%; height: 100%; }
.captcha-img span { font-size: 12px; color: #999; }
.error { color: #ef4444; font-size: 13px; margin-bottom: 12px; }

.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1a3a5c; color: #fff; padding: 0; display: flex; flex-direction: column; position: fixed; height: 100vh; }
.sidebar-title { padding: 20px 24px; font-size: 16px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a { display: block; padding: 12px 24px; color: rgba(255,255,255,0.7); text-decoration: none; cursor: pointer; transition: all 0.2s; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,0.1); color: #fff; }
.logout-btn { padding: 16px 24px; color: rgba(255,255,255,0.6); text-decoration: none; cursor: pointer; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn:hover { color: #fff; }

.main-content { margin-left: 220px; padding: 24px; flex: 1; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; color: #333; }

.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; border-bottom: 2px solid #eee; color: #666; font-size: 13px; font-weight: 600; }
td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 14px; color: #333; }
tr:hover td { background: #f8f9fa; }
.title-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag { background: #e8f0fe; color: #1a3a5c; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.badge-green { background: #dcfce7; color: #16a34a; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.badge-gray { background: #f3f4f6; color: #6b7280; padding: 2px 10px; border-radius: 12px; font-size: 12px; }

.btn-primary { background: #1a3a5c; color: #fff; border: none; border-radius: 8px; padding: 8px 20px; cursor: pointer; font-size: 14px; }
.btn-primary:hover { background: #15304d; }
.btn-outline { background: #fff; color: #1a3a5c; border: 1px solid #1a3a5c; border-radius: 8px; padding: 8px 20px; cursor: pointer; font-size: 14px; }
.btn-sm { padding: 4px 12px; border-radius: 6px; border: 1px solid #ddd; background: #fff; cursor: pointer; font-size: 12px; margin-right: 6px; }
.btn-sm:hover { background: #f0f0f0; }
.btn-danger { color: #ef4444; border-color: #ef4444; }
.btn-danger:hover { background: #fef2f2; }
.btn-success { color: #16a34a; border-color: #16a34a; }
.btn-success:hover { background: #f0fdf4; }

.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; height: calc(100vh - 140px); }
.chat-sidebar { background: #fff; border-radius: 12px; overflow-y: auto; }
.chat-user-item { padding: 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; position: relative; }
.chat-user-item:hover, .chat-user-item.active { background: #f0f7ff; }
.chat-user-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.chat-user-msg { font-size: 12px; color: #999; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { position: absolute; top: 12px; right: 12px; background: #1a3a5c; color: #fff; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.chat-area { background: #fff; border-radius: 12px; display: flex; flex-direction: column; }
.chat-messages { flex: 1; padding: 20px; overflow-y: auto; }
.msg-admin { display: flex; margin-bottom: 12px; }
.msg-user { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.msg-bubble { max-width: 60%; padding: 10px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.msg-admin .msg-bubble { background: #f3f4f6; color: #333; }
.msg-user .msg-bubble { background: #1a3a5c; color: #fff; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #999; }
.chat-input-bar { display: flex; padding: 16px; border-top: 1px solid #eee; gap: 12px; }
.chat-input-bar input { flex: 1; padding: 10px 16px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.chat-input-bar input:focus { outline: none; border-color: #1a3a5c; }

.search-input { padding: 8px 16px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; width: 240px; }
.search-input:focus { outline: none; border-color: #1a3a5c; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 16px; width: 440px; max-width: 92vw; max-height: 90vh; overflow-y: auto; }
.modal-lg { background: #fff; border-radius: 16px; width: 780px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #eee; }
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #999; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 12px; }
.form-input { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.form-input:focus { outline: none; border-color: #1a3a5c; }
.toggle-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.form-label { font-size: 14px; color: #666; white-space: nowrap; }
.form-row .form-input { flex: 1; margin-bottom: 0; }

.toast { position: fixed; top: 20px; right: 20px; background: #16a34a; color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 2000; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.record-summary { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid #eee; font-size: 14px; color: #555; }
.record-summary b { color: #1a3a5c; font-size: 16px; }
