:root {
  --bg: #fbf7f4;
  --bg2: #f5efe9;
  --panel: #ffffff;
  --panel2: #faf5f0;
  --border: #ece2da;
  --text: #292524; /* stone-800 */
  --muted: #a8a29e; /* stone-400 */
  --accent: #f59e0b; /* amber-500 */
  --accent2: #ec4899; /* pink-500 */
  --grad: linear-gradient(135deg, #f59e0b 0%, #f97316 45%, #ec4899 100%);
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 10px 30px -12px rgba(217,119,6,0.18);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1200px 500px at 100% -5%, rgba(244,63,94,.07), transparent 60%),
    radial-gradient(1000px 500px at -10% 0%, rgba(245,158,11,.08), transparent 55%);
  background-attachment: fixed;
}
h1, h2, h3, .font-display { font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif; letter-spacing: -0.01em; }

/* ---- AUTH ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 24px; padding: 36px 32px;
  box-shadow: var(--shadow);
  animation: fadeInScale .45s ease-out;
}
.auth-card .brand-logo { font-size: 30px; font-weight: 800; }
.auth-card .brand-logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.auth-wrap .auth-card::before { content: ""; display:block; width:52px; height:6px; border-radius:99px; background:var(--grad); margin:0 auto 20px; }

/* ---- FORM ---- */
label { display: block; font-size: 13px; font-weight: 600; color: #57534e; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel2);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(245,158,11,.14); }
textarea { resize: vertical; min-height: 60px; font-family: 'Consolas', monospace; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; border: none;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: filter .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 6px 18px -6px rgba(236,72,153,.4);
}
.btn:hover { filter: brightness(1.03); box-shadow: 0 10px 22px -8px rgba(236,72,153,.5); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: var(--panel); border: 1px solid var(--border); color: #57534e; box-shadow: none; }
.btn.ghost:hover { background: var(--panel2); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg,#ef4444,#dc2626); box-shadow: 0 6px 18px -6px rgba(220,38,38,.4); }
.btn.danger:hover { filter: brightness(.98); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.block { width: 100%; }

/* ---- LAYOUT ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--panel); border-right: 1px solid var(--border);
  padding: 22px 14px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display:flex; align-items:center; gap:10px; font-family:'Outfit'; font-size:20px; font-weight:800; padding: 2px 12px 20px; }
.brand .logo-dot { width: 34px; height:34px; border-radius:11px; background:var(--grad); display:flex; align-items:center; justify-content:center; color:#fff; font-size:16px; box-shadow: 0 4px 12px -3px rgba(236,72,153,.5); }
.brand span:last-child { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  text-align: left; background: none; border: none; color: #78716c;
  padding: 12px 14px; border-radius: 12px; font-size: 14px; cursor: pointer;
  font-weight: 600; transition: all .15s; display:flex; align-items:center; gap:10px;
}
.nav button:hover { background: var(--panel2); color: var(--text); }
.nav button.active { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(236,72,153,.5); }
.sidebar .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); }
.sidebar .foot .who { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.main { flex: 1; padding: 28px 34px; overflow: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h2 { margin: 0; font-size: 25px; font-weight: 800; }
.topbar h2 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- STATS ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); animation: fadeInUp .5s ease both; }
.stat .v { font-size: 27px; font-weight: 800; font-family:'Outfit'; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; font-weight:600; }

/* ---- CARD ---- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 18px; font-size: 16px; font-weight: 700; }
.card .row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.card .row > div { flex: 1; min-width: 160px; }

/* ---- TABLE ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px; border-bottom: 1px solid var(--border); font-weight: 700; }
.table td { padding: 13px 10px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tr { transition: background .12s; }
.table tr:hover td { background: var(--panel2); }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 12px; background: var(--panel2); border:1px solid var(--border); }
.badge { display: inline-block; padding: 5px 12px; font-size: 12px; font-weight: 700; border-radius: 99px; text-transform: capitalize; letter-spacing:.02em; }
.badge.available { background: rgba(245,158,11,.14); color: #b45309; }
.badge.sold { background: rgba(220,38,38,.12); color: #dc2626; }
.badge.pending { background: rgba(245,158,11,.16); color: #b45309; }
.badge.processing { background: rgba(59,130,246,.12); color: #2563eb; }
.badge.paid { background: rgba(16,185,129,.13); color: #059669; }
.badge.shipped { background: rgba(139,92,246,.12); color: #7c3aed; }
.badge.done { background: rgba(22,163,74,.13); color: #16a34a; }
.badge.cancelled { background: rgba(220,38,38,.12); color: #dc2626; }

.muted { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; }

/* ---- TOAST ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #292524; color:#fff; padding: 14px 22px; border-radius: 14px; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.35); opacity: 0; transition: opacity .2s; z-index: 100; }
.toast.show { opacity: 1; }
.toast.err { background: #dc2626; }

.empty { text-align: center; color: var(--muted); padding: 44px 0; }
.net { display:flex; flex-direction:column; gap:4px; }
.net b { font-size: 30px; font-family:'Outfit'; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- REPORT period tabs & table ---- */
.report-tab { padding: 8px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s; }
.report-tab:hover { border-color: var(--accent); }
.report-tab.active { background: var(--grad); color: #fff; border-color: transparent; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rep-table th, .rep-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); }
.rep-table th:first-child, .rep-table td:first-child { text-align: left; }
.rep-table thead th { background: var(--panel2); font-size: 12px; font-weight: 700; color: var(--muted); }
.rep-table tbody tr:hover { background: var(--panel2); }
.rep-table tfoot th { padding: 12px; font-weight: 800; border-bottom: none; border-top: 2px solid var(--border); text-align: right; }
.rep-table tfoot th:first-child { text-align: left; }

/* ---- PAYMENT TOGGLE SWITCH ---- */
.switch { position: relative; width: 62px; height: 34px; border-radius: 999px; border: none; cursor: pointer; background: #d6d3d1; transition: background .2s; flex-shrink: 0; }
.switch.on { background: var(--grad); }
.switch .knob { position: absolute; top: 3px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: left .2s; }
.switch.on .knob { left: 30px; }
.switch.sm { width: 48px; height: 28px; }
.switch.sm .knob { width: 22px; height: 22px; top: 3px; left: 3px; }
.switch.sm.on .knob { left: 23px; }

/* ---- MODAL ---- */
.modal { position: fixed; inset: 0; background: rgba(41,37,36,.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal .box { background: var(--panel); border: 1px solid var(--border); border-radius: 22px; width: 100%; max-width: 620px; max-height: 90vh; overflow: auto; padding: 28px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.4); animation: fadeInScale .3s ease both; }
.modal .box h3 { margin: 0 0 20px; }
.preview { width: 90px; height: 90px; object-fit: cover; border-radius: 14px; background: var(--panel2); border:1px solid var(--border); margin-top:8px; }
.field { margin-bottom: 14px; }

/* ---- ANIMATION ---- */
@keyframes fadeInScale { from { opacity:0; transform: scale(.93) } to { opacity:1; transform: scale(1) } }
@keyframes fadeUp { from { opacity:0; transform: translateY(14px) } to { opacity:1; transform: translateY(0) } }
.stagger-1{animation-delay:.03s}.stagger-2{animation-delay:.06s}.stagger-3{animation-delay:.09s}.stagger-4{animation-delay:.12s}.stagger-5{animation-delay:.15s}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: column; }
  .nav { flex-direction: row; overflow-x: auto; }
  .grid2 { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}