:root {
  --bg: #0f1419;
  --panel: #1a2130;
  --panel-2: #212a3d;
  --border: #2d3650;
  --text: #e8eaf0;
  --muted: #8b96ab;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.2), 0 8px 24px rgba(0,0,0,0.28);
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle at top, rgba(34,197,94,0.06), transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

header {
  padding: 14px 18px;
  background: rgba(26,33,48,0.92);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: 0.2px; }

#status-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-online { background: rgba(34,197,94,0.14); color: var(--accent); }
.status-offline { background: rgba(248,113,113,0.14); color: var(--danger); }
.status-pending { background: rgba(251,191,36,0.14); color: var(--warn); }

main { padding: 16px; max-width: 720px; margin: 0 auto 90px; }

.login-box, .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.login-box { max-width: 380px; margin-left: auto; margin-right: auto; margin-top: 48px; }
.login-box h2 { margin-top: 0; font-size: 20px; }

section:not(.hidden) { animation: fadeIn 0.18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

input, select, button {
  font-size: 15px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b0f18;
  color: var(--text);
  width: 100%;
  margin-top: 6px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
}

label { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); font-weight: 500; }
label:first-child { margin-top: 0; }

.password-field { position: relative; display: flex; align-items: center; width: 100%; }
.password-field input { padding-right: 44px; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #0b0f18 inset !important;
  -webkit-text-fill-color: #e8eaf0 !important;
  caret-color: #e8eaf0 !important;
  transition: background-color 9999s ease-in-out 0s;
}

button {
  background: var(--accent);
  color: #04160c;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
button:hover { background: var(--accent-hover); }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); font-weight: 600; }
button.secondary:hover { background: #29334a; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

.item-row td:last-child { text-align: right; }
.qty-input { width: 64px; padding: 8px; }

.pending-tag { font-size: 12px; color: var(--warn); font-weight: 500; }
.discrepancy { color: var(--danger); font-weight: 700; }
.reconciled { color: var(--accent); font-weight: 600; }

.hidden { display: none; }

.owner-only { display: none; }
body.is-owner-manager .owner-only { display: table-cell; }
.owner-only-block { display: none; }
body.is-owner-manager .owner-only-block { display: block; }
.owner-only-inline { display: none; }
body.is-owner-manager .owner-only-inline { display: inline-flex; align-items: center; justify-content: center; }

#admin-menu-btn {
  width: auto; margin-top: 0; padding: 8px 12px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; line-height: 1; border-radius: var(--radius-sm);
}
#admin-menu-btn:hover { background: #29334a; }

.eye-toggle {
  position: absolute; right: 6px; width: auto; padding: 6px 8px; margin-top: 0;
  background: transparent; border: none; font-size: 18px; cursor: pointer;
  color: var(--text); opacity: 0.8;
}
.eye-toggle:hover { opacity: 1; background: transparent; }

.staff-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.staff-row:last-child { border-bottom: none; }
.staff-row .staff-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.staff-row button { width: auto; padding: 7px 12px; margin-top: 0; font-size: 12px; }
.temp-password-box { background: #0b0f18; border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 12px; margin-top: 8px; font-size: 13px; }
.temp-password-box strong { color: var(--accent); font-size: 17px; letter-spacing: 1px; }

.opening-locked { font-size: 12px; color: var(--muted); }
.stock-input-cell input { width: 64px; padding: 7px; margin-top: 0; }
.stock-input-cell button { width: auto; padding: 7px 9px; margin-top: 4px; font-size: 12px; }

.catalog-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.catalog-row:last-child { border-bottom: none; }
.catalog-row .catalog-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.catalog-row .catalog-actions { display: flex; gap: 6px; flex-shrink: 0; }
.catalog-row .catalog-actions button { width: auto; padding: 7px 12px; margin-top: 0; font-size: 12px; }
.catalog-edit-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.catalog-edit-row .catalog-edit-actions { display: flex; gap: 8px; margin-top: 10px; }
.catalog-edit-row .catalog-edit-actions button { width: auto; padding: 7px 12px; margin-top: 0; font-size: 12px; }

.screen-header { display: flex; align-items: center; gap: 12px; }
.nav-back-btn { width: auto; padding: 7px 14px; margin-top: 0; font-size: 13px; }

.nav-list { padding: 4px 6px; }
.nav-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); padding: 16px 10px; margin-top: 0; font-size: 15px; font-weight: 500;
  text-align: left; cursor: pointer; border-radius: var(--radius-sm);
}
.nav-row:hover { background: var(--panel-2); }
.nav-row:last-child { border-bottom: none; }
.nav-row-label { display: flex; align-items: center; gap: 10px; }
.nav-chevron { color: var(--muted); font-size: 18px; }

/* Persistent sidebar (responsive nav, 1 Oct 2026). Hidden below 900px --
   phones keep the existing hamburger -> full Admin-menu-screen flow
   untouched, since the item table needs the width more than a permanent
   nav rail does. At >=900px (PC/tablet) it docks to the left instead.
   Top offset is an approximate padding (not a measured header height) --
   the background color matches the header's, so a few px of difference
   is invisible rather than a visible seam; nudge the 76px if you see a
   gap or overlap once this is live. */
#app-sidebar { display: none; }
@media (min-width: 900px) {
  #app-sidebar:not(.hidden) {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    padding: 76px 8px 20px;
    background: rgba(26,33,48,0.92);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 9;
  }
  #admin-menu-btn { display: none; }
  body.has-sidebar main { margin-left: 240px; }
}

.add-item-btn-top { width: 100%; margin-top: 0; }
