/* ============================================================
   AJ PHARMACY — Glass Component System
   ============================================================ */

/* ============ GLASS SURFACES ============ */
.glass-card,
.glass-panel,
.glass-widget,
.glass-stat {
  position: relative;
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--inset-hi);
}
.glass-card { padding: 20px; }
.glass-panel { padding: 0; overflow: hidden; }
.glass-widget { padding: 16px 18px; }

.glass-card.hover-lift,
.glass-widget.hover-lift {
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.glass-card.hover-lift:hover,
.glass-widget.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--inset-hi);
  border-color: rgba(20, 103, 214, 0.22);
}

/* Panel header/footer for .glass-panel */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--edge-soft);
}
.panel-head .panel-title { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 700; }
.panel-head .panel-title i { color: var(--brand); font-size: 17px; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--edge-soft); }
.panel-body { padding: 20px; }

/* Section card with tinted accent */
.accent-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--brand), var(--teal));
  opacity: 0.85;
}

/* ============ STAT CARDS ============ */
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.glass-stat {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--t-med), box-shadow var(--t-med);
}
.glass-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md), var(--inset-hi); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }
.stat-icon {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px;
  font-size: 17px;
  background: var(--tone-bg, var(--brand-soft));
  color: var(--tone-fg, var(--brand));
  flex: none;
}
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; color: var(--text); }
.stat-value .cur { font-size: 14px; font-weight: 700; color: var(--text-3); margin-right: 5px; letter-spacing: 0; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }
.stat-sub { font-size: 12px; color: var(--text-3); }

/* tone helpers */
.tone-blue { --tone-bg: var(--brand-soft); --tone-fg: var(--brand); }
.tone-teal { --tone-bg: var(--teal-soft); --tone-fg: var(--teal); }
.tone-cyan { --tone-bg: var(--cyan-soft); --tone-fg: var(--cyan); }
.tone-green { --tone-bg: var(--green-soft); --tone-fg: var(--green); }
.tone-amber { --tone-bg: var(--amber-soft); --tone-fg: var(--amber); }
.tone-red { --tone-bg: var(--red-soft); --tone-fg: var(--red); }
.tone-violet { --tone-bg: var(--violet-soft); --tone-fg: var(--violet); }

/* ============ BUTTONS ============ */
.btn-aj {
  --btn-bg: var(--surface-strong);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  min-height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}
.btn-aj:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); filter: brightness(1.02); }
.btn-aj:active { transform: translateY(0) scale(0.985); }
.btn-aj:disabled, .btn-aj.disabled { opacity: 0.55; pointer-events: none; }
.btn-aj i { font-size: 15px; }

.btn-primary-aj {
  --btn-fg: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(20, 103, 214, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
[data-theme="dark"] .btn-primary-aj { color: #06121f; }
.btn-primary-aj:hover { box-shadow: 0 9px 22px -6px rgba(20, 103, 214, 0.6), inset 0 1px 0 rgba(255,255,255,.22); }

.btn-success-aj {
  --btn-fg: #fff;
  background: linear-gradient(135deg, #1aa56e, #128a5c);
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(23, 151, 106, 0.55), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-danger-aj {
  --btn-fg: #fff;
  background: linear-gradient(135deg, #e2436a, #c92b4d);
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(220, 53, 86, 0.5), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-teal-aj {
  --btn-fg: #fff;
  background: linear-gradient(135deg, #12aaa4, #0b8781);
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(14, 159, 154, 0.5), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-ghost-aj { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost-aj:hover { background: var(--hover-tint); color: var(--text); box-shadow: none; }

.btn-sm-aj { padding: 6px 12px; min-height: 31px; font-size: 12.5px; border-radius: 9px; }
.btn-sm-aj i { font-size: 13.5px; }
.btn-lg-aj { padding: 13px 26px; min-height: 50px; font-size: 15px; border-radius: 14px; }
.btn-lg-aj i { font-size: 18px; }
.btn-block-aj { width: 100%; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--edge);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  transition: all var(--t-fast);
  flex: none;
}
.icon-btn:hover { color: var(--brand); border-color: rgba(20, 103, 214, 0.35); background: var(--brand-soft); }
.icon-btn i { font-size: 17px; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm i { font-size: 14px; }
.icon-btn .dot-badge {
  position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg);
}

/* Segmented control */
.seg-group {
  display: inline-flex;
  padding: 4px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--edge-soft);
  border-radius: var(--radius-sm);
}
.seg-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface-solid);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}
[data-theme="dark"] .seg-btn.active { background: rgba(90, 162, 255, 0.16); color: var(--brand); }

/* ============ BADGES & CHIPS ============ */
.badge-aj {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--badge-bg, var(--brand-soft));
  color: var(--badge-fg, var(--brand));
  border: 1px solid transparent;
}
.badge-aj i { font-size: 12px; }
.badge-aj.blue { --badge-bg: var(--brand-soft); --badge-fg: var(--brand); }
.badge-aj.teal { --badge-bg: var(--teal-soft); --badge-fg: var(--teal); }
.badge-aj.green { --badge-bg: var(--green-soft); --badge-fg: var(--green); }
.badge-aj.amber { --badge-bg: var(--amber-soft); --badge-fg: var(--amber); }
.badge-aj.red { --badge-bg: var(--red-soft); --badge-fg: var(--red); }
.badge-aj.violet { --badge-bg: var(--violet-soft); --badge-fg: var(--violet); }
.badge-aj.gray { --badge-bg: rgba(120, 140, 165, 0.14); --badge-fg: var(--text-2); }
.badge-aj.outline { background: transparent; border-color: currentColor; opacity: 0.9; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--edge-soft);
  cursor: default;
}
.chip i { font-size: 13px; color: var(--text-3); }
.chip.clickable { cursor: pointer; transition: all var(--t-fast); }
.chip.clickable:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand-soft); border-color: rgba(20,103,214,.3); color: var(--brand); }

.filter-chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Status dot */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.blue { background: var(--brand); }
.dot.gray { background: var(--text-3); }
.dot.pulse { animation: ajPulse 2s infinite; }

/* ============ FORMS ============ */
.form-glass { width: 100%; }
.form-label-aj {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.form-label-aj .req { color: var(--red); margin-left: 2px; }
.input-aj,
.select-aj,
.textarea-aj {
  width: 100%;
  padding: 9px 13px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.textarea-aj { min-height: 88px; resize: vertical; }
.input-aj::placeholder, .textarea-aj::placeholder { color: var(--text-3); font-weight: 400; }
.input-aj:focus, .select-aj:focus, .textarea-aj:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--ring);
  background: var(--surface-strong);
}
.select-aj {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23808fa5' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
.input-icon-wrap { position: relative; }
.input-icon-wrap > i {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 15px;
  pointer-events: none;
}
.input-icon-wrap .input-aj { padding-left: 38px; }
.input-suffix-wrap { position: relative; }
.input-suffix-wrap .suffix {
  position: absolute; right: 13px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: var(--text-3);
  pointer-events: none;
}
.input-suffix-wrap .input-aj { padding-right: 52px; }

.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.form-error-text { font-size: 11.5px; color: var(--red); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
fieldset { border: none; padding: 0; margin: 0; min-width: 0; }

.checkbox-aj, .radio-aj {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
  user-select: none;
}
.checkbox-aj input, .radio-aj input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark {
  width: 19px; height: 19px;
  border-radius: 6px;
  border: 1.5px solid var(--edge);
  background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  flex: none;
}
.checkmark::after {
  content: "";
  width: 10px; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.7 5.3a1 1 0 010 1.4l-4.5 4.5a1 1 0 01-1.4 0L4.3 8.7a1 1 0 011.4-1.4l1.8 1.8 3.8-3.8a1 1 0 011.4 0z'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--t-fast);
}
.checkbox-aj input:checked + .checkmark { background: var(--brand); border-color: var(--brand); }
.checkbox-aj input:checked + .checkmark::after { opacity: 1; transform: scale(1); }
.checkbox-aj input:focus-visible + .checkmark { box-shadow: 0 0 0 3px var(--ring); }
.radio-mark {
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1.5px solid var(--edge);
  background: var(--surface-2);
  position: relative;
  flex: none;
  transition: all var(--t-fast);
}
.radio-aj input:checked + .radio-mark { border-color: var(--brand); }
.radio-aj input:checked + .radio-mark::after {
  content: "";
  position: absolute; inset: 3.5px;
  border-radius: 50%;
  background: var(--brand);
}

/* Toggle switch */
.switch-aj { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch-aj input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track {
  position: absolute; inset: 0;
  border-radius: 99px;
  background: rgba(120, 140, 165, 0.32);
  transition: background var(--t-fast);
  cursor: pointer;
}
.switch-track::before {
  content: "";
  position: absolute;
  width: 17px; height: 17px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform var(--t-fast);
}
.switch-aj input:checked + .switch-track { background: var(--brand); }
.switch-aj input:checked + .switch-track::before { transform: translateX(17px); }
.switch-aj input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--ring); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; }
.switch-row + .switch-row { border-top: 1px dashed var(--edge-soft); }
.switch-row .sw-info { min-width: 0; }
.switch-row .sw-title { font-size: 13.5px; font-weight: 650; }
.switch-row .sw-desc { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* Search field large (POS) */
.search-xl {
  width: 100%;
  padding: 15px 18px 15px 48px;
  border-radius: 15px;
  border: 1px solid var(--edge);
  background: var(--surface-strong);
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-xs);
  transition: all var(--t-fast);
}
.search-xl:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}
.search-xl::placeholder { color: var(--text-3); }

/* Quantity stepper */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}
.qty-stepper button {
  width: 30px; height: 32px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.qty-stepper button:hover { background: var(--brand-soft); color: var(--brand); }
.qty-stepper .qty-val {
  min-width: 34px;
  text-align: center;
  font-weight: 750;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.qty-stepper.lg button { width: 38px; height: 40px; font-size: 18px; }
.qty-stepper.lg .qty-val { min-width: 46px; font-size: 15.5px; }

/* ============ TABLES ============ */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--edge-soft);
}
.table-toolbar .tb-search { max-width: 300px; flex: 1 1 200px; }
.table-toolbar .spacer { flex: 1; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.aj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}
table.aj-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 10.8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--edge-soft);
  background: var(--surface-2);
  white-space: nowrap;
  user-select: none;
}
table.aj-table th.sortable { cursor: pointer; }
table.aj-table th.sortable:hover { color: var(--brand); }
table.aj-table th .sort-ind { margin-left: 4px; font-size: 11px; opacity: 0.7; }
table.aj-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--edge-soft);
  vertical-align: middle;
  color: var(--text);
}
table.aj-table tbody tr { transition: background var(--t-fast); }
table.aj-table tbody tr:hover { background: var(--hover-tint); }
table.aj-table tbody tr:last-child td { border-bottom: none; }
table.aj-table tbody tr.row-click { cursor: pointer; }
table.aj-table .cell-main { font-weight: 650; }
table.aj-table .cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
table.aj-table td.actions-cell { text-align: right; white-space: nowrap; }
table.aj-table td.num-cell { font-variant-numeric: tabular-nums; font-weight: 650; }

.table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--edge-soft);
  font-size: 12.5px;
  color: var(--text-3);
}
.pagination-aj { display: flex; gap: 5px; align-items: center; }
.page-btn {
  min-width: 31px; height: 31px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--edge-soft);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  font-family: inherit;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* Mobile responsive table → cards */
@media (max-width: 767.98px) {
  table.aj-table.mobile-cards { min-width: 0; }
  table.aj-table.mobile-cards thead { display: none; }
  table.aj-table.mobile-cards tbody tr {
    display: block;
    margin: 10px 12px;
    border: 1px solid var(--edge-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 6px 4px;
  }
  table.aj-table.mobile-cards tbody tr td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: none;
    padding: 7px 12px;
  }
  table.aj-table.mobile-cards tbody tr td::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    flex: none;
  }
  table.aj-table.mobile-cards tbody tr td:first-child { font-weight: 700; }
  table.aj-table.mobile-cards tbody tr td.actions-cell { justify-content: flex-end; }
  table.aj-table.mobile-cards tbody tr td.actions-cell::before { content: none; }
}

/* ============ MODALS ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 22, 40, 0.42);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  animation: ajFadeIn 0.2s ease both;
  overflow-y: auto;
}
.glass-modal {
  width: 100%;
  max-width: 520px;
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--inset-hi);
  animation: ajPop 0.28s var(--ease) both;
  margin: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}
.glass-modal.modal-md { max-width: 640px; }
.glass-modal.modal-lg { max-width: 820px; }
.glass-modal.modal-xl { max-width: 1020px; }
.modal-head-aj {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 14px;
}
.modal-title-aj { font-size: 16.5px; font-weight: 750; letter-spacing: -0.02em; }
.modal-sub-aj { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.modal-body-aj { padding: 4px 22px 20px; overflow-y: auto; }
.modal-foot-aj {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 22px;
  border-top: 1px solid var(--edge-soft);
  background: var(--surface-2);
}
.modal-foot-aj .left { margin-right: auto; }

/* ============ DRAWER ============ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: rgba(10, 22, 40, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: ajFadeIn 0.2s ease both;
}
.drawer-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 1081;
  width: min(560px, 96vw);
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  border-left: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: drawerIn 0.32s var(--ease) both;
}
@keyframes drawerIn { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--edge-soft);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
  padding: 15px 22px;
  border-top: 1px solid var(--edge-soft);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--surface-2);
}

/* Bottom sheet (mobile POS cart etc.) */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(10, 22, 40, 0.45);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: ajFadeIn 0.2s ease both;
}
.sheet-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1091;
  max-height: 86vh;
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  border-top: 1px solid var(--panel-border);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.32s var(--ease) both;
}
@keyframes sheetUp { from { transform: translateY(70px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-grab { width: 44px; height: 5px; border-radius: 99px; background: var(--edge); margin: 10px auto 2px; flex: none; }
.sheet-head { padding: 8px 20px 12px; border-bottom: 1px solid var(--edge-soft); display: flex; align-items: center; justify-content: space-between; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* ============ TOASTS ============ */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}
.toast-aj {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md);
  animation: ajSlideRight 0.3s var(--ease) both;
}
.toast-aj.leaving { animation: ajFadeIn 0.25s ease reverse both; }
.toast-ico {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex: none;
}
.toast-aj.success .toast-ico { background: var(--green-soft); color: var(--green); }
.toast-aj.error .toast-ico { background: var(--red-soft); color: var(--red); }
.toast-aj.warning .toast-ico { background: var(--amber-soft); color: var(--amber); }
.toast-aj.info .toast-ico { background: var(--brand-soft); color: var(--brand); }
.toast-msg { font-size: 13px; font-weight: 600; line-height: 1.45; padding-top: 4px; }
.toast-close {
  margin-left: auto;
  border: none; background: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  flex: none;
}

/* ============ DROPDOWN MENUS ============ */
.dd-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1070;
  min-width: 230px;
  padding: 7px;
  border-radius: 15px;
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg);
  animation: ajPop 0.2s var(--ease) both;
}
.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background var(--t-fast);
  font-family: inherit;
}
.dd-item:hover { background: var(--hover-tint); color: var(--text); }
.dd-item i { font-size: 15px; color: var(--text-3); width: 18px; text-align: center; }
.dd-item.danger { color: var(--red); }
.dd-item.danger i { color: var(--red); }
.dd-divider { height: 1px; background: var(--edge-soft); margin: 6px 8px; }
.dd-header { padding: 8px 11px 6px; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); }
.dd-anchor { position: relative; }

/* ============ TABS ============ */
.tabs-aj {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--edge-soft);
  scrollbar-width: none;
}
.tabs-aj::-webkit-scrollbar { display: none; }
.tab-aj {
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-3);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color var(--t-fast);
  display: inline-flex; align-items: center; gap: 7px;
}
.tab-aj:hover { color: var(--text); }
.tab-aj.active { color: var(--brand); }
.tab-aj.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2.5px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--teal));
}
.tab-count {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--edge-soft);
  color: var(--text-3);
}
.tab-aj.active .tab-count { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

/* Vertical settings nav */
.settings-nav { display: flex; flex-direction: column; gap: 3px; }
.settings-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: all var(--t-fast);
}
.settings-nav a i { font-size: 15.5px; color: var(--text-3); }
.settings-nav a:hover { background: var(--hover-tint); color: var(--text); }
.settings-nav a.active { background: var(--brand-soft); color: var(--brand); }
.settings-nav a.active i { color: var(--brand); }

/* ============ AVATARS ============ */
.avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 750;
  color: #fff;
  background: linear-gradient(135deg, var(--av1, var(--brand)), var(--av2, var(--teal)));
  flex: none;
  letter-spacing: 0;
  user-select: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; border-radius: 9px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; border-radius: 15px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; border-radius: 20px; }
.avatar.round { border-radius: 50%; }

/* ============ PROGRESS / METERS ============ */
.meter {
  height: 8px;
  border-radius: 99px;
  background: rgba(120, 140, 165, 0.16);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--teal));
  transition: width 0.6s var(--ease);
}
.meter-fill.green { background: linear-gradient(90deg, #1aa56e, #27c288); }
.meter-fill.amber { background: linear-gradient(90deg, #e09a12, #f2b93d); }
.meter-fill.red { background: linear-gradient(90deg, #dc3556, #ef5f7d); }
.meter.thin { height: 5px; }

.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }

/* ============ KEY-VALUE LIST ============ */
.kv-list { display: flex; flex-direction: column; }
.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 9.5px 0;
  border-bottom: 1px dashed var(--edge-soft);
  font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--text-3); font-weight: 550; flex: none; }
.kv-val { font-weight: 650; text-align: right; word-break: break-word; }

/* ============ TIMELINE ============ */
.timeline-aj { position: relative; padding-left: 26px; }
.timeline-aj::before {
  content: "";
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 2px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--brand-soft-2), var(--edge-soft));
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -26px; top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 2px solid var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 8.5px;
  color: var(--brand);
}
.tl-dot.teal { border-color: var(--teal); color: var(--teal); }
.tl-dot.amber { border-color: var(--amber); color: var(--amber); }
.tl-dot.red { border-color: var(--red); color: var(--red); }
.tl-dot.green { border-color: var(--green); color: var(--green); }
.tl-time { font-size: 11px; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
.tl-text { font-size: 13px; }
.tl-text b { font-weight: 700; }

/* ============ EMPTY STATES ============ */
.empty-state {
  text-align: center;
  padding: 46px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-ico {
  width: 64px; height: 64px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 27px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 8px;
}
.empty-title { font-size: 15.5px; font-weight: 750; }
.empty-text { font-size: 13px; color: var(--text-3); max-width: 340px; }
.empty-action { margin-top: 14px; }

/* ============ COMMAND PALETTE ============ */
.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 1150;
  background: rgba(8, 18, 34, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 11vh 18px 18px;
  animation: ajFadeIn 0.16s ease both;
}
.palette-box {
  width: 100%;
  max-width: 620px;
  border-radius: 20px;
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(30px) saturate(175%);
  backdrop-filter: blur(30px) saturate(175%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: ajPop 0.22s var(--ease) both;
  display: flex;
  flex-direction: column;
  max-height: 68vh;
}
.palette-input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--edge-soft); }
.palette-input-wrap i { font-size: 18px; color: var(--text-3); }
.palette-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
}
.palette-input::placeholder { color: var(--text-3); }
.palette-kbd {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--edge);
  background: var(--surface-2);
  color: var(--text-3);
}
.palette-results { overflow-y: auto; padding: 8px; }
.palette-group-label {
  padding: 9px 12px 4px;
  font-size: 10.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.palette-item:hover, .palette-item.selected { background: var(--brand-soft); }
.palette-item .pi-ico {
  width: 33px; height: 33px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--edge-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  color: var(--brand);
  flex: none;
}
.palette-item .pi-title { font-size: 13.5px; font-weight: 650; }
.palette-item .pi-sub { font-size: 11.5px; color: var(--text-3); }
.palette-item .pi-enter { margin-left: auto; opacity: 0; font-size: 12px; color: var(--text-3); }
.palette-item.selected .pi-enter { opacity: 1; }
.palette-empty { padding: 34px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ============ ALERTS / CALLOUTS ============ */
.callout {
  display: flex;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.5;
}
.callout i { font-size: 16px; margin-top: 1px; flex: none; }
.callout.info { background: var(--brand-soft); border-color: rgba(20,103,214,.18); color: var(--text); }
.callout.info i { color: var(--brand); }
.callout.warning { background: var(--amber-soft); border-color: rgba(217,138,6,.2); color: var(--text); }
.callout.warning i { color: var(--amber); }
.callout.success { background: var(--green-soft); border-color: rgba(23,151,106,.2); color: var(--text); }
.callout.success i { color: var(--green); }
.callout.danger { background: var(--red-soft); border-color: rgba(220,53,86,.18); color: var(--text); }
.callout.danger i { color: var(--red); }

/* ============ MISC ============ */
.divider-v { width: 1px; align-self: stretch; background: var(--edge-soft); margin: 0 4px; }
.section-gap { height: 22px; }
.link-arrow { font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.code-tag {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--edge-soft);
  color: var(--text-2);
  white-space: nowrap;
}
