* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { font-family: 'Segoe UI', Tahoma, sans-serif; background: #f4f4f4; color: #222; }
body { padding-bottom: 80px; }

.app-header {
    background: #1a1a1a; color: #fff; padding: 14px 16px;
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.app-header h1 { font-size: 18px; font-weight: 700; flex: 1; }
.back-btn {
    color: #fff; text-decoration: none; font-size: 22px;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: rgba(255,255,255,.1);
}
.date-badge { font-size: 12px; background: #c9a227; color: #1a1a1a; padding: 4px 10px; border-radius: 12px; font-weight: 700; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.stats .stat-card.full { grid-column: 1 / -1; }
.stat-card { background: #fff; border-radius: 12px; padding: 14px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-green .stat-value { color: #27ae60; }
.stat-red .stat-value { color: #c0392b; }

.actions { display: flex; gap: 10px; padding: 0 12px 12px; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 16px; border-radius: 10px; font-weight: 700; font-size: 15px;
    border: none; cursor: pointer; text-decoration: none; transition: transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #c9a227; color: #1a1a1a; }
.btn-outline { background: #fff; color: #333; border: 2px solid #ddd; }
.btn-secondary { background: #eee; color: #333; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-lg { flex: 1; padding: 14px; font-size: 16px; }
.full-width { width: 100%; margin-top: 8px; }

.orders-list { padding: 0 12px; }
.section-title { font-size: 15px; color: #666; margin: 10px 0; font-weight: 700; }
.empty { text-align: center; color: #999; padding: 40px 20px; background: #fff; border-radius: 12px; }

.order-item {
    background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    text-decoration: none; color: inherit;
}
.order-main { flex: 1; min-width: 0; }
.order-customer { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.order-desc { font-size: 13px; color: #666; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-time { font-size: 11px; color: #aaa; }
.order-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.order-price { font-weight: 700; font-size: 15px; color: #1a1a1a; white-space: nowrap; }
.text-red { color: #c0392b; }
.text-green { color: #27ae60; }
.order-btns { display: flex; gap: 4px; }
.icon-btn {
    background: #f4f4f4; border: none; border-radius: 8px; padding: 6px 8px;
    font-size: 14px; cursor: pointer;
}
.icon-btn:active { background: #e0e0e0; }

.debtor-item { cursor: pointer; }
.arrow { font-size: 22px; color: #ccc; }

.payment-row { background: #f0faf3; }

.modal {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 100; align-items: center; justify-content: center; padding: 16px;
}
.modal.show { display: flex; }
.modal-box {
    background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px;
    max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { margin-bottom: 14px; color: #1a1a1a; font-size: 18px; }
.modal-box label { display: block; font-size: 13px; color: #666; margin: 12px 0 6px; font-weight: 700; }
.modal-box input {
    width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 10px;
    font-size: 15px; font-family: inherit;
}
.modal-box input:focus { outline: none; border-color: #c9a227; }
.modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal-btns .btn { flex: 1; }

.customer-search-wrap { position: relative; }
.customer-suggest {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff;
    border: 2px solid #c9a227; border-radius: 10px; margin-top: 4px;
    max-height: 180px; overflow-y: auto; z-index: 10; display: none;
}
.customer-suggest.show { display: block; }
.customer-suggest div {
    padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0; font-size: 14px;
}
.customer-suggest div:hover, .customer-suggest div.active { background: #faf6e8; }

.pay-customer { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.pay-total { font-size: 14px; color: #666; margin-bottom: 14px; }
.pay-total span { font-weight: 700; color: #c0392b; }
.pay-btns { display: flex; gap: 10px; margin-bottom: 12px; }
.pay-btns .btn { flex: 1; }

.app-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #1a1a1a; color: #fff; text-align: center;
    padding: 10px; font-size: 12px; z-index: 40;
    box-shadow: 0 -2px 8px rgba(0,0,0,.15);
}
.app-footer strong { color: #c9a227; }
.app-footer a { color: #4fc3f7; text-decoration: none; }