* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; }

/* Public index page */
.public-page { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.public-header { text-align: center; padding: 60px 20px 40px; color: #fff; }
.public-header h1 { font-size: 2.5em; margin-bottom: 10px; text-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.public-header p { font-size: 1.1em; opacity: 0.9; }
.public-content { flex: 1; max-width: 800px; margin: 0 auto; padding: 0 20px; width: 100%; }
.public-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.public-card { background: rgba(255,255,255,0.95); border-radius: 16px; padding: 30px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.1); transition: transform 0.3s; }
.public-card:hover { transform: translateY(-5px); }
.public-card .icon { font-size: 2.5em; margin-bottom: 10px; }
.public-card h3 { color: #333; margin-bottom: 8px; }
.public-card p { color: #666; font-size: 0.9em; line-height: 1.6; }
.public-footer { text-align: center; padding: 30px 20px; color: rgba(255,255,255,0.7); font-size: 0.85em; }
.public-footer a { color: rgba(255,255,255,0.9); text-decoration: none; }
.public-footer a:hover { text-decoration: underline; }

/* Login page */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-box h2 { text-align: center; color: #333; margin-bottom: 30px; font-size: 1.5em; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; color: #555; font-size: 0.9em; }
.form-group input, .form-group select { width: 100%; padding: 12px 14px; border: 2px solid #e1e5eb; border-radius: 8px; font-size: 15px; color: #1a1a1a; background: #fff; outline: none; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus { border-color: #4facfe; }
.form-group input:-webkit-autofill { -webkit-text-fill-color: #1a1a1a; -webkit-box-shadow: 0 0 0 30px #fff inset; }
.error-msg { color: #e74c3c; font-size: 0.9em; text-align: center; margin-bottom: 15px; padding: 10px; background: #fef0ef; border-radius: 8px; }
.login-footer { text-align: center; margin-top: 25px; color: #999; font-size: 0.8em; }

/* Admin layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: linear-gradient(180deg, #2c3e50, #1a252f); color: #fff; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; }
.sidebar-header { padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h3 { font-size: 1.1em; color: #4facfe; }
.nav-list { list-style: none; padding: 10px 0; }
.nav-list li a { display: block; padding: 12px 20px; color: rgba(255,255,255,0.7); text-decoration: none; transition: all 0.3s; font-size: 0.95em; }
.nav-list li a:hover { background: rgba(255,255,255,0.1); color: #fff; padding-left: 25px; }
.main-content { margin-left: 220px; flex: 1; padding: 20px; }
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 1.4em; color: #333; }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; text-decoration: none; transition: all 0.3s; }
.btn-primary { background: linear-gradient(135deg, #4facfe, #00f2fe); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(79,172,254,0.4); }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-warning { background: #f39c12; color: #fff; }

/* Cards */
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat-card .num { font-size: 2em; font-weight: bold; color: #4facfe; margin: 5px 0; }
.stat-card .label { color: #888; font-size: 0.85em; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eee; font-size: 0.9em; }
table th { background: #f8f9fa; color: #555; font-weight: 600; }
table tr:hover { background: #f5f7fa; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; justify-content: center; align-items: center; }
.modal.show { display: flex; }
.modal-content { background: #fff; border-radius: 12px; padding: 30px; width: 90%; max-width: 500px; max-height: 80vh; overflow-y: auto; }
.modal-content h3 { margin-bottom: 20px; color: #333; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Trend bars */
.trend-chart { display: flex; gap: 8px; align-items: flex-end; height: 150px; padding: 20px 0; }
.trend-bar { flex: 1; display: flex; flex-direction: column; align-items: center; }
.trend-bar .bar { width: 100%; background: linear-gradient(180deg, #4facfe, #00f2fe); border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.3s; }
.trend-bar .day-label { font-size: 0.75em; color: #888; margin-top: 5px; }

/* Status badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.8em; }
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* Search */
.search-box { display: inline-flex; margin-bottom: 15px; }
.search-box input { padding: 8px 12px; border-radius: 6px 0 0 6px; border: 1px solid #ddd; border-right: none; font-size: 14px; outline: none; }
.search-box button { padding: 8px 12px; border-radius: 0 6px 6px 0; border: 1px solid #ddd; background: #f5f5f5; cursor: pointer; }

/* Pay page */
.pay-page { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.pay-header { text-align: center; padding: 40px 20px; color: #fff; }
.pay-header h1 { font-size: 1.8em; }
.pay-box { max-width: 400px; margin: 0 auto; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); text-align: center; }
.pay-box .price { font-size: 3em; font-weight: bold; color: #e74c3c; margin: 15px 0; }
.pay-box .store-name { color: #888; margin-bottom: 10px; }
.pay-box .device-name { color: #333; font-size: 1.2em; margin-bottom: 5px; }
.pay-btn { width: 100%; padding: 15px; background: linear-gradient(135deg, #4facfe, #00f2fe); color: #fff; border: none; border-radius: 10px; font-size: 1.1em; cursor: pointer; margin-top: 20px; transition: all 0.3s; }
.pay-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(79,172,254,0.5); }
.pay-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.pay-footer { text-align: center; padding: 30px; color: rgba(255,255,255,0.7); font-size: 0.85em; margin-top: 40px; }
.pay-error { background: #fef0ef; color: #e74c3c; padding: 20px; border-radius: 12px; margin: 20px; text-align: center; }

/* Alert */
.alert-warning { background: #fff3cd; border: 1px solid #ffc107; color: #856404; padding: 12px 16px; border-radius: 8px; margin-bottom: 15px; }

/* Flex helpers */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-10 { margin-bottom: 10px; }
.mt-10 { margin-top: 10px; }
.text-center { text-align: center; }
