* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f2f5; color: #333; }

/* Login page */
.admin-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0a3d25, #0e5f3a); }
.login-box { background: #fff; border-radius: 16px; padding: 48px; width: 400px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-box h1 { color: var(--primary, #0e5f3a); font-size: 1.5rem; text-align: center; margin-bottom: 8px; }
.login-subtitle { text-align: center; color: #6b7280; margin-bottom: 32px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 6px; color: #374151; font-weight: 500; font-size: 0.9rem; }
.login-form input { width: 100%; padding: 12px 16px; border-radius: 10px; border: 1px solid #d1d5db; font-size: 0.9rem; outline: none; transition: border-color 0.2s; }
.login-form input:focus { border-color: #0e5f3a; }
.error-msg { color: #dc2626; font-size: 0.85rem; margin-bottom: 12px; }
.info-msg { color: #059669; font-size: 0.85rem; margin-bottom: 12px; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #0a3d25; color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; }
.sidebar-header { padding: 20px; font-size: 1.1rem; font-weight: 800; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-nav { flex: 1; padding: 12px; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.nav-item { display: block; padding: 10px 14px; color: rgba(255,255,255,0.7); text-decoration: none; border-radius: 8px; font-size: 0.9rem; margin-bottom: 4px; transition: all 0.2s; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #4ade80; font-weight: 600; }
.logout-btn { background: none; border: none; cursor: pointer; width: 100%; text-align: left; font-size: 0.9rem; color: rgba(255,255,255,0.7); padding: 10px 14px; border-radius: 8px; }
.logout-btn:hover { background: rgba(255,255,255,0.08); color: #ef4444; }

/* Main content */
.main-content { flex: 1; margin-left: 220px; padding: 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; color: #111827; }

/* Cards */
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card-title { font-size: 0.85rem; color: #6b7280; margin-bottom: 8px; }
.card-value { font-size: 2rem; font-weight: 800; color: #0e5f3a; }
.card-value.warn { color: #dc2626; }
.settings-card { margin-top: 20px; max-width: 420px; }
.bg-setting-form { display: flex; align-items: center; gap: 12px; }
.bg-setting-form input[type="color"] { width: 56px; height: 40px; padding: 2px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; cursor: pointer; }
.setting-hint { font-size: 0.8rem; color: #9ca3af; margin-top: 10px; }

/* Button */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; cursor: pointer; border: 1px solid #d1d5db; background: #fff; color: #374151; text-decoration: none; transition: all 0.2s; }
.btn:hover { background: #f3f4f6; }
.btn-primary { background: #0e5f3a; color: #fff; border-color: #0e5f3a; }
.btn-primary:hover { background: #0a3d25; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn.active { background: #0e5f3a; color: #fff; border-color: #0e5f3a; }

/* Table */
.table-wrap { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 0.8rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e5e7eb; background: #f9fafb; }
.data-table td { padding: 12px 16px; font-size: 0.9rem; border-bottom: 1px solid #f3f4f6; }
.data-table tr:hover td { background: #f9fafb; }
.data-table .empty { text-align: center; color: #9ca3af; padding: 40px; }
.actions { display: flex; gap: 8px; }

/* Badge */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-unread { background: #fee2e2; color: #dc2626; }
.badge-read { background: #dbeafe; color: #2563eb; }
.badge-replied { background: #d1fae5; color: #059669; }
.badge-closed { background: #f3f4f6; color: #6b7280; }

/* Filter */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-form select, .filter-form input { padding: 8px 12px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 0.85rem; outline: none; }
.filter-form select:focus, .filter-form input:focus { border-color: #0e5f3a; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 16px; justify-content: center; margin-top: 24px; }
.pagination .page-btn.disabled { opacity: 0.5; pointer-events: none; }
.pagination span { font-size: 0.9rem; color: #6b7280; }

/* Form */
.form { background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: #374151; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 0.9rem; outline: none; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: #0e5f3a; box-shadow: 0 0 0 3px rgba(14,95,58,0.1); }
.form-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 24px; border-top: 1px solid #e5e7eb; }
.preview { margin-top: 8px; }

/* Message detail */
.detail-card { background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.detail-section { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid #f3f4f6; }
.detail-section:last-child { border-bottom: none; }
.detail-section h3 { font-size: 1rem; color: #111827; margin-bottom: 16px; }
.detail-row { display: flex; padding: 8px 0; }
.detail-label { width: 120px; flex-shrink: 0; color: #6b7280; font-size: 0.85rem; }
.detail-content { background: #f9fafb; padding: 16px; border-radius: 8px; color: #374151; font-size: 0.9rem; line-height: 1.8; }
.detail-meta { font-size: 0.8rem; color: #6b7280; margin-top: 12px; }
.detail-actions { margin-top: 24px; }
.reply-form { margin-top: 16px; }
