:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1f2432;
  --accent: #f0b90b;
  --accent-2: #3b82f6;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --border: #2a3040;
  --ok: #22c55e;
  --err: #ef4444;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent-2); text-decoration: none; }

/* Layout */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 230px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0 12px 18px 12px;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Thin subtle scrollbar styling */
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  padding: 18px 8px 18px 8px;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 10;
  margin: 0;
}

.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.sidebar nav a {
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.sidebar nav a:hover { background: var(--panel-2); }
.sidebar nav a.active { background: var(--accent); color: #111; font-weight: 600; }

.logout button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}
.logout button:hover { color: var(--text); border-color: var(--muted); }

.content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1100px;
  height: 100%;
  overflow-y: auto;
}

h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 16px; margin: 24px 0 12px; }

/* Cards & stats */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.card .value { font-size: 28px; font-weight: 700; }
.card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; background: var(--panel-2); }
tr:last-child td { border-bottom: none; }

/* Forms */
.form-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  max-width: 640px;
}
label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=file], textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 90px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox input { width: auto; }
.checkbox label { margin: 0; color: var(--text); }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #111;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--err); color: #fff; }
.btn.success { background: var(--ok); color: #06210f; font-weight: 600; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* Badges */
.badge { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.pending { background: #3a2f00; color: var(--warn); }
.badge.paid { background: #06331b; color: var(--ok); }
.badge.delivered { background: #06331b; color: var(--ok); }
.badge.cancelled { background: #3a0d0d; color: var(--err); }
.badge.available { background: #06331b; color: var(--ok); }
.badge.reserved { background: #3a2f00; color: var(--warn); }
.badge.sold { background: #1c2733; color: #7fb0e6; }
.badge.ok { background: #06331b; color: var(--ok); }
.badge.danger { background: #3a0d0d; color: var(--err); }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #06331b; color: var(--ok); border: 1px solid #0d5c33; }
.flash.error { background: #3a0d0d; color: var(--err); border: 1px solid #6b1a1a; }
.flash.warning { background: #3a2f00; color: var(--warn); border: 1px solid #6b5312; }
.flash.floating { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 10; min-width: 300px; }

/* Filters */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar form { display: flex; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.chip.active { background: var(--accent); color: #111; border-color: var(--accent); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 100%; max-width: 340px; margin: 16px; }
.login-box h1 { text-align: center; }

code { background: var(--panel-2); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); }

/* Mobile Header */
.mobile-header {
  display: none;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1001;
  height: 56px;
}
.menu-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-toggle:hover {
  background: var(--panel-2);
}
.mobile-brand {
  font-weight: 700;
  font-size: 18px;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Responsive adjustments for mobile/tablet */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border);
    max-height: none;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .brand {
    padding: 24px 8px;
    border-bottom: 1px solid var(--border);
  }

  .content {
    width: 100%;
    padding: 16px 12px;
    height: auto;
    overflow: visible;
  }

  /* Responsive Tables */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Compact dashboard cards on mobile */
  .cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
  }
  .card {
    padding: 12px;
  }
  .card .value {
    font-size: 22px;
  }

  /* Compact form card */
  .form-card {
    padding: 16px 14px;
  }
}

