/* =====================================================================
   SalonSuite — app stylesheet
   Plain CSS, no build step. Mobile-first & responsive. RTL-aware.
   Theme colours are injected per-tenant via inline --primary/--secondary.
   ===================================================================== */
:root{
  --primary:#7c3aed; --primary-d:#6d28d9; --secondary:#0f172a;
  --bg:#f6f7fb; --surface:#ffffff; --border:#e5e7eb; --muted:#6b7280;
  --text:#111827; --ok:#059669; --warn:#d97706; --danger:#dc2626;
  --radius:12px; --shadow:0 1px 3px rgba(16,24,40,.08),0 1px 2px rgba(16,24,40,.06);
  --sidebar:248px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif;
  background:var(--bg); color:var(--text); font-size:15px; line-height:1.5;
}
[dir="rtl"] body{font-family:system-ui,"Segoe UI","Noto Kufi Arabic","Noto Sans Arabic",Tahoma,sans-serif}
a{color:var(--primary); text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3,h4{margin:0 0 .5rem; line-height:1.25}
h1{font-size:1.5rem} h2{font-size:1.25rem} h3{font-size:1.05rem}
img{max-width:100%}
small,.muted{color:var(--muted)}
.hidden{display:none!important}

/* ---- layout: sidebar app shell ---- */
.shell{display:flex; min-height:100vh}
.sidebar{
  width:var(--sidebar); background:var(--secondary); color:#e5e7eb;
  position:fixed; inset-block:0; inset-inline-start:0; overflow-y:auto; z-index:40;
  transition:transform .2s ease;
}
.sidebar .brand{display:flex; align-items:center; gap:.6rem; padding:1.1rem 1.2rem; font-weight:700; color:#fff; font-size:1.15rem}
.sidebar .brand .dot{width:26px;height:26px;border-radius:8px;background:var(--primary);display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:.9rem}
.sidebar nav{padding:.5rem .6rem 2rem}
.sidebar .nav-group{margin:.9rem .6rem .3rem; font-size:.7rem; text-transform:uppercase; letter-spacing:.08em; color:#94a3b8}
.sidebar a.item{
  display:flex; align-items:center; gap:.7rem; padding:.6rem .8rem; border-radius:10px;
  color:#cbd5e1; font-size:.92rem; margin-bottom:2px;
}
.sidebar a.item:hover{background:rgba(255,255,255,.06); color:#fff; text-decoration:none}
.sidebar a.item.active{background:var(--primary); color:#fff}
.sidebar a.item .ic{width:18px; text-align:center; opacity:.9}
.main{flex:1; margin-inline-start:var(--sidebar); min-width:0; display:flex; flex-direction:column}
.topbar{
  background:var(--surface); border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  padding:.7rem 1.2rem; position:sticky; top:0; z-index:30;
}
.topbar .burger{display:none; background:none; border:0; font-size:1.4rem; cursor:pointer; color:var(--text)}
.topbar .rt{display:flex; align-items:center; gap:.9rem}
.content{padding:1.4rem; max-width:1200px; width:100%}
.page-head{display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin-bottom:1.1rem}

/* ---- cards / grid ---- */
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow)}
.card .card-b{padding:1.1rem}
.card .card-h{padding:.9rem 1.1rem; border-bottom:1px solid var(--border); font-weight:600}
.grid{display:grid; gap:1rem}
.g2{grid-template-columns:repeat(2,1fr)} .g3{grid-template-columns:repeat(3,1fr)} .g4{grid-template-columns:repeat(4,1fr)}
.stat{padding:1.1rem}
.stat .n{font-size:1.7rem; font-weight:700}
.stat .l{color:var(--muted); font-size:.85rem}
.flex{display:flex} .between{justify-content:space-between} .center{align-items:center}
.gap{gap:.8rem} .wrap{flex-wrap:wrap} .grow{flex:1}

/* ---- buttons ---- */
.btn{
  display:inline-flex; align-items:center; gap:.45rem; cursor:pointer;
  background:var(--primary); color:#fff; border:1px solid var(--primary);
  padding:.55rem .95rem; border-radius:10px; font-size:.9rem; font-weight:500;
}
.btn:hover{background:var(--primary-d); border-color:var(--primary-d); text-decoration:none; color:#fff}
.btn.sm{padding:.35rem .6rem; font-size:.82rem}
.btn.block{width:100%; justify-content:center}
.btn.ghost{background:#fff; color:var(--text); border-color:var(--border)}
.btn.ghost:hover{background:#f9fafb; color:var(--text)}
.btn.danger{background:var(--danger); border-color:var(--danger)}
.btn.ok{background:var(--ok); border-color:var(--ok)}
.btn.wa{background:#25d366; border-color:#25d366}
.btn.wa:hover{background:#1eb257; border-color:#1eb257}

/* ---- forms ---- */
label{display:block; font-size:.85rem; font-weight:500; margin-bottom:.3rem}
input,select,textarea{
  width:100%; padding:.55rem .7rem; border:1px solid var(--border);
  border-radius:9px; font-size:.92rem; background:#fff; color:var(--text); font-family:inherit;
}
input:focus,select:focus,textarea:focus{outline:2px solid color-mix(in srgb,var(--primary) 35%,transparent); border-color:var(--primary)}
.field{margin-bottom:.9rem}
.row{display:grid; gap:.9rem}
@media(min-width:640px){.row.c2{grid-template-columns:1fr 1fr}.row.c3{grid-template-columns:1fr 1fr 1fr}}
.check{display:flex; align-items:center; gap:.5rem}
.check input{width:auto}

/* ---- tables ---- */
.table-wrap{overflow-x:auto}
table.tbl{width:100%; border-collapse:collapse; background:var(--surface)}
table.tbl th,table.tbl td{padding:.7rem .8rem; text-align:start; border-bottom:1px solid var(--border); white-space:nowrap}
table.tbl th{font-size:.75rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); background:#fafafa}
table.tbl tbody tr:hover,table.tbl tr:hover{background:#fafafe}

/* ---- badges / pills ---- */
.badge{display:inline-block; padding:.15rem .55rem; border-radius:999px; font-size:.74rem; font-weight:600}
.badge.gray{background:#f1f5f9; color:#475569}
.badge.green{background:#dcfce7; color:#166534}
.badge.amber{background:#fef3c7; color:#92400e}
.badge.red{background:#fee2e2; color:#991b1b}
.badge.blue{background:#dbeafe; color:#1e40af}
.badge.purple{background:#ede9fe; color:#5b21b6}

/* ---- flash ---- */
.flash{padding:.8rem 1rem; border-radius:10px; margin-bottom:1rem; font-size:.9rem}
.flash.ok{background:#dcfce7; color:#166534; border:1px solid #bbf7d0}
.flash.error{background:#fee2e2; color:#991b1b; border:1px solid #fecaca}

/* ---- auth ---- */
.auth-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:1.2rem; background:linear-gradient(135deg,var(--secondary),#1e293b)}
.auth-card{width:100%; max-width:400px; background:#fff; border-radius:16px; padding:2rem; box-shadow:0 20px 40px rgba(0,0,0,.25)}
.auth-card .logo{text-align:center; margin-bottom:1.3rem}
.auth-card .logo .dot{width:46px;height:46px;border-radius:12px;background:var(--primary);display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:1.3rem;font-weight:700}

/* ---- POS ---- */
.pos{display:grid; grid-template-columns:1fr 380px; gap:1rem; align-items:start}
.pos .catalog{display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:.7rem}
.pos .tile{background:#fff; border:1px solid var(--border); border-radius:12px; padding:.8rem; cursor:pointer; text-align:start}
.pos .tile:hover{border-color:var(--primary); box-shadow:var(--shadow)}
.pos .tile .nm{font-weight:600; font-size:.88rem; margin-bottom:.25rem}
.pos .tile .pr{color:var(--primary); font-weight:700; font-size:.9rem}
.pos .tile .tag{font-size:.7rem; color:var(--muted)}
.cart{position:sticky; top:74px}
.cart .line{display:flex; align-items:center; gap:.5rem; padding:.5rem 0; border-bottom:1px dashed var(--border)}
.cart .line .nm{flex:1; font-size:.87rem}
.cart .line select{width:auto; padding:.25rem .4rem; font-size:.78rem}
.cart .line .qty{width:52px; padding:.3rem}
.tabs{display:flex; gap:.4rem; margin-bottom:.8rem; flex-wrap:wrap}
.tabs button{background:#fff; border:1px solid var(--border); border-radius:999px; padding:.35rem .8rem; cursor:pointer; font-size:.82rem}
.tabs button.on{background:var(--primary); color:#fff; border-color:var(--primary)}

/* ---- storefront ---- */
.sf-banner{height:280px; background-size:cover; background-position:center; position:relative; background-color:var(--secondary)}
.sf-banner .ov{position:absolute; inset:0; background:linear-gradient(180deg,rgba(0,0,0,.15),rgba(0,0,0,.55))}
.sf-header{position:relative; z-index:2; color:#fff; height:100%; display:flex; flex-direction:column; justify-content:flex-end; padding:1.4rem; max-width:1000px; margin:0 auto}
.sf-header .logo{width:70px;height:70px;border-radius:14px;background:#fff;object-fit:cover;box-shadow:var(--shadow);margin-bottom:.6rem}
.sf-wrap{max-width:1000px; margin:0 auto; padding:1.4rem}
.sf-svc{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:1rem}
.sf-svc .item{background:#fff; border:1px solid var(--border); border-radius:14px; padding:1rem}
.sf-svc .item .pr{color:var(--primary); font-weight:700; margin-top:.4rem}
.chips{display:flex; gap:.4rem; flex-wrap:wrap; margin:.4rem 0 1rem}
.chip{background:#fff;border:1px solid var(--border);border-radius:999px;padding:.3rem .8rem;font-size:.82rem}

/* ---- pricing ---- */
.plans{display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:1.2rem}
.plan{background:#fff;border:1px solid var(--border);border-radius:16px;padding:1.5rem;text-align:center}
.plan.pop{border-color:var(--primary); box-shadow:0 8px 30px rgba(124,58,237,.15)}
.plan .price{font-size:2rem;font-weight:800;margin:.5rem 0}
.plan ul{list-style:none;padding:0;margin:1rem 0;text-align:start}
.plan ul li{padding:.35rem 0;border-bottom:1px solid var(--border);font-size:.9rem}

/* ---- misc ---- */
.divider{height:1px;background:var(--border);margin:1rem 0}
.list-reset{list-style:none;padding:0;margin:0}
.text-end{text-align:end}.text-center{text-align:center}
.mt{margin-top:1rem}.mb{margin-bottom:1rem}.mt2{margin-top:2rem}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--primary);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:.85rem}

/* ---- responsive ---- */
@media(max-width:900px){.pos{grid-template-columns:1fr}.cart{position:static}}
@media(max-width:768px){
  .sidebar{transform:translateX(-100%)} [dir="rtl"] .sidebar{transform:translateX(100%)}
  .sidebar.open{transform:translateX(0)}
  .main{margin-inline-start:0}
  .topbar .burger{display:block}
  .g2,.g3,.g4{grid-template-columns:1fr}
  .content{padding:1rem}
  .scrim{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:35}
}
@media(min-width:769px){.scrim{display:none}}

/* ---- In-app dialogs & toasts (replace native alert/confirm) ---- */
.ui-ovl{position:fixed;inset:0;background:rgba(15,23,42,.5);display:flex;align-items:center;justify-content:center;z-index:2000;padding:1rem;opacity:0;transition:opacity .15s}
.ui-ovl.show{opacity:1}
.ui-dlg{background:#fff;border-radius:14px;max-width:390px;width:100%;box-shadow:0 20px 50px rgba(0,0,0,.28);transform:translateY(10px);transition:transform .15s}
.ui-ovl.show .ui-dlg{transform:none}
.ui-dlg .ui-bd{padding:1.3rem}
.ui-dlg .ui-title{font-weight:700;font-size:1.05rem;margin-bottom:.4rem;color:#0f172a}
.ui-dlg .ui-msg{color:#475569;line-height:1.6;white-space:pre-line}
.ui-dlg .ui-ft{display:flex;gap:.6rem;justify-content:flex-end;padding:0 1.3rem 1.3rem}
.ui-toast-wrap{position:fixed;left:0;right:0;bottom:1.2rem;display:flex;flex-direction:column;align-items:center;gap:.5rem;z-index:2100;pointer-events:none}
.ui-toast{background:#0f172a;color:#fff;padding:.7rem 1.1rem;border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.2);font-size:.9rem;max-width:90%;opacity:0;transform:translateY(10px);transition:opacity .2s,transform .2s;pointer-events:auto}
.ui-toast.show{opacity:1;transform:none}
.ui-toast.ok{background:#15803d}
.ui-toast.error{background:#b91c1c}

/* Close (✕) button injected into popover cards */
.pop-close{position:absolute;top:.45rem;inset-inline-end:.45rem;width:30px;height:30px;border:none;border-radius:8px;background:#f1f5f9;color:#475569;font-size:1.25rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:3}
.pop-close:hover{background:#e2e8f0;color:#0f172a}
