/* Oxyping Admin Design System — production SaaS shell
   Loaded after page inline styles so shared components stay consistent. */

@font-face {
  font-family: "IranYekan";
  src: url("../assets/fonts/Qs_Iranyekan.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IranYekan";
  src: url("../assets/fonts/Qs_Iranyekan_medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IranYekan";
  src: url("../assets/fonts/Qs_Iranyekan_bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IranYekan";
  src: url("../assets/fonts/Qs_Iranyekan_bold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --op-bg: #0b0f14;
  --op-surface: #121821;
  --op-surface-2: #18212d;
  --op-surface-3: #1e2936;
  --op-border: rgba(255, 255, 255, 0.08);
  --op-border-strong: rgba(255, 255, 255, 0.14);
  --op-text: #e6edf3;
  --op-text-muted: #8b949e;
  --op-text-faint: #6e7681;
  --op-primary: #e6b800;
  --op-primary-soft: rgba(230, 184, 0, 0.12);
  --op-primary-hover: #f0c720;
  --op-primary-ink: #141414;
  --op-success: #3fb950;
  --op-success-soft: rgba(63, 185, 80, 0.12);
  --op-warning: #d29922;
  --op-warning-soft: rgba(210, 153, 34, 0.14);
  --op-danger: #f85149;
  --op-danger-soft: rgba(248, 81, 73, 0.12);
  --op-info: #58a6ff;
  --op-info-soft: rgba(88, 166, 255, 0.12);
  --op-ring: rgba(230, 184, 0, 0.45);
  --op-radius-sm: 6px;
  --op-radius: 10px;
  --op-radius-md: 12px;
  --op-radius-lg: 16px;
  --op-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --op-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
  --op-sidebar: 17rem;
  --op-sidebar-collapsed: 5rem;
  --op-header-h: 4rem;
  --op-transition: 160ms ease;
  --op-focus-ring: 0 0 0 2px var(--op-bg), 0 0 0 4px var(--op-ring);
  color-scheme: dark;
}

html { scroll-behavior: smooth; }

body.admin-shell {
  font-family: "IranYekan", Vazirmatn, Tahoma, sans-serif;
  background: var(--op-bg);
  color: var(--op-text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.admin-shell #grid-pattern { display: none !important; }

/* ---------- Layout shell ---------- */
.admin-shell #sidebar {
  width: var(--op-sidebar);
  background: var(--op-surface);
  border-left: 1px solid var(--op-border);
  backdrop-filter: none;
  transition: width var(--op-transition), transform 220ms ease;
}

.admin-shell #main-content-wrapper {
  transition: margin-right var(--op-transition);
  min-width: 0;
  width: 100%;
}

@media (min-width: 1024px) {
  .admin-shell #main-content-wrapper {
    margin-right: var(--op-sidebar);
  }
  body.sidebar-collapsed.admin-shell #sidebar {
    width: var(--op-sidebar-collapsed);
  }
  body.sidebar-collapsed.admin-shell #main-content-wrapper {
    margin-right: var(--op-sidebar-collapsed);
  }
}

.admin-shell .admin-header {
  height: auto;
  min-height: var(--op-header-h);
  background: rgba(11, 15, 20, 0.94);
  border-bottom: 1px solid var(--op-border);
  backdrop-filter: blur(12px);
}

.admin-header-inner {
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1rem 0.85rem;
}
@media (min-width: 640px) {
  .admin-header-inner { padding: 0.85rem 1.5rem 0.95rem; }
}
@media (min-width: 1024px) {
  .admin-header-inner { padding: 0.9rem 2rem 1rem; }
}

.admin-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 900px) {
  .admin-header-main {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.25rem;
  }
}

.admin-header-identity {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
}

.admin-header-copy {
  min-width: 0;
  padding-top: 0.1rem;
}

.admin-page-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #fff;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
@media (min-width: 640px) {
  .admin-page-title { font-size: 1.4rem; }
}

.admin-page-subtitle {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--op-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-header-aside {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
}
@media (min-width: 900px) {
  .admin-header-aside {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    max-width: min(720px, 62%);
    flex: 0 1 auto;
  }
}

.page-actions-slot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}
@media (min-width: 900px) {
  .page-actions-slot { justify-content: flex-end; }
}

.page-actions-slot:empty {
  display: none;
}

.logout-header-btn {
  flex-shrink: 0;
  align-self: stretch;
  justify-content: center;
}
@media (min-width: 900px) {
  .logout-header-btn {
    align-self: center;
  }
}
.logout-header-btn:hover {
  border-color: rgba(248, 81, 73, 0.45);
  color: #fda4a4;
}

/* Compact action toolbar used in page_actions */
.op-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--op-border);
  border-radius: 12px;
  background: rgba(24, 33, 45, 0.72);
}
@media (min-width: 900px) {
  .op-toolbar {
    width: auto;
    max-width: 100%;
  }
}

.op-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.op-toolbar-divider {
  display: none;
  width: 1px;
  align-self: stretch;
  min-height: 1.75rem;
  background: var(--op-border);
  margin: 0 0.15rem;
}
@media (min-width: 640px) {
  .op-toolbar-divider { display: block; }
}

.op-toolbar .op-select,
.op-toolbar-select {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  height: 2.25rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-size: 0.8125rem;
}
@media (min-width: 480px) {
  .op-toolbar .op-select,
  .op-toolbar-select {
    width: auto;
    min-width: 9.5rem;
    max-width: 14rem;
  }
}

.op-toolbar .op-btn,
.op-btn-sm {
  height: 2.25rem;
  padding: 0 0.8rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.op-toolbar .op-input {
  height: 2.25rem;
  font-size: 0.8125rem;
  min-width: 0;
  width: 100%;
}
@media (min-width: 480px) {
  .op-toolbar .op-input {
    width: 12rem;
  }
}
.op-toolbar .op-search {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 18rem;
  position: relative;
}
.op-toolbar .op-search .op-input {
  width: 100%;
  padding-left: 2.35rem;
  padding-right: 0.75rem;
}
.op-toolbar .op-search .op-icon-btn {
  position: absolute;
  left: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
}
.op-toolbar .op-search .op-icon-btn i {
  position: static;
  transform: none;
  pointer-events: auto;
  color: inherit;
}

.admin-shell .admin-main {
  padding: 1.25rem 1rem 2.5rem;
}

@media (min-width: 640px) {
  .admin-shell .admin-main { padding: 1.5rem 1.5rem 3rem; }
}
@media (min-width: 1024px) {
  .admin-shell .admin-main { padding: 1.75rem 2rem 3rem; }
}

/* ---------- Sidebar nav ---------- */
.nav-section {
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  padding: 0 0.75rem;
}
.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--op-text-faint);
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
}
body.sidebar-collapsed .nav-section-label { opacity: 0; height: 0; margin: 0; padding: 0; }

.menu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  margin: 0.1rem 0.35rem;
  border-radius: var(--op-radius);
  border-right: 3px solid transparent;
  color: var(--op-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--op-transition), color var(--op-transition), border-color var(--op-transition);
  transform: none !important;
}
.menu-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--op-text);
  border-right-color: transparent;
  transform: none !important;
}
.menu-link:focus-visible {
  outline: none;
  box-shadow: var(--op-focus-ring);
}
.menu-link.active {
  background: var(--op-primary-soft);
  color: var(--op-primary);
  border-right-color: var(--op-primary);
  font-weight: 700;
  background-image: none !important;
}
.menu-link.active:hover { transform: none !important; }
.menu-icon {
  width: 1.15rem;
  height: 1.15rem;
  stroke-width: 1.75;
  flex-shrink: 0;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.15rem;
}
.menu-link-text { white-space: nowrap; transition: opacity 120ms ease; }
.menu-badge {
  min-width: 1.2rem;
  height: 1.15rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.menu-badge--warn { background: var(--op-warning); color: #111; }
.menu-badge--danger { background: var(--op-danger); color: #fff; }

body.sidebar-collapsed .menu-link { justify-content: center; gap: 0; padding-left: 0.5rem; padding-right: 0.5rem; }
body.sidebar-collapsed .menu-link-text,
body.sidebar-collapsed .sidebar-header-text { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
body.sidebar-collapsed #sidebar-toggle-icon { transform: rotate(180deg); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.sidebar-brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--op-primary-soft);
  color: var(--op-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 0.85rem;
  border: 1px solid rgba(230, 184, 0, 0.25);
}
.sidebar-footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--op-radius);
  border: 1px solid var(--op-border);
  background: var(--op-surface-2);
  color: var(--op-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  transition: background var(--op-transition), color var(--op-transition), border-color var(--op-transition);
}
.sidebar-footer-link:hover {
  background: var(--op-info-soft);
  border-color: rgba(88, 166, 255, 0.35);
  color: var(--op-info);
}
.sidebar-footer-link.logout-link {
  color: var(--op-danger);
  border-color: rgba(248, 81, 73, 0.25);
  background: var(--op-danger-soft);
}
.sidebar-footer-link.logout-link:hover {
  background: rgba(248, 81, 73, 0.2);
  border-color: rgba(248, 81, 73, 0.4);
  color: var(--op-danger);
}
.logout-header-btn {
  color: var(--op-text-muted) !important;
  border-color: var(--op-border) !important;
}
.logout-header-btn:hover {
  color: var(--op-danger) !important;
  border-color: rgba(248, 81, 73, 0.35) !important;
  background: var(--op-danger-soft) !important;
}

/* ---------- Cards (overrides legacy glass-card) ---------- */
.glass-card,
.op-card {
  background: var(--op-surface) !important;
  border: 1px solid var(--op-border) !important;
  border-radius: var(--op-radius-md) !important;
  box-shadow: var(--op-shadow) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: hidden;
  position: relative;
  transition:
    border-color 180ms ease,
    box-shadow 220ms ease,
    transform 220ms ease,
    opacity 420ms cubic-bezier(.22,1,.36,1);
}
.glass-card::before,
.op-card::before { display: none !important; }
.glass-card:hover,
.op-card:hover {
  border-color: var(--op-border-strong) !important;
  transform: translateY(-2px);
  box-shadow: var(--op-shadow-md) !important;
}
.glass-card.is-visible { opacity: 1; transform: none; }

.op-kpi {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
}
.op-kpi-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--op-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--op-border);
  background: var(--op-surface-2);
}
.op-kpi-label {
  font-size: 0.8rem;
  color: var(--op-text-muted);
  font-weight: 500;
}
.op-kpi-value {
  margin-top: 0.2rem;
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* ---------- Tables ---------- */
.op-table,
.sales-table,
table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
}
.op-table thead th,
.sales-table thead th,
table.data-table thead th {
  background: var(--op-surface-2);
  color: var(--op-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--op-border);
  white-space: nowrap;
}
.op-table tbody td,
.sales-table tbody td,
table.data-table tbody td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--op-border);
  color: var(--op-text);
  vertical-align: middle;
}
.op-table tbody tr:hover,
.sales-table tbody tr:hover,
table.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}
.op-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--op-radius-md);
}

.stagger-item {
  opacity: 1 !important;
  transform: none !important;
}

/* ---------- Buttons ---------- */
.op-btn,
.panel-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--op-radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--op-transition), border-color var(--op-transition), color var(--op-transition), opacity var(--op-transition);
  cursor: pointer;
  line-height: 1.2;
}
.op-btn:focus-visible,
.panel-action-btn:focus-visible,
.op-icon-btn:focus-visible,
.sidebar-footer-link:focus-visible {
  outline: none;
  box-shadow: var(--op-focus-ring);
}
.op-btn:disabled,
.panel-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.op-btn-primary,
.panel-action-btn.primary,
button.bg-brand-primary {
  background: var(--op-primary) !important;
  color: var(--op-primary-ink) !important;
  border-color: transparent !important;
}
.op-btn-primary:hover:not(:disabled),
.panel-action-btn.primary:hover:not(:disabled) {
  background: var(--op-primary-hover) !important;
}
.op-btn-secondary {
  background: var(--op-surface-2);
  color: var(--op-text);
  border-color: var(--op-border);
}
.op-btn-secondary:hover:not(:disabled) {
  background: var(--op-surface-3);
  border-color: var(--op-border-strong);
}
.op-btn-danger {
  background: var(--op-danger-soft);
  color: var(--op-danger);
  border-color: rgba(248, 81, 73, 0.35);
}
.op-btn-danger:hover:not(:disabled) {
  background: rgba(248, 81, 73, 0.22);
}
.op-btn-ghost {
  background: transparent;
  color: var(--op-text-muted);
  border-color: transparent;
}
.op-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  color: var(--op-text);
}
.op-icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  min-height: 0;
  padding: 0;
  border-radius: var(--op-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--op-text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--op-transition), color var(--op-transition);
}
.op-icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--op-text);
}
.op-icon-btn.danger:hover {
  background: var(--op-danger-soft);
  color: var(--op-danger);
}

/* ---------- Forms ---------- */
.op-input,
.op-select,
.op-textarea,
input.form-input,
select.form-input,
textarea.form-input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--op-radius);
  background: var(--op-surface-2);
  border: 1px solid var(--op-border);
  color: var(--op-text);
  font-size: 0.875rem;
  transition: border-color var(--op-transition), box-shadow var(--op-transition);
}
.op-input:focus,
.op-select:focus,
.op-textarea:focus,
input.form-input:focus,
select.form-input:focus,
textarea.form-input:focus {
  outline: none;
  border-color: rgba(230, 184, 0, 0.55);
  box-shadow: 0 0 0 3px var(--op-primary-soft);
}
.op-input:focus-visible,
.op-select:focus-visible,
.op-textarea:focus-visible,
input.form-input:focus-visible,
select.form-input:focus-visible,
textarea.form-input:focus-visible {
  outline: none;
  box-shadow: var(--op-focus-ring);
  border-color: var(--op-primary);
}
.op-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--op-text-muted);
}
.op-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
  padding: 1rem;
  background: var(--op-surface);
  border: 1px solid var(--op-border);
  border-radius: var(--op-radius-md);
  margin-bottom: 1rem;
}
.op-search {
  position: relative;
  flex: 1 1 14rem;
  min-width: 12rem;
}
.op-search i,
.op-search .op-search-icon {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--op-text-faint);
  pointer-events: none;
}
.op-search input {
  padding-right: 2.4rem;
}

/* ---------- Badges ---------- */
.op-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--op-radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
  border: 1px solid transparent;
  white-space: nowrap;
}
.op-badge-success { background: var(--op-success-soft); color: var(--op-success); border-color: rgba(63,185,80,.25); }
.op-badge-warning { background: var(--op-warning-soft); color: #e3b341; border-color: rgba(210,153,34,.3); }
.op-badge-danger { background: var(--op-danger-soft); color: var(--op-danger); border-color: rgba(248,81,73,.3); }
.op-badge-info { background: var(--op-info-soft); color: var(--op-info); border-color: rgba(88,166,255,.3); }
.op-badge-neutral { background: rgba(255,255,255,.06); color: var(--op-text-muted); border-color: var(--op-border); }
.op-badge-primary { background: var(--op-primary-soft); color: var(--op-primary); border-color: rgba(230,184,0,.3); }

/* ---------- Empty / loading ---------- */
.op-empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--op-text-muted);
}
.op-empty-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.85rem;
  border-radius: var(--op-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--op-surface-2);
  border: 1px solid var(--op-border);
  color: var(--op-text-faint);
  font-size: 1.25rem;
}
.op-empty-title { color: #fff; font-weight: 700; font-size: 1rem; margin-bottom: 0.35rem; }
.op-empty-desc { font-size: 0.85rem; max-width: 26rem; margin: 0 auto; }

.op-spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--op-primary);
  border-radius: 50%;
  animation: op-spin 0.7s linear infinite;
}
@keyframes op-spin { to { transform: rotate(360deg); } }

/* ---------- Modal ---------- */
.op-modal-overlay,
#modal-container .fixed.inset-0 {
  background: rgba(0, 0, 0, 0.62) !important;
  backdrop-filter: blur(2px);
}
.op-modal,
.modal-panel {
  background: var(--op-surface) !important;
  border: 1px solid var(--op-border) !important;
  border-radius: var(--op-radius-lg) !important;
  box-shadow: var(--op-shadow-md) !important;
}

/* ---------- Toast ---------- */
#op-toast-root {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
@media (min-width: 640px) {
  #op-toast-root {
    right: auto;
    width: 22rem;
  }
}
.op-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--op-radius-md);
  background: var(--op-surface-2);
  border: 1px solid var(--op-border);
  box-shadow: var(--op-shadow-md);
  color: var(--op-text);
  font-size: 0.85rem;
  animation: op-toast-in 180ms ease;
}
.op-toast.closing { animation: op-toast-out 160ms ease forwards; }
.op-toast-success { border-right: 3px solid var(--op-success); }
.op-toast-error { border-right: 3px solid var(--op-danger); }
.op-toast-warning { border-right: 3px solid var(--op-warning); }
.op-toast-info { border-right: 3px solid var(--op-info); }
@keyframes op-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes op-toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* Legacy toast used on dashboard */
.toast-notification {
  background: var(--op-surface-2) !important;
  backdrop-filter: none !important;
  border-radius: var(--op-radius-md) !important;
  box-shadow: var(--op-shadow-md) !important;
}

/* ---------- Misc ---------- */
.admin-shell ::-webkit-scrollbar { width: 8px; height: 8px; }
.admin-shell ::-webkit-scrollbar-track { background: var(--op-bg); }
.admin-shell ::-webkit-scrollbar-thumb { background: #30363d; border-radius: 8px; }
.admin-shell ::-webkit-scrollbar-thumb:hover { background: #484f58; }

.ltr-num, .mono-ltr {
  direction: ltr;
  unicode-bidi: plaintext;
  font-variant-numeric: tabular-nums;
}

a.menu-link,
a.op-btn,
a.sidebar-footer-link,
button,
[role="button"] {
  cursor: pointer;
}

.flash-stack {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(28rem, calc(100% - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.flash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--op-radius-md);
  border: 1px solid var(--op-border);
  background: var(--op-surface-2);
  font-size: 0.85rem;
  box-shadow: var(--op-shadow-md);
}
.flash-item.success { border-right: 3px solid var(--op-success); color: var(--op-success); }
.flash-item.danger,
.flash-item.error { border-right: 3px solid var(--op-danger); color: var(--op-danger); }
.flash-item.info { border-right: 3px solid var(--op-info); color: var(--op-info); }

#cursor-glow { display: none !important; }

.page-actions-slot > .op-toolbar {
  width: 100%;
}
@media (min-width: 900px) {
  .page-actions-slot > .op-toolbar {
    width: auto;
  }
}
.page-actions-slot > .op-btn,
.page-actions-slot > a.op-btn,
.page-actions-slot > form {
  width: auto;
  flex: 0 0 auto;
}
.mobile-scroll-tabs {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-scroll-tabs::-webkit-scrollbar { display: none; }

/* =========================================================
   Global motion system
   ========================================================= */

@media (prefers-reduced-motion: no-preference) {
  .admin-main {
    animation: op-page-in .45s cubic-bezier(.22,1,.36,1) both;
  }
  .admin-page-title {
    animation: op-title-in .4s cubic-bezier(.22,1,.36,1) both;
  }
  .admin-page-subtitle {
    animation: op-title-in .45s cubic-bezier(.22,1,.36,1) .05s both;
  }
  .page-actions-slot,
  .logout-header-btn {
    animation: op-fade-up .4s cubic-bezier(.22,1,.36,1) .08s both;
  }

  .op-reveal {
    opacity: 0;
    transform: translateY(16px) scale(.985);
    will-change: opacity, transform;
  }
  .op-reveal.is-in {
    opacity: 1;
    transform: none;
  }

  .op-btn,
  .panel-action-btn,
  .op-icon-btn,
  .submit-btn,
  button.bg-brand-primary {
    transition:
      background 160ms ease,
      border-color 160ms ease,
      color 160ms ease,
      opacity 160ms ease,
      transform 140ms ease,
      box-shadow 180ms ease !important;
  }
  .op-btn:hover:not(:disabled),
  .panel-action-btn:hover:not(:disabled),
  button.bg-brand-primary:hover:not(:disabled) {
    transform: translateY(-1px);
  }
  .op-btn:active:not(:disabled),
  .panel-action-btn:active:not(:disabled),
  .op-icon-btn:active,
  button.bg-brand-primary:active:not(:disabled) {
    transform: scale(.97);
  }

  .op-btn-primary,
  .panel-action-btn.primary,
  button.bg-brand-primary {
    position: relative;
    overflow: hidden;
  }
  .op-btn-primary::after,
  .panel-action-btn.primary::after,
  button.bg-brand-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%);
    transform: translateX(-130%);
    transition: transform .55s ease;
    pointer-events: none;
  }
  .op-btn-primary:hover::after,
  .panel-action-btn.primary:hover::after,
  button.bg-brand-primary:hover::after {
    transform: translateX(130%);
  }

  .menu-link {
    transition:
      background 160ms ease,
      color 160ms ease,
      border-color 160ms ease,
      transform 160ms ease,
      padding 160ms ease !important;
  }
  .menu-link:hover {
    transform: translateX(-2px) !important;
  }
  .menu-link.active {
    animation: op-nav-pulse .5s ease both;
  }
  .menu-link .menu-icon {
    transition: transform 180ms ease, color 160ms ease;
  }
  .menu-link:hover .menu-icon {
    transform: scale(1.08);
  }

  .op-table tbody tr,
  .sales-table tbody tr,
  table.data-table tbody tr {
    transition: background 150ms ease, transform 150ms ease;
  }
  .op-table tbody tr:hover,
  .sales-table tbody tr:hover,
  table.data-table tbody tr:hover {
    background: rgba(230, 184, 0, 0.04);
  }

  .op-input:focus,
  .op-select:focus,
  .op-textarea:focus,
  input.form-input:focus,
  select.form-input:focus,
  textarea.form-input:focus {
    transition: border-color 160ms ease, box-shadow 180ms ease, background 160ms ease;
  }

  .op-badge {
    transition: transform 150ms ease, background 150ms ease;
  }
  .op-badge:hover { transform: translateY(-1px); }

  .op-kpi-value {
    transition: transform 200ms ease;
  }
  .op-card:hover .op-kpi-value {
    transform: scale(1.02);
  }

  .flash-item {
    animation: op-flash-in .35s cubic-bezier(.22,1,.36,1) both;
  }

  .admin-header {
    transition: box-shadow 200ms ease, background 200ms ease;
  }
  body.op-scrolled .admin-header {
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    background: rgba(11, 15, 20, 0.96);
  }

  /* Soft skeleton shimmer for loading placeholders */
  .op-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04));
    background-size: 200% 100%;
    animation: op-shimmer 1.2s linear infinite;
    border-radius: 8px;
  }
}

@keyframes op-page-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes op-title-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes op-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes op-nav-pulse {
  from { box-shadow: inset 0 0 0 0 rgba(230,184,0,0); }
  40% { box-shadow: inset 0 0 0 1px rgba(230,184,0,.18); }
  to { box-shadow: inset 0 0 0 0 rgba(230,184,0,0); }
}
@keyframes op-flash-in {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes op-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .admin-main,
  .admin-page-title,
  .admin-page-subtitle,
  .page-actions-slot,
  .logout-header-btn,
  .op-reveal,
  .flash-item,
  .menu-link.active,
  .op-toast,
  .op-spinner,
  .op-skeleton {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .op-card:hover,
  .glass-card:hover,
  .op-btn:hover,
  .op-btn:active,
  .menu-link:hover,
  .op-badge:hover,
  .op-card:hover .op-kpi-value {
    transform: none !important;
  }
  .op-btn-primary::after,
  .panel-action-btn.primary::after,
  button.bg-brand-primary::after {
    display: none !important;
  }
}
