:root {
  --bg: #f4efe4;
  --surface: #fffdf8;
  --text: #1b2333;
  --muted: #877f70;
  --border: #e8dfcd;
  --primary: #1f4f9a;
  --primary-dark: #163b78;
  --primary-50: #eef3fb;
  --primary-100: #e1e9f6;
  --primary-200: #c6d4ec;
  --gold: #c2912f;
  --gold-light: #e8c97a;
  --gold-50: #f8efd9;
  --clay: #a9562f;
  --ink: #0f2147;
  --green: #2f8f6a;
  --amber: #c99335;
  --rose: #c25a4e;
  --shadow: 0 10px 30px rgba(43, 33, 14, .08);
  --cuneiform: "Noto Sans Cuneiform", "Segoe UI Historic", serif;
  --display: "Reem Kufi", "Tajawal", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Tajawal", Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg,var(--bg) 0%,var(--primary-50) 100%); }
.login-card { width: min(390px,100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px; box-shadow: 0 18px 50px rgba(32,38,56,.12); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.login-brand strong, .login-brand span { display: block; }
.login-brand span { color: var(--muted); font-size: 12px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-submit { width: 100%; margin-top: 4px; }
.login-card > .text-button { display: block; margin: 15px auto 0; }
.customer-portal { display: none; min-height: 100vh; background: var(--bg); }
.customer-portal.active { display: block; }
.customer-portal-header { height: 82px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px,6vw); }
.customer-portal-header .login-brand { margin: 0; }
.portal-main { max-width: 900px; margin: 0 auto; padding: 45px 20px; }
.portal-hero { text-align: center; margin-bottom: 26px; }
.portal-hero p { color: var(--primary); font-size: 12px; font-weight: 800; margin: 0; }
.portal-hero h1 { margin: 7px 0; font-size: 28px; }
.portal-hero span { color: var(--muted); font-size: 13px; }
.portal-booking { padding: 22px; }
.booking-services { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.booking-service { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; }
.booking-service input { accent-color: var(--primary); }
.booking-service strong { color: var(--primary); }
.portal-submit { width: 100%; margin-top: 16px; }
.customer-auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.customer-auth-tab { height: 42px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; color: var(--muted); font-weight: 700; }
.customer-auth-tab.active { border-color: var(--primary-200); background: var(--primary-50); color: var(--primary); }
.customer-session-bar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); margin: -22px -22px 16px; padding: 12px 22px; }
.customer-session-bar strong, .customer-session-bar span { display: block; }
.customer-session-bar span { color: var(--muted); direction: ltr; text-align: right; font-size: 12px; }
.linked-customer-card { display: flex; align-items: center; gap: 10px; background: #eef6f1; border: 1px solid #d6e9de; border-radius: 10px; padding: 10px; margin-bottom: 14px; }
.linked-customer-card strong, .linked-customer-card span { display: block; }
.linked-customer-card div span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.booking-confirmation { text-align: center; }
.confirmation-check { width: 72px; height: 72px; margin: 4px auto 12px; border-radius: 50%; background: #e6f2ec; color: var(--green); display: grid; place-items: center; font-size: 38px; font-weight: 800; }
.confirmation-label { color: var(--green); font-size: 14px; font-weight: 800; margin: 0; }
.booking-confirmation h2 { margin: 7px 0 18px; font-size: 20px; }
.confirmation-barber { width: fit-content; min-width: 220px; margin: 0 auto 16px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; text-align: right; }
.confirmation-barber-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.confirmation-barber small, .confirmation-barber strong, .confirmation-barber span { display: block; }
.confirmation-barber small { color: var(--muted); font-size: 10px; }
.confirmation-barber strong { margin-top: 2px; }
.confirmation-barber span { color: var(--primary); font-size: 11px; }
.confirmation-details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: right; }
.confirmation-details div { border: 1px solid var(--border); background: #faf6ee; border-radius: 10px; padding: 11px; }
.confirmation-details small, .confirmation-details strong { display: block; }
.confirmation-details small { color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.confirmation-details strong { font-size: 12px; }
.cancel-booking-button { width: 100%; margin-top: 8px; color: #a8453a; }
.cancel-confirm-button { background: #b4493d; }
.cancelled-check { background: #f8e6e1; color: #b4493d; }
.cancelled-label { color: #b4493d; }
.full-cancellation-note { grid-column: 1/-1; }
.cancellation-note { display: block; max-width: 180px; color: #94413a; font-size: 9px; margin-top: 5px; line-height: 1.5; }
.status.cancelled { background: #f8e6e1; color: #b4493d; }
.recent-card-grid, .appointments-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.recent-card-grid { padding: 14px 18px 18px; }
.appointments-section { margin-top: 14px; }
.appointments-card-grid { gap: 14px; }
.appointment-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 6px 18px rgba(40,48,70,.045); overflow: hidden; }
.appointment-card.high-priority { border-right: 4px solid var(--rose); }
.appointment-card.compact { border: 1px solid var(--border); }
.appointment-card-head, .appointment-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.appointment-customer { display: flex; align-items: center; gap: 9px; }
.appointment-customer strong, .appointment-customer small { display: block; }
.appointment-customer strong { font-size: 14px; }
.appointment-customer small { color: var(--muted); margin-top: 3px; }
.appointment-card-date { height: 58px; border-radius: 10px; background: #faf6ee; display: flex; align-items: center; gap: 9px; margin: 13px 0 10px; padding: 8px 10px; }
.appointment-card-date > span { width: 36px; height: 36px; border-radius: 9px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; }
.appointment-card-date strong, .appointment-card-date small { display: block; direction: ltr; text-align: right; }
.appointment-card-date strong { font-size: 16px; }
.appointment-card-date small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.appointment-card-services { min-height: 44px; color: #5d6270; font-size: 11px; line-height: 1.8; }
.appointment-card-services small, .appointment-cancellation small { display: block; color: var(--muted); font-size: 9px; }
.appointment-card-services span { color: var(--text); }
.appointment-card-footer { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.appointment-card-footer small { display: block; color: var(--muted); font-size: 9px; }
.appointment-card-footer > div strong { display: block; color: var(--primary); margin-top: 3px; }
.appointment-cancellation { background: #fbf0ec; border-radius: 8px; padding: 8px; margin-top: 8px; }
.appointment-cancellation strong { display: block; color: #94413a; font-size: 10px; margin-top: 3px; }
.archive-card-grid { padding: 14px; width: 100%; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 235px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: #fff; border-left: 1px solid var(--border); display: flex; flex-direction: column; padding: 25px 18px 18px; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 28px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: var(--primary); color: white; display: grid; place-items: center; font-size: 21px; font-weight: 800; box-shadow: 0 8px 18px rgba(31,79,154,.22); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav-list { display: flex; flex-direction: column; gap: 6px; }
.nav-item { border: 0; background: transparent; color: #5d6270; height: 48px; border-radius: 10px; display: flex; align-items: center; gap: 12px; padding: 0 13px; font-size: 14px; font-weight: 700; }
.nav-item.active { background: var(--primary-50); color: var(--primary); }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 7px; font-size: 14px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 18px 8px 0; display: flex; align-items: center; gap: 9px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.profile-copy { flex: 1; }
.profile-copy strong, .profile-copy span { display: block; }
.profile-copy strong { font-size: 12px; }
.profile-copy span { color: var(--muted); font-size: 11px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; color: #6c6658; }
.main-content { min-width: 0; padding: 22px 28px 40px; }
.topbar { height: 66px; display: flex; align-items: flex-start; justify-content: space-between; }
.topbar h1 { margin: 3px 0 0; font-size: 25px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.notification { position: relative; }
.notification span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); left: 8px; top: 8px; border: 2px solid white; }
.primary-button { height: 42px; border: 0; border-radius: 9px; background: var(--primary); color: white; padding: 0 17px; font-weight: 700; box-shadow: 0 7px 14px rgba(31,79,154,.14); }
.primary-button:hover { background: var(--primary-dark); }
.mobile-menu { display: none; }
.view { display: none; }
.view.active { display: block; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat-card { min-height: 108px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 10px; padding: 16px; }
.stat-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; }
.lavender { background: var(--primary-50); color: var(--primary); }
.amber { background: var(--gold-50); color: var(--gold); }
.green { background: #e6f2ec; color: var(--green); }
.rose { background: #f8e6e1; color: var(--rose); }
.stat-card span { color: var(--muted); display: block; font-size: 12px; }
.stat-card strong { display: block; margin-top: 5px; font-size: 21px; direction: ltr; text-align: right; }
.trend { align-self: end; color: var(--muted); font-size: 10px; white-space: nowrap; }
.trend.up { color: var(--green); }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-top: 14px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; }
.panel-header { min-height: 67px; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-header h2, .section-toolbar h2 { margin: 0; font-size: 15px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.text-button, .filter-button { border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 700; }
.filter-button { border: 1px solid var(--border); border-radius: 8px; color: #657087; padding: 7px 10px; }
.appointment-list { min-height: 220px; }
.appointment-row { display: grid; grid-template-columns: 55px 42px 1fr auto; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.appointment-row:last-child { border-bottom: 0; }
.appointment-time { direction: ltr; text-align: right; font-weight: 800; font-size: 13px; }
.customer-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.appointment-info strong, .appointment-info span { display: block; }
.appointment-info strong { font-size: 13px; }
.appointment-info span { color: var(--muted); font-size: 11px; }
.status { display: inline-block; border-radius: 20px; padding: 5px 9px; font-size: 10px; font-weight: 700; }
.status.confirmed { background: #eaf7f2; color: #229c70; }
.status.pending { background: var(--gold-50); color: #c88632; }
.status.completed { background: var(--primary-50); color: var(--primary); }
.quick-actions { padding: 8px 14px; }
.quick-actions button { width: 100%; height: 70px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); display: grid; grid-template-columns: 42px 1fr 20px; align-items: center; gap: 9px; text-align: right; }
.quick-actions button:last-child { border-bottom: 0; }
.quick-actions strong, .quick-actions small { display: block; }
.quick-actions strong { font-size: 13px; }
.quick-actions small { color: var(--muted); margin-top: 3px; }
.quick-actions b { color: #adb4bf; }
.quick-icon { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; }
.table-panel { margin-top: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); background: #faf6ee; font-size: 11px; text-align: right; padding: 10px 18px; }
td { border-top: 1px solid var(--border); padding: 11px 18px; font-size: 12px; }
.table-name { display: flex; align-items: center; gap: 9px; }
.action-button { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 7px; height: 30px; padding: 0 8px; }
.section-toolbar { height: 58px; display: flex; justify-content: space-between; align-items: flex-start; }
.search-box { width: 280px; height: 42px; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.search-box input { border: 0; outline: 0; width: 100%; background: transparent; }
.customer-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.customer-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 16px; display: grid; grid-template-columns: 48px 1fr auto; gap: 11px; }
.customer-card .customer-avatar { width: 48px; height: 48px; }
.customer-card strong, .customer-card span { display: block; }
.customer-card span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.customer-card .notes { grid-column: 1/-1; background: #faf6ee; border-radius: 8px; padding: 8px 10px; color: #6c7585; font-size: 11px; }
.customer-last-image { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary-50); }
.professional-card { display: block; padding: 0; overflow: hidden; }
.customer-card-cover { height: 150px; background: linear-gradient(135deg,var(--primary-50),var(--primary-50)); position: relative; }
.customer-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.image-count { position: absolute; left: 10px; bottom: 10px; background: rgba(24,33,47,.78); color: white !important; border-radius: 20px; padding: 5px 9px; font-size: 10px !important; }
.customer-cover-avatar { position: absolute; inset: 0; display: grid; place-items: center; color: var(--primary); font-size: 52px; font-weight: 800; }
.customer-card-info { padding: 14px; }
.customer-card-title { display: flex; justify-content: space-between; gap: 8px; }
.customer-card-title strong { font-size: 16px; }
.customer-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.customer-metrics div { background: #faf6ee; border-radius: 9px; padding: 8px; text-align: center; }
.customer-metrics strong { color: var(--primary); font-size: 17px; }
.muted-note { color: var(--muted) !important; }
.customer-profile-button { width: 100%; height: 38px; border: 1px solid var(--primary-200); background: var(--primary-50); color: var(--primary); border-radius: 8px; font-weight: 700; }
.profile-modal-cover { height: 220px; border-radius: 12px; overflow: hidden; background: var(--primary-50); display: grid; place-items: center; }
.profile-modal-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-modal-cover span { font-size: 70px; color: var(--primary); font-weight: 800; }
.customer-image-gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(76px,1fr)); gap: 8px; margin-top: 10px; }
.customer-gallery-thumb { position: relative; aspect-ratio: 1; height: auto; border: 2px solid transparent; border-radius: 9px; padding: 0; overflow: hidden; background: #f3ede1; transition: border-color .15s, transform .15s; }
.customer-gallery-thumb:hover { border-color: var(--primary); transform: translateY(-1px); }
.customer-gallery-thumb.active { border-color: var(--primary); }
.customer-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.profile-modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.profile-value { min-height: 42px; border: 1px solid var(--border); background: #faf6ee; border-radius: 8px; padding: 10px; font-size: 12px; }
.services-picker { border: 1px solid #e3d9c5; border-radius: 10px; padding: 10px 12px; margin: 0; }
.services-picker legend { padding: 0 5px; font-size: 12px; font-weight: 700; }
.service-check { min-height: 38px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); font-size: 12px; }
.service-check:last-child { border-bottom: 0; }
.service-check input { accent-color: var(--primary); }
.service-check strong { color: var(--primary); direction: rtl; }
.service-summary { color: #5d6270; font-size: 11px; line-height: 1.7; }
.appointment-total { display: block; margin-top: 3px; color: var(--text); direction: rtl; }
.availability-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.weekly-schedule-panel { grid-column: 1/-1; }
.weekly-schedule { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 14px; }
.schedule-day { border: 1px solid var(--border); border-radius: 11px; padding: 10px; }
.schedule-day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.schedule-toggle { color: var(--muted); font-size: 11px; }
.schedule-toggle input { accent-color: var(--primary); }
.schedule-slots { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.schedule-slot { height: 32px; border: 1px solid var(--border); border-radius: 7px; display: grid; place-items: center; color: var(--muted); font-size: 10px; direction: ltr; cursor: pointer; }
.schedule-slot input { display: none; }
.appointment-card-date strong, .schedule-slot, select[name="time"], input[type="time"] { direction: ltr; }
.schedule-slot.selected { border-color: var(--primary-200); background: var(--primary-50); color: var(--primary); font-weight: 700; }
.disabled-days, .disabled-slots { min-height: 180px; }
.availability-row { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); direction: rtl; }
.availability-row:last-child { border-bottom: 0; }
.availability-row strong, .availability-row span { display: block; }
.availability-row strong { font-size: 13px; direction: ltr; text-align: right; }
.availability-row span { color: var(--muted); font-size: 10px; margin-top: 3px; }
.priority-badge { display: block; margin-top: 5px; width: fit-content; border-radius: 12px; padding: 3px 7px; font-size: 9px; font-weight: 700; }
.priority-badge.high { background: #f8e6e1; color: #b4493d; }
.priority-badge.normal { background: #f3ede1; color: #778195; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.gallery-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.gallery-card img { width: 100%; height: 210px; object-fit: cover; display: block; }
.gallery-card div { padding: 10px 12px; }
.gallery-card strong, .gallery-card span { display: block; }
.gallery-card strong { font-size: 13px; }
.gallery-card span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.services-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.service-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 18px; display: flex; align-items: center; gap: 12px; }
.service-card .stat-icon { flex: 0 0 44px; }
.service-card div:nth-child(2) { flex: 1; }
.service-card strong, .service-card span { display: block; }
.service-card strong { font-size: 14px; }
.service-card span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.service-actions { display: flex; gap: 5px; }
.danger-action { color: #a8453a; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(26,31,44,.42); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 14px; box-shadow: 0 20px 50px rgba(23,30,45,.22); }
.modal-header { height: 64px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-close { border: 0; background: #f3ede1; width: 32px; height: 32px; border-radius: 8px; color: #777; }
.modal-body { padding: 18px 20px 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1/-1; }
.field label { font-size: 12px; font-weight: 700; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #e3d9c5; border-radius: 8px; outline: 0; padding: 10px 11px; background: var(--surface); }
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.upload-hint { color: var(--muted); font-size: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.secondary-button { height: 42px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 0 16px; }
.toast { position: fixed; left: 28px; bottom: 28px; background: #262b36; color: white; border-radius: 9px; padding: 12px 16px; font-size: 12px; transform: translateY(90px); transition: .25s; z-index: 200; }
.toast.show { transform: translateY(0); }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 195px minmax(0,1fr); }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .gallery-grid { grid-template-columns: repeat(3,1fr); }
  .recent-card-grid, .appointments-card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; right: -260px; width: 235px; transition: .25s; box-shadow: -10px 0 30px rgba(24,33,47,.12); }
  .sidebar.open { right: 0; }
  .main-content { padding: 16px; }
  .mobile-menu { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
  .topbar { height: 62px; align-items: flex-start; }
  .topbar > div:nth-child(2) { margin-right: 8px; margin-left: auto; }
  .topbar h1 { font-size: 20px; }
  .notification { display: none; }
  .primary-button { padding: 0 12px; }
  .stats-grid, .dashboard-grid, .customer-grid, .services-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2,1fr); }
  .gallery-card img { height: 150px; }
  .table-panel { margin-top: 14px; }
  .search-box { width: min(220px,65%); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .appointment-row { grid-template-columns: 50px 38px 1fr; }
  .appointment-row .status { display: none; }
  .availability-layout { grid-template-columns: 1fr; }
  .weekly-schedule { grid-template-columns: 1fr; }
  .schedule-slots { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .booking-services { grid-template-columns: 1fr; }
  .portal-main { padding: 28px 14px; }
  .portal-hero h1 { font-size: 23px; }
  .customer-portal-header { height: 72px; padding: 0 14px; }
  .profile-modal-body { grid-template-columns: 1fr; }
  .confirmation-details { grid-template-columns: 1fr; }
  .recent-card-grid, .appointments-card-grid { grid-template-columns: 1fr; }
}

/* صور بطاقة الزبون */
.profile-cover-open { position: relative; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.profile-cover-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-cover-open .cover-zoom-hint { position: absolute; left: 10px; bottom: 10px; font-size: 11px; font-weight: 700; color: white; background: rgba(24,33,47,.72); border-radius: 20px; padding: 5px 10px; }
.customer-photos { margin-top: 14px; }
.customer-photos-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.customer-photos-head strong small { color: var(--muted); font-weight: 600; }
.customer-photos-add { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; font-size: 12px; cursor: pointer; }
.customer-photos-empty { margin-top: 10px; padding: 16px; border: 1px dashed var(--primary-200); border-radius: 10px; color: var(--muted); font-size: 12px; text-align: center; }
.thumb-badge { position: absolute; right: 4px; top: 4px; background: var(--primary); color: white; font-size: 9px; font-weight: 700; border-radius: 10px; padding: 2px 6px; }

.image-viewer { position: fixed; inset: 0; z-index: 150; background: rgba(12,14,20,.94); display: flex; flex-direction: column; color: white; }
.viewer-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.viewer-title { font-weight: 700; font-size: 14px; }
.viewer-actions { display: flex; gap: 8px; }
.viewer-button { height: 36px; min-width: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: white; font-size: 12px; font-weight: 700; }
.viewer-delete[data-confirm="yes"] { background: #c0392b; border-color: #c0392b; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; padding: 0 56px; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: white; font-size: 28px; line-height: 1; }
.viewer-prev { right: 8px; }
.viewer-next { left: 8px; }
.viewer-strip { display: flex; gap: 8px; padding: 12px 16px 16px; overflow-x: auto; justify-content: safe center; }
.viewer-thumb { flex: 0 0 56px; height: 56px; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: none; opacity: .6; }
.viewer-thumb.active { border-color: white; opacity: 1; }
.viewer-thumb img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) {
  .viewer-stage { padding: 0 8px; }
  .viewer-nav { width: 38px; height: 38px; font-size: 24px; background: rgba(0,0,0,.45); }
}

/* الصورة الشخصية الثابتة في بطاقة الزبون */
.customer-identity { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(135deg,var(--primary-50),#fff); }
.customer-identity-photo { flex: 0 0 96px; width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: var(--primary-50); display: grid; place-items: center; border: 3px solid white; box-shadow: 0 4px 14px rgba(31,79,154,.18); }
.customer-identity-photo img { width: 100%; height: 100%; object-fit: cover; }
.customer-identity-photo span { font-size: 40px; color: var(--primary); font-weight: 800; }
.customer-identity-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.customer-identity-info strong { font-size: 17px; }
.customer-identity-info > span { color: var(--muted); font-size: 13px; text-align: right; }
.customer-identity-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
@media (max-width: 480px) {
  .customer-identity-photo { flex-basis: 76px; width: 76px; height: 76px; }
}

/* صورة الزبون في الحجوزات */
.customer-avatar { flex-shrink: 0; overflow: hidden; }
.customer-avatar.has-photo { padding: 0; border: 2px solid white; box-shadow: 0 0 0 1px var(--primary-200); cursor: pointer; }
.customer-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.customer-avatar.has-photo:hover { box-shadow: 0 0 0 2px var(--primary); }

/* أيام الأسبوع في صفحة حجز الزبون */
.portal-days-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.portal-days-field legend { font-size: 12px; font-weight: 700; margin-bottom: 8px; padding: 0; }
.portal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.portal-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.portal-day input { position: absolute; opacity: 0; pointer-events: none; }
.portal-day-name { font-weight: 800; font-size: 13px; }
.portal-day-date { font-size: 11px; color: var(--muted); }
.portal-day small { font-size: 10px; color: var(--primary); font-weight: 700; }
.portal-day:hover { border-color: var(--primary-200); }
.portal-day:has(input:checked) { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 1px var(--primary) inset; }
.portal-day:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.portal-day.unavailable { background: #f3ede1; cursor: not-allowed; opacity: .6; }
.portal-day.unavailable small { color: var(--muted); }
@media (max-width: 640px) {
  .portal-days { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
  .portal-day { scroll-snap-align: start; }
}

/* ===== منصة متعددة الصالونات ===== */
.loading-card { display: grid; place-items: center; gap: 14px; text-align: center; color: var(--muted); }
.loading-spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--primary-200); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.message-card { display: grid; justify-items: center; gap: 10px; text-align: center; }
.message-card h2 { margin: 6px 0 0; font-size: 18px; }
.message-card p { margin: 0; color: var(--muted); line-height: 1.7; }

.admin-screen { min-height: 100vh; background: var(--bg); }
.admin-header { height: 76px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 max(16px, 5vw); }
.admin-header .login-brand { margin: 0; }
.admin-main { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; display: grid; gap: 20px; }
.salons-list { display: grid; gap: 12px; }
.salon-row { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: var(--surface); }
.salon-row.inactive { background: #faf6ee; opacity: .8; }
.salon-row-main { display: flex; align-items: center; gap: 10px; }
.salon-row-main > div { flex: 1; min-width: 0; }
.salon-row-main strong, .salon-row-main small { display: block; }
.salon-row-main small { color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.salon-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.salon-row-actions a { text-decoration: none; display: inline-flex; align-items: center; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; font-size: 12px; }

.barbers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.barber-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.barber-card.inactive { opacity: .65; }
.barber-photo { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--primary-50); display: grid; place-items: center; }
.barber-photo img { width: 100%; height: 100%; object-fit: cover; }
.barber-photo span { font-size: 34px; font-weight: 800; color: var(--primary); }
.barber-info { display: grid; gap: 4px; }
.barber-info small { color: var(--muted); font-size: 11px; }
.barber-state { font-size: 11px; font-weight: 700; }
.barber-state.on { color: #1f9d6b; }
.barber-state.off { color: #b0563f; }
.barber-actions { display: flex; gap: 8px; }
.check-row { flex-direction: row !important; align-items: center; gap: 8px; font-size: 13px; }
.barber-tag { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-50); border-radius: 20px; padding: 2px 9px; width: fit-content; }
.toolbar-select { height: 42px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 0 10px; font: inherit; font-size: 13px; }
.availability-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.availability-title h2 { margin: 0; }
.import-box { margin-top: 16px; padding: 12px; border: 1px dashed var(--primary-200); border-radius: 10px; display: grid; gap: 6px; }
.import-box span { color: var(--muted); font-size: 12px; }
#copy-booking-link { white-space: nowrap; }

.portal-barbers-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.portal-barbers-field legend { font-size: 12px; font-weight: 700; margin-bottom: 8px; padding: 0; }
.portal-barbers { display: flex; flex-wrap: wrap; gap: 10px; }
.portal-barber-option { display: grid; align-content: start; gap: 6px; width: 124px; max-width: 100%; }
.portal-barber { position: relative; display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: center; }
.portal-barber input { position: absolute; opacity: 0; pointer-events: none; }
.portal-barber:has(input:checked) { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 1px var(--primary) inset; }
.portal-barber:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.portal-barber-photo { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.portal-barber-photo img, .confirmation-barber-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.confirmation-barber-avatar { overflow: hidden; }
.portal-barber-name { font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .section-toolbar { height: auto; flex-wrap: wrap; gap: 10px; }
  .toolbar-select { flex: 1; }
  .link-row { flex-direction: column; }
}

/* وضع التجربة */
.demo-login-help { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); display: grid; gap: 8px; }
.demo-login-help strong { font-size: 12px; color: #8a5a12; }
.demo-login-help .secondary-button { height: auto; padding: 9px 12px; display: grid; gap: 2px; text-align: center; text-decoration: none; }
.demo-login-help small { font-size: 10px; color: var(--muted); font-weight: 500; }

/* =====================================================================
   هوية صالون الحلاقة: فحمي + نحاسي + خطوط عمود الحلاق
   ===================================================================== */
:root {
  --bg: #f5f2ec;
  --surface: #ffffff;
  --text: #1b1a18;
  --muted: #7c766c;
  --border: #e8e2d8;
  --primary: #8a5d22;          /* نحاسي داكن: روابط، أسعار، تحديد */
  --primary-dark: #6c4716;
  --primary-50: #f8f1e5;
  --primary-100: #f0e2c9;
  --primary-200: #e1c9a0;
  --brass: #c49a5a;
  --brass-light: #e2c48e;
  --gold: #c49a5a;
  --gold-light: #e2c48e;
  --gold-50: #faf4ea;
  --ink: #161514;
  --ink-2: #24221f;
  --pole-red: #b32a22;
  --pole-blue: #1e3a5f;
  --green: #2e7d5b;
  --rose: #b32a22;
  --shadow: 0 1px 2px rgba(22, 21, 20, .04), 0 8px 24px rgba(22, 21, 20, .06);
  --display: "El Messiri", "Tajawal", sans-serif;
  --pole: repeating-linear-gradient(-45deg, var(--pole-red) 0 9px, #fff 9px 15px, var(--pole-blue) 15px 24px, #fff 24px 30px);
}
body { background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, .topbar h1, .portal-hero h1, .brand strong, .login-brand strong, .modal-header h2,
.booking-confirmation h2, .message-card h2, .section-toolbar h2, .stat-card strong { font-family: var(--display); font-weight: 700; }

/* الشعار */
.brand-mark {
  background: linear-gradient(160deg, var(--ink-2), var(--ink)); color: var(--brass-light);
  border: 1px solid rgba(196, 154, 90, .6); border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(196, 154, 90, .14), 0 6px 16px rgba(0, 0, 0, .25);
  font-family: var(--display); font-weight: 700;
}
.brand-mark.cuneiform-mark { font-family: "Noto Sans Cuneiform", serif; font-size: 20px; font-weight: 400; }

/* شاشة الدخول */
.login-screen {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(196, 154, 90, .18), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #1c1b19, #0f0e0d);
}
.login-screen::after {
  content: "✂\FE0E"; position: absolute; left: -6vmin; bottom: -14vmin; pointer-events: none;
  font-size: 58vmin; line-height: 1; color: rgba(196, 154, 90, .06); transform: rotate(-28deg);
}
.login-card {
  position: relative; z-index: 1; overflow: hidden; padding-top: 38px;
  background: var(--surface); border: 0; border-radius: 16px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, .5), 0 0 0 1px rgba(196, 154, 90, .25);
}
.login-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--pole); }
.login-brand strong { font-size: 20px; }
.login-brand span { color: var(--muted); }

/* الشريط الجانبي */
.sidebar { background: linear-gradient(180deg, var(--ink-2) 0%, var(--ink) 100%); border-left: 0; color: #ebe5da; }
.sidebar::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: var(--pole); opacity: .9; }
.brand { border-bottom: 1px solid rgba(255, 255, 255, .08); margin-bottom: 18px; padding-bottom: 22px; }
.brand strong { color: #fff; font-size: 17px; }
.brand span { color: rgba(235, 229, 218, .55); }
.nav-item { color: rgba(235, 229, 218, .7); transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-item.active { background: rgba(196, 154, 90, .14); color: var(--brass-light); box-shadow: inset -3px 0 0 var(--brass); }
.nav-icon { border-color: currentColor; border-radius: 50%; }
.sidebar-footer { border-top-color: rgba(255, 255, 255, .08); }
.sidebar .avatar { background: rgba(196, 154, 90, .16); color: var(--brass-light); border: 1px solid rgba(196, 154, 90, .4); }
.sidebar .profile-copy strong { color: #fff; }
.sidebar .profile-copy span { color: rgba(235, 229, 218, .5); }
.sidebar .icon-button { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); color: #ebe5da; }

/* الشريط العلوي */
.topbar h1 { font-size: 28px; color: var(--ink); }
.eyebrow { color: var(--primary); font-weight: 700; }

/* الأزرار والحقول */
.primary-button {
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
  box-shadow: 0 6px 14px rgba(22, 21, 20, .18); transition: background .15s, color .15s, transform .1s;
}
.primary-button:hover { background: var(--ink-2); color: var(--brass-light); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.secondary-button { color: var(--ink); transition: border-color .15s, background .15s; }
.secondary-button:hover { border-color: var(--brass); background: var(--gold-50); }
.action-button { color: #55514a; transition: border-color .15s, color .15s; }
.action-button:hover { border-color: var(--brass); color: var(--primary); }
.text-button { color: var(--primary); }
.field input, .field textarea, .field select, .toolbar-select, .search-box { border-color: #e2dbcf; background: #fff; }
.field input:focus, .field textarea:focus, .field select:focus, .toolbar-select:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(196, 154, 90, .2); outline: 0; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* البطاقات */
.panel, .stat-card, .appointment-card, .customer-card, .service-card, .barber-card, .gallery-card, .salon-row { border-color: var(--border); box-shadow: var(--shadow); }
.panel { border-radius: 16px; }
.panel-header h2 { font-size: 18px; color: var(--ink); }
.panel-header h2::before { content: ""; display: inline-block; width: 4px; height: 16px; margin-inline-end: 9px; vertical-align: -2px; border-radius: 2px; background: var(--pole); }
.stat-card { position: relative; overflow: hidden; border-radius: 16px; }
.stat-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brass); opacity: .7; }
.stat-card strong { font-size: 26px; color: var(--ink); }
.stat-icon { border-radius: 50%; }
.lavender { background: var(--primary-50); color: var(--primary); }
.appointment-card { border-radius: 16px; transition: transform .15s, box-shadow .15s; }
.appointment-card:hover, .barber-card:hover, .customer-card:hover, .service-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(22, 21, 20, .04), 0 16px 32px rgba(22, 21, 20, .1); }
.appointment-card.high-priority { border-right-color: var(--pole-red); }
.appointment-card-date { background: #faf7f2; border: 1px solid #f0ebe2; }
.appointment-card-date > span { background: var(--ink); color: var(--brass-light); border-radius: 50%; }
.appointment-card-footer > div strong, .booking-service strong { color: var(--primary); font-family: var(--display); }
.appointment-time { font-family: var(--display); color: var(--ink); }
.barber-card, .service-card { transition: transform .15s, box-shadow .15s; }
.barber-photo, .customer-identity-photo { border: 3px solid #fff; box-shadow: 0 0 0 2px var(--brass), 0 8px 18px rgba(22, 21, 20, .15); }
.customer-card-cover { background: linear-gradient(160deg, #2a2724, var(--ink)); }
.customer-cover-avatar { color: var(--brass-light); font-family: var(--display); }
.barber-tag { color: var(--primary); background: var(--primary-50); border: 1px solid var(--primary-100); }
.service-card .stat-icon { background: var(--ink); color: var(--brass-light); }

/* النوافذ والإشعارات */
.modal-backdrop { background: rgba(15, 14, 13, .55); backdrop-filter: blur(3px); }
.modal { border-radius: 16px; position: relative; overflow-x: hidden; background: var(--surface); }
.modal::before { content: ""; display: block; height: 5px; background: var(--pole); }
.modal-header h2 { color: var(--ink); }
.toast { background: var(--ink); color: #fff; border-inline-start: 4px solid var(--brass); box-shadow: 0 14px 30px rgba(0, 0, 0, .3); }

/* صفحة الزبون */
.customer-portal { background: transparent; }
.customer-portal-header { position: relative; background: var(--ink); border-bottom: 0; }
.customer-portal-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px; background: var(--pole); }
.customer-portal-header .login-brand strong { color: #fff; }
.customer-portal-header .login-brand span { color: rgba(235, 229, 218, .65); }
.portal-main { padding-top: 56px; }
.portal-hero::before, .booking-confirmation::before {
  content: "✂\FE0E"; display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--brass); font-size: 18px; margin-bottom: 10px;
  background: linear-gradient(90deg, transparent calc(50% - 90px), var(--brass-light) calc(50% - 90px) calc(50% - 22px), transparent calc(50% - 22px) calc(50% + 22px), var(--brass-light) calc(50% + 22px) calc(50% + 90px), transparent calc(50% + 90px)) center / 100% 1px no-repeat;
}
.portal-hero h1 { font-size: 34px; color: var(--ink); }
.portal-hero p { color: var(--primary); letter-spacing: .02em; }
.portal-booking { border-radius: 18px; border-top: 0; box-shadow: 0 2px 4px rgba(22, 21, 20, .04), 0 24px 50px rgba(22, 21, 20, .09); }
.booking-service { transition: border-color .15s, background .15s; }
.booking-service input { accent-color: var(--ink); }
.booking-service:has(input:checked) { border-color: var(--ink); background: #faf7f2; }
.portal-day:has(input:checked), .portal-barber:has(input:checked) { border-color: var(--ink); background: var(--ink); box-shadow: 0 10px 20px rgba(22, 21, 20, .18); }
.portal-day:has(input:checked) .portal-day-name, .portal-barber:has(input:checked) .portal-barber-name { color: #fff; }
.portal-day:has(input:checked) .portal-day-date { color: rgba(255, 255, 255, .7); }
.portal-day:has(input:checked) small { color: var(--brass-light); }
.portal-day-name { font-family: var(--display); }
.portal-barber-photo { border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.confirmation-check { background: var(--ink); color: var(--brass-light); box-shadow: 0 0 0 6px var(--gold-50); }
.confirmation-label { color: var(--primary); }
.confirmation-details div { background: #faf7f2; }

/* إدارة المنصة */
.admin-screen { background: transparent; }
.admin-header { position: relative; background: var(--ink); border-bottom: 0; }
.admin-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px; background: var(--pole); }
.admin-header .login-brand strong { color: #fff; }
.admin-header .login-brand span { color: rgba(235, 229, 218, .65); }

.status.confirmed { background: #e8f3ed; color: var(--green); }
.loading-spinner { border-color: var(--primary-100); border-top-color: var(--ink); }
button.field { justify-content: center; align-items: center; flex-direction: row; }

@media (max-width: 760px) {
  .topbar h1 { font-size: 22px; }
  .portal-hero h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01s !important; }
}

/* =====================================================================
   ألوان احترافية: أبيض + أزرق للشريط الجانبي والتحكمات
   ===================================================================== */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --brass: #1d4ed8;
  --brass-light: #dbeafe;
  --gold: #1d4ed8;
  --gold-light: #dbeafe;
  --gold-50: #eff6ff;
  --ink: #111827;
  --ink-2: #1f2937;
  --green: #15803d;
  --rose: #c0574b;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 6px 18px rgba(17, 24, 39, .05);
  --pole: repeating-linear-gradient(-45deg, #1d4ed8 0 8px, #ffffff 8px 14px, #93c5fd 14px 22px, #ffffff 22px 28px);
}
body { background: var(--bg); color: var(--text); }

/* الشعار */
.brand-mark { background: var(--primary); color: #fff; border: 0; box-shadow: 0 6px 14px rgba(29, 78, 216, .22); }

/* شاشة الدخول: بيضاء هادئة */
.login-screen { background: linear-gradient(160deg, #ffffff 0%, #eff6ff 100%); }
.login-screen::after { color: rgba(29, 78, 216, .06); }
.login-card { box-shadow: 0 24px 60px rgba(17, 24, 39, .1), 0 0 0 1px var(--border); }
.login-card::before { height: 5px; background: var(--primary); }

/* الشريط الجانبي الأخضر */
.sidebar { background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%); color: #fff; box-shadow: none; }
.sidebar::before { display: none; }
.brand { border-bottom-color: rgba(255, 255, 255, .16); }
.brand .brand-mark { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.brand span { color: rgba(255, 255, 255, .7); }
.nav-item { color: rgba(255, 255, 255, .82); }
.nav-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-item.active { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(0, 0, 0, .1); }
.sidebar-footer { border-top-color: rgba(255, 255, 255, .16); }
.sidebar .avatar { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .3); }
.sidebar .profile-copy span { color: rgba(255, 255, 255, .7); }
.sidebar .icon-button { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); color: #fff; }

/* الأزرار والتحكمات الخضراء */
.primary-button { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(29, 78, 216, .2); }
.primary-button:hover { background: var(--primary-dark); color: #fff; }
.secondary-button:hover, .action-button:hover { border-color: var(--primary-200); background: var(--primary-50); color: var(--primary); }
.field input:focus, .field textarea:focus, .field select:focus, .toolbar-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .14); }
:focus-visible { outline-color: var(--primary); }
input[type="checkbox"], input[type="radio"], .booking-service input { accent-color: var(--primary); }
.topbar h1, .panel-header h2, .modal-header h2, .portal-hero h1, .stat-card strong { color: var(--text); }
.panel-header h2::before { background: var(--primary); }
.stat-card::before { background: var(--primary); opacity: .55; }
.appointment-card-date { background: #f9fafb; border-color: #eef0f3; }
.appointment-card-date > span, .service-card .stat-icon { background: var(--primary-50); color: var(--primary); }
.appointment-card.high-priority { border-right-color: var(--rose); }
.customer-card-cover { background: linear-gradient(160deg, var(--primary-50), #ffffff); }
.customer-cover-avatar { color: var(--primary); }
.barber-photo, .customer-identity-photo { box-shadow: 0 0 0 2px var(--primary-200), 0 6px 14px rgba(17, 24, 39, .08); }
.toast { background: var(--primary-dark); border-inline-start-color: #93c5fd; }
.modal::before { height: 4px; background: var(--primary); }
.modal-backdrop { background: rgba(17, 24, 39, .35); }

/* رأس صفحة الزبون وصفحة المدير */
.customer-portal-header, .admin-header { background: var(--primary); }
.customer-portal-header::after, .admin-header::after { display: none; }
.customer-portal-header .brand-mark, .admin-header .brand-mark { background: #fff; color: var(--primary); }
.customer-portal-header .login-brand span, .admin-header .login-brand span { color: rgba(255, 255, 255, .78); }
.portal-hero::before, .booking-confirmation::before { color: var(--primary); }
.booking-service:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.portal-day:has(input:checked), .portal-barber:has(input:checked) { border-color: var(--primary); background: var(--primary); box-shadow: 0 8px 18px rgba(29, 78, 216, .22); }
.portal-day:has(input:checked) small { color: #dbeafe; }
.portal-booking { box-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 18px 40px rgba(17, 24, 39, .07); }
.confirmation-check { background: var(--primary); color: #fff; box-shadow: 0 0 0 6px var(--primary-50); }
.confirmation-details div { background: #f9fafb; }
.loading-spinner { border-top-color: var(--primary); }
.demo-login-help strong { color: var(--primary-dark); }
.field input, .field textarea, .field select, .toolbar-select, .search-box, .services-picker, fieldset.services-picker { border-color: #e2e5ea; }
.portal-day.unavailable { background: #f3f4f6; }
.customer-card .notes, .confirmation-details div { background: #f9fafb; }
.status.confirmed { background: #dcfce7; color: #15803d; }
.login-screen { background: linear-gradient(160deg, #ffffff 0%, #eff6ff 100%); }

/* ---------- المتجر ---------- */
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--rose); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.nav-badge[hidden] { display: none; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.product-card.inactive { opacity: .6; }
.product-image { aspect-ratio: 4 / 3; background: var(--primary-50); }
.product-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-image.no-image, .order-thumb.no-image { display: grid; place-items: center; font-size: 34px; color: var(--primary); }
.product-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.product-title strong { font-size: 14px; }
.product-title b { color: var(--primary); font-size: 13px; white-space: nowrap; }
.product-body p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.product-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.stock-pill { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 20px; background: #e8f3ed; color: var(--green); }
.stock-pill.out { background: #f8e6e1; color: #b4493d; }
.stock-pill.reserved { background: var(--gold-50); color: #a8701f; }
.product-body .service-actions, .portal-product .primary-button { margin-top: auto; }
.portal-product .primary-button { width: 100%; }
.portal-product.sold-out .product-image { filter: grayscale(1); opacity: .7; }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.market-orders-panel { margin-bottom: 22px; }
.market-orders-panel .panel-header { gap: 12px; flex-wrap: wrap; }
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-row { display: grid; grid-template-columns: 56px 1fr auto; grid-template-areas: "thumb main side" "thumb actions actions"; gap: 6px 12px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.order-thumb { grid-area: thumb; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--primary-50); font-size: 24px !important; }
.order-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.order-main { grid-area: main; min-width: 0; }
.order-main strong, .order-main span, .order-main small { display: block; }
.order-main strong small { display: inline; color: var(--muted); font-weight: 700; }
.order-main span { font-size: 12px; margin-top: 3px; }
.order-main > small { color: var(--muted); font-size: 11px; margin-top: 3px; overflow-wrap: anywhere; }
.order-side { grid-area: side; text-align: left; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.order-side b { color: var(--primary); font-size: 13px; white-space: nowrap; }
.order-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; }
.order-actions:empty { display: none; }
.checkbox-field { flex-direction: row !important; align-items: center; gap: 8px; font-size: 13px; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--primary); }

.portal-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-width: 420px; margin: 0 auto 26px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.portal-tabs[hidden] { display: none; }
.portal-tab { height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; }
.portal-tab.active { background: var(--primary); color: #fff; }
.my-orders { padding: 18px; margin-bottom: 18px; }
.my-order { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.my-order strong, .my-order small { display: block; }
.my-order small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.cancel-order { color: var(--rose) !important; }
.reserve-product { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.reserve-product strong, .reserve-product span { display: block; }
.reserve-product span { color: var(--muted); font-size: 12px; margin-top: 3px; }
@media (max-width: 640px) {
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-body { padding: 10px; }
  .product-title { flex-direction: column; gap: 3px; }
  .order-row { grid-template-columns: 48px 1fr; grid-template-areas: "thumb main" "side side" "actions actions"; }
  .order-thumb { width: 48px; height: 48px; }
  .order-side { flex-direction: row; justify-content: space-between; align-items: center; }
  .my-order { grid-template-columns: 1fr auto; }
  .my-order .cancel-order { grid-column: 1 / -1; justify-self: start; }
}

.barber-contact-links { display: flex; flex-wrap: wrap; gap: 4px; }
.barber-contact-links a { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 7px; border: 1px solid var(--primary-100); border-radius: 6px; background: var(--primary-50); color: var(--primary-dark); font-size: 11px; font-weight: 700; text-decoration: none; }
.barber-contact-links a:hover { text-decoration: underline; }
.barber-contact-links bdi { direction: ltr; }
.barber-info .barber-contact-links, .portal-barber-option .barber-contact-links { justify-content: center; }
.confirmation-barber .barber-contact-links { margin-top: 6px; }
.portal-contact-directory { display: grid; gap: 8px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.portal-contact-directory h2 { margin: 0; font-size: 15px; }
.portal-social-profile { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.portal-social-profile strong { font-size: 13px; }

/* مؤشر حالة الحفظ في أعلى لوحة التحكم */
.sync-status { align-self: center; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; color: #15803d; background: #dcfce7; }
.sync-status[data-status="saving"] { color: #a16207; background: #fef9c3; }
.sync-status[data-status="error"] { color: #b91c1c; background: #fee2e2; }
@media (max-width: 640px) { .sync-status:not([data-status="error"]) { display: none; } }
