:root {
  --black: #0b0a08;
  --black-soft: #151310;
  --panel: #1b1815;
  --panel-2: #211d18;
  --border: rgba(232, 185, 35, 0.12);
  --gold: #e8b923;
  --gold-light: #f6d668;
  --gold-dark: #a5790f;
  --text-light: #f5efe0;
  --text-muted: #a79f8c;
  --green: #34c266;
  --red: #ef5858;
  --blue: #4c9be8;
  --orange: #f0a336;
  --radius: 14px;
  --shadow: 0 16px 34px rgba(0,0,0,0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--black-soft);
  color: var(--text-light);
}
h1, h2, h3, .sidebar-brand span, .login-card h1 { font-family: 'Marcellus', serif; font-weight: 400; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border: none; border-radius: 10px;
  font-weight: 600; font-size: 0.88rem; transition: 0.2s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); color: var(--black); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(232,185,35,0.3); }
.btn-outline { border: 1.5px solid var(--gold); color: var(--gold); background: none; }
.btn-outline:hover { background: var(--gold); color: var(--black); }
.btn-danger { background: rgba(239,88,88,0.15); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 12px; font-size: 0.78rem; border-radius: 8px; }

/* ===== Login ===== */
.login-screen {
  min-height: 100vh; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(232,185,35,0.12), transparent 55%), var(--black);
  padding: 20px;
}
.login-screen:not([hidden]) { display: flex; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 44px 40px; width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow);
}
.login-logo { width: 66px; height: 66px; border-radius: 50%; object-fit: cover; margin: 0 auto 18px; border: 2px solid var(--gold); }
.login-card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.login-card em { color: var(--gold); font-style: normal; }
.login-sub { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 28px; }
#loginForm { text-align: left; }
#loginForm label { display: block; font-size: 0.78rem; color: var(--text-muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.5px; }
#loginForm input {
  width: 100%; padding: 12px 14px; background: var(--black-soft);
  border: 1px solid var(--border); border-radius: 10px; color: var(--text-light); font-size: 0.92rem;
}
#loginForm input:focus { outline: none; border-color: var(--gold); }
#loginForm .btn { margin-top: 22px; }
#loginForm .btn + .btn { margin-top: 10px; }
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-field button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; background: none; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.password-field button:hover { color: var(--gold); }
.login-hint { color: var(--text-muted); font-size: 0.74rem; margin-top: 16px; line-height: 1.5; }
.login-error {
  display: flex; align-items: center; gap: 8px; color: var(--red);
  background: rgba(239,88,88,0.12); border: 1px solid rgba(239,88,88,0.3);
  border-radius: 9px; padding: 10px 14px; font-size: 0.8rem; margin-top: 16px;
}
.login-card.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ===== App shell ===== */
.app { min-height: 100vh; }
.app:not([hidden]) { display: flex; }

.sidebar {
  width: 250px; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: margin 0.25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 22px 22px; font-size: 1.05rem; }
.sidebar-brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }
.sidebar-brand em { color: var(--gold); font-style: normal; }
.sidebar-nav { flex: 1; padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
  background: none; border: none; color: var(--text-muted); font-size: 0.92rem; font-weight: 500;
  text-align: left; transition: 0.18s ease;
}
.nav-item i { width: 18px; text-align: center; }
.nav-item:hover { background: rgba(232,185,35,0.06); color: var(--text-light); }
.nav-item.active { background: var(--gold); color: var(--black); font-weight: 600; }
.sidebar-footer-link { display: flex; align-items: center; gap: 10px; padding: 18px 22px; color: var(--text-muted); font-size: 0.82rem; border-top: 1px solid var(--border); }
.sidebar-footer-link:hover { color: var(--gold); }

.main { flex: 1; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 18px; padding: 18px 30px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--black-soft); z-index: 20;
}
.menu-toggle { display: none; background: none; border: none; color: var(--gold); font-size: 1.2rem; }
.topbar h1 { font-size: 1.4rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.icon-btn { position: relative; background: none; border: none; color: var(--text-muted); font-size: 1.1rem; }
.icon-btn .dot { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.profile { display: flex; align-items: center; gap: 10px; position: relative; padding: 6px 10px; border-radius: 10px; }
.profile:hover { background: rgba(255,255,255,0.03); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: var(--black); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
.profile-info { display: flex; flex-direction: column; font-size: 0.82rem; line-height: 1.3; }
.profile-info span { color: var(--text-muted); font-size: 0.74rem; }
.profile > i { color: var(--text-muted); font-size: 0.7rem; }
.profile-menu {
  position: absolute; top: 52px; right: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); min-width: 140px; opacity: 0; visibility: hidden;
  transform: translateY(-6px); transition: 0.18s ease; overflow: hidden;
}
.profile-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-menu button { width: 100%; padding: 12px 16px; background: none; border: none; color: var(--text-light); text-align: left; display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.profile-menu button:hover { background: rgba(232,185,35,0.08); color: var(--gold); }

.content { padding: 28px 30px 60px; }
.page h2.section-heading { font-size: 1.1rem; margin: 30px 0 16px; color: var(--gold-light); }

/* ===== Summary cards ===== */
.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
.summary-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; align-items: center; gap: 16px; transition: 0.2s ease;
}
.summary-card:hover { border-color: rgba(232,185,35,0.35); transform: translateY(-2px); }
.summary-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.summary-card .value { font-size: 1.5rem; font-family: 'Marcellus', serif; }
.summary-card .label { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }

/* ===== Charts ===== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; height: 320px; display: flex; flex-direction: column;
}
.chart-card.wide { grid-column: span 2; }
.chart-card h3 { font-size: 1rem; margin-bottom: 16px; font-weight: 500; }
.chart-card h3 span { color: var(--text-muted); font-size: 0.78rem; font-family: 'Poppins', sans-serif; margin-left: 6px; }
.chart-card canvas { flex: 1; max-height: 100%; }

/* ===== Toolbar / search ===== */
.page-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; width: 280px; max-width: 100%; }
.search-box i { color: var(--text-muted); }
.search-box input { background: none; border: none; color: var(--text-light); font-size: 0.88rem; width: 100%; }
.search-box input:focus { outline: none; }
.status-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { padding: 8px 18px; border-radius: 50px; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted); font-size: 0.82rem; font-weight: 500; }
.chip.active { background: var(--gold); color: var(--black); border-color: var(--gold); }

/* ===== Tables ===== */
.table-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-card.span2 { grid-column: span 2; padding: 22px; height: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
tbody td { padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(232,185,35,0.03); }
.cell-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.cell-actions { display: flex; gap: 8px; }
.icon-action { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.04); border: none; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 0.82rem; }
.icon-action:hover { background: rgba(232,185,35,0.12); color: var(--gold); }
.icon-action.danger:hover { background: rgba(239,88,88,0.15); color: var(--red); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 50px; font-size: 0.74rem; font-weight: 600; }
.badge-green { background: rgba(52,194,102,0.15); color: var(--green); }
.badge-red { background: rgba(239,88,88,0.15); color: var(--red); }
.badge-gold { background: rgba(232,185,35,0.15); color: var(--gold); }
.badge-blue { background: rgba(76,155,232,0.15); color: var(--blue); }
.badge-orange { background: rgba(240,163,54,0.15); color: var(--orange); }
.badge-gray { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.action-row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-btn { padding: 6px 12px; border-radius: 7px; font-size: 0.72rem; font-weight: 600; border: none; }
.mini-btn.accept { background: rgba(76,155,232,0.15); color: var(--blue); }
.mini-btn.preparing { background: rgba(240,163,54,0.15); color: var(--orange); }
.mini-btn.ready { background: rgba(232,185,35,0.15); color: var(--gold); }
.mini-btn.complete { background: rgba(52,194,102,0.15); color: var(--green); }
.mini-btn.cancel { background: rgba(239,88,88,0.15); color: var(--red); }
.mini-btn:hover { filter: brightness(1.3); }

/* ===== Categories grid ===== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.cat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.cat-card i { font-size: 1.6rem; color: var(--gold); margin-bottom: 12px; }
.cat-card h4 { font-family: 'Marcellus', serif; font-weight: 400; font-size: 1.1rem; margin-bottom: 6px; }
.cat-card p { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 14px; line-height: 1.5; }
.cat-card .cat-count { color: var(--gold-light); font-size: 0.78rem; font-weight: 600; margin-bottom: 14px; display: block; }
.cat-card .cell-actions { justify-content: flex-end; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 300;
  display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: 0.2s ease; padding: 20px;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 480px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow); transform: translateY(10px); transition: 0.2s ease; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.1rem; }
.modal-header button { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 14px; background: var(--black-soft); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text-light); font-size: 0.88rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--gold); }
.form-group textarea { resize: vertical; min-height: 70px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; text-transform: none; font-size: 0.88rem; color: var(--text-light); }
.modal-footer { display: flex; gap: 10px; margin-top: 22px; }
.modal-footer .btn { flex: 1; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
  background: var(--gold); color: var(--black); font-weight: 600; padding: 13px 24px; border-radius: 50px;
  box-shadow: var(--shadow); z-index: 400; opacity: 0; visibility: hidden; transition: 0.25s ease;
  display: flex; align-items: center; gap: 10px; font-size: 0.88rem;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: span 1; }
  .table-card.span2 { grid-column: span 1; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 150; margin-left: -250px; }
  .sidebar.open { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 20px 16px 50px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cards-grid { grid-template-columns: 1fr; }
  .profile-info { display: none; }
}
