* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #fff;
  --card-bg: #fff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-secondary: #64748b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

/* ========== Login ========== */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; position: relative; overflow: hidden; }
.login-bg { position: absolute; inset: 0; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-bg::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle at 30% 50%, rgba(255,255,255,.08) 0%, transparent 50%); animation: float 20s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(30px,-30px); } }
.login-card { position: relative; background: #fff; border-radius: 16px; padding: 48px 40px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-header { text-align: center; margin-bottom: 36px; }
.login-logo { width: 64px; height: 64px; background: var(--primary); border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.login-logo i { font-size: 32px; color: #fff; }
.login-header h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.login-header p { color: var(--text-secondary); font-size: 14px; }
.input-group { position: relative; margin-bottom: 16px; }
.input-group i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 18px; }
.input-group input { width: 100%; padding: 12px 14px 12px 44px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; transition: border-color .2s; }
.input-group input:focus { border-color: var(--primary); }
.btn-login { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s; margin-top: 8px; }
.btn-login:hover { background: #4338ca; }
.btn-login:active { transform: scale(.98); }
.error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 20px; }

/* ========== Layout ========== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 240px; background: var(--sidebar-bg); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 50; transition: transform .3s; }
.sidebar-header { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-icon { font-size: 24px; color: var(--primary-light); }
.logo-text { font-size: 17px; font-weight: 600; color: #fff; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

/* App switcher */
.app-switcher { padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.switcher-label { display: block; font-size: 11px; color: rgba(255,255,255,.4); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.app-select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: #fff; font-size: 13px; outline: none; cursor: pointer; }
.app-select option { background: var(--sidebar-bg); color: #fff; }
.app-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--primary-bg); color: var(--primary); margin-left: 12px; }
.badge-app { background: #eef2ff; color: #4f46e5; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.btn-sm-inline { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; font-size: 13px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--sidebar-text); text-decoration: none; font-size: 14px; cursor: pointer; transition: all .15s; border-radius: 0 8px 8px 0; margin-right: 12px; }
.nav-link:hover { color: #e2e8f0; background: rgba(255,255,255,.06); }
.nav-link.active { color: #fff; background: var(--primary); }
.nav-link i { font-size: 18px; width: 20px; text-align: center; }
.nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 20px; }
.nav-group-title { padding: 8px 20px 4px; font-size: 11px; text-transform: uppercase; color: rgba(255,255,255,.3); letter-spacing: 1px; font-weight: 600; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; color: var(--sidebar-text); }
.user-meta { flex: 1; }
.user-name { font-size: 13px; color: #fff; font-weight: 500; }
.user-role { font-size: 11px; color: var(--sidebar-text); }

/* Main */
.main-area { flex: 1; margin-left: 240px; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--card-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 40; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }
.page-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; gap: 8px; }
.btn-icon { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all .15s; }
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
.content-area { padding: 24px; flex: 1; }

/* ========== Cards ========== */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-card.mini { cursor: pointer; transition: transform .15s, box-shadow .15s; padding: 16px; }
.stat-card.mini:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-body { flex: 1; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-value.app-name { font-size: 15px; }
.stat-label { font-size: 13px; color: var(--text-secondary); }
.text-secondary { color: var(--text-secondary); font-size: 12px; }

/* Quick actions */
.quick-actions { display: flex; gap: 16px; }
.quick-action { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 16px; border-radius: var(--radius); border: 1.5px dashed var(--border); text-decoration: none; color: var(--text-secondary); cursor: pointer; transition: all .2s; }
.quick-action:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.quick-action i { font-size: 28px; }
.quick-action span { font-size: 13px; font-weight: 500; }

/* ========== Table ========== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar-sm { width: 32px; height: 32px; border-radius: 8px; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; overflow: hidden; flex-shrink: 0; }
.user-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-user { background: #d1fae5; color: #065f46; }
.badge-blocked { background: #fee2e2; color: #991b1b; font-size: 11px; margin-left: 4px; cursor: default; }
.badge:hover { opacity: .8; }
.row-blocked td { opacity: .6; }
.btn-block { background: #fee2e2; color: #dc2626; }
.btn-unblock { background: #d1fae5; color: #059669; }

/* ========== Feedback ========== */
.fb-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.fb-item:last-child { border-bottom: none; }
.fb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fb-user { display: flex; align-items: center; gap: 8px; }
.fb-avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; overflow: hidden; }
.fb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fb-name { font-size: 13px; font-weight: 500; }
.fb-time { font-size: 12px; color: var(--text-secondary); }
.fb-content { font-size: 14px; line-height: 1.6; margin-bottom: 8px; }
.fb-image { max-width: 200px; border-radius: 8px; cursor: pointer; margin-bottom: 8px; }
.fb-reply { background: #f1f5f9; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 8px; border-left: 3px solid var(--primary); }
.fb-reply-label { color: var(--primary); font-weight: 500; }
.fb-actions { display: flex; gap: 8px; }
.btn-sm { padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; transition: opacity .15s; }
.btn-sm:hover { opacity: .8; }
.btn-reply { background: var(--primary-bg); color: var(--primary); }
.btn-delete { background: #fee2e2; color: var(--danger); }

/* ========== Form ========== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input { width: 100%; max-width: 400px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; transition: border-color .2s; }
.form-input:focus { border-color: var(--primary); }
.form-textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; resize: vertical; font-family: inherit; transition: border-color .2s; }
.form-textarea:focus { border-color: var(--primary); }
.search-input { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; width: 200px; }
.search-input:focus { border-color: var(--primary); }

/* ========== Buttons ========== */
.btn-primary { padding: 10px 20px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .2s; }
.btn-primary:hover { background: #4338ca; }
.btn-secondary { padding: 10px 20px; background: #f1f5f9; color: var(--text); border: none; border-radius: var(--radius); font-size: 14px; cursor: pointer; }

/* ========== Modal ========== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 440px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); padding: 4px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ========== Page sections ========== */
.page-section { display: none; }
.page-section.active { display: block; }

/* ========== Empty ========== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { flex-direction: column; }
}
