/* DEO Salon & Wellness POS */
:root {
  --navy: #3f5a78;
  --navy-d: #2e445c;
  --slate: #475663;
  --gold: #b8924a;
  --gold-l: #f4ecdc;
  --bg: #f5f3ef;
  --card: #ffffff;
  --line: #e4e0d8;
  --ink: #26313c;
  --muted: #7a8490;
  --ok: #2f7d4f;
  --bad: #b83a3a;
  --warn: #a8741a;
  --dept: var(--navy);
  --r: 12px;
  --shadow: 0 1px 2px rgba(30,40,55,.06), 0 4px 16px rgba(30,40,55,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy); }
h1, h2, h3 { font-family: "Cormorant Garamond", Georgia, serif; color: var(--navy-d); margin: 0 0 .5em; letter-spacing: .2px; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 20px; }
.muted { color: var(--muted); }
small { font-size: 11px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 18px; height: 60px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; white-space: nowrap; }
.brand-mark { font-family: "Cormorant Garamond", serif; font-weight: 700; font-size: 26px; color: var(--navy); letter-spacing: 2px; }
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--gold); font-weight: 600; }
.mainnav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.mainnav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--slate); font-weight: 500; white-space: nowrap; }
.mainnav a:hover { background: var(--bg); }
.mainnav a.active { background: var(--navy); color: #fff; }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox > a:first-child { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; font-weight: 700; }
.uname { display: flex; flex-direction: column; line-height: 1.1; font-weight: 600; font-size: 13px; }
.uname small { color: var(--muted); font-weight: 500; }
.nav-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 22px 18px 40px; flex: 1; }
.appfoot { text-align: center; color: var(--muted); font-size: 11px; padding: 14px; }

/* ---------- basics ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--slate); margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=tel], input[type=search], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d5d0c6; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--dept) 35%, transparent); border-color: var(--dept); }
textarea { min-height: 80px; resize: vertical; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; }
label.check input { width: auto; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font: 600 13px Montserrat, system-ui, sans-serif; cursor: pointer; text-decoration: none; background: #e9e6e0; color: var(--ink); transition: .15s; }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--dept); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-outline { background: #fff; border-color: var(--dept); color: var(--dept); }
.btn-ghost { background: transparent; color: var(--slate); border-color: var(--line); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-lg { padding: 14px 18px; font-size: 15px; }
.btn-block { width: 100%; }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: #eaf5ee; border-color: #bfdcc9; color: #245c3b; }
.alert-danger { background: #fbecec; border-color: #eec4c4; color: #8a2a2a; }
.alert-warning { background: #fdf5e6; border-color: #eed8ad; color: #7a5412; }
.alert-info { background: #eaf1f8; border-color: #c4d6e8; color: #2d4a67; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; background: #faf9f6; position: sticky; top: 0; }
.tbl tr:hover td { background: #fcfbf8; }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
.tbl tr.voided td { color: #aaa; text-decoration: line-through; }
.tbl tr.voided td.nostrike { text-decoration: none; }
table.kv th { text-align: left; padding: 6px 16px 6px 0; color: var(--muted); font-weight: 500; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: #eee; color: #555; white-space: nowrap; }
.badge-salon { background: #e3eaf2; color: var(--navy-d); }
.badge-wellness { background: var(--gold-l); color: #86682f; }
.badge-ok { background: #e4f3ea; color: var(--ok); }
.badge-bad { background: #f8e3e3; color: var(--bad); }
.badge-admin { background: var(--navy); color: #fff; }

.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 24px; font-weight: 700; margin-top: 4px; color: var(--navy-d); }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.salon { border-top: 4px solid var(--navy); }
.stat.wellness { border-top: 4px solid var(--gold); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { margin: 0; min-width: 140px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 30px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--slate); font-weight: 600; }
.tabs a.active { background: var(--dept); color: #fff; border-color: var(--dept); }

/* ---------- login ---------- */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 32px 30px; box-shadow: 0 10px 40px rgba(40,50,70,.12); border-top: 5px solid var(--gold); text-align: center; }
.login-card form { text-align: left; margin-top: 16px; }
.login-logos { display: flex; gap: 14px; justify-content: center; align-items: center; margin-bottom: 18px; }
.login-logos img { height: 52px; max-width: 46%; object-fit: contain; }
.login-contact { font-size: 11px; color: var(--muted); margin-top: 18px; }

/* ---------- POS ---------- */
.pos-main { flex: 1; padding: 0; }
.pos-page .appfoot { display: none; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: calc(100vh - 60px); }
.pos-catalog { display: flex; flex-direction: column; padding: 14px 16px; overflow: hidden; }
.dept-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.dept-tab { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px; height: 66px; cursor: pointer; display: grid; place-items: center; transition: .15s; }
.dept-tab img { max-height: 46px; max-width: 90%; object-fit: contain; opacity: .55; filter: grayscale(.6); transition: .15s; }
.dept-tab.active { border-color: var(--dc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dc) 18%, transparent); }
.dept-tab.active img { opacity: 1; filter: none; }
.dept-count:not(:empty) { position: absolute; top: -8px; right: -8px; background: var(--dc); color: #fff; min-width: 24px; height: 24px; border-radius: 12px; display: grid; place-items: center; font-size: 12px; font-weight: 700; padding: 0 6px; }
.catalog-tools { margin-bottom: 10px; }
.catalog-tools input { font-size: 15px; padding: 11px 14px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; margin-bottom: 6px; flex-shrink: 0; }
.chip-btn { white-space: nowrap; border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 20px; cursor: pointer; font: 500 12px Montserrat, sans-serif; color: var(--slate); }
.chip-btn.active { background: var(--dept); color: #fff; border-color: var(--dept); }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; overflow-y: auto; padding: 2px 2px 20px; align-content: start; }
.svc { text-align: left; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--dept); border-radius: 10px; padding: 10px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 92px; height: auto; font-family: inherit; overflow: hidden; transition: transform .08s, box-shadow .15s; }
.svc:hover { box-shadow: 0 4px 14px rgba(40,50,70,.12); }
.svc:active { transform: scale(.97); }
.svc-cat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.svc-name { font-weight: 600; font-size: 13px; line-height: 1.25; flex: 1; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.svc-price { font-weight: 700; color: var(--dept); font-size: 14px; }
.svc-price small { font-weight: 500; color: var(--muted); }
.svc-price .warn { color: var(--warn); }
.empty { padding: 30px 10px; text-align: center; }

.pos-bill { background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 16px; overflow-y: auto; gap: 10px; }
.bill-head { display: flex; justify-content: space-between; align-items: center; }
.bill-head h2 { margin: 0; font-size: 22px; color: var(--dept); }
.bill-customer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.price-type { display: flex; gap: 14px; align-items: center; background: var(--gold-l); padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.price-type label { margin: 0; display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.price-type input { margin: 0; }
.bill-items { flex: 1 0 120px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; min-height: 120px; }
.item { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.item:last-child { border-bottom: 0; }
.item.edited { background: linear-gradient(90deg, #fff8ea, transparent); }
.it-name { font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.it-ctrl { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { border: 0; background: #f3f1ec; width: 28px; height: 30px; cursor: pointer; font-size: 16px; }
.qty span { min-width: 28px; text-align: center; font-weight: 600; }
.it-price { padding: 5px 8px !important; text-align: right; max-width: 120px; justify-self: end; }
.it-price-ro { text-align: right; color: var(--muted); }
.it-total { min-width: 80px; text-align: right; }
.it-del { border: 0; background: none; color: var(--bad); font-size: 20px; cursor: pointer; line-height: 1; }
.tag { font-size: 10px; font-weight: 600; background: #eee; color: #666; padding: 1px 6px; border-radius: 10px; vertical-align: middle; }
.tag-gold { background: var(--gold-l); color: #86682f; }
.bill-totals { border-top: 2px solid var(--line); padding-top: 8px; }
.bill-totals .row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; gap: 8px; }
.discount-row .disc-inputs { display: flex; gap: 4px; flex: 1; justify-content: flex-end; }
.discount-row select { width: 70px; padding: 5px; }
.discount-row input { width: 90px; padding: 5px 8px; text-align: right; }
.discount-row strong { min-width: 80px; text-align: right; color: var(--bad); }
.bill-totals .grand { font-size: 20px; color: var(--dept); padding-top: 6px; }
.bill-pay { display: flex; flex-direction: column; gap: 8px; }
.pay-methods { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { margin: 0; cursor: pointer; }
.chip input { display: none; }
.chip span { display: inline-block; padding: 6px 11px; border: 1px solid var(--line); border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--slate); }
.chip input:checked + span { background: var(--dept); color: #fff; border-color: var(--dept); }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.pay-row label { margin: 0; }
input.bad { border-color: var(--bad); background: #fff6f6; }
.change-box { background: #f6f4ef; border-radius: 8px; padding: 6px 12px; text-align: right; }
.change-box span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.change-box strong { font-size: 18px; color: var(--ok); }

/* dialogs */
.dlg { border: 0; border-radius: 16px; padding: 22px; width: min(460px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(30,38,48,.45); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-wide { width: min(760px, 96vw); }
.done-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 12px; }
.done-head h3 { color: var(--ok); margin-bottom: 2px; }
.done-head p { margin: 2px 0; }
.done-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sms-status.ok { color: var(--ok); font-weight: 600; }
.sms-status.bad { color: var(--bad); font-weight: 600; }
#receiptFrame { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: 10px; background: #f0f0f0; }

.help { font-size: 12px; color: var(--muted); margin-top: -6px; margin-bottom: 12px; }
code { background: #f1eee8; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.inline-price { width: 110px !important; padding: 5px 8px !important; text-align: right; }
.chart-box { position: relative; height: 280px; }
.bar { height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--dept); }

@media (max-width: 1100px) {
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .mainnav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: #fff; flex-direction: column; padding: 8px; border-bottom: 1px solid var(--line); }
  .nav-open .mainnav { display: flex; }
  .topbar { justify-content: space-between; }
  .uname { display: none; }
  .brand-sub { display: none; }
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pos-catalog { overflow: visible; }
  .svc-grid { max-height: 55vh; }
  .pos-bill { border-left: 0; border-top: 1px solid var(--line); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .container { padding: 16px 12px 30px; }
  .bill-customer { grid-template-columns: 1fr; }
  .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
