* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:-apple-system, sans-serif; background:#f5f7fa; color:#1a2332; height:100vh; overflow:hidden; }

#app { display:flex; flex-direction:column; height:100vh; max-width:480px; margin:0 auto; background:#f5f7fa; }

/* Header */
.app-header { background:linear-gradient(135deg,#2196F3,#1565C0); color:#fff; padding:16px; flex-shrink:0; }
.header-content { display:flex; justify-content:space-between; align-items:center; }
.header-content h1 { font-size:18px; }
.header-actions { display:flex; align-items:center; gap:10px; }
.token-display { background:rgba(255,255,255,0.2); padding:4px 12px; border-radius:16px; font-size:13px; }
.voice-btn { background:rgba(255,255,255,0.2); border:none; color:#fff; font-size:20px; padding:6px 12px; border-radius:50%; cursor:pointer; }

/* Content */
.content { flex:1; overflow-y:auto; padding:16px; padding-bottom:80px; }
.page { display:none; animation:fadeIn .3s; }
.page.active { display:block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px);} to{opacity:1;transform:translateY(0);} }

/* Stats */
.stats-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
.stat-card { background:#fff; padding:14px; border-radius:12px; border-left:4px solid #2196F3; display:flex; align-items:center; gap:10px; cursor:pointer; }
.stat-card:active { transform:scale(0.97); }
.stat-icon { font-size:24px; }
.stat-label { display:block; font-size:11px; color:#999; }
.stat-value { display:block; font-size:16px; font-weight:700; }

/* Buttons */
.quick-actions { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-bottom:16px; }
.btn-primary { padding:10px; background:#2196F3; color:#fff; border:none; border-radius:8px; font-weight:600; cursor:pointer; }
.btn-secondary { padding:10px; background:#fff; color:#1a2332; border:1px solid #e0e0e0; border-radius:8px; cursor:pointer; }
.btn-primary:active, .btn-secondary:active { transform:scale(0.97); }

/* Cards */
.card { background:#fff; border-radius:12px; padding:16px; margin-bottom:12px; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.card h3 { font-size:14px; margin-bottom:10px; }
.card input { width:100%; padding:10px; border:2px solid #e0e0e0; border-radius:8px; margin-bottom:8px; font-size:14px; }
.card input:focus { border-color:#2196F3; outline:none; }

/* Page Headers */
.page-header { display:flex; gap:8px; margin-bottom:12px; }
.page-header input, .page-header select { flex:1; padding:10px; border:2px solid #e0e0e0; border-radius:8px; font-size:14px; }
.page-header input:focus, .page-header select:focus { border-color:#2196F3; outline:none; }

/* Customer List */
.customer-item { background:#fff; padding:14px; border-radius:10px; margin-bottom:8px; display:flex; justify-content:space-between; align-items:center; cursor:pointer; }
.customer-item:active { transform:scale(0.98); }
.customer-name { font-weight:600; }
.customer-phone { font-size:13px; color:#999; }
.customer-debt { font-weight:600; color:#f44336; }

/* Debt List */
.debt-item { background:#fff; padding:14px; border-radius:10px; margin-bottom:8px; border-left:4px solid #2196F3; }
.debt-item.overdue { border-left-color:#f44336; }
.debt-item.paid { border-left-color:#4CAF50; opacity:0.7; }
.debt-header { display:flex; justify-content:space-between; align-items:center; }
.debt-amount { font-size:18px; font-weight:700; }
.debt-status { font-size:12px; padding:2px 10px; border-radius:12px; }
.debt-status.pending { background:#ffebee; color:#c62828; }
.debt-status.paid { background:#e8f5e9; color:#2e7d32; }
.debt-customer { font-size:14px; color:#666; margin-top:4px; }
.debt-actions { display:flex; gap:8px; margin-top:8px; }
.debt-actions button { padding:4px 12px; border:none; border-radius:6px; font-size:12px; cursor:pointer; }
.btn-pay { background:#4CAF50; color:#fff; }
.btn-remind { background:#FF9800; color:#fff; }

/* Bottom Nav */
.bottom-nav { display:flex; background:#fff; border-top:1px solid #e0e0e0; flex-shrink:0; position:sticky; bottom:0; }
.nav-btn { flex:1; padding:10px; border:none; background:transparent; font-size:24px; color:#999; cursor:pointer; }
.nav-btn.active { color:#2196F3; }

/* Modal */
.modal { 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-content { background:#fff; border-radius:16px; padding:24px; max-width:400px; width:90%; max-height:80vh; overflow-y:auto; position:relative; }
.modal-close { position:absolute; top:12px; right:16px; font-size:24px; cursor:pointer; }

/* Toast */
.toast { position:fixed; bottom:100px; left:50%; transform:translateX(-50%); background:rgba(0,0,0,0.8); color:#fff; padding:12px 24px; border-radius:30px; font-size:14px; z-index:2000; }

/* Language */
.lang-btn { padding:8px 16px; border:2px solid #e0e0e0; border-radius:8px; background:#fff; cursor:pointer; margin-right:8px; }
.lang-btn.active { border-color:#2196F3; background:#e3f2fd; }

/* Section */
.section { background:#fff; border-radius:12px; padding:16px; margin-top:16px; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.section h3 { font-size:14px; margin-bottom:12px; }

/* Activity */
.activity-item { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid #f5f7fa; }
.activity-item:last-child { border-bottom:none; }
.activity-icon { font-size:18px; }
.activity-content { flex:1; font-size:13px; }
.activity-time { font-size:11px; color:#999; }

/* Empty State */
.empty-state { text-align:center; padding:30px; color:#999; }
.empty-state span { font-size:40px; display:block; margin-bottom:8px; }

/*  Toggle Switch  */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    transition: .3s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: .3s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background: #2196F3;
}

.switch input:checked + .slider:before {
    transform: translateX(22px);
}

/*   AD SYSTEM  */

/* Ad Container */
.ad-container {
    background: #fff;
    padding: 8px 12px;
    margin: 8px 8px 0 8px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    min-height: 70px;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    border: 1px solid #e8e8e8;
}

/* Ad Banner */
.ad-banner {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 0;
    transition: all 0.2s;
}

.ad-banner:active {
    transform: scale(0.99);
}

/* Ad Content */
.ad-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ad-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e3f2fd;
    border-radius: 10px;
    flex-shrink: 0;
}

.ad-details {
    flex: 1;
    min-width: 0;
}

.ad-details h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a2332;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-details p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-price {
    display: inline-block;
    font-weight: 700;
    color: #f44336;
    font-size: 13px;
    margin: 2px 0;
}

.ad-cta {
    display: inline-block;
    font-size: 11px;
    color: #2196F3;
    font-weight: 600;
    margin-top: 2px;
}

.ad-advertiser {
    font-size: 10px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
    padding-left: 8px;
    border-left: 1px solid #e8e8e8;
}

.ad-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.ad-placeholder {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #999;
    font-size: 14px;
    padding: 8px 0;
}

/* Ad Manager Button */
.ad-manager-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, #FF9800, #E65100);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ad-manager-btn:active {
    transform: scale(0.95);
}
