:root {
  --bg: #13100d;
  --bg2: #1e1914;
  --bg3: #2a2018;
  --card: #302620;
  --border: #3e3228;
  --accent: #e8862a;
  --accent-hover: #f09a40;
  --accent-subtle: rgba(232,134,42,.12);
  --text: #f5f0eb;
  --text2: #9b8e82;
  --red: #e53935;
  --green: #43a047;
  --blue: #42a5f5;
  --radius: 10px;
  --sidebar-w: 240px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* ── Login ── */
#login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #1a1410, #0d0a08);
}
.login-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 48px 40px; width: 380px; text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--text2); margin-bottom: 28px; font-size: 14px; }
#login-form input {
  width: 100%; padding: 12px 16px; margin-bottom: 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg3); color: var(--text);
  font-size: 14px; outline: none; transition: border .2s;
}
#login-form input:focus { border-color: var(--accent); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.password-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  margin-top: -7px; /* offset for input's 14px margin-bottom */
  background: transparent; border: none; cursor: pointer; color: var(--text2);
  padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
.password-toggle:hover { color: var(--accent); background: var(--accent-subtle); }
.password-toggle i { font-size: 20px; }
.login-links { text-align: right; margin-top: -6px; margin-bottom: 6px; font-size: 13px; }
.login-links a { color: var(--text2); }
.login-links a:hover { color: var(--accent); }
.info-text { color: var(--green); font-size: 13px; margin-top: 8px; min-height: 18px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 20px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
  border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
  background: none; border: none; color: var(--text2); cursor: pointer;
  width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--bg3); color: var(--text); }

/* ── Layout ── */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 100;
  transition: transform .3s;
}
.sidebar-header { padding: 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.sidebar-logo { font-size: 28px; }
.sidebar-title { font-size: 18px; font-weight: 700; }
.nav-list { list-style: none; flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 8px; color: var(--text2); font-size: 14px; font-weight: 500;
  transition: all .15s; margin-bottom: 2px;
}
.nav-link:hover { background: var(--bg3); color: var(--text); }
.nav-link.active { background: var(--accent-subtle); color: var(--accent); }
.nav-link i { font-size: 20px; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }

#main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
#topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 28px;
  border-bottom: 1px solid var(--border); background: var(--bg2); position: sticky; top: 0; z-index: 50;
}
#topbar h2 { flex: 1; font-size: 20px; font-weight: 600; }
#admin-email { color: var(--text2); font-size: 13px; }
#menu-toggle { display: none; }
#content { padding: 28px; flex: 1; }

/* ── Cards & Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 8px;
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--accent); }
.stat-card .stat-label { font-size: 13px; color: var(--text2); font-weight: 500; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.card-header h3 { font-size: 16px; font-weight: 600; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--text2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
td { color: var(--text); }
tr:hover td { background: var(--bg3); }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.badge-pending { background: rgba(255,183,77,.15); color: #ffb74d; }
.badge-confirmed { background: rgba(67,160,71,.15); color: #66bb6a; }
.badge-completed { background: rgba(66,165,245,.15); color: #42a5f5; }
.badge-cancelled { background: rgba(229,57,53,.15); color: #e53935; }
.badge-queued { background: rgba(255,183,77,.15); color: #ffb74d; }
.badge-sent { background: rgba(67,160,71,.15); color: #66bb6a; }
.badge-refunded { background: rgba(123,104,238,.15); color: #7b68ee; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text2); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit;
  outline: none; transition: border .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  width: 540px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
#modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; padding: 12px 28px; border-radius: 8px;
  font-size: 14px; font-weight: 500; z-index: 300; transition: opacity .3s;
}

/* ── Activity feed ── */
.activity-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 36px; height: 36px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--accent-subtle); color: var(--accent); font-size: 18px;
}
.activity-text { flex: 1; }
.activity-text .title { font-size: 14px; font-weight: 500; }
.activity-text .meta { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ── Detail view ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { padding: 10px 0; }
.detail-item .label { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.detail-item .value { font-size: 15px; font-weight: 500; }

/* ── Filters ── */
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filters select, .filters input[type="text"], .filters input[type="date"] {
  padding: 8px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; font-family: inherit;
  outline: none;
}
.search-input { min-width: 240px; }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text2);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  #menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
