@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap");

:root {
  --brand-blue: #003882;
  --brand-blue-2: #0056b3;
  --brand-orange: #ff8c00;
  --brand-orange-2: #ff6a00;
  --brand-green: #198754;
  --brand-green-2: #146c43;
  --brand-red: #dc3545;
  --ink: #1a1a2e;
  --muted: #666;
  --bg: #f8f9fc;
  --card: #ffffff;
  --border: #e5e9f0;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: "Cairo", "Segoe UI", sans-serif;
  direction: rtl;
  background: var(--bg);
  color: #222;
}

button,
input,
select,
textarea {
  font-family: "Cairo", sans-serif;
}

.app-shell {
  min-height: 100vh;
  background: var(--bg);
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-2));
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-2));
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: #fff;
}

.btn-warning {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-2));
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: #555;
}

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

.btn-md {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-flat {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
}

.card-accent {
  border-right: 4px solid var(--brand-orange);
}

.input {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border 0.2s;
  direction: rtl;
}

.input:focus {
  border-color: var(--brand-orange);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #777;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--brand-orange);
  border-bottom-color: var(--brand-orange);
}

.tab-btn:hover {
  color: var(--brand-orange);
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

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

.scroll-list {
  overflow-y: auto;
}

.scroll-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scroll-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.scroll-list::-webkit-scrollbar-thumb {
  background: var(--brand-orange);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-2));
  color: #fff;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13px;
  text-align: right;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
  color: #333;
}

tr:hover td {
  background: #fff8f0;
}

select {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  background: #fff;
  cursor: pointer;
  direction: rtl;
}

select:focus {
  border-color: var(--brand-orange);
}

.low-stock {
  background: #fff3cd;
  color: #856404;
}

.out-stock {
  background: #f8d7da;
  color: #842029;
}

.good-stock {
  background: #d1e7dd;
  color: #0f5132;
}

.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.topbar {
  background: #fff;
  padding: 0 24px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  height: 50px;
  object-fit: contain;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--brand-blue);
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--brand-orange);
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-divider {
  width: 1px;
  height: 30px;
  background: #eee;
  margin: 0 10px;
}

/* Nav button variants */
.nav-btn {
  padding: 8px 16px;
  font-size: 14px;
  background: transparent;
  color: #555;
  border-radius: 10px;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: #f0f0f0;
}

.nav-btn-active-green {
  background: #f0fff4;
  color: #198754;
}

.nav-btn-active-orange {
  background: #fff0e0;
  color: #ff8c00;
}

.nav-btn-active-blue {
  background: #e0efff;
  color: #003882;
}

[data-theme="dark"] .nav-btn {
  color: #bbb;
}

[data-theme="dark"] .nav-btn:hover {
  background: #252636;
}

[data-theme="dark"] .nav-btn-active-green {
  background: #1a2e22;
  color: #2ecc71;
}

[data-theme="dark"] .nav-btn-active-orange {
  background: #2e2a1a;
  color: #ffa940;
}

[data-theme="dark"] .nav-btn-active-blue {
  background: #1e2a3a;
  color: #4a9eff;
}

.notification {
  position: fixed;
  top: 90px;
  left: 24px;
  z-index: 9999;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.3s ease;
}

.toast {
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  pointer-events: none;
}

.toast-success {}
.toast-error {}
.toast-warning {}
.toast-info {}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-2) 100%);
  padding: 20px;
}

.login-card {
  padding: 40px 30px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
  background: #fff;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.login-logo img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.error-box {
  background: #fff0f0;
  color: var(--brand-red);
  border: 1px solid #f8d7da;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 700;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

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

.cta {
  width: 100%;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-2));
  color: #fff;
  padding: 12px;
  font-size: 15px;
}

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

.modal-card {
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--brand-blue);
  color: #fff;
  border-radius: 16px 16px 0 0;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  text-align: left;
}

.receipt-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.pill {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.alert-good {
  background: #f0fff4;
  color: var(--brand-green);
}

.alert-warn {
  background: #fff3cd;
  color: #856404;
}

.alert-bad {
  background: #fff0f0;
  color: #842029;
}

.hidden {
  display: none;
}

.hide-money .amt {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}
.hide-money canvas[data-fair-chart],
.hide-money canvas[data-dashboard-chart] {
  filter: blur(8px);
  pointer-events: none;
}

.flex {
  display: flex;
  align-items: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  display: flex;
  flex-wrap: wrap;
}

.gap-6 {
  gap: 6px;
}

.gap-8 {
  gap: 8px;
}

.gap-10 {
  gap: 10px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: #888;
}

.text-strong {
  font-weight: 800;
}

.shadow-soft {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.bg-white {
  background: #fff;
}

.pill-blue {
  background: #e0efff;
  color: var(--brand-blue);
}

.pill-orange {
  background: #fff8f0;
  color: var(--brand-orange);
}

.pill-green {
  background: #d1e7dd;
  color: #0f5132;
}

.pill-red {
  background: #f8d7da;
  color: #842029;
}

.input-icon {
  position: relative;
}

.input-icon span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
}

.input-icon input {
  padding-right: 40px;
}

.pos-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

.sticky-top {
  position: sticky;
  top: 90px;
}

.table-wrap {
  overflow-x: auto;
}

.section-title {
  font-weight: 900;
  font-size: 26px;
}

.sub-title {
  font-size: 14px;
  color: #777;
}

.clickable {
  cursor: pointer;
}

/* Form improvements */
label {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  display: block;
  margin-bottom: 4px;
}

input, select, textarea {
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.1);
}

/* Fieldset spacing */
.form-section {
  margin-bottom: 16px;
}

/* Inline form group */
.form-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

/* Responsive table wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Truncate text */
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Badge variants */
.badge-blue {
  background: #e0efff;
  color: var(--brand-blue);
}

.badge-orange {
  background: #fff3cd;
  color: #856404;
}

.badge-green {
  background: #d1e7dd;
  color: #0f5132;
}

.badge-red {
  background: #f8d7da;
  color: #842029;
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
}

.status-dot-green { background: #198754; }
.status-dot-orange { background: #ff8c00; }
.status-dot-red { background: #dc3545; }
.status-dot-gray { background: #aaa; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Scrollable container */
.scroll-y {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.max-h-200 { max-height: 200px; }
.max-h-300 { max-height: 300px; }

/* Gap utilities */
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

/* Width utilities */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Flex shorthand */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

/* Margin utilities */
.m-0 { margin: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

/* Padding utilities */
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

/* Font weight */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

/* Font size */
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }

/* Border radius */
.rounded-4 { border-radius: 4px; }
.rounded-6 { border-radius: 6px; }
.rounded-8 { border-radius: 8px; }
.rounded-12 { border-radius: 12px; }
.rounded-16 { border-radius: 16px; }
.rounded-circle { border-radius: 50%; }

/* Colors */
.c-brand { color: var(--brand-blue); }
.c-orange { color: var(--brand-orange); }
.c-green { color: var(--brand-green); }
.c-red { color: var(--brand-red); }
.c-muted { color: #888; }
.c-white { color: #fff; }

/* Backgrounds */
.bg-brand { background: var(--brand-blue); }
.bg-orange { background: var(--brand-orange); }
.bg-green { background: var(--brand-green); }
.bg-red { background: var(--brand-red); }
.bg-muted { background: #f8f9fc; }
.bg-white { background: #fff; }
.bg-transparent { background: transparent; }

/* Border */
.border { border: 1px solid var(--border); }
.border-0 { border: none; }
.border-bottom { border-bottom: 1px solid var(--border); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; top: 0; }

/* Z-index */
.z-1 { z-index: 1; }
.z-10 { z-index: 10; }
.z-100 { z-index: 100; }

/* Animation */
.transition { transition: all 0.2s; }

/* Hover lift */
.hover-lift {
  transition: transform 0.2s, box-shadow 0.2s;
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Shadow */
.shadow-sm { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.shadow-md { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 8px 32px rgba(0,0,0,0.15); }

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

  .sticky-top {
    position: static;
  }
}

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

  .topbar-inner {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
  }

  .nav-divider {
    display: none;
  }
}

[data-theme="dark"] {
  --brand-blue: #4a9eff;
  --brand-blue-2: #6db3ff;
  --brand-orange: #ffa940;
  --brand-orange-2: #ff8c00;
  --brand-green: #2ecc71;
  --brand-green-2: #27ae60;
  --brand-red: #e74c3c;
  --ink: #e4e4e7;
  --muted: #a1a1aa;
  --bg: #0f1117;
  --card: #1a1b26;
  --border: #2d2e3a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] body {
  background: var(--bg);
  color: #e4e4e7;
}

[data-theme="dark"] .topbar {
  background: #1a1b26;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .nav-actions button {
  color: #ccc !important;
}

[data-theme="dark"] .input {
  background: #2d2e3a;
  color: #f0f0f0;
  border-color: #3d3e4a;
}

[data-theme="dark"] .card {
  background: var(--card);
}

[data-theme="dark"] td {
  color: #e0e0e0;
  border-bottom-color: #2d2e3a;
}

[data-theme="dark"] th {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-2));
}

[data-theme="dark"] .login-screen {
  background: linear-gradient(135deg, #0f1117 0%, #1a1b26 100%);
}

[data-theme="dark"] .login-card {
  background: #1a1b26;
}

[data-theme="dark"] tr:hover td {
  background: #252636;
}

[data-theme="dark"] .brand-title {
  color: #4a9eff;
}

[data-theme="dark"] .brand-sub {
  color: var(--brand-orange);
}

[data-theme="dark"] .notification {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] select {
  background: #2d2e3a;
  color: #f0f0f0;
  border-color: #3d3e4a;
}

[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .modal-card {
  background: #1a1b26;
}

[data-theme="dark"] .modal-header {
  background: #2d2e3a;
}

[data-theme="dark"] .receipt-card {
  background: #1a1b26;
}

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3, [data-theme="dark"] h4 {
  color: #f0f0f0 !important;
}

[data-theme="dark"] .section-title {
  color: var(--brand-orange) !important;
}

[data-theme="dark"] .sub-title {
  color: #bbb !important;
}

[data-theme="dark"] .login-card h2 {
  color: var(--brand-blue) !important;
}

[data-theme="dark"] .login-card p {
  color: #bbb !important;
}

[data-theme="dark"] .table-wrap td {
  color: #e0e0e0;
}

[data-theme="dark"] .tab-btn {
  color: #999;
}

[data-theme="dark"] .tab-btn.active {
  color: var(--brand-orange);
  border-bottom-color: var(--brand-orange);
}

[data-theme="dark"] .topbar .btn {
  color: #ccc !important;
}

[data-theme="dark"] .login-card .input-icon input {
  background: #2d2e3a !important;
  color: #f0f0f0 !important;
}

[data-theme="dark"] input[type="date"] {
  color-scheme: dark;
}

[data-theme="dark"] .scroll-list::-webkit-scrollbar-track {
  background: #1a1b26;
}

[data-theme="dark"] .login-card label {
  color: #ccc !important;
}

[data-theme="dark"] [style*="color:#888"] { color: #ccc !important; }
[data-theme="dark"] [style*="color: #888"] { color: #ccc !important; }
[data-theme="dark"] [style*="color:#666"] { color: #bbb !important; }
[data-theme="dark"] [style*="color: #666"] { color: #bbb !important; }
[data-theme="dark"] [style*="color:#aaa"] { color: #ddd !important; }
[data-theme="dark"] [style*="color: #aaa"] { color: #ddd !important; }
[data-theme="dark"] [style*="color:#555"] { color: #ddd !important; }
[data-theme="dark"] [style*="color: #555"] { color: #ddd !important; }
[data-theme="dark"] [style*="color:#777"] { color: #bbb !important; }
[data-theme="dark"] [style*="color: #777"] { color: #bbb !important; }
[data-theme="dark"] [style*="color:#444"] { color: #ccc !important; }
[data-theme="dark"] [style*="color: #444"] { color: #ccc !important; }
[data-theme="dark"] [style*="color:#333"] { color: #e0e0e0 !important; }
[data-theme="dark"] [style*="color: #333"] { color: #e0e0e0 !important; }

[data-theme="dark"] [style*="background:white"] { background: #1a1b26 !important; }
[data-theme="dark"] [style*="background: white"] { background: #1a1b26 !important; }
[data-theme="dark"] [style*="background:#fff"] { background: #1a1b26 !important; }
[data-theme="dark"] [style*="background: #fff"] { background: #1a1b26 !important; }
[data-theme="dark"] [style*="background:#f8f9fc"] { background: #252636 !important; }
[data-theme="dark"] [style*="background: #f8f9fc"] { background: #252636 !important; }
[data-theme="dark"] [style*="background:#f0f0f0"] { background: #252636 !important; }
[data-theme="dark"] [style*="background: #f0f0f0"] { background: #252636 !important; }
[data-theme="dark"] [style*="background:#fff8f0"] { background: #252636 !important; }
[data-theme="dark"] [style*="background: #fff8f0"] { background: #252636 !important; }
[data-theme="dark"] [style*="background:#e0efff"] { background: #1e2a3a !important; }
[data-theme="dark"] [style*="background: #e0efff"] { background: #1e2a3a !important; }
[data-theme="dark"] [style*="background:#f0fff4"] { background: #1a2e22 !important; }
[data-theme="dark"] [style*="background: #f0fff4"] { background: #1a2e22 !important; }
[data-theme="dark"] [style*="background:#f8f0ff"] { background: #2a1e3a !important; }
[data-theme="dark"] [style*="background: #f8f0ff"] { background: #2a1e3a !important; }
[data-theme="dark"] [style*="background:#f0fbff"] { background: #1a2a3a !important; }
[data-theme="dark"] [style*="background: #f0fbff"] { background: #1a2a3a !important; }
[data-theme="dark"] [style*="background:#fff0f0"] { background: #2e1a1a !important; }
[data-theme="dark"] [style*="background: #fff0f0"] { background: #2e1a1a !important; }
[data-theme="dark"] [style*="background:#fff3cd"] { background: #2e2a1a !important; }
[data-theme="dark"] [style*="background: #fff3cd"] { background: #2e2a1a !important; }
[data-theme="dark"] [style*="background:#d1e7dd"] { background: #1a2e22 !important; }
[data-theme="dark"] [style*="background: #d1e7dd"] { background: #1a2e22 !important; }
[data-theme="dark"] [style*="background:#f8d7da"] { background: #2e1a1a !important; }
[data-theme="dark"] [style*="background: #f8d7da"] { background: #2e1a1a !important; }
[data-theme="dark"] [style*="background:linear-gradient(135deg, #fff8f0, #fff)"] { background: linear-gradient(135deg, #252636, #1a1b26) !important; }
[data-theme="dark"] [style*="border:2px solid #00388230"] { border-color: #4a9eff30 !important; }
[data-theme="dark"] [style*="border:2px solid #ff8c0030"] { border-color: #ffa94030 !important; }
[data-theme="dark"] [style*="border-right:5px solid #ff8c00"] { border-right-color: var(--brand-orange) !important; }

[data-theme="dark"] .hide-money .amt {
  filter: blur(6px);
}
[data-theme="dark"] .hide-money canvas[data-fair-chart],
[data-theme="dark"] .hide-money canvas[data-dashboard-chart] {
  filter: blur(8px);
}

@media (max-width: 700px) {
  .brand-title {
    font-size: 16px;
  }

  .section-title {
    font-size: 22px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

/* Warehouse Module Styles */
.warehouse-dashboard {
  padding: 20px;
}

.warehouse-dashboard h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: var(--ink);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 30px;
}

.quick-actions .btn {
  padding: 12px;
  font-size: 14px;
  white-space: nowrap;
}

.alerts-section, .valuation-section, .reports-container {
  background: var(--card);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.alerts-section h3, .valuation-section h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: var(--ink);
}

.alert-row {
  background-color: #fff3cd;
}

[data-theme="dark"] .alert-row {
  background-color: #2e2a1a;
}

.low-stock-row {
  background-color: #f8d7da;
}

[data-theme="dark"] .low-stock-row {
  background-color: #2e1a1a;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-danger {
  background-color: var(--brand-red);
  color: white;
}

.badge-success {
  background-color: var(--brand-green);
  color: white;
}

.stock-view, .receive-form, .allocate-form, .return-form, .transfer-form, .movement-log, .reports-view {
  padding: 20px;
}

.stock-view h2, .receive-form h2, .allocate-form h2, .return-form h2, .transfer-form h2, .movement-log h2, .reports-view h2 {
  font-size: 24px;
  margin-bottom: 15px;
  color: var(--ink);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--ink);
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 56, 130, 0.1);
}

[data-theme="dark"] .form-control {
  background-color: #2d2e3a;
  border-color: #444;
  color: #f0f0f0;
}

[data-theme="dark"] label {
  color: #ccc !important;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #2d2e3a;
  color: #f0f0f0;
  border-color: #3d3e4a;
}

[data-theme="dark"] .card-flat {
  border-color: #2d2e3a;
}

[data-theme="dark"] .c-muted {
  color: #bbb;
}

[data-theme="dark"] .bg-muted {
  background: #252636;
}

[data-theme="dark"] .divider {
  background: #2d2e3a;
}

[data-theme="dark"] .border {
  border-color: #2d2e3a;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.table th {
  background-color: var(--bg);
  padding: 12px;
  text-align: right;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--border);
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.table tr:hover {
  background-color: rgba(0, 56, 130, 0.05);
}

[data-theme="dark"] .table th {
  background-color: #2d2e3a;
  color: #e0e0e0;
}

[data-theme="dark"] .table tr:hover {
  background-color: rgba(74, 158, 255, 0.1);
}

.table-striped tbody tr:nth-child(odd) {
  background-color: #f8f9fc;
}

[data-theme="dark"] .table-striped tbody tr:nth-child(odd) {
  background-color: #252636;
}

.allocation-row, .return-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.allocation-row select, .allocation-row input,
.return-row select, .return-row input {
  flex: 1;
  max-width: 200px;
}

.report-card {
  background: var(--card);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.report-card h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: var(--ink);
}

.reports-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 998;
  animation: fadeIn 0.2s ease;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #fff;
  z-index: 999;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  animation: slideIn 0.25s ease;
  display: flex;
  flex-direction: column;
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
  background: var(--brand-blue);
  color: #fff;
}

.sidebar-header .brand-title {
  color: #fff;
  font-size: 16px;
}

.sidebar-header .btn {
  color: rgba(255,255,255,0.8);
  font-size: 20px;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-item {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  color: #333;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-item:hover {
  background: #f0f4ff;
  color: var(--brand-blue);
}

.sidebar-item.active {
  background: #e8f0fe;
  color: var(--brand-blue);
  border-left: 3px solid var(--brand-blue);
}

.sidebar-item-danger {
  color: #dc3545;
}

.sidebar-item-danger:hover {
  background: #fff0f0;
  color: #dc3545;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #eee;
  font-size: 13px;
  color: #888;
}

[data-theme="dark"] .sidebar {
  background: #1a1b26;
}

[data-theme="dark"] .sidebar-item {
  color: #e0e0e0;
}

[data-theme="dark"] .sidebar-item:hover {
  background: #252636;
  color: #4a9eff;
}

[data-theme="dark"] .sidebar-item.active {
  background: #1e2a3a;
  color: #4a9eff;
  border-left-color: #4a9eff;
}

[data-theme="dark"] .sidebar-header {
  background: #2d2e3a;
  border-bottom-color: #2d2e3a;
}

[data-theme="dark"] .sidebar-footer {
  border-top-color: #2d2e3a;
  color: #aaa;
}

/* === MOBILE (≤ 600px) === */
@media (max-width: 600px) {
  .topbar { padding: 0 12px; }
  .topbar-inner { height: auto; padding: 8px 0; gap: 6px; }
  .brand img { height: 36px; }
  .brand-title { font-size: 14px; }
  .brand-sub { font-size: 10px; }
  .nav-actions { gap: 4px; }
  .nav-btn { padding: 6px 8px; font-size: 12px; min-height: 40px; }
  .nav-label { display: none; }
  .nav-divider { display: none; }
  .page-wrap { padding: 12px 8px !important; }

  .section-title { font-size: 18px !important; }
  .sub-title { font-size: 12px !important; }

  .card { border-radius: 12px; }
  .card > div[style*="padding"] { padding: 12px !important; }

  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { gap: 12px; }
  .form-row { grid-template-columns: 1fr; }

  table { font-size: 11px; }
  table th, table td { padding: 6px 4px; }
  .table-wrap { max-height: none !important; }
  .table-responsive { font-size: 11px; }
  .table-responsive td, .table-responsive th { padding: 6px 4px; }

  .sidebar { width: 100vw; }
  .sidebar-header { padding: 14px 16px; }
  .sidebar-body { padding: 4px 0; }
  .sidebar-item { padding: 12px 16px; font-size: 13px; }
  .sidebar-footer { padding: 12px 16px; font-size: 12px; }

  .modal { padding: 8px; align-items: flex-end; }
  .modal-card { max-width: 100%; max-height: 85vh; border-radius: 16px 16px 0 0; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 12px 16px; }
  .modal-footer { padding: 12px 16px; }

  .pos-grid { grid-template-columns: 1fr; }
  .sticky-top { position: static; }

  .login-card { padding: 24px 16px; }
  .login-logo { width: 80px; height: 80px; }

  .quick-actions { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
  .quick-actions .btn { padding: 10px; font-size: 12px; min-height: 44px; }

  .btn, button { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .btn-md { min-height: 44px; }
  .btn-lg { min-height: 48px; }

  .reports-container { grid-template-columns: 1fr; }

  .flex-between.flex-wrap { gap: 8px; }
  .flex.gap-12 { gap: 6px; }
  .flex.gap-10 { gap: 6px; }
  .flex.gap-8 { gap: 4px; }

  input, select, textarea { font-size: 14px; padding: 10px; }

  .toast { max-width: 90vw; left: 5vw; font-size: 13px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
  table { font-size: 10px; }
  table th, table td { padding: 4px 2px; }
  .quick-actions { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
  .quick-actions .btn { font-size: 11px; padding: 8px; }
  .brand-title { font-size: 12px; }
}
