/* ============================================================
   XSPORT FITNESS — Gym POS  ·  Warm boutique design system
   ============================================================ */

:root {
  /* Accent (tweakable) */
  --red:        #CE1126;
  --red-deep:   #9E0E20;
  --red-soft:   #FBEAE9;
  --red-softer: #FDF4F3;

  /* Warm neutrals */
  --canvas:   #F6F0E9;
  --card:     #FFFFFF;
  --card-2:   #FFFCF9;
  --ink:      #2A2320;   /* warm charcoal, never pure black */
  --ink-2:    #6E6259;
  --ink-3:    #9B8E84;
  --line:     #ECE1D6;
  --line-2:   #F4ECE3;

  /* Support tones */
  --green:    #2E7D5B;
  --green-soft:#E7F1EC;
  --amber:    #B8821A;
  --amber-soft:#F8EFD9;
  --blue:     #2F5E8A;
  --blue-soft:#E8EFF6;

  /* Geometry */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --shadow-sm: 0 1px 2px rgba(74,40,28,.05), 0 1px 3px rgba(74,40,28,.04);
  --shadow:    0 6px 18px rgba(74,40,28,.07), 0 2px 6px rgba(74,40,28,.05);
  --shadow-lg: 0 24px 60px rgba(74,40,28,.16), 0 8px 24px rgba(74,40,28,.10);

  --sidebar-w: 256px;

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-num: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
::selection { background: var(--red-soft); }

.num { font-family: var(--font-num); font-feature-settings: "tnum" 1; letter-spacing: -.01em; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #E2D6C9; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #D2C2B0; background-clip: content-box; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #FFFCF9 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
}
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--red);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(206,17,38,.32);
  flex: none;
  position: relative;
  overflow: hidden;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name b { font-size: 17px; font-weight: 800; letter-spacing: .04em; color: var(--ink); }
.brand-name span { font-size: 10px; font-weight: 700; letter-spacing: .34em; color: var(--red); margin-top: 5px; }

.nav-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 12px 12px; }
.nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); padding: 16px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13.5px; font-weight: 600;
  border: none; background: none; width: 100%; text-align: left;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; color: var(--ink-3); transition: color .15s; }
.nav-item:hover { background: var(--line-2); color: var(--ink); }
.nav-item:hover i { color: var(--ink-2); }
.nav-item.active { background: var(--red-soft); color: var(--red-deep); }
.nav-item.active i { color: var(--red); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; background: var(--red); border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--red); color: #fff; border-radius: 20px;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center;
}
.nav-item.active .nav-badge { background: var(--red); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--r-sm);
  transition: background .15s;
}
.user-chip:hover { background: var(--line-2); }
.user-chip .ava { width: 34px; height: 34px; flex: none; }
.user-chip-info { line-height: 1.2; min-width: 0; }
.user-chip-info b { font-size: 13px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-info span { font-size: 11px; color: var(--ink-3); }

/* ---- Main column ---- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  height: 68px; flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px;
  background: rgba(255,253,251,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 800; margin: 0; letter-spacing: -.01em; white-space: nowrap; }
.topbar .sub { font-size: 12.5px; color: var(--ink-3); font-weight: 500; margin-top: 1px; }
.burger { display: none; }

.searchbox {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 14px; height: 40px;
  width: 280px; color: var(--ink-3);
  transition: border-color .15s, box-shadow .15s;
}
.searchbox:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.searchbox input { border: none; background: none; outline: none; font-size: 13.5px; color: var(--ink); width: 100%; font-family: inherit; }
.searchbox input::placeholder { color: var(--ink-3); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); display: grid; place-items: center;
  position: relative; transition: all .15s; flex: none;
}
.icon-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 1.5px solid var(--card); }

.content { flex: 1; min-height: 0; overflow-y: auto; padding: 26px; }
.content-narrow { max-width: 1320px; margin: 0 auto; }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.ava {
  border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; flex: none;
  font-size: 13px; letter-spacing: .02em;
  background: var(--red);
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 20px; border-radius: 12px;
  font-size: 14px; font-weight: 700; border: 1px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.btn i { font-size: 13px; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(206,17,38,.26); }
.btn-primary:hover { background: var(--red-deep); box-shadow: 0 6px 18px rgba(206,17,38,.34); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); background: var(--card-2); }
.btn-soft { background: var(--red-soft); color: var(--red-deep); }
.btn-soft:hover { background: #F7DCDA; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
}
.badge i { font-size: 8px; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red   { background: var(--red-soft); color: var(--red-deep); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue  { background: var(--blue-soft); color: var(--blue); }
.badge-grey  { background: var(--line-2); color: var(--ink-2); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 13px; border-radius: 30px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--line);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.stat-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 22px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-ico {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 15px; margin-bottom: 14px;
}
.stat-label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stat-value { font-size: 25px; font-weight: 700; margin: 5px 0 6px; letter-spacing: -.02em; }
.stat-value .cur { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-right: 3px; }
.stat-delta { font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red-deep); }
.stat-delta.flat { color: var(--ink-3); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line-2);
}
.panel-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; }
.panel-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.link-btn { background: none; border: none; color: var(--red); font-weight: 700; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { color: var(--red-deep); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }

/* mini bar chart */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 188px; padding: 18px 20px 8px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--red) 0%, #E0556A 100%);
  position: relative; transition: height .6s cubic-bezier(.2,.7,.3,1);
}
.bar.muted { background: linear-gradient(180deg, #EBD9CB 0%, #F2E6DA 100%); }
.bar-day { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.bar-val { position: absolute; top: -19px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }

/* list rows */
.lrow { display: flex; align-items: center; gap: 13px; padding: 13px 20px; border-bottom: 1px solid var(--line-2); }
.lrow:last-child { border-bottom: none; }
.lrow:hover { background: var(--card-2); }
.lrow .ava { width: 38px; height: 38px; }
.lrow-main { min-width: 0; flex: 1; }
.lrow-main b { font-size: 13.5px; font-weight: 700; display: block; }
.lrow-main span { font-size: 12px; color: var(--ink-3); }
.lrow-amt { font-weight: 700; font-size: 14px; text-align: right; }
.lrow-amt small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 500; }

/* ============================================================
   POS
   ============================================================ */
.pos { display: grid; grid-template-columns: 1fr 392px; gap: 18px; height: 100%; }
.pos-left { display: flex; flex-direction: column; min-height: 0; }
.pos-right { min-height: 0; }

.pos-memberbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.pos-memberbar .ava { width: 46px; height: 46px; font-size: 16px; }
.member-meta { flex: 1; min-width: 0; }
.member-meta b { font-size: 15px; font-weight: 800; }
.member-meta .row { display: flex; gap: 10px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.member-meta .row span { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }

.seg {
  display: inline-flex; background: var(--line-2); border-radius: 12px; padding: 4px; gap: 3px;
}
.seg button {
  border: none; background: none; padding: 7px 15px; border-radius: 9px;
  font-size: 13px; font-weight: 700; color: var(--ink-2); transition: all .15s;
}
.seg button.on { background: var(--card); color: var(--red-deep); box-shadow: var(--shadow-sm); }

.cat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; margin-right: -4px; }
.cat-title { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 6px 2px 12px; }

.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.pkg {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  text-align: left; transition: all .16s; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pkg:hover { border-color: var(--red); transform: translateY(-3px); box-shadow: var(--shadow); }
.pkg.sel { border-color: var(--red); background: var(--red-softer); box-shadow: 0 0 0 2px var(--red-soft); }
.pkg-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.pkg-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-size: 15px; }
.pkg-tag { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.pkg b { font-size: 14.5px; font-weight: 800; display: block; }
.pkg .dur { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pkg .price { margin-top: 12px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.pkg .price .cur { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.pkg-check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 11px; opacity: 0; transform: scale(.6); transition: all .16s; }
.pkg.sel .pkg-check { opacity: 1; transform: scale(1); }

/* product card variant */
.prod { display: flex; flex-direction: column; }
.prod-img { height: 88px; border-radius: 10px; background: linear-gradient(135deg, #F4ECE3, #FBEAE9); display: grid; place-items: center; font-size: 30px; color: var(--red); margin-bottom: 12px; }

/* add-on rows */
.addon { display: flex; align-items: center; gap: 13px; padding: 13px 15px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.addon:hover { border-color: var(--ink-3); }
.addon-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 16px; }
.addon-main { flex: 1; min-width: 0; }
.addon-main b { font-size: 13.5px; font-weight: 700; display: block; }
.addon-main span { font-size: 12px; color: var(--ink-3); }
.addon-price { font-weight: 700; font-size: 14px; margin-right: 4px; }

/* ---- Cart / invoice ---- */
.cart { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
.cart-head { padding: 18px 20px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; }
.cart-head h3 { margin: 0; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.cart-head .count { background: var(--red-soft); color: var(--red-deep); font-size: 11px; font-weight: 700; border-radius: 20px; padding: 2px 9px; }

.cart-items { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px; }
.citem { display: flex; gap: 12px; padding: 13px 8px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.citem:last-child { border-bottom: none; }
.citem-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-size: 14px; flex: none; }
.citem-main { flex: 1; min-width: 0; }
.citem-main b { font-size: 13.5px; font-weight: 700; display: block; line-height: 1.3; }
.citem-main span { font-size: 11.5px; color: var(--ink-3); }
.citem-right { text-align: right; flex: none; }
.citem-price { font-weight: 700; font-size: 13.5px; }
.qty { display: inline-flex; align-items: center; gap: 0; margin-top: 7px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 24px; height: 24px; border: none; background: var(--card-2); color: var(--ink-2); display: grid; place-items: center; font-size: 11px; }
.qty button:hover { background: var(--red-soft); color: var(--red); }
.qty span { min-width: 26px; text-align: center; font-size: 12.5px; font-weight: 700; }
.citem-x { background: none; border: none; color: var(--ink-3); font-size: 12px; padding: 4px; margin-top: 2px; }
.citem-x:hover { color: var(--red); }

.cart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--ink-3); text-align: center; padding: 30px; }
.cart-empty .e-ico { width: 64px; height: 64px; border-radius: 18px; background: var(--line-2); display: grid; place-items: center; font-size: 26px; color: var(--ink-3); }
.cart-empty b { font-size: 14px; color: var(--ink-2); font-weight: 700; }
.cart-empty p { font-size: 12.5px; margin: 0; max-width: 200px; }

.cart-foot { border-top: 1px solid var(--line-2); padding: 16px 20px 18px; background: var(--card-2); }
.sumrow { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 9px; }
.sumrow .l { color: var(--ink-2); font-weight: 500; }
.sumrow .v { font-weight: 700; }
.sumrow.disc .v { color: var(--green); }
.disc-input { display: flex; align-items: center; gap: 8px; }
.disc-input input { width: 56px; height: 28px; border: 1px solid var(--line); border-radius: 8px; text-align: right; padding: 0 8px; font-size: 12.5px; font-weight: 700; font-family: var(--font-num); outline: none; }
.disc-input input:focus { border-color: var(--red); }
.disc-input .pct { background: var(--line-2); border: 1px solid var(--line); border-radius: 8px; height: 28px; display: grid; place-items: center; padding: 0 9px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.sum-total { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.sum-total .l { font-size: 14px; font-weight: 800; }
.sum-total .v { font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.sum-total .v .cur { font-size: 14px; color: var(--ink-3); font-weight: 700; margin-right: 3px; }

.pay-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-bottom: 14px; }
.pay {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 9px 4px 7px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: all .15s;
}
.pay i { font-size: 15px; color: var(--ink-2); }
.pay span { font-size: 9.5px; font-weight: 700; color: var(--ink-2); }
.pay:hover { border-color: var(--ink-3); }
.pay.on { border-color: var(--red); background: var(--red-softer); }
.pay.on i, .pay.on span { color: var(--red-deep); }

/* ============================================================
   TABLES (members)
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .searchbox { width: 320px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 15px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all .15s;
}
.filter-chip:hover { border-color: var(--ink-3); }
.filter-chip.on { background: var(--red-soft); border-color: transparent; color: var(--red-deep); }
.filter-chip .c { font-size: 11px; background: rgba(0,0,0,.05); border-radius: 10px; padding: 1px 7px; }
.filter-chip.on .c { background: rgba(206,17,38,.12); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.tbl tbody td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--card-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tcell-user { display: flex; align-items: center; gap: 12px; }
.tcell-user .ava { width: 38px; height: 38px; }
.tcell-user b { font-weight: 700; font-size: 13.5px; display: block; }
.tcell-user span { font-size: 12px; color: var(--ink-3); }
.bar-thin { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; width: 110px; }
.bar-thin i { display: block; height: 100%; border-radius: 6px; background: var(--red); }

/* ============================================================
   ATTENDANCE
   ============================================================ */
.att-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.checkin-card { padding: 26px; text-align: center; }
.scan-zone {
  border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 34px 26px;
  background: var(--card-2); margin: 20px 0; transition: all .2s;
}
.scan-zone.live { border-color: var(--red); background: var(--red-softer); }
.scan-ring {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 18px;
  background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-size: 38px;
  position: relative;
}
.scan-ring.live::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid var(--red); opacity: .5; animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.95); opacity: .6; } 100% { transform: scale(1.25); opacity: 0; } }

.att-row { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.att-row:last-child { border-bottom: none; }
.att-in { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--green); display: flex; align-items: center; gap: 6px; }

/* ============================================================
   MODAL
   ============================================================ */
.overlay {
  position: fixed; inset: 0; background: rgba(42,35,32,.42);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: calc(100vh - 48px); overflow: hidden;
  display: flex; flex-direction: column;
  animation: pop .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { padding: 22px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.modal-x { background: var(--line-2); border: none; width: 32px; height: 32px; border-radius: 9px; color: var(--ink-2); display: grid; place-items: center; }
.modal-x:hover { background: var(--red-soft); color: var(--red); }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px 22px; display: flex; gap: 10px; border-top: 1px solid var(--line-2); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.field input, .field select {
  width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 11px;
  padding: 0 14px; font-size: 14px; font-family: inherit; color: var(--ink); background: var(--card); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---- Invoice receipt ---- */
.invoice { max-width: 460px; }
.inv-top { background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%); color: #fff; padding: 26px 26px 22px; }
.inv-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.inv-brand .m { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.16); display: grid; place-items: center; }
.inv-brand b { font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.inv-brand span { font-size: 9px; letter-spacing: .3em; opacity: .85; display: block; margin-top: 3px; }
.inv-paid { display: flex; align-items: center; justify-content: space-between; }
.inv-paid .big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.inv-paid .big .cur { font-size: 15px; opacity: .8; font-weight: 700; }
.inv-stamp { border: 2px solid rgba(255,255,255,.6); border-radius: 10px; padding: 6px 12px; font-size: 12px; font-weight: 800; letter-spacing: .1em; transform: rotate(-6deg); }
.inv-body { padding: 22px 26px; }
.inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-bottom: 18px; }
.inv-meta .k { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.inv-meta .v { font-size: 13.5px; font-weight: 700; margin-top: 2px; }
.inv-line { display: flex; justify-content: space-between; padding: 9px 0; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.inv-line .d { color: var(--ink-2); }
.inv-line .a { font-weight: 700; }
.inv-tot { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; margin-top: 6px; border-top: 2px solid var(--ink); }
.inv-tot .l { font-weight: 800; font-size: 15px; }
.inv-tot .v { font-weight: 700; font-size: 22px; }
.inv-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 26px 22px; }
.inv-act { border: 1px solid var(--line); background: var(--card); border-radius: 11px; padding: 11px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; color: var(--ink-2); transition: all .15s; }
.inv-act i { font-size: 16px; }
.inv-act:hover { border-color: var(--red); color: var(--red-deep); background: var(--red-softer); }

/* toast */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg); animation: toastin .3s cubic-bezier(.2,.8,.3,1);
}
.toast i { color: #5FD597; font-size: 15px; }
@keyframes toastin { from { opacity: 0; transform: translateY(16px); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.scrim { display: none; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .pos { grid-template-columns: 1fr 340px; }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 268px;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.3,.8,.3,1);
    box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(42,35,32,.4); z-index: 25; }
  .burger { display: grid; }
  .dash-grid { grid-template-columns: 1fr; }
  .att-grid { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; overflow-y: auto; height: auto; }
  .pos-right { position: sticky; bottom: 0; }
  .cart { height: auto; max-height: 70vh; }
  .searchbox { display: none; }
}
@media (max-width: 680px) {
  .content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .pkg-grid { grid-template-columns: repeat(2, 1fr); }
  .inv-actions { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .topbar h1 { font-size: 16px; }
}
