:root {
  --gold: #D68C36;
  --gold-light: #e4a654;
  --gold-dark: #b8741f;
  --teal: #113239;
  --teal-light: #1a4a54;
  --cream: #FFF8F0;
  --cream-dark: #F5EDE0;
  --white: #FFFFFF;
  --text-dark: #2D2D2D;
  --text-muted: #6B6B6B;
  --green: #2e7d32;
  --green-bg: #e8f5e9;
  --red: #c62828;
  --red-bg: #ffebee;
  --blue: #1565c0;
  --blue-bg: #e3f2fd;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(17, 50, 57, 0.06);
  --shadow-md: 0 4px 20px rgba(17, 50, 57, 0.08);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'Cairo', sans-serif;
  background-color: var(--cream);
  color: var(--text-dark);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HEADER ===== */
.header {
  background: var(--teal);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

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

.header__title {
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 800;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header__count {
  color: var(--gold);
  font-weight: 700;
  font-size: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
}

/* ===== STATS ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 28px 0;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-right: 4px solid var(--gold);
}

.stat-card--confirmed {
  border-right-color: var(--blue);
}

.stat-card--completed {
  border-right-color: var(--green);
}

.stat-card--cancelled {
  border-right-color: var(--red);
}

.stat-card__number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--teal);
}

.stat-card__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== FILTERS ===== */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 22px;
  border: 2px solid var(--cream-dark);
  background: var(--white);
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.filter-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--white);
}

/* ===== TABLE ===== */
.table-wrapper {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
  margin-bottom: 40px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table thead {
  background: var(--teal);
  color: var(--white);
}

.table th {
  padding: 14px 16px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--cream-dark);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--cream);
}

.table__empty {
  text-align: center;
  padding: 48px 16px !important;
  color: var(--text-muted);
  font-size: 1rem;
}

.table__error {
  color: var(--red);
}

.cell--product {
  font-weight: 700;
  color: var(--teal);
  max-width: 180px;
}

.cell--notes {
  max-width: 160px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

/* ===== STATUS SELECT ===== */
.status-select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--cream-dark);
  font-family: 'Cairo', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  direction: rtl;
  background: var(--cream);
  color: var(--text-dark);
}

.status-select:focus {
  outline: none;
  border-color: var(--gold);
}

.status--new {
  background: #fff8e1;
  border-color: #ffc107;
  color: #f57f17;
}

.status--confirmed {
  background: var(--blue-bg);
  border-color: #64b5f6;
  color: var(--blue);
}

.status--completed {
  background: var(--green-bg);
  border-color: #81c784;
  color: var(--green);
}

.status--cancelled {
  background: var(--red-bg);
  border-color: #ef9a9a;
  color: var(--red);
}

/* ===== ITEMS CELL ===== */
.cell--items {
  min-width: 180px;
  max-width: 260px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 0.85rem;
  border-bottom: 1px dashed var(--cream-dark);
}

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

.item-qty {
  background: var(--cream-dark);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
}

.item-price {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-right: auto;
  white-space: nowrap;
}

.cell--total {
  font-weight: 800;
  color: var(--teal);
  white-space: nowrap;
}

/* ===== PAYMENT BADGE ===== */
.payment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.payment-badge svg {
  display: block;
}

.payment-badge--cash {
  background: var(--green-bg);
  color: var(--green);
}

.payment-badge--card {
  background: var(--blue-bg);
  color: var(--blue);
}

/* Row tinting */
.row--cancelled {
  opacity: 0.55;
}

/* ===== LOGIN ===== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

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

.login-card__icon {
  width: 56px;
  height: 56px;
  background: var(--teal);
  color: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-card__title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--teal);
  margin-bottom: 4px;
}

.login-card__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-card .form-group {
  text-align: right;
  margin-bottom: 16px;
}

.login-card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  transition: border-color var(--transition);
  direction: ltr;
  text-align: right;
}

.login-card input:focus {
  outline: none;
  border-color: var(--gold);
}

.login-card .btn {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  font-size: 1rem;
}

.login-error {
  background: var(--red-bg);
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: none;
}

.login-error.show {
  display: block;
}

/* ===== LOGOUT BUTTON ===== */
.btn--logout {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.3);
  color: var(--white);
  padding: 8px 18px;
  font-size: 0.8rem;
}

.btn--logout:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
  transform: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .header__title {
    font-size: 1.2rem;
  }

  .table {
    font-size: 0.8rem;
  }

  .table th,
  .table td {
    padding: 10px 10px;
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card__number {
    font-size: 1.5rem;
  }

  .container {
    padding: 0 12px;
  }
}
