
:root {
  --primary: #8b4a62;
  --primary-dark: #683246;
  --primary-light: #f6e9ee;
  --success: #2e7d32;
  --warning: #ed6c02;
  --info: #0288d1;
  --bg: #f4f1f2;
  --surface: #ffffff;
  --text: #1f1b1d;
  --muted: #665d61;
  --border: #dcd4d7;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; }

.topbar { background: var(--primary-dark); color: #fff; padding: 8px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-pill { font-size: 0.78rem; padding: 3px 10px; border-radius: 20px; background: rgba(255,255,255,0.18); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.sync-pill.online { background: #2e7d32; color: #fff; }
.sync-pill.local { background: #ed6c02; color: #fff; }

.role-switch { display: flex; gap: 6px; background: rgba(255,255,255,0.15); padding: 4px; border-radius: 8px; }
.role-btn { border: none; background: transparent; color: #fff; padding: 8px 14px; border-radius: 6px; font-weight: 600; cursor: pointer; min-height: 40px; }
.role-btn.active { background: #fff; color: var(--primary-dark); }

.tabs { display: flex; background: var(--surface); border-bottom: 2px solid var(--border); overflow-x: auto; }
.tab-btn { flex: 1; min-width: 125px; min-height: 54px; border: none; background: transparent; font-size: 0.98rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; padding: 10px 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }
.badge { background: var(--warning); color: #fff; border-radius: 12px; padding: 2px 8px; font-size: 0.8rem; }

.main-wrap { max-width: 1200px; margin: 0 auto; padding: 14px; }
.panel { display: none; }
.panel.active { display: block; }

.card { background: var(--surface); border-radius: 12px; padding: 16px; border: 1px solid var(--border); margin-bottom: 14px; box-shadow: 0 2px 6px rgba(0,0,0,0.03); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.card-title { font-size: 1.18rem; font-weight: 700; color: var(--primary-dark); }

.btn { min-height: 48px; padding: 10px 18px; border-radius: 8px; border: none; font-size: 1rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.15s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: #fff; border: 2px solid var(--border); color: var(--text); }
.btn-danger { background: #c62828; color: #fff; }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: 0.9rem; }

input, select, textarea { min-height: 48px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; width: 100%; background: #fff; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.92rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 12px; }

.cal-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline-slot { display: flex; border-bottom: 1px solid var(--border); min-height: 58px; align-items: stretch; }
.slot-time { width: 72px; flex-shrink: 0; font-weight: 700; padding: 10px 8px; background: #faf8f9; border-right: 1px solid var(--border); font-size: 0.95rem; }
.slot-events { flex: 1; padding: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.event-chip { padding: 8px 12px; border-radius: 8px; font-size: 0.92rem; flex: 1; min-width: 220px; border-left: 5px solid var(--primary); background: var(--primary-light); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.event-chip.passive { background: #e8f5e9; border-left-color: var(--success); }
.event-chip .tag-passive { background: var(--success); color: #fff; font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; font-weight: 700; }

.pos-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
@media (max-width: 900px) { .pos-layout { grid-template-columns: 1fr; } }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 10px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.srv-tile { background: #fff; border: 2px solid var(--border); border-radius: 10px; padding: 12px; text-align: left; cursor: pointer; min-height: 76px; display: flex; flex-direction: column; justify-content: space-between; }
.srv-tile:active { border-color: var(--primary); background: var(--primary-light); }
.srv-tile .srv-name { font-weight: 600; font-size: 0.95rem; line-height: 1.25; }
.srv-tile .srv-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.88rem; color: var(--primary-dark); font-weight: 700; }

.receipt-list { max-height: 260px; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 10px 0; }
.receipt-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px dashed var(--border); }
.total-row { font-size: 1.4rem; font-weight: 800; display: flex; justify-content: space-between; padding: 10px 0; color: var(--primary-dark); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-box { background: var(--primary-light); padding: 16px; border-radius: 10px; border: 1px solid var(--border); }
.stat-box .val { font-size: 1.6rem; font-weight: 800; color: var(--primary-dark); }

@media print {
  body * { visibility: hidden; }
  #print-receipt-area, #print-receipt-area * { visibility: visible; }
  #print-receipt-area { position: absolute; left: 0; top: 0; width: 80mm; font-family: monospace; font-size: 12px; }
}

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 999; }
.modal-backdrop.open { display: flex; }
.modal-box { background: #fff; border-radius: 14px; max-width: 540px; width: 100%; padding: 20px; max-height: 90vh; overflow-y: auto; }
.danger-zone { background: #fff5f5; border: 2px solid #ffcdd2; border-radius: 10px; padding: 14px; margin-top: 16px; }
.info-box { background: #eef6fc; border-left: 4px solid var(--info); padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.94rem; }
