@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=IBM+Plex+Sans:wght@500;600;700&display=swap');

/* Force Western digits even on Arabic OS/browser locales */
html { font-feature-settings: "tnum" 1; }

:root {
  --bg: #eef3f8;
  --bg-glow-1: rgba(0, 196, 204, 0.16);
  --bg-glow-2: rgba(10, 37, 64, 0.10);
  --surface: #ffffff;
  --ink: #0a2540;
  --muted: #5b7390;
  --line: #d5e0ec;
  --teal: #00c4cc;
  --teal-deep: #0891a0;
  --teal-soft: #e7fbfd;
  --navy: #0a2540;
  --navy-2: #123456;
  --danger: #d92d20;
  --danger-soft: #fee4e2;
  --success: #039855;
  --success-soft: #dcfae6;
  --warning: #dc6803;
  --warning-soft: #fef0c7;
  --shadow: 0 1px 2px rgba(10, 37, 64, 0.05), 0 10px 28px rgba(10, 37, 64, 0.08);
  --shadow-lg: 0 18px 50px rgba(10, 37, 64, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --touch: 48px;
  --sidebar: 286px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, var(--bg-glow-1), transparent 34%),
    radial-gradient(circle at 100% 0%, var(--bg-glow-2), transparent 28%),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 45%, #eaf1f7 100%);
  -webkit-font-smoothing: antialiased;
}

/* Force English digits visually for numeric surfaces */
.num, .money, .money-input, .stat .value, .cart-line input,
input[inputmode="numeric"], input[inputmode="decimal"],
td.num, th.num {
  font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}

a { color: var(--teal-deep); text-decoration: none; }
a:hover { color: var(--navy); }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background:
    linear-gradient(165deg, rgba(0,196,204,.18), transparent 40%),
    linear-gradient(180deg, #071b30 0%, var(--navy) 48%, var(--navy-2) 100%);
  color: #fff;
  padding: 1rem .85rem 5.5rem;
  border-left: 1px solid rgba(255,255,255,.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .4rem .55rem 1rem;
  margin-bottom: .45rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 196, 204, .28);
  background: #fff;
  flex-shrink: 0;
}
.brand strong { display: block; font-size: 1.02rem; line-height: 1.2; }
.brand span { display: block; opacity: .72; font-size: .78rem; margin-top: .18rem; }

.nav-group {
  margin: 1rem .7rem .35rem;
  font-size: .68rem;
  letter-spacing: .05em;
  opacity: .52;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 44px;
  padding: .55rem .8rem;
  margin-bottom: .16rem;
  border-radius: 12px;
  color: rgba(255,255,255,.88);
  transition: .16s ease;
}
.nav-link svg { width: 18px; height: 18px; opacity: .88; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(0,196,204,.34), rgba(0,196,204,.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,196,204,.35);
}

.main { min-width: 0; padding: 1.2rem 1.45rem 6.5rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.2rem;
  padding: .85rem 1rem;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(213,224,236,.9);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
}
.topbar-meta { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .8rem .35rem .35rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}

.card {
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; margin-bottom: 1rem;
}
.section-title {
  margin: 0 0 .9rem;
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 700;
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #fff 0%, #f7fbfc 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.stat::before {
  content: "";
  position: absolute;
  inset-inline-end: -20px; top: -20px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,196,204,.16), transparent 70%);
}
.stat::after {
  content: "";
  position: absolute;
  inset-inline-start: 0; top: 14px; bottom: 14px;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(180deg, var(--teal), var(--teal-deep));
}
.stat .label { color: var(--muted); font-size: .86rem; font-weight: 600; position: relative; }
.stat .value {
  margin-top: .45rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
  position: relative;
}
.stat.tone-warn::after { background: linear-gradient(180deg, #fdb022, var(--warning)); }
.stat.tone-danger::after { background: linear-gradient(180deg, #f97066, var(--danger)); }
.stat.tone-success::after { background: linear-gradient(180deg, #32d583, var(--success)); }

label {
  display: block;
  margin-bottom: .35rem;
  font-weight: 700;
  font-size: .9rem;
  color: var(--navy);
}
.field-money { position: relative; }
.field-money .suffix {
  position: absolute;
  left: 12px; /* after LTR number: 100,000 د.ع */
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  font-size: .85rem;
  pointer-events: none;
  direction: rtl;
}
.field-money .money-input { padding-left: 48px; padding-right: .9rem; }

input, select, textarea {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.money-input {
  letter-spacing: .02em;
  font-weight: 600;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(0,196,204,.55);
  box-shadow: 0 0 0 4px rgba(0,196,204,.14);
}
textarea { min-height: 104px; resize: vertical; }
.form-row { margin-bottom: .95rem; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.stack-sm > * + * { margin-top: .55rem; }
.muted { color: var(--muted); }
.grow { flex: 1; min-width: 160px; }

.btn, button.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: var(--touch);
  padding: .65rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .92rem;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
  transition: .14s ease;
  box-shadow: 0 10px 20px rgba(0, 196, 204, .22);
}
.btn:hover { filter: brightness(1.03); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-navy {
  background: linear-gradient(135deg, var(--navy), #163b5f);
  box-shadow: 0 10px 20px rgba(10, 37, 64, .22);
}
.btn-outline {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-outline:hover { background: #f8fafc; filter: none; }
.btn-danger {
  background: linear-gradient(135deg, #f97066, var(--danger));
  box-shadow: 0 10px 20px rgba(217, 45, 32, .2);
}
.btn-sm { min-height: 38px; padding: .4rem .8rem; font-size: .84rem; border-radius: 10px; }
.btn-block { width: 100%; }

.toolbar {
  display: flex;
  gap: .65rem;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 1rem;
}

.table-wrap { overflow: auto; border-radius: 14px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td {
  padding: .85rem .7rem;
  text-align: right;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
th {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  background: #f5f8fb;
  position: sticky;
  top: 0;
}
tbody tr:hover { background: #f7fbfc; }
tbody tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: .12rem .55rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  background: #e8f1f8;
  color: var(--navy);
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.alert {
  border-radius: 14px;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: #abefc6; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }

.cashier {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr);
  gap: 1rem;
  align-items: start;
}
.product-chip {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem;
  cursor: pointer;
  background: #fff;
  transition: .15s ease;
}
.product-chip:hover {
  border-color: rgba(0,196,204,.5);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.cart-line {
  display: grid;
  grid-template-columns: 1.5fr .7fr .85fr .7fr auto;
  gap: .45rem;
  align-items: center;
  padding: .7rem 0;
  border-bottom: 1px dashed var(--line);
}

.guest-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 12% 18%, rgba(0,196,204,.22), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(10,37,64,.18), transparent 30%),
    linear-gradient(155deg, #f4f8fb, #e8f7f8 48%, #e9eef5);
}
.guest-card {
  width: min(460px, 100%);
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(213,224,236,.95);
  border-radius: 26px;
  padding: 1.7rem 1.55rem;
  box-shadow: var(--shadow-lg);
}
.guest-card .brand-login {
  display: flex; align-items: center; gap: .9rem; margin-bottom: 1.2rem;
}
.guest-card .brand-login img {
  width: 72px; height: 72px; border-radius: 18px; object-fit: cover;
  box-shadow: 0 12px 28px rgba(0,196,204,.25);
}
.guest-card h1 { margin: 0; color: var(--navy); font-size: 1.5rem; }
.guest-card p.lead { margin: .25rem 0 0; color: var(--muted); font-size: .92rem; }

.page-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
}

.offline-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--warning);
  color: #fff;
  text-align: center;
  padding: .55rem;
  font-weight: 700;
}
.offline-banner.show { display: block; }

.mobile-nav {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(5, 1fr);
  padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
}
.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  min-height: 58px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
}
.mobile-nav a svg { width: 20px; height: 20px; }
.mobile-nav a.active, .mobile-nav a:hover { color: var(--teal-deep); }

.search-wrap { position: relative; }
.search-results {
  display: none;
  position: absolute;
  z-index: 30;
  inset-inline: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow: auto;
  padding: .35rem;
}
.search-results.show { display: block; }
.search-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  text-align: right;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: .7rem .75rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.search-item:hover, .search-item.is-first:hover { background: var(--teal-soft); }
.search-item-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.search-item-main strong { font-size: .95rem; }
.search-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .15rem;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
.search-empty { padding: .85rem; color: var(--muted); text-align: center; }

/* Customer / entity profile */
.profile-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1.25rem;
  padding: 1.25rem 1.35rem;
  background:
    linear-gradient(135deg, rgba(0,196,204,.08), transparent 42%),
    rgba(255,255,255,.96);
}
.profile-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
  flex: 1;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--teal), var(--navy));
  box-shadow: 0 12px 24px rgba(10, 37, 64, .18);
}
.profile-identity { min-width: 0; flex: 1; }
.profile-name-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  margin-bottom: .65rem;
}
.profile-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.25;
}
.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1.25rem;
}
.profile-meta-item {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 120px;
}
.profile-meta-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
}
.profile-notes {
  margin: .85rem 0 0;
  padding: .7rem .85rem;
  background: #f5f8fb;
  border-radius: 12px;
  font-size: .9rem;
  line-height: 1.55;
}
.profile-hero-balance {
  min-width: 200px;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.profile-hero-balance .label {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}
.profile-hero-balance .value {
  margin-top: .35rem;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
}
.profile-hero-balance.is-due {
  background: linear-gradient(160deg, #fff8f0, #fff);
  border-color: #f9dbaf;
}
.profile-hero-balance.is-due .value { color: var(--warning); }
.profile-hero-balance.is-clear {
  background: linear-gradient(160deg, #f3faf6, #fff);
  border-color: #abefc6;
}
.profile-hero-balance.is-clear .value { color: var(--success); }

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr);
  gap: 1rem;
  align-items: start;
}
.profile-side {
  display: grid;
  gap: 1rem;
}
.profile-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.profile-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .8rem .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  transition: .15s ease;
}
.profile-list-item:hover {
  border-color: rgba(0,196,204,.45);
  background: var(--teal-soft);
  color: inherit;
  transform: translateY(-1px);
}
.profile-list-main {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}
.profile-list-main strong { color: var(--navy); font-size: .95rem; }
.profile-list-main .muted { font-size: .8rem; }
.profile-list-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
  flex-shrink: 0;
}
.profile-list-aside .money {
  font-weight: 700;
  color: var(--navy);
  font-size: .95rem;
}
.profile-side-foot {
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
  font-size: .86rem;
}
.empty-block {
  margin: 0;
  padding: 1.1rem .4rem;
  text-align: center;
  font-size: .92rem;
}

.pwa-install-bar {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: .85rem;
  flex-wrap: wrap;
  margin: 0 1.2rem 0.85rem;
  padding: .85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(0,196,204,.35);
  background: linear-gradient(135deg, rgba(0,196,204,.12), #fff);
  box-shadow: var(--shadow);
}
.pwa-install-bar.is-visible {
  display: flex;
}
.pwa-install-bar[hidden] {
  display: none !important;
}
.pwa-install-bar strong { display: block; color: var(--navy); }
.pwa-install-bar .muted { font-size: .82rem; }
.pwa-install-actions { display: flex; gap: .45rem; }

/* Topbar actions / notifications / AI / toasts */
.topbar-actions { display: inline-flex; align-items: center; gap: .45rem; }
.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--navy);
  position: relative;
  transition: .15s ease;
  box-shadow: none;
  padding: 0;
  min-height: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: rgba(0,196,204,.45); background: var(--teal-soft); transform: translateY(-1px); }
.icon-btn-ai {
  background: linear-gradient(135deg, rgba(0,196,204,.16), #fff);
  border-color: rgba(0,196,204,.35);
}
.notify-wrap { position: relative; }
.notify-badge {
  position: absolute;
  top: -4px; left: -4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  display: grid; place-items: center;
  font-family: "IBM Plex Sans", sans-serif;
}
.notify-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(360px, 86vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  overflow: hidden;
}
.notify-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--line);
  background: #f7fafc;
}
.linkish {
  appearance: none; border: 0; background: none; color: var(--teal-deep);
  font: inherit; font-weight: 700; cursor: pointer; padding: 0;
}
.notify-list { max-height: 320px; overflow: auto; }
.notify-item {
  display: block; width: 100%; text-align: right;
  padding: .85rem .95rem;
  border: 0; border-bottom: 1px solid var(--line);
  background: #fff; cursor: pointer; font: inherit; color: inherit;
}
.notify-item:hover { background: var(--teal-soft); }
.notify-item .muted { font-size: .78rem; margin-top: .25rem; }

.toast-host {
  position: fixed;
  inset-inline-start: 1rem;
  bottom: 5.5rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  pointer-events: none;
  width: min(360px, calc(100vw - 2rem));
}
.toast {
  pointer-events: auto;
  padding: .85rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  animation: toast-in .22s ease;
}
.toast-success { background: var(--success-soft); color: var(--success); border-color: #abefc6; }
.toast-error { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }
.toast-info { background: #e8f1f8; color: var(--navy); border-color: var(--line); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.ai-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 37, 64, .35);
  z-index: 90;
  backdrop-filter: blur(2px);
}
.ai-drawer {
  position: fixed;
  top: 0; bottom: 0;
  left: 0; /* دائماً من اليسار حتى في RTL */
  width: min(400px, 94vw);
  background: #fff;
  z-index: 95;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform .22s ease;
}
.ai-drawer.open { transform: translateX(0); }
.ai-drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.05rem;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(0,196,204,.12), transparent 50%),
    #f8fafc;
}
.ai-suggestions {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--line);
}
.ai-suggestions button {
  appearance: none; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: .35rem .7rem;
  font: inherit; font-size: .78rem; font-weight: 600;
  color: var(--navy); cursor: pointer;
}
.ai-suggestions button:hover { background: var(--teal-soft); border-color: rgba(0,196,204,.4); }
.ai-messages {
  flex: 1; overflow: auto; padding: 1rem .9rem;
  display: flex; flex-direction: column; gap: .65rem;
  background: linear-gradient(180deg, #f7fafc, #fff);
}
.ai-bubble {
  max-width: 92%;
  padding: .75rem .85rem;
  border-radius: 14px;
  line-height: 1.55;
  font-size: .92rem;
  white-space: pre-wrap;
}
.ai-bot { background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.ai-user {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff; align-self: flex-end;
}
.ai-compose {
  display: flex; gap: .5rem;
  padding: .85rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.ai-compose input { margin: 0; }

.ai-insight-card {
  background:
    linear-gradient(135deg, rgba(0,196,204,.10), transparent 45%),
    rgba(255,255,255,.96);
}
.ai-insight-body {
  min-height: 72px;
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--ink);
}
.ai-insight-body.is-loading {
  color: var(--muted);
  background: linear-gradient(90deg, #f1f5f9, #fff, #f1f5f9);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 12px;
  padding: .85rem;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.kbd-hint {
  display: flex; flex-wrap: wrap; gap: .45rem;
  margin-top: .55rem;
  font-size: .78rem;
  color: var(--muted);
}
.kbd-hint kbd {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 700;
  background: #eef3f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1rem .35rem;
  color: var(--navy);
}
.stat, .card, .btn, .nav-link, .product-chip, .profile-list-item {
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, filter .14s ease;
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cashier { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-nav { display: grid; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .cart-line { grid-template-columns: 1fr 1fr; }
  .main { padding: 1rem 1rem 6.5rem; }
  .profile-hero { flex-direction: column; }
  .profile-hero-balance { min-width: 0; width: 100%; }
  .toast-host { bottom: 5.8rem; }
}
@media print {
  .sidebar, .mobile-nav, .topbar .no-print, .no-print, .btn, .page-footer,
  .ai-drawer, .ai-backdrop, .toast-host, .notify-panel { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
}
