:root {
  --bg: #0a0f1a;
  --bg-card: #111827;
  --bg-hover: #1e293b;
  --border: #1e3a5f;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.15);
  --income: #22c55e;
  --income-bg: rgba(34, 197, 94, 0.1);
  --expense: #ef4444;
  --expense-bg: rgba(239, 68, 68, 0.1);
  --balance: #f59e0b;
  --balance-bg: rgba(245, 158, 11, 0.12);
  --today: #3b82f6;
  --today-bg: rgba(59, 130, 246, 0.1);
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 100% 0%, rgba(245, 158, 11, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 0% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.sync-status {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-width: 88px;
  text-align: center;
  white-space: nowrap;
}

.sync-status.online { border-color: var(--income); color: var(--income); }
.sync-status.saving { border-color: var(--primary); color: var(--gold); }
.sync-status.offline { color: var(--text-muted); }
.sync-status.need-login { border-color: var(--primary); color: var(--gold); }
.sync-status.error { border-color: var(--expense); color: var(--expense); }

.btn-save-now {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.bulk-add-card {
  margin-top: 16px;
}

.bulk-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.bulk-textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
}

.bulk-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-logout {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 100% 0%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  border: 2px solid var(--primary);
  margin-bottom: 16px;
}

.login-card h1 {
  background: linear-gradient(135deg, var(--gold), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.login-card > p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.login-btn {
  width: 100%;
  margin-top: 8px;
}

.login-remember {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 14px;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.login-remember input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.login-remember:hover {
  color: var(--text);
}

.login-error {
  color: var(--expense);
  font-size: 0.85rem;
  min-height: 20px;
  margin-top: 8px;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.logo-img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--primary);
  box-shadow: 0 0 16px var(--gold-glow);
  background: #0f172a;
}

.logo-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.shop-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--gold-glow);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding-left: 2px;
  margin-left: -2px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-align: right;
}

.nav-group-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-group.expanded .nav-group-toggle,
.nav-group.group-active .nav-group-toggle {
  color: var(--text);
  background: rgba(245, 158, 11, 0.08);
}

.nav-group.group-active .nav-group-toggle {
  color: var(--gold);
}

.nav-chevron {
  margin-right: auto;
  font-size: 0.75rem;
  opacity: 0.7;
  transition: transform 0.2s;
}

.nav-group.expanded .nav-chevron {
  transform: rotate(180deg);
}

.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 2px 8px 6px 0;
  margin-right: 10px;
  border-right: 2px solid rgba(245, 158, 11, 0.2);
}

.nav-group.expanded .nav-group-items {
  display: flex;
}

.nav-btn.nav-sub-btn {
  padding: 8px 12px 8px 10px;
  font-size: 0.84rem;
  gap: 0;
}

.nav-btn.nav-sub-btn .nav-label {
  flex: 1;
}

.nav-btn.nav-sub-btn::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  margin-left: 8px;
  flex-shrink: 0;
}

.nav-btn.nav-sub-btn.active::before {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: right;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--primary), #b45309);
  color: #0a0f1a;
  font-weight: 600;
}

.nav-icon {
  font-size: 1.1rem;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Main */
.main {
  flex: 1;
  margin-right: 260px;
  padding: 32px;
  min-width: 0;
  width: calc(100% - 260px);
  max-width: none;
  box-sizing: border-box;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.header h2 {
  font-size: 1.75rem;
  font-weight: 700;
}

.header p {
  color: var(--text-muted);
  margin-top: 4px;
}

.header-date {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Pages */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 901px) {
  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-card.income { border-color: rgba(16, 185, 129, 0.3); background: var(--income-bg); }
.stat-card.expense { border-color: rgba(239, 68, 68, 0.3); background: var(--expense-bg); }
.stat-card.balance { border-color: rgba(245, 158, 11, 0.35); background: var(--balance-bg); }
.stat-card.today { border-color: rgba(59, 130, 246, 0.3); background: var(--today-bg); }
.stat-card.today h3 { color: var(--today); }
.stat-card.today .stat-icon { color: var(--today); }

.shop-banner {
  background: linear-gradient(135deg, #111827 0%, #1a2332 50%, rgba(245, 158, 11, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.shop-banner-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.banner-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--primary);
  box-shadow: 0 0 24px var(--gold-glow);
}

.shop-banner h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.shop-banner p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.quick-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.quick-btn.income:hover {
  border-color: var(--income);
  background: var(--income-bg);
}

.quick-btn.expense:hover {
  border-color: var(--expense);
  background: var(--expense-bg);
}

.quick-btn span:first-child {
  font-size: 1.2rem;
}

.monthly-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.legend-dot.income { background: var(--income); }
.legend-dot.expense { background: var(--expense); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--bg-hover);
}

.stat-card.income .stat-icon { color: var(--income); }
.stat-card.expense .stat-icon { color: var(--expense); }
.stat-card.balance .stat-icon { color: var(--balance); }

.stat-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-card h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2px;
}

.stat-card.income h3 { color: var(--income); }
.stat-card.expense h3 { color: var(--expense); }
.stat-card.balance h3 { color: var(--balance); }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.dashboard-grid,
.reports-grid,
.categories-grid {
  display: grid;
  gap: 24px;
}

.dashboard-grid {
  grid-template-columns: 1fr 1fr;
}

.reports-grid {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 24px;
}

.categories-grid {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Transactions */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transaction-list.full {
  max-height: 600px;
  overflow-y: auto;
}

.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.transaction-item:hover {
  border-color: var(--border);
}

.transaction-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.transaction-icon.income { background: var(--income-bg); color: var(--income); }
.transaction-icon.expense { background: var(--expense-bg); color: var(--expense); }

.transaction-details h4 {
  font-size: 0.95rem;
  font-weight: 500;
}

.transaction-details p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.transaction-amount {
  text-align: left;
  font-weight: 600;
  font-size: 1rem;
}

.transaction-amount.income { color: var(--income); }
.transaction-amount.expense { color: var(--expense); }

.transaction-actions {
  display: flex;
  gap: 8px;
  margin-right: 12px;
}

.delete-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.delete-btn:hover {
  border-color: var(--expense);
  color: var(--expense);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  display: block;
  font-size: 2.2rem;
  margin-bottom: 10px;
  opacity: 0.85;
}

/* Chart */
.chart-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-bar-label {
  width: 100px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.chart-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.chart-bar-fill.expense {
  background: linear-gradient(90deg, var(--expense), #f87171);
}

.chart-bar-value {
  width: 80px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Forms */
.form-card {
  max-width: 600px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.type-toggle {
  display: flex;
  gap: 8px;
}

.type-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.type-btn.active[data-type="income"] {
  background: var(--income-bg);
  border-color: var(--income);
  color: var(--income);
}

.type-btn.active[data-type="expense"] {
  background: var(--expense-bg);
  border-color: var(--expense);
  color: var(--expense);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}

.link-btn:hover {
  text-decoration: underline;
}

/* Filters */
.filters {
  display: flex;
  gap: 8px;
}

.filters select,
.filters input {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

/* Categories */
.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.category-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
}

.category-tag.income { border-color: rgba(16, 185, 129, 0.3); }
.category-tag.expense { border-color: rgba(239, 68, 68, 0.3); }

.category-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.category-tag button:hover {
  color: var(--expense);
}

/* Report bars */
.report-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.report-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.report-bar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.report-bar-fill.income {
  height: 100%;
  background: var(--income);
  border-radius: 4px;
}

.report-bar-fill.expense {
  height: 100%;
  background: var(--expense);
  border-radius: 4px;
}

/* Monthly chart */
.monthly-chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 200px;
  margin-top: 20px;
  padding: 0 8px;
}

.month-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.month-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
  width: 100%;
}

.month-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
}

.month-bar.income { background: var(--income); }
.month-bar.expense { background: var(--expense); }

.month-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-group.full-width {
  grid-column: 1 / -1;
}

/* Currency */
.currency-toggle .curr-btn.active[data-curr="IQD"] {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
}

.currency-toggle .curr-btn.active[data-curr="foreign"] {
  background: var(--gold-glow);
  border-color: var(--primary);
  color: var(--gold);
}

.foreign-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.conversion-result {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 16px;
  margin-top: 8px;
}

.conversion-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.conversion-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.conversion-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
}

.conversion-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.currency-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.rate-status {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  margin-left: 8px;
}

.rate-status.online { border-color: var(--income); color: var(--income); }
.rate-status.manual { border-color: var(--primary); color: var(--gold); }
.rate-status.offline { border-color: var(--expense); color: var(--expense); }

.rate-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.converter-card {
  margin-bottom: 24px;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--gold);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.swap-btn:hover {
  background: var(--gold-glow);
  border-color: var(--primary);
  transform: rotate(180deg);
}

.conv-result-box {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  min-height: 48px;
  display: flex;
  align-items: center;
}

.conv-rate-info {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rates-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rate-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 120px 100px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.rate-row:hover {
  border-color: var(--border);
}

.rate-row.header {
  background: transparent;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 16px;
}

.rate-currency {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.rate-value {
  font-size: 0.9rem;
}

.rate-value.online-val {
  color: var(--text-muted);
}

.rate-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.rate-input:focus {
  outline: none;
  border-color: var(--primary);
}

.rate-input.has-override {
  border-color: var(--primary);
  background: var(--gold-glow);
}

.rate-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
}

.rate-badge.online { background: var(--income-bg); color: var(--income); }
.rate-badge.manual { background: var(--balance-bg); color: var(--gold); }
.rate-badge.none { background: var(--expense-bg); color: var(--expense); }

.rate-clear-btn {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.rate-clear-btn:hover {
  border-color: var(--expense);
  color: var(--expense);
}

.tx-foreign-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Inventory */
.inventory-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

.inventory-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.inv-product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
}

.inv-product-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.inv-product-row:hover {
  border-color: var(--border);
}

.inv-product-row.low-stock {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
}

.inv-product-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.inv-prod-thumb,
.prod-thumb,
.sale-prod-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.sale-prod-thumb {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto 6px;
}

.product-images-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.product-images-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.prod-img-card {
  width: 88px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.prod-img-card.primary {
  border-color: var(--gold);
}

.prod-img-card img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  display: block;
}

.prod-img-actions {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prod-img-primary-tag {
  font-size: 0.68rem;
  color: var(--gold);
}

.online-order-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

.online-order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.order-item-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.order-item-no-img {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 8px;
  flex-shrink: 0;
}

.inv-product-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.inv-product-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-brand {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.inv-product-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.inv-product-prices {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.inv-price-old {
  text-decoration: line-through;
  opacity: 0.7;
  margin-left: 4px;
}

.inv-price-sale {
  color: #f87171;
  font-weight: 700;
}

.inv-sale-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: #ef4444;
  vertical-align: middle;
}

.shop-sale-price-field {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px dashed rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

.shop-sale-price-field label {
  color: #fca5a5;
}

.shop-global-discount-card {
  margin-bottom: 20px;
  border-color: rgba(239, 68, 68, 0.28);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(17, 24, 39, 0.95));
}

.shop-global-discount-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
  cursor: pointer;
  font-weight: 600;
}

.shop-global-discount-preview {
  margin: 12px 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--bg);
  font-size: 0.85rem;
  line-height: 1.5;
}

.shop-global-discount-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.sgd-list-title {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.95rem;
}

.sgd-admin-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(239, 68, 68, 0.05));
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sgd-admin-row.live {
  border-color: rgba(34, 197, 94, 0.35);
}

.sgd-admin-row.inactive {
  opacity: 0.72;
}

.sgd-admin-row.expired {
  border-color: rgba(148, 163, 184, 0.35);
  opacity: 0.8;
}

.sgd-admin-badge {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}

.sgd-admin-info {
  flex: 1;
  min-width: 0;
}

.sgd-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.sgd-status-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.sgd-status-badge.live {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
}

.sgd-status-badge.inactive {
  color: var(--text-muted);
}

.sgd-status-badge.expired {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.sgd-admin-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sgd-date-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

.sgd-date-chip.start {
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.sgd-date-chip.target {
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--gold);
}

.sgd-date-chip.end {
  border-color: rgba(148, 163, 184, 0.3);
}

.sgd-admin-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.shop-global-discount-form {
  margin-top: 4px;
}

.shop-global-discount-form h4 {
  margin-bottom: 14px;
  color: var(--gold);
}

@media (max-width: 720px) {
  .sgd-admin-row {
    flex-direction: column;
  }

  .sgd-admin-actions {
    width: 100%;
    justify-content: stretch;
  }

  .sgd-admin-actions .shop-ad-action-btn {
    flex: 1;
    min-width: 0;
  }
}

.inv-stock-badge {
  text-align: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg-hover);
  min-width: 70px;
}

.inv-stock-badge strong {
  display: block;
  font-size: 1.3rem;
}

.inv-stock-badge span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.inv-stock-badge em {
  display: block;
  font-size: 0.65rem;
  color: var(--expense);
  font-style: normal;
  margin-top: 2px;
}

.inv-stock-badge.ok strong { color: var(--income); }
.inv-stock-badge.low strong { color: var(--expense); }
.inv-stock-badge.empty strong { color: var(--text-muted); }

.inv-product-actions {
  display: flex;
  gap: 6px;
}

.inv-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.inv-action-btn.in:hover { border-color: var(--income); background: var(--income-bg); }
.inv-action-btn.out:hover { border-color: var(--expense); background: var(--expense-bg); }
.inv-action-btn.edit:hover { border-color: var(--primary); background: var(--gold-glow); }
.inv-action-btn.del:hover { border-color: var(--expense); color: var(--expense); }

.inv-movement-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.inv-movement-row {
  display: grid;
  grid-template-columns: 90px 1fr 60px 90px 100px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.85rem;
}

.inv-mov-type {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
}

.inv-mov-type.in { background: var(--income-bg); color: var(--income); }
.inv-mov-type.out { background: var(--expense-bg); color: var(--expense); }
.inv-mov-type.adjust { background: var(--balance-bg); color: var(--gold); }

.inv-mov-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.inv-mov-info strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-mov-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.inv-mov-qty {
  font-weight: 700;
  text-align: center;
}

.inv-mov-balance {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.inv-mov-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: left;
}

.inv-dash-grid {
  margin-top: 24px;
}

.inv-dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.inv-dash-stats div {
  text-align: center;
  padding: 16px 10px;
  background: var(--bg);
  border-radius: 8px;
}

.inv-dash-stats span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.inv-dash-stats strong {
  font-size: 1.2rem;
  color: var(--gold);
}

.inv-dash-stats div.warn strong {
  color: var(--expense);
}

.inv-alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inv-alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
}

.inv-alert-qty {
  font-weight: 700;
  color: var(--expense);
  font-size: 0.85rem;
}

.field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Sales / قائمة بيع */
.sales-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

.sale-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
  padding: 4px;
}

.sale-product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text);
  text-align: center;
}

.sale-product-card:hover {
  border-color: var(--primary);
  background: var(--gold-glow);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.sale-in-cart {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--primary);
  color: #0a0f1a;
  font-weight: 700;
  font-size: 0.75rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sale-prod-icon {
  font-size: 2rem;
}

.sale-product-card strong {
  font-size: 0.85rem;
  line-height: 1.3;
}

.sale-prod-brand {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sale-prod-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
}

.sale-prod-stock {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sales-cart {
  position: sticky;
  top: 20px;
  min-width: 0;
  overflow-x: hidden;
}

.sale-cart-badge {
  background: var(--gold-glow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--gold);
}

.sale-cart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.sale-empty {
  padding: 30px 10px !important;
}

.sale-cart-item {
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.sale-cart-item.has-item-discount {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.06);
}

.sale-cart-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.sale-cart-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.sale-price-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
  font-size: 0.75rem;
}

.sale-buy-tag {
  color: #fbbf24;
}

.sale-list-tag {
  color: var(--text-muted);
}

.sale-margin-tag {
  color: #34d399;
}

.sale-margin-tag.warn {
  color: var(--expense);
}

.sale-item-disc-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.sale-disc-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

.sale-item-disc-fields {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.sale-disc-item-input {
  width: 72px;
  padding: 4px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

.sale-disc-result {
  font-size: 0.78rem;
  color: var(--expense);
}

.sale-invoice-no {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.tx-invoice-note {
  font-size: 0.82rem;
  color: #60a5fa;
  margin-top: 2px;
}

.tx-sale-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.sale-cart-info strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.sale-cart-price-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sale-price-input {
  width: 80px;
  padding: 4px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.sale-cart-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sale-cart-qty button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}

.sale-cart-qty button:hover {
  border-color: var(--primary);
  color: var(--gold);
}

.sale-cart-qty span {
  min-width: 20px;
  text-align: center;
  font-weight: 600;
}

.sale-cart-line-total {
  font-weight: 700;
  color: var(--income);
  font-size: 0.9rem;
  white-space: nowrap;
}

.sale-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
}

.sale-remove-btn:hover {
  color: var(--expense);
}

.sale-total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, var(--gold-glow), rgba(34, 197, 94, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  margin-bottom: 16px;
}

.sale-discount-box {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}

.sale-discount-box > label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sale-discount-modes {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.sale-disc-mode-btn {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.sale-disc-mode-btn.active {
  border-color: var(--primary);
  color: var(--gold);
  background: var(--gold-glow);
}

.sale-discount-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sale-discount-input-wrap input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.sale-totals-box {
  padding: 14px;
  background: linear-gradient(135deg, var(--gold-glow), rgba(34, 197, 94, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  margin-bottom: 16px;
}

.sale-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sale-total-row strong {
  color: var(--text);
  font-size: 1rem;
}

.sale-discount-row strong {
  color: var(--income);
}

.sale-final-row {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(245, 158, 11, 0.35);
}

.sale-final-row span {
  font-weight: 600;
  color: var(--text);
}

.sale-final-row strong {
  font-size: 1.45rem;
  color: var(--gold);
}

.sale-hist-discount {
  display: inline-block;
  margin-right: 8px;
  font-size: 0.82rem;
  color: var(--income);
}

.sale-total-box span {
  color: var(--text-muted);
}

.sale-total-box strong {
  font-size: 1.5rem;
  color: var(--gold);
}

.sale-pay-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.sale-actions {
  margin-top: 8px;
}

.btn-sale {
  flex: 1;
  font-size: 1rem;
  padding: 14px;
}

.sale-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sale-history-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 8px;
  gap: 16px;
}

.sale-hist-info strong {
  color: var(--income);
  font-size: 1.05rem;
}

.sale-hist-foreign {
  display: block;
  font-size: 0.82rem;
  color: var(--gold);
  margin-top: 2px;
}

.sale-hist-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.sale-hist-info em {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: normal;
}

.sale-hist-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sale-hist-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.sale-hist-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.btn-icon:hover {
  background: var(--bg-hover);
}

.btn-icon.danger:hover {
  border-color: var(--expense);
}

.sale-hist-profit {
  display: block;
  font-size: 0.82rem;
  color: #34d399;
  margin-top: 2px;
}

.sale-hist-online {
  display: inline-block;
  font-size: 0.78rem;
  color: #a78bfa;
  margin-right: 6px;
}

.return-source-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.expense-text {
  color: var(--expense) !important;
}

.profit-text {
  color: #34d399 !important;
}

.stat-card.profit {
  border-color: rgba(52, 211, 153, 0.3);
}

.stat-card.cogs {
  border-color: rgba(251, 191, 36, 0.3);
}

.sale-hist-customer {
  display: block;
  font-size: 0.82rem;
  color: #60a5fa;
  margin-top: 2px;
}

/* Customers */
.customers-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.customer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 600px;
  overflow-y: auto;
}

.customer-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.customer-card:hover {
  border-color: var(--primary);
  background: var(--gold-glow);
}

.customer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #b45309);
  color: #0a0f1a;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.customer-card-info {
  flex: 1;
  min-width: 0;
}

.customer-card-info h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.customer-card-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.customer-card-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--gold);
}

.customer-last {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.customer-detail-panel {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.customer-detail-panel.open {
  display: flex;
}

.customer-detail-inner {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.cust-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cust-detail-grid div {
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
}

.cust-detail-grid span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cust-detail-grid strong {
  font-size: 0.9rem;
}

.cust-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.cust-history-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  gap: 12px;
}

.cust-history-item strong {
  color: var(--income);
}

.cust-history-item p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.cust-history-item span {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cust-search-wrap,
.sale-customer-search {
  position: relative;
}

.cust-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
}

.cust-dropdown-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.cust-dropdown-item:last-child {
  border-bottom: none;
}

.cust-dropdown-item:hover {
  background: rgba(245, 158, 11, 0.1);
}

.cust-dropdown-item strong {
  font-size: 0.9rem;
}

.cust-dropdown-item span {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.cust-dropdown-empty {
  padding: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

.sale-customer-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(17, 24, 39, 0.95));
  border: 1.5px solid rgba(59, 130, 246, 0.22);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sale-customer-box.has-customer {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.sale-customer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sale-customer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.sale-customer-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.15);
  font-size: 1rem;
}

.sale-customer-clear {
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.sale-customer-clear:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.55);
}

.sale-customer-clear:active {
  transform: scale(0.97);
}

.sale-customer-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sale-customer-search:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.sale-customer-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.sale-customer-search-input::placeholder {
  color: var(--text-muted);
}

.sale-customer-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
}

.sale-customer-field {
  min-width: 0;
  width: 100%;
}

.sale-customer-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.scf-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.scf-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.scf-icon {
  font-size: 0.95rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.scf-input-wrap input {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
}

.scf-input-wrap input::placeholder {
  color: var(--text-muted);
}

.sale-customer-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  font-size: 0.82rem;
  color: #93c5fd;
}

.cust-badge {
  font-weight: 700;
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.tx-customer-note {
  font-size: 0.78rem;
  color: #60a5fa;
  margin-top: 2px;
}

.export-card {
  margin-bottom: 24px;
  background: linear-gradient(135deg, #111827, rgba(245, 158, 11, 0.08));
  border-color: rgba(245, 158, 11, 0.35);
}

.export-card-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}

.export-card h3 {
  color: var(--gold);
  margin-bottom: 6px;
}

.export-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 480px;
}

.export-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.export-filters .form-group {
  margin-bottom: 0;
  min-width: 140px;
}

.btn-export-excel {
  white-space: nowrap;
  padding: 12px 20px;
}

.sidebar-footer .btn-primary {
  font-size: 0.85rem;
  padding: 10px 12px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 14px 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { border-color: var(--income); }
.toast.error { border-color: var(--expense); }

/* Bottom navigation — mobile */
.bottom-nav {
  display: none;
}

.mobile-menu-drawer {
  display: none;
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: stretch;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  }

  .bottom-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    cursor: pointer;
    border-radius: 10px;
    transition: color 0.2s, background 0.2s;
  }

  .bottom-nav-btn.active {
    color: var(--gold);
    background: var(--gold-glow);
  }

  .bottom-nav-icon {
    font-size: 1.35rem;
    line-height: 1;
  }

  .bottom-nav-label {
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .mobile-menu-drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1100;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0.25s;
  }

  .mobile-menu-drawer.open {
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.25s;
  }

  .mobile-menu-drawer.open .mobile-menu-backdrop {
    opacity: 1;
  }

  .mobile-menu-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 78vh;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
  }

  .mobile-menu-drawer.open .mobile-menu-panel {
    transform: translateY(0);
  }

  .mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
  }

  .mobile-menu-header h3 {
    font-size: 1rem;
    font-weight: 600;
  }

  .mobile-menu-list {
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .mobile-menu-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .mobile-menu-section-title {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gold);
    padding: 0 4px 2px;
    margin: 0;
  }

  .mobile-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 78px;
    padding: 10px 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
  }

  .mobile-menu-item:active {
    background: var(--bg-hover);
    border-color: var(--primary);
  }

  .mobile-menu-icon {
    font-size: 1.5rem;
    line-height: 1;
  }

  .mobile-menu-label {
    font-size: 0.72rem;
    text-align: center;
    line-height: 1.3;
  }

  .mobile-menu-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 0;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }

  .mobile-menu-export {
    flex: 1;
    min-width: 120px;
    font-size: 0.82rem;
    padding: 10px 12px;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  .main {
    margin-right: 0;
    width: 100%;
    max-width: none;
    padding: 16px;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .header {
    padding: 12px 0 16px;
  }

  .header-right {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .header-date {
    display: none;
  }

  .shop-banner-content {
    flex-direction: column;
    text-align: center;
  }

  .quick-actions {
    justify-content: center;
  }

  .dashboard-grid,
  .reports-grid,
  .categories-grid,
  .inv-dash-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  .inventory-layout {
    grid-template-columns: 1fr;
  }

  .sales-layout {
    grid-template-columns: 1fr;
  }

  .sales-cart {
    position: static;
  }

  .customers-layout {
    grid-template-columns: 1fr;
  }

  .cust-detail-grid {
    grid-template-columns: 1fr;
  }

  .inv-product-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .inv-product-actions {
    justify-content: flex-end;
  }

  .inv-movement-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .inv-dash-stats {
    grid-template-columns: 1fr 1fr;
  }

  .export-card-content {
    flex-direction: column;
  }

  .export-filters {
    flex-direction: column;
    width: 100%;
  }

  .export-filters .form-group {
    width: 100%;
  }

  .filters {
    flex-direction: column;
  }

  .rate-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .rate-row.header {
    display: none;
  }

  .converter-grid {
    grid-template-columns: 1fr;
  }

  .swap-btn {
    margin: 0 auto 8px;
  }
}

/* تطبيق أندرويد + موبايل — قياسات مضبوطة */
html.nf-mobile-layout .sidebar,
html.nf-native-app .sidebar {
  display: none;
}

html.nf-mobile-layout .bottom-nav,
html.nf-native-app .bottom-nav {
  display: flex;
}

html.nf-native-app {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.nf-native-app body {
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

html.nf-native-app .main,
html.nf-mobile-layout .main {
  margin-right: 0;
  max-width: 100%;
  padding: 12px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

html.nf-native-app .header {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 20px;
}

html.nf-native-app .header h2 {
  font-size: 1.2rem;
  line-height: 1.35;
}

html.nf-native-app .header p {
  font-size: 0.82rem;
}

html.nf-native-app .header-right {
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

html.nf-native-app .stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

html.nf-native-app .stat-card {
  padding: 14px 12px;
  gap: 10px;
}

html.nf-native-app .stat-card h3 {
  font-size: 1rem;
  word-break: break-word;
}

html.nf-native-app .stat-card p {
  font-size: 0.75rem;
}

html.nf-native-app .stat-icon {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}

html.nf-native-app .quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

html.nf-native-app .quick-btn {
  min-height: 72px;
  padding: 10px 6px;
  font-size: 0.72rem;
}

html.nf-native-app .quick-btn span:first-child {
  font-size: 1.35rem;
}

html.nf-native-app .form-group input,
html.nf-native-app .form-group select,
html.nf-native-app .form-group textarea,
html.nf-native-app .bulk-textarea {
  font-size: 16px;
  min-height: 44px;
}

html.nf-native-app .btn-primary,
html.nf-native-app .btn-secondary {
  min-height: 44px;
}

html.nf-native-app .login-screen {
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px
    calc(16px + env(safe-area-inset-bottom, 0px));
}

html.nf-native-app .login-card {
  width: 100%;
  max-width: 100%;
  padding: 28px 20px;
}

html.nf-native-app .login-logo {
  width: 96px;
  height: 96px;
}

html.nf-native-app .toast {
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 32px);
  font-size: 0.9rem;
}

html.nf-native-app .transaction-item {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

html.nf-native-app .transaction-item > div:last-child {
  justify-content: space-between;
  width: 100%;
}

html.nf-native-app .sales-product-card {
  min-height: 44px;
}

html.nf-native-app .bottom-nav-label {
  font-size: 0.62rem;
}

html.nf-native-app .sync-status,
html.nf-native-app .user-badge {
  font-size: 0.7rem;
  padding: 4px 8px;
}

/* الإعدادات والمستخدمين */
.user-badge {
  font-size: 0.85rem;
  color: var(--gold);
  padding: 6px 12px;
  background: rgba(212, 175, 55, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.settings-card {
  padding: 24px;
}

.settings-card h3 {
  margin-bottom: 16px;
  color: var(--gold);
}

.shop-link-banner {
  margin-bottom: 20px;
  padding: 20px 24px;
}

.shop-link-banner h3 {
  color: var(--gold);
  margin-bottom: 8px;
}

.shop-link-banner a {
  color: var(--primary);
  word-break: break-all;
  font-weight: 600;
}

.online-check {
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.online-orders-header {
  flex-wrap: wrap;
  gap: 12px;
}

#online_orders .card-header {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

#online_orders .card-header > h3 {
  width: 100%;
}

.online-orders-toolbar {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  width: 100%;
}

.online-orders-toolbar .shop-toolbar-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 12px 0 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(17, 24, 39, 0.95));
  transition: border-color 0.2s, box-shadow 0.2s;
}

.online-orders-toolbar .shop-toolbar-select-wrap:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.shop-toolbar-select-icon {
  font-size: 1rem;
  opacity: 0.8;
  flex-shrink: 0;
  pointer-events: none;
}

.shop-toolbar-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 24px 10px 4px;
  cursor: pointer;
  outline: none;
  min-width: 148px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 4px center;
}

.shop-toolbar-select option {
  background: var(--bg-card);
  color: var(--text);
}

@media (max-width: 640px) {
  .online-orders-toolbar .shop-toolbar-actions {
    width: 100%;
  }

  .online-orders-toolbar .shop-toolbar-select-wrap {
    flex: 1;
    min-width: 0;
  }

  .shop-toolbar-select {
    width: 100%;
    min-width: 0;
  }
}

.online-order-id {
  display: inline-block;
  margin-right: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}

.shop-ads-admin-card {
  margin-bottom: 20px;
}

.shop-ads-admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.shop-ads-list-title {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.95rem;
}

.shop-ad-admin-no-img {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--card);
  border-radius: 8px;
  flex-shrink: 0;
}

.shop-ad-admin-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.shop-ad-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}

.shop-ad-action-btn .sab-icon {
  font-size: 1rem;
  line-height: 1;
}

.shop-ad-action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.shop-ad-action-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.shop-ad-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-ad-action-btn.edit {
  border-color: rgba(59, 130, 246, 0.45);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(17, 24, 39, 0.95));
  color: #93c5fd;
}

.shop-ad-action-btn.edit:hover:not(:disabled) {
  border-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(17, 24, 39, 0.95));
}

.shop-ad-action-btn.toggle {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(17, 24, 39, 0.95));
  color: var(--gold);
}

.shop-ad-action-btn.toggle.show {
  border-color: rgba(34, 197, 94, 0.45);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(17, 24, 39, 0.95));
  color: #86efac;
}

.shop-ad-action-btn.toggle:hover:not(:disabled) {
  border-color: var(--primary);
}

.shop-ad-action-btn.delete {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(17, 24, 39, 0.95));
  color: #fca5a5;
}

.shop-ad-action-btn.delete:hover:not(:disabled) {
  border-color: var(--expense);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(17, 24, 39, 0.95));
}

.shop-ad-admin-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(59, 130, 246, 0.04));
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.shop-ad-admin-row:hover {
  border-color: rgba(245, 158, 11, 0.28);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.shop-ad-admin-row.inactive {
  opacity: 0.72;
}

.shop-ad-admin-row.expired-ad {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06), rgba(17, 24, 39, 0.95));
}

.shop-ad-admin-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.shop-ad-admin-info {
  flex: 1;
  min-width: 0;
}

.shop-ad-admin-info p {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.shop-ad-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-ad-link-line {
  word-break: break-all;
}

.shop-ad-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  white-space: nowrap;
}

.shop-ad-status-badge.hidden-ad {
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--text-muted);
}

.shop-ad-status-badge.expired {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
}

.shop-ad-status-badge.soon {
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--gold);
  background: rgba(245, 158, 11, 0.1);
}

.shop-ad-admin-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.shop-ad-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

.shop-ad-date-chip.upload {
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.08);
}

.shop-ad-date-chip.active {
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
  background: rgba(34, 197, 94, 0.08);
}

.shop-ad-date-chip.soon {
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--gold);
  background: rgba(245, 158, 11, 0.08);
}

.shop-ad-date-chip.expired {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}

.shop-ad-date-chip.open {
  border-color: rgba(148, 163, 184, 0.3);
}

.shop-ad-date-chip.sort {
  border-color: rgba(148, 163, 184, 0.25);
}

.shop-ad-admin-meta {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .shop-ad-admin-row {
    flex-direction: column;
  }

  .shop-ad-admin-actions {
    width: 100%;
    justify-content: stretch;
  }

  .shop-ad-action-btn {
    flex: 1;
    min-width: 0;
  }
}

.shop-ad-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

.shop-ad-preview-wrap {
  margin-top: 8px;
}

.shop-ad-preview-img {
  max-width: 200px;
  max-height: 120px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.online-order-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.online-order-card.pending { border-right: 3px solid var(--primary); }
.online-order-card.confirmed { border-right: 3px solid var(--income); }
.online-order-card.with_courier { border-right: 3px solid #3b82f6; }
.online-order-card.delivered { border-right: 3px solid #22c55e; }
.online-order-card.cancelled { opacity: 0.7; }

.online-order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.online-order-phone {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.online-order-items {
  margin-bottom: 6px;
}

.online-order-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.online-order-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.settings-form .form-group {
  margin-bottom: 14px;
}

.users-admin {
  margin-top: 8px;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.user-row .muted {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-right: 8px;
}

.user-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-danger {
  background: rgba(220, 53, 69, 0.15);
  color: #ff6b7a;
  border: 1px solid rgba(220, 53, 69, 0.35);
}

.badge-ok {
  color: #4ade80;
}

.badge-off {
  color: #f87171;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}

.perm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.discounts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .discounts-grid { grid-template-columns: 1fr; }
}

.discounts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.discount-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.discount-card.inactive { opacity: 0.65; }

.discount-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.discount-code {
  font-family: monospace;
  font-size: 1.1rem;
  letter-spacing: 1px;
  margin-left: 8px;
}

.discount-percent {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.discount-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.discount-actions {
  display: flex;
  gap: 8px;
}

.badge-active {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  font-size: 0.75rem;
}

.badge-inactive {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  font-size: 0.75rem;
}

.form-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  cursor: pointer;
}

.discount-usage-highlight {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  margin: 12px 0;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 10px;
}

.usage-big {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  min-width: 48px;
  text-align: center;
}

.usage-bar-wrap {
  margin: 8px 0 12px;
}

.usage-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4ade80);
  border-radius: 999px;
  transition: width 0.3s;
}

.usage-bar-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.edit-stats-box {
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  font-size: 0.9rem;
}

.edit-stats-box p { margin: 4px 0; }

.usage-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.usage-log-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.usage-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.shop-buyers-toolbar {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  width: 100%;
}

#shop_buyers .card-header {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

#shop_buyers .card-header > div:first-child {
  width: 100%;
}

.shop-toolbar-search {
  flex: 1;
  min-width: min(100%, 200px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shop-toolbar-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.shop-toolbar-search-icon {
  font-size: 1rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.shop-toolbar-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.shop-toolbar-input::placeholder {
  color: var(--text-muted);
}

.shop-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.shop-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}

.shop-toolbar-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.shop-toolbar-btn:active {
  transform: scale(0.98);
}

.shop-toolbar-btn.compensate {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(180, 83, 9, 0.1));
  color: var(--gold);
}

.shop-toolbar-btn.compensate:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #b45309);
  color: #0a0f1a;
}

.shop-toolbar-btn.refresh {
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(17, 24, 39, 0.95));
  color: #93c5fd;
}

.shop-toolbar-btn.refresh:hover {
  border-color: rgba(59, 130, 246, 0.55);
  color: #bfdbfe;
}

.shop-toolbar-btn.refresh.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

.shop-toolbar-btn.refresh.is-loading .stb-icon {
  display: inline-block;
  animation: shopToolbarSpin 0.7s linear infinite;
}

@keyframes shopToolbarSpin {
  to { transform: rotate(360deg); }
}

.shop-toolbar-btn .stb-icon {
  font-size: 1.05rem;
  line-height: 1;
}

@media (max-width: 640px) {
  .shop-toolbar-actions {
    width: 100%;
  }

  .shop-toolbar-btn {
    flex: 1;
  }
}

.shop-buyers-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shop-buyer-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--bg-card);
  border-right: 3px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shop-buyer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.shop-buyer-identity {
  flex: 1;
  min-width: 200px;
}

.shop-buyer-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.shop-buyer-code {
  display: inline-block;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-glow);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.copy-ref-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}

.copy-ref-btn:hover {
  border-color: var(--primary);
  color: var(--gold);
}

.copy-ref-btn:active {
  transform: scale(0.94);
}

.shop-buyer-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.shop-buyer-user {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.shop-buyer-kpis {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.shop-buyer-kpi {
  min-width: 88px;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--bg);
}

.shop-buyer-kpi.orders {
  border-color: rgba(59, 130, 246, 0.35);
  background: var(--today-bg);
}

.shop-buyer-kpi.spent {
  border-color: rgba(34, 197, 94, 0.35);
  background: var(--income-bg);
}

.shop-buyer-kpi .kpi-val {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.shop-buyer-kpi .kpi-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.shop-buyer-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.shop-buyer-detail {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.shop-buyer-detail .detail-icon {
  font-size: 1.1rem;
  line-height: 1;
  margin-top: 2px;
}

.shop-buyer-detail .detail-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.shop-buyer-detail .detail-value {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.detail-link {
  color: var(--gold);
  text-decoration: none;
}

.detail-link:hover {
  text-decoration: underline;
}

.shop-buyer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 2px;
}

.shop-buyer-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shop-buyer-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.shop-buyer-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.shop-buyer-action-btn:active {
  transform: scale(0.98);
}

.shop-buyer-action-btn.is-details {
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(17, 24, 39, 0.9));
}

.shop-buyer-action-btn.is-details:hover {
  border-color: rgba(59, 130, 246, 0.55);
}

.shop-buyer-action-btn.is-wallet {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(17, 24, 39, 0.9));
}

.shop-buyer-action-btn.is-wallet:hover {
  border-color: rgba(245, 158, 11, 0.65);
}

.shop-buyer-action-btn .sba-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.shop-buyer-action-btn.is-details .sba-icon {
  background: rgba(59, 130, 246, 0.15);
}

.shop-buyer-action-btn.is-wallet .sba-icon {
  background: rgba(245, 158, 11, 0.15);
}

.shop-buyer-action-btn .sba-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-buyer-action-btn .sba-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.shop-buyer-action-btn .sba-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-buyer-action-btn.is-wallet .sba-sub {
  color: var(--gold);
  font-weight: 600;
}

.shop-buyer-action-btn .sba-arrow {
  font-size: 1.1rem;
  color: var(--text-muted);
  opacity: 0.7;
  flex-shrink: 0;
  transform: rotate(180deg);
  transition: transform 0.2s, opacity 0.2s;
}

.shop-buyer-action-btn:hover .sba-arrow {
  opacity: 1;
  transform: rotate(180deg) translateX(3px);
}

@media (max-width: 520px) {
  .shop-buyer-action-bar {
    grid-template-columns: 1fr;
  }
}

.shop-buyer-kpi.wallet {
  border-color: rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.08);
}

.buyer-wallet-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.buyer-wallet-summary {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.wallet-balance-big {
  margin: 4px 0;
  color: var(--gold);
  font-size: 1.8rem;
}

.buyer-wallet-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}

.wallet-action-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.wallet-tab:has(input:checked) {
  border-color: var(--primary);
  background: rgba(212, 175, 55, 0.12);
}

.wallet-tx-title {
  margin: 4px 0 0;
  font-size: 1rem;
}

.wallet-tx-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.wallet-tx-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.wallet-tx-row.credit { border-right: 3px solid var(--income); }
.wallet-tx-row.debit { border-right: 3px solid var(--expense); }

.wallet-tx-side {
  text-align: left;
  flex-shrink: 0;
}

.wallet-tx-amt {
  display: block;
  font-weight: 700;
}

.return-policy-row small.muted {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
}

.inv-return-tag {
  color: var(--gold);
}

.shop-buyer-footer .muted {
  color: var(--text-muted);
  opacity: 0.85;
}

.modal-wide {
  max-width: 640px;
}

.buyer-orders-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 65vh;
  overflow-y: auto;
}

.buyer-order-entry {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border-right: 3px solid var(--primary);
}

.buyer-order-entry.confirmed { border-right-color: var(--income); }
.buyer-order-entry.with_courier { border-right-color: #3b82f6; }
.buyer-order-entry.delivered { border-right-color: #22c55e; }
.buyer-order-entry.cancelled { opacity: 0.75; border-right-color: var(--expense); }

.buyer-order-entry-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.buyer-order-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  color: var(--text);
}

.buyer-order-date {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.buyer-order-status {
  margin-right: auto;
  font-size: 0.82rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.buyer-order-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.buyer-order-item-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 0.88rem;
}

.buyer-order-item-row .item-name {
  color: var(--text);
}

.buyer-order-item-row .item-qty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.buyer-order-item-row .item-price {
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}

.buyer-order-discount {
  font-size: 0.82rem;
  color: var(--income);
  margin-bottom: 6px;
}

.buyer-order-total {
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.buyer-order-total strong {
  color: var(--text);
}

/* سندات الصرف */
.voucher-list, .debt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voucher-row, .debt-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.voucher-no {
  color: var(--gold);
  margin-left: 8px;
}

.voucher-amount {
  font-weight: 600;
}

.voucher-meta, .voucher-desc, .debt-meta, .debt-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.account-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.account-tag {
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.85rem;
}

.account-balance-tag {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  padding: 10px 14px;
  min-width: 132px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(17, 24, 39, 0.95));
  border-color: rgba(245, 158, 11, 0.25);
}

.account-balance-tag strong {
  color: var(--gold);
  font-size: 0.95rem;
}

.accounts-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  padding-top: 4px;
}

.account-add-field {
  flex: 1;
  min-width: min(100%, 180px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.account-add-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.account-add-field.type {
  flex: 0 1 170px;
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(17, 24, 39, 0.95));
}

.account-add-field.type:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.account-add-icon {
  font-size: 1rem;
  opacity: 0.8;
  flex-shrink: 0;
}

.account-add-input,
.account-add-select {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.account-add-input::placeholder {
  color: var(--text-muted);
}

.account-add-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-weight: 600;
  padding: 10px 22px 10px 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 2px center;
}

.account-add-select option {
  background: var(--bg-card);
  color: var(--text);
}

.account-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid rgba(34, 197, 94, 0.4);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(17, 24, 39, 0.95));
  color: #86efac;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}

.account-add-btn:hover {
  transform: translateY(-1px);
  border-color: var(--income);
  background: linear-gradient(135deg, var(--income), #16a34a);
  color: #0a0f1a;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.25);
}

.account-add-btn:active {
  transform: scale(0.98);
}

.account-add-btn-icon {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 640px) {
  .account-add-form {
    flex-direction: column;
  }

  .account-add-field.type {
    flex: 1;
    width: 100%;
  }

  .account-add-btn {
    width: 100%;
  }
}

.debt-dir-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.debt-dir-btn {
  padding: 10px 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.debt-dir-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #111;
  font-weight: 600;
}

.debt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.debt-amounts {
  margin-top: 6px;
  font-size: 0.9rem;
}

.debt-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.debt-payments {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.hidden {
  display: none !important;
}

.voucher-dir-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.voucher-tab-btn {
  padding: 10px 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.voucher-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #111;
  font-weight: 600;
}

.receipt-no {
  color: var(--income);
}

.sale-hist-credit {
  font-size: 0.78rem;
  color: var(--gold);
  margin-right: 6px;
}

.sale-collect-toggle {
  flex-wrap: wrap;
}

#sales .sale-option-group {
  display: grid;
  gap: 10px;
}

#sales .sale-option-group.payment {
  grid-template-columns: 1fr 1fr;
}

#sales .sale-option-group.collect {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#sales .sale-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  min-height: 54px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}

#sales .sale-option-btn:hover:not(:disabled):not(.is-disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  border-color: rgba(245, 158, 11, 0.35);
}

#sales .sale-option-btn:active:not(:disabled):not(.is-disabled) {
  transform: scale(0.98);
}

#sales .sale-option-btn .sob-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

#sales .sale-option-btn .sob-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#sales .sale-option-btn .sob-text strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

#sales .sale-option-btn .sob-text small {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

#sales .sale-pay-btn.active[data-sale-pay="IQD"] {
  border-color: rgba(59, 130, 246, 0.55);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(17, 24, 39, 0.95));
  color: #93c5fd;
}

#sales .sale-pay-btn.active[data-sale-pay="IQD"] .sob-icon {
  background: rgba(59, 130, 246, 0.2);
}

#sales .sale-pay-btn.active[data-sale-pay="foreign"] {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(17, 24, 39, 0.95));
  color: var(--gold);
}

#sales .sale-pay-btn.active[data-sale-pay="foreign"] .sob-icon {
  background: rgba(245, 158, 11, 0.18);
}

#sales .sale-collect-btn.active[data-sale-collect="cash"] {
  border-color: rgba(34, 197, 94, 0.55);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.16), rgba(17, 24, 39, 0.95));
  color: #86efac;
}

#sales .sale-collect-btn.active[data-sale-collect="cash"] .sob-icon {
  background: rgba(34, 197, 94, 0.18);
}

#sales .sale-collect-btn.active[data-sale-collect="partial"] {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(17, 24, 39, 0.95));
  color: var(--gold);
}

#sales .sale-collect-btn.active[data-sale-collect="partial"] .sob-icon {
  background: rgba(245, 158, 11, 0.16);
}

#sales .sale-collect-btn.active[data-sale-collect="credit"] {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(17, 24, 39, 0.95));
  color: #fca5a5;
}

#sales .sale-collect-btn.active[data-sale-collect="credit"] .sob-icon {
  background: rgba(239, 68, 68, 0.15);
}

#sales .sale-option-btn.is-disabled,
#sales .sale-option-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 640px) {
  #sales .sale-option-group.collect {
    grid-template-columns: 1fr;
  }
}

.profit-snap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.profit-snap-table th,
.profit-snap-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.input-readonly {
  opacity: 0.85;
  cursor: default;
  background: var(--bg);
}

.debt-reminder-banner {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(239, 68, 68, 0.08));
}

.debt-reminder-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.debt-reminder-list {
  margin: 8px 0 0;
  padding-right: 18px;
  color: var(--text);
}

.debt-reminder-list li {
  margin-bottom: 4px;
}

.debt-reminder-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--gold);
}

.field-hint {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.custom-cat-add-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.custom-cat-add-row input {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.custom-cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.custom-cat-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}

.custom-cat-tag button:hover {
  color: var(--expense);
}

.inv-custom-cat-card {
  margin-top: 16px;
}

.online-order-payment-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.online-order-collect {
  font-size: 1.15rem;
  color: var(--gold);
}

.online-order-delivery-pay {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.online-order-card-hint {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.shop-payment-settings-card {
  margin-bottom: 16px;
}

.shop-link-banner {
  margin-bottom: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.shop-link-banner h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.shop-link-banner p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.shop-link-banner a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}

.shop-link-banner a:hover {
  text-decoration: underline;
}

.shop-link-sidebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.04));
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}

.shop-link-sidebar:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.shop-link-icon {
  font-size: 1.25rem;
}

.shop-link-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.shop-link-text strong {
  font-size: 0.88rem;
  color: var(--gold);
}

.shop-link-text small {
  font-size: 0.72rem;
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
}

.shop-link-arrow {
  font-size: 0.9rem;
  color: var(--text-muted);
}
