*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
  font-size: 14px;
}

.admin-login {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1a1a1a 0%, #2b2b2b 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.login-card {
  background: #fff; border-radius: 16px;
  padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}

.login-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 32px; }
.login-brand { font-size: 24px; font-weight: 700; letter-spacing: 3px; color: #1a1a1a; }
.login-sub { font-size: 12px; color: #888; margin-top: 4px; letter-spacing: 1px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; color: #555; }
.login-field input {
  width: 100%; padding: 12px 14px;
  border: 1px solid #e0e0e0; border-radius: 10px;
  font-family: inherit; font-size: 14px; outline: none; transition: border-color .2s;
}
.login-field input:focus { border-color: #2b2b2b; }
.login-btn {
  width: 100%; padding: 13px; background: #1a1a1a; color: #fff;
  border: none; border-radius: 10px; font-family: inherit; font-size: 12px;
  letter-spacing: 1px; text-transform: uppercase; cursor: pointer; margin-top: 8px; transition: background .2s;
}
.login-btn:hover { background: #333; }
.login-error { color: #e74c3c; font-size: 12px; text-align: center; margin: 8px 0 0; }
.login-hint { text-align: center; font-size: 11px; color: #aaa; margin-top: 20px; }
.login-hint code { background: #f4f5f7; padding: 2px 6px; border-radius: 4px; font-size: 11px; }

.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.admin-sidebar {
  background: #1a1a1a; color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.admin-brand { padding: 28px 24px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; }
.admin-brand span { font-size: 18px; font-weight: 700; letter-spacing: 3px; }
.admin-brand small { font-size: 10px; color: rgba(255,255,255,.4); letter-spacing: 1px; margin-top: 2px; }
.admin-nav { flex: 1; padding: 16px 0; }
.admin-nav__link {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  color: rgba(255,255,255,.6); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all .2s; border-left: 3px solid transparent;
}
.admin-nav__link:hover { color: #fff; background: rgba(255,255,255,.05); }
.admin-nav__link.is-active { color: #fff; background: rgba(255,255,255,.08); border-left-color: #fff; }
.admin-sidebar__footer { padding: 20px 24px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 10px; }
.sidebar-link-out { color: rgba(255,255,255,.5); font-size: 12px; text-decoration: none; transition: color .2s; }
.sidebar-link-out:hover { color: #fff; }
.logout-btn {
  background: none; border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.6); border-radius: 8px;
  padding: 8px 14px; font-size: 12px; cursor: pointer; font-family: inherit; transition: all .2s; text-align: left;
}
.logout-btn:hover { border-color: rgba(255,255,255,.5); color: #fff; }

.admin-main { display: flex; flex-direction: column; overflow-y: auto; }
.admin-topbar {
  background: #fff; border-bottom: 1px solid #e8e8e8;
  padding: 18px 32px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.admin-page-title { font-size: 20px; font-weight: 600; margin: 0; }
.admin-topbar__right { display: flex; align-items: center; gap: 12px; }
.admin-user { font-size: 13px; color: #888; background: #f0f0f0; padding: 6px 12px; border-radius: 20px; }
.admin-section { padding: 28px 32px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.stat-card__icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-card__icon--dark   { background: #1a1a1a; }
.stat-card__icon--green  { background: #2d6a4f; }
.stat-card__icon--blue   { background: #1a4f8a; }
.stat-card__icon--purple { background: #5c3d8f; }
.stat-card__label { display: block; font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-card__value { font-size: 26px; font-weight: 700; color: #1a1a1a; }

.admin-card { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.07); overflow: hidden; }
.admin-card__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid #f0f0f0; }
.admin-card__head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.btn-link { background: none; border: none; color: #555; font-size: 12px; cursor: pointer; font-family: inherit; text-decoration: underline; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: #f9f9f9; padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600; color: #666; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid #f0f0f0; }
.admin-table td { padding: 13px 16px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; font-size: 13px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }
.table-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.table-placeholder { width: 44px; height: 44px; border-radius: 8px; background: #2b2b2b; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; font-weight: 700; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge--pending  { background: #fff3cd; color: #856404; }
.badge--confirm  { background: #d1e7dd; color: #0f5132; }
.badge--shipping { background: #cfe2ff; color: #084298; }
.badge--done     { background: #d1e7dd; color: #0f5132; }
.badge--cancel   { background: #f8d7da; color: #842029; }
.badge--unread   { background: #e2d9f3; color: #432874; }
.badge--read     { background: #f4f5f7; color: #888; }

.btn-primary { background: #1a1a1a; color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; cursor: pointer; font-family: inherit; transition: background .2s; }
.btn-primary:hover { background: #333; }
.btn-secondary { background: #f4f5f7; color: #333; border: 1px solid #e0e0e0; border-radius: 8px; padding: 10px 18px; font-size: 12px; cursor: pointer; font-family: inherit; transition: all .2s; }
.btn-secondary:hover { background: #eee; }
.btn-danger { background: none; color: #e74c3c; border: 1px solid #e74c3c; border-radius: 6px; padding: 6px 12px; font-size: 11px; cursor: pointer; font-family: inherit; transition: all .2s; }
.btn-danger:hover { background: #e74c3c; color: #fff; }
.btn-edit { background: none; color: #1a1a1a; border: 1px solid #ccc; border-radius: 6px; padding: 6px 12px; font-size: 11px; cursor: pointer; font-family: inherit; transition: all .2s; }
.btn-edit:hover { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn-view { background: none; color: #1a4f8a; border: 1px solid #1a4f8a; border-radius: 6px; padding: 6px 12px; font-size: 11px; cursor: pointer; font-family: inherit; transition: all .2s; }
.btn-view:hover { background: #1a4f8a; color: #fff; }
.action-btns { display: flex; gap: 6px; }
.section-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.empty-state { text-align: center; color: #aaa; padding: 40px; font-size: 14px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px; }
.modal-card { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; line-height: 1; }
.modal-close:hover { color: #1a1a1a; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; color: #555; }
.modal-field input, .modal-field select, .modal-field textarea { width: 100%; padding: 10px 12px; border: 1px solid #e0e0e0; border-radius: 8px; font-family: inherit; font-size: 13px; outline: none; transition: border-color .2s; }
.modal-field input:focus, .modal-field select:focus, .modal-field textarea:focus { border-color: #1a1a1a; }
.modal-field--check label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.modal-field--check input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; align-items: center; }

.order-detail { margin-bottom: 20px; }
.order-detail p { margin: 6px 0; font-size: 13px; line-height: 1.7; }
.order-items-list { margin-top: 12px; }
.order-item-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.status-select { padding: 8px 12px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; }

@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-section { padding: 20px 16px; }
  .admin-topbar  { padding: 14px 16px; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .modal-row     { grid-template-columns: 1fr; }
}
