*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold: #B38E28;
  --gold-dim: #E2D28C;
  --ink: #111010;
  --ink2: #1E1C1C;
  --ground: #F5F3EF;
  --mid: #5A5048;
  --border: #D5CCBE;
  --sidebar-w: 220px;
  --topbar-h: 60px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; background: var(--ground); color: var(--ink); }

/* ── Shell ── */
.ae-shell { display: flex; min-height: 100vh; }

.ae-sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.ae-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  text-decoration: none;
  border-bottom: 1px solid #2A2828;
}
.ae-brand-mark {
  width: 34px; height: 34px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: -0.5px;
  flex-shrink: 0;
}
.ae-brand-name { color: #fff; font-size: 14px; font-weight: 500; letter-spacing: 0.04em; }

.ae-nav { display: flex; flex-direction: column; padding: 12px 0; flex: 1; }
.ae-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: #AAA;
  text-decoration: none;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
}
.ae-nav-item:hover { background: #1E1C1C; color: #fff; }
.ae-nav-active { background: #1E1C1C; color: var(--gold) !important; }
.ae-nav-icon { font-size: 16px; width: 20px; text-align: center; opacity: 0.7; }
.ae-nav-active .ae-nav-icon { opacity: 1; }

.ae-signout {
  margin: 12px; padding: 8px 12px;
  background: none; border: 1px solid #2A2828;
  color: #666; font-size: 12px; cursor: pointer; border-radius: 6px;
  transition: border-color 0.15s, color 0.15s;
}
.ae-signout:hover { border-color: #555; color: #aaa; }

/* ── Main ── */
.ae-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.ae-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.ae-page-title { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.ae-topbar-actions { display: flex; gap: 8px; }

.ae-content { padding: 28px; flex: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none; transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn-danger { background: #C0392B; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Cards ── */
.ae-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px 24px; }
.stat-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mid); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--mid); margin-top: 4px; }

/* ── Table ── */
.ae-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 14px; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mid); border-bottom: 1px solid var(--border); font-weight: 500; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #F0EDE8; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFAF8; }
.td-link { color: var(--ink); text-decoration: none; font-weight: 500; }
.td-link:hover { color: var(--gold); }

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--mid); }
.field input, .field select, .field textarea {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; color: var(--ink); background: #fff;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
.field textarea { resize: vertical; min-height: 100px; font-family: inherit; }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--gold); background: #FBF9F5; }
.upload-zone input[type=file] { display: none; }
.upload-thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.upload-thumb { position: relative; width: 90px; height: 113px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ── Toast ── */
#ae-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 13px;
  opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 9999;
  white-space: nowrap;
}
#ae-toast.show { opacity: 1; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--mid); }
.empty-state p { margin-top: 8px; font-size: 13px; }

/* ── Login page ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.login-box { background: #1A1818; border: 1px solid #2A2828; border-radius: 14px; padding: 40px; width: 360px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-mark { width: 52px; height: 52px; background: var(--gold); color: var(--ink); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; letter-spacing: -0.5px; }
.login-title { color: #fff; font-size: 18px; font-weight: 500; letter-spacing: 0.06em; }
.login-sub { color: #666; font-size: 12px; letter-spacing: 0.04em; }
.login-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.login-field label { color: #888; font-size: 12px; letter-spacing: 0.04em; }
.login-field input { padding: 10px 14px; background: #111010; border: 1px solid #333; border-radius: 8px; color: #fff; font-size: 14px; }
.login-field input:focus { outline: none; border-color: var(--gold); }
.login-btn { width: 100%; padding: 11px; background: var(--gold); color: var(--ink); border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-btn:hover { opacity: 0.9; }
.login-msg { text-align: center; font-size: 13px; color: #888; margin-top: 16px; line-height: 1.5; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ae-sidebar { display: none; }
  .ae-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
}
