* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

:root {
  --bg-1: #040816;
  --bg-2: #091326;
  --bg-3: #0d1b38;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --blue: #60a5fa;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

body {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.22), transparent 22%),
    radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.10), transparent 22%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3) 100%);
  color: var(--text);
  min-height: 100vh;
}

/* LOGIN */
.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.35), transparent 28%),
    radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.18), transparent 28%),
    linear-gradient(135deg, #020617, #0f172a, #172554);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box-modern {
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.97);
  color: #1e293b;
  border-radius: 26px;
  padding: 36px 28px;
  box-shadow: 0 25px 80px rgba(255,255,255,0.18);
}

.receipt-logo-wrap {
  text-align: center;
  margin-bottom: 12px;
}

.receipt-logo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid #2563eb;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  background: #fff;
}

.login-box-modern h1 {
  text-align: center;
  font-size: 28px;
  color: #4b6488;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-box-modern h2 {
  text-align: center;
  color: #2563eb;
  margin-bottom: 20px;
  font-size: 18px;
}

.login-box-modern label {
  display: block;
  margin-bottom: 8px;
  margin-top: 10px;
  font-weight: 600;
  color: #475569;
}

.login-box-modern input {
  width: 100%;
  padding: 14px;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 15px;
  outline: none;
}

.modern-login-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

.login-error {
  text-align: center;
  color: #dc2626;
  font-weight: 700;
  margin-bottom: 10px;
  min-height: 20px;
}

.login-help {
  margin-top: 16px;
  text-align: center;
  color: #475569;
  line-height: 1.6;
}

/* SIDEBAR */
.sidebar {
  width: 230px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: linear-gradient(180deg, rgba(4,11,24,0.96), rgba(11,23,49,0.96));
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
}

.brand h2 {
  font-size: 20px;
  color: #e2e8f0;
}

.brand p {
  font-size: 12px;
  color: #8aa0c4;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-links a {
  position: relative;
  display: block;
  width: 100%;
  color: #b8c4db;
  text-decoration: none;
  padding: 12px 14px 12px 18px;
  border-radius: 12px;
  transition: 0.18s ease;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.nav-links a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 4px;
  height: calc(100% - 18px);
  border-radius: 999px;
  background: transparent;
}

.nav-links a:hover {
  background: rgba(59, 130, 246, 0.10);
  color: #ffffff;
}

.nav-links a.active {
  background: linear-gradient(90deg, rgba(59,130,246,0.16), rgba(59,130,246,0.05));
  color: #ffffff;
}

.nav-links a.active::before {
  background: var(--blue);
}

.logout-btn {
  width: 100%;
  margin-top: auto;
  padding: 12px;
  background: linear-gradient(90deg, #dc2626, #ef4444);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  font-weight: bold;
}

.main-content {
  margin-left: 230px;
  padding: 26px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  background: rgba(10, 18, 32, 0.72);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 22px;
  padding: 18px 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.20);
}

.topbar h1 {
  font-size: 42px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-datetime,
.user-chip,
.role-chip {
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 11px 16px;
  border-radius: 14px;
  font-weight: 700;
  color: #e2e8f0;
}

.user-chip,
.role-chip {
  text-transform: uppercase;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

.panel,
.stat-card {
  background: linear-gradient(180deg, rgba(20, 32, 56, 0.88), rgba(18, 31, 57, 0.76));
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 18px 38px rgba(0,0,0,0.18);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 22px;
  text-transform: uppercase;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.stat-card span {
  display: block;
  color: #d5deed;
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-card strong {
  font-size: 34px;
  font-weight: 800;
  color: #8be9ff;
}

.dashboard-grid,
.home-layout,
.products-layout,
.history-layout,
.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.shop-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 0.9fr;
  gap: 18px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.game-box,
.game-select {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  font-weight: 800;
  text-align: left;
}

.game-box-title {
  font-size: 18px;
  margin-bottom: 8px;
}

.status-ready span {
  color: #60a5fa;
}

.status-running {
  border-color: rgba(239,68,68,0.4);
  background: rgba(127, 29, 29, 0.35);
}

.status-running span {
  color: #fca5a5;
}

.home-games-grid {
  margin-bottom: 18px;
}

.game-select {
  cursor: pointer;
}

.active-game {
  border: 2px solid #60a5fa;
}

.timer-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  margin-bottom: 18px;
  align-items: center;
}

.timer-box {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  color: #8be9ff;
}

.timer-running {
  background: rgba(127, 29, 29, 0.45);
  border-color: rgba(239,68,68,0.4);
  color: #fecaca;
}

.timer-actions,
.product-form-actions,
.receipt-actions,
.action-btns,
.qty-box {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-grid,
.product-form-grid,
.user-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.form-grid label,
.product-form-grid label,
.user-form-grid label {
  display: block;
  margin-bottom: 8px;
  color: #d5deed;
  font-weight: 700;
}

.form-grid input,
.form-grid select,
.product-form-grid input,
.product-form-grid select,
.user-form-grid input,
.user-form-grid select,
.summary-input input,
.scan-row input,
.search-input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
  outline: none;
}

.receipt-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid #334155;
  white-space: pre-wrap;
  font-family: monospace;
  line-height: 1.5;
  min-height: 420px;
  font-size: 14px;
}

.thermal-box::before {
  content: "MJL";
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 52px;
  font-weight: bold;
}

.scan-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  margin-bottom: 16px;
}

.block-search {
  margin-bottom: 16px;
}

.shop-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.shop-item {
  border: 1px solid rgba(59,130,246,0.18);
  background: rgba(59,130,246,0.10);
  color: #dbeafe;
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-item span,
.shop-item small {
  color: #9fb4d6;
  font-size: 12px;
}

.shop-item b {
  color: #fff;
}

.shop-summary {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.summary-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.summary-line strong {
  color: #8be9ff;
  font-size: 20px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  color: #8ea1bf;
  font-size: 12px;
  padding: 12px 10px;
  border-bottom: 1px solid #334155;
  text-transform: uppercase;
}

tbody td {
  padding: 14px 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.8);
  color: #e2e8f0;
  font-size: 14px;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.in-stock {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.18);
}

.low-stock {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.18);
}

.out-stock {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.qty-btn,
.btn {
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.qty-btn {
  background: rgba(59,130,246,0.14);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.22);
}

.btn.blue { background: rgba(59,130,246,0.14); color: #93c5fd; border: 1px solid rgba(59,130,246,0.22); }
.btn.green { background: rgba(34,197,94,0.16); color: #86efac; border: 1px solid rgba(34,197,94,0.22); }
.btn.red { background: rgba(239,68,68,0.16); color: #fca5a5; border: 1px solid rgba(239,68,68,0.22); }
.btn.orange { background: rgba(245,158,11,0.16); color: #fde68a; border: 1px solid rgba(245,158,11,0.22); }
.small-btn { padding: 8px 10px; }

.simple-list {
  display: grid;
  gap: 10px;
}

.simple-list-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(10,18,32,0.45);
  border-radius: 12px;
}

@media (max-width: 1300px) {
  .shop-layout,
  .products-layout,
  .dashboard-grid,
  .home-layout,
  .history-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .form-grid,
  .product-form-grid,
  .games-grid,
  .shop-product-grid,
  .user-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid,
  .form-grid,
  .product-form-grid,
  .games-grid,
  .shop-product-grid,
  .receipt-actions,
  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .scan-row,
  .summary-line,
  .timer-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-right {
    flex-direction: column;
    align-items: flex-start;
  }
}