/* Spa POS - Mobile-first styles */
:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --error: #dc2626;
    --success: #16a34a;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Login */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: linear-gradient(135deg, #0d9488 0%, #134e4a 100%); }
.login-card { background: var(--card); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 360px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 1.75rem; margin-bottom: 0.25rem; color: var(--primary-dark); }
.login-subtitle { color: var(--muted); margin-bottom: 1.5rem; }
.mpin-input { width: 100%; font-size: 2rem; text-align: center; letter-spacing: 0.5rem; padding: 0.75rem; border: 2px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; }
.mpin-input:focus { outline: none; border-color: var(--primary); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.65rem 1.25rem; border-radius: 10px; border: none; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.875rem; }
.btn-lg { padding: 1rem; font-size: 1.1rem; }
.inline-form { display: inline; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* Booking page - full screen mobile */
.booking-body { background: var(--bg); min-height: 100vh; }
.booking-page { max-width: 600px; margin: 0 auto; padding: 1rem 1rem 2rem; min-height: 100vh; }
.booking-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.booking-header h1 { font-size: 1.5rem; }
.booking-user { color: var(--muted); font-size: 0.875rem; }
.booking-header-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }

.booking-section { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.field-label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.5rem; color: var(--text); }
.field-readonly { font-size: 1.1rem; color: var(--primary-dark); font-weight: 500; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.75rem; }
.error-text { color: var(--error); }
.field-input { width: 100%; padding: 0.75rem; font-size: 1.1rem; border: 1.5px solid var(--border); border-radius: 10px; }
.field-input:focus { outline: none; border-color: var(--primary); }
.field-auto { background: #f0fdfa; color: var(--primary-dark); font-weight: 700; font-size: 1.2rem; cursor: not-allowed; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.assignment-status { font-size: 0.8rem; font-weight: 600; color: var(--primary); }

/* Counter */
.counter-group { display: flex; align-items: center; gap: 0.5rem; }
.counter-btn { width: 48px; height: 48px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg); font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.counter-btn:active { background: var(--border); }
.counter-input { flex: 1; text-align: center; font-size: 1.5rem; font-weight: 700; padding: 0.5rem; border: 1.5px solid var(--border); border-radius: 10px; -moz-appearance: textfield; }
.counter-input::-webkit-outer-spin-button, .counter-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Staff cards */
.staff-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
@media (min-width: 400px) { .staff-grid { grid-template-columns: repeat(3, 1fr); } }
.staff-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.65rem 0.5rem; border: 2px solid var(--border); border-radius: var(--radius); background: var(--card); transition: all 0.15s; min-height: 88px; }
.staff-card.selected { border-color: var(--primary); background: #ccfbf1; }
.staff-name { font-size: 0.85rem; font-weight: 600; text-align: center; margin-bottom: 0.4rem; }
.staff-counter { display: flex; align-items: center; gap: 0.35rem; }
.staff-counter .counter-btn { width: 36px; height: 36px; font-size: 1.25rem; }
.staff-count { min-width: 1.5rem; text-align: center; font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.counter-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Assigned staff edit panel */
.assigned-panel { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); }
.assigned-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.assigned-panel-header .field-label { margin-bottom: 0; }
.btn-link { background: none; border: none; color: var(--error); font-size: 0.85rem; font-weight: 600; cursor: pointer; padding: 0.25rem; }
.assigned-list { display: flex; flex-direction: column; gap: 0.4rem; }
.assigned-row { display: flex; align-items: center; gap: 0.5rem; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; padding: 0.5rem 0.65rem; }
.assigned-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.assigned-controls { display: flex; align-items: center; gap: 0.3rem; }
.assigned-controls .counter-btn { width: 32px; height: 32px; font-size: 1.1rem; }
.assigned-count { min-width: 1.25rem; text-align: center; font-weight: 700; color: var(--primary-dark); }
.btn-remove { background: #fee2e2; color: var(--error); border: none; border-radius: 8px; padding: 0.35rem 0.6rem; font-size: 0.75rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-remove:active { background: #fecaca; }

/* Payment */
.payment-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.payment-option { display: flex; }
.payment-option input { display: none; }
.payment-option span { flex: 1; text-align: center; padding: 0.75rem 0.5rem; border: 1.5px solid var(--border); border-radius: 10px; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.15s; }
.payment-option input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.hidden-section { display: none; }

/* Summary & reports */
.summary-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-bottom: 1rem; }
.summary-card { background: var(--card); border-radius: var(--radius); padding: 0.75rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.summary-label { display: block; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.summary-value { display: block; font-size: 1.25rem; font-weight: 700; margin-top: 0.25rem; }
.summary-value.small { font-size: 0.95rem; }

.report-card { background: var(--card); border-radius: var(--radius); margin-bottom: 0.5rem; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.report-card-header { display: flex; justify-content: space-between; padding: 0.6rem 1rem; background: #f1f5f9; font-size: 0.85rem; }
.report-card-body { padding: 0.75rem 1rem; }
.report-amount { font-size: 1.25rem; font-weight: 700; color: var(--primary-dark); margin: 0.25rem 0; }
.report-staff { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0; }
.report-meta { font-size: 0.8rem; color: var(--muted); }
.tag { display: inline-block; background: #e0f2fe; color: #0369a1; padding: 0.15rem 0.5rem; border-radius: 6px; font-size: 0.8rem; font-weight: 500; }
.empty-state { text-align: center; padding: 2rem; color: var(--muted); }

/* Admin layout */
.admin-body { background: var(--bg); }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: #134e4a; color: #fff; padding: 1.5rem 1rem; display: flex; flex-direction: column; flex-shrink: 0; }
.admin-brand { font-size: 1.25rem; font-weight: 700; margin-bottom: 2rem; }
.admin-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.admin-nav a { color: #99f6e4; text-decoration: none; padding: 0.6rem 0.75rem; border-radius: 8px; font-size: 0.9rem; }
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,0.12); color: #fff; }
.admin-logout button { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 0.5rem; border-radius: 8px; width: 100%; cursor: pointer; font-size: 0.85rem; }
.admin-main { flex: 1; padding: 1.5rem 2rem; overflow-x: auto; }
.page-title { font-size: 1.5rem; margin-bottom: 1.25rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.5rem; }
.page-header .page-header-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.admin-form { max-width: 480px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35rem; }
.form-group input, .form-group select { width: 100%; padding: 0.6rem 0.75rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: 1rem; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1.5rem; }

.data-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table th { background: #f1f5f9; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.actions { display: flex; gap: 0.75rem; align-items: center; }
.actions a { color: var(--primary); text-decoration: none; font-weight: 500; }
.link-danger { background: none; border: none; color: var(--error); cursor: pointer; font-size: 0.9rem; padding: 0; }
.empty-cell { text-align: center; color: var(--muted); padding: 2rem !important; }
.date-filter { display: flex; gap: 0.5rem; align-items: center; }
.date-filter input { padding: 0.4rem 0.6rem; border: 1.5px solid var(--border); border-radius: 8px; }
.admin-summary { max-width: 800px; }
.filter-form { max-width: 100%; margin-bottom: 1.25rem; }
.filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; align-items: end; }
.filter-action .btn { width: 100%; }
.report-staff-header { margin-bottom: 1rem; }
.report-staff-header h2 { font-size: 1.25rem; }
.summary-card-total { background: #ccfbf1; border: 1px solid #99f6e4; }
.table-total-row { background: #f0fdfa; }
.text-muted { color: var(--muted); font-size: 0.8rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }
.section-heading { font-size: 1.1rem; font-weight: 700; margin: 1.25rem 0 0.75rem; }
.report-tabs { display: flex; gap: 0.35rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.25rem; margin: 1rem 0 0.75rem; }
.report-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.65rem 0.75rem; border: none; border-radius: 8px; background: transparent; font-size: 0.9rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.report-tab.active { background: var(--primary); color: #fff; }
.report-tab-count { min-width: 1.35rem; padding: 0.1rem 0.4rem; border-radius: 999px; background: var(--bg); font-size: 0.75rem; font-weight: 700; }
.report-tab.active .report-tab-count { background: rgba(255,255,255,0.25); color: #fff; }
.report-tab-panel.hidden-section { display: none; }
.expense-table { margin-top: 0; }
.expense-total-row td { border-bottom: none; }
.expense-amount { color: var(--error) !important; font-weight: 700; }
.expense-card { border-left: 3px solid var(--error); }

/* Expense modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal.hidden-section { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.modal-card {
    position: relative;
    background: var(--card);
    width: 100%;
    max-width: 480px;
    border-radius: 16px 16px 0 0;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.modal-title { font-size: 1.2rem; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.modal-actions .btn { flex: 1; }
.expense-form .form-group { margin-bottom: 0.75rem; }
.expense-form label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35rem; }
@media (min-width: 500px) {
    .modal { align-items: center; }
    .modal-card { border-radius: var(--radius); }
}

.impersonation-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fcd34d;
    font-weight: 600;
}
.link-btn { background: none; border: none; color: var(--primary); font-weight: 700; cursor: pointer; padding: 0; }
.actions .inline-form { display: inline; margin-left: 0.5rem; }
.link-danger { background: none; border: none; color: var(--error); font-weight: 700; cursor: pointer; padding: 0; }
.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }
.pagination-wrap { margin-top: 1rem; }

/* Super Admin */
.super-admin-body { background: #f1f5f9; }
.super-sidebar { width: 260px; background: linear-gradient(180deg, #0f766e 0%, #134e4a 100%); }
.super-brand-icon { opacity: 0.7; margin-right: 0.35rem; }
.super-nav-link { font-weight: 700; letter-spacing: 0.04em; font-size: 0.8rem !important; }
.sidebar-spa-filter { margin: 1rem 0; padding: 0.75rem; background: rgba(0,0,0,0.15); border-radius: 10px; }
.sidebar-spa-filter label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: #99f6e4; margin-bottom: 0.35rem; font-weight: 700; }
.spa-filter-select { width: 100%; padding: 0.5rem; border-radius: 8px; border: none; font-size: 0.85rem; background: #fff; color: var(--text); }
.super-main { background: #f8fafc; }
.super-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.super-spa-card { background: var(--card); border-radius: var(--radius); padding: 1.25rem; box-shadow: 0 1px 4px rgba(15,23,42,0.06); border: 1px solid var(--border); }
.super-spa-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.super-spa-code { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); }
.super-spa-name { font-size: 1.05rem; margin-bottom: 0.75rem; }
.super-spa-stats { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.super-spa-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.active-spa-pill { background: #e0f2fe; color: #0369a1; padding: 0.5rem 0.75rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 1rem; display: inline-block; }
.active-spa-pill.muted { background: #f1f5f9; color: var(--muted); }
.tag-success { background: #dcfce7; color: #166534; }
.tag-muted { background: #f1f5f9; color: var(--muted); }
.super-filter-bar { display: flex; gap: 0.5rem; align-items: center; }
.super-form { background: var(--card); padding: 1.25rem; border-radius: var(--radius); border: 1px solid var(--border); }
.form-group select { width: 100%; padding: 0.65rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: 1rem; }
.form-group input[type="text"], .form-group input[type="password"], .form-group input[type="email"] { width: 100%; padding: 0.65rem; border: 1.5px solid var(--border); border-radius: 8px; }

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; padding: 1rem; }
    .admin-nav { flex-direction: row; flex-wrap: wrap; }
    .admin-main { padding: 1rem; }
}
