/* ============================
   Auction Management System CSS
   ============================ */

:root {
  --primary: #2e53b8;
  --primary-hover: #25469d;
  --primary-foreground: #ffffff;
  --primary-light: #eef3ff;
  --secondary: #eeeff2;
  --secondary-foreground: #0f1729;
  --background: #f6f7f9;
  --foreground: #0f1729;
  --card: #ffffff;
  --card-foreground: #0f1729;
  --muted: #eeeff2;
  --muted-foreground: #6b7280;
  --border: #e2e4e9;
  --ring: #2e53b8;
  --destructive: #dc2828;
  --destructive-foreground: #ffffff;
  --success: #22c55e;
  --warning: #f2a20d;
  --info: #3b82f6;

  --sidebar: #0f1729;
  --sidebar-foreground: #eeeff2;
  --sidebar-primary: #f2a20d;
  --sidebar-primary-foreground: #0f1729;
  --sidebar-accent: #20273c;
  --sidebar-border: #20273c;

  --radius: 0.625rem;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

html { font-size: 18px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================
   Utility Classes
   ============================ */

.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-muted { color: var(--muted-foreground); }
.text-destructive { color: var(--destructive); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.grid { display: grid; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.z-10 { z-index: 10; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

.border { border: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.border-0 { border: 0; }
.border-destructive { border-color: var(--destructive); }

.bg-background { background: var(--background); }
.bg-card { background: var(--card); }
.bg-primary { background: var(--primary); }
.bg-primary-light { background: var(--primary-light); }
.bg-muted { background: var(--muted); }
.bg-destructive { background: var(--destructive); }
.bg-destructive\/10 { background: rgba(239, 68, 68, 0.1); }
.bg-success\/10 { background: rgba(34, 197, 94, 0.1); }
.bg-warning\/10 { background: rgba(245, 158, 11, 0.1); }
.bg-info\/10 { background: rgba(59, 130, 246, 0.1); }
.bg-white { background: #fff; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }

.pt-4 { padding-top: 1rem; }
.pb-4 { padding-bottom: 1rem; }
.pl-10 { padding-left: 2.5rem; }
.pl-3 { padding-left: 0.75rem; }
.pr-4 { padding-right: 1rem; }

.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }

.tracking-tight { letter-spacing: -0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.leading-tight { line-height: 1.25; }
.whitespace-nowrap { white-space: nowrap; }

/* ============================
   Transitions & Animations
   ============================ */

.transition-all { transition: all 0.2s ease; }
.transition-shadow { transition: box-shadow 0.2s ease; }
.duration-200 { transition-duration: 0.2s; }
.duration-300 { transition-duration: 0.3s; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-spin { animation: spin 1s linear infinite; }
.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }

/* ============================
   Sidebar
   ============================ */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  z-index: 50;
  overflow: hidden;
}
.sidebar.open { width: 260px; }
.sidebar.closed { width: 68px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  min-height: 82px;
  height: auto;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  overflow: visible;
}
.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  background: var(--sidebar-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-primary-foreground);
  flex-shrink: 0;
}
.sidebar-logo-icon i { font-size: 1.1rem; }
.sidebar-logo-text { min-width: 0; padding-top: 0.05rem; }
.sidebar-logo-text h1 { font-size: 0.9rem; font-weight: 700; color: var(--sidebar-foreground); line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
.sidebar-logo-text p { font-size: 0.65rem; color: rgba(241,245,249,0.5); letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.2; margin-top: 0.12rem; }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.5rem;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 2px; }

.sidebar-section-title {
  padding: 1rem 0.75rem 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(241,245,249,0.3);
  font-weight: 600;
}
.sidebar-divider {
  margin: 0.75rem 0.5rem;
  border-top: 1px solid rgba(51,65,85,0.3);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  color: rgba(241,245,249,0.6);
  transition: all 0.2s;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link:hover {
  color: var(--sidebar-foreground);
  background: rgba(51,65,85,0.5);
}
.sidebar-link.active {
  background: var(--sidebar-accent);
  color: var(--sidebar-primary);
}
.sidebar-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-icon-3d {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.45), inset 0 -8px 14px rgba(15,23,42,.18), 0 8px 18px rgba(0,0,0,.28);
  transform: perspective(80px) rotateX(8deg);
  transition: transform .18s ease, box-shadow .18s ease;
}
.sidebar-icon-3d::after {
  content: '';
  position: absolute;
  inset: 2px 3px auto 3px;
  height: 38%;
  border-radius: 0.55rem 0.55rem 0.3rem 0.3rem;
  background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0));
  pointer-events: none;
}
.sidebar-icon-3d i {
  width: auto;
  font-size: 1rem;
  color: #fff;
  filter: drop-shadow(0 2px 3px rgba(15,23,42,.35));
  position: relative;
  z-index: 1;
}
.sidebar-link:hover .sidebar-icon-3d,
.sidebar-link.active .sidebar-icon-3d {
  transform: perspective(80px) rotateX(0deg) translateY(-1px) scale(1.04);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.5), inset 0 -8px 14px rgba(15,23,42,.14), 0 10px 22px rgba(0,0,0,.34);
}
.nav-icon-home { background: linear-gradient(145deg,#22d3ee,#2563eb 62%,#1e3a8a); }
.nav-icon-tai-san { background: linear-gradient(145deg,#fbbf24,#f97316 62%,#9a3412); }
.nav-icon-khach-hang { background: linear-gradient(145deg,#a78bfa,#7c3aed 62%,#4c1d95); }
.nav-icon-phien-dau-gia { background: linear-gradient(145deg,#60a5fa,#2e53b8 60%,#1e3a8a); }
.nav-icon-auction-room-php { background: linear-gradient(145deg,#8b5cf6,#2563eb 58%,#1e1b4b); overflow: visible; }
.door-open-3d {
  width: 1.1rem;
  height: 1.25rem;
  display: inline-block;
  position: relative;
  perspective: 90px;
  filter: drop-shadow(0 3px 4px rgba(15,23,42,.35));
}
.door-open-3d::before {
  content: '';
  position: absolute;
  left: 0.12rem;
  top: 0.08rem;
  width: 0.78rem;
  height: 1.08rem;
  border-radius: 0.12rem;
  background: linear-gradient(145deg,#e0f2fe,#60a5fa 55%,#1d4ed8);
  border: 0.08rem solid rgba(255,255,255,.8);
  transform-origin: left center;
  transform: rotateY(-38deg) skewY(-2deg);
  box-shadow: inset -0.18rem -0.12rem 0.2rem rgba(30,64,175,.32), 0.13rem 0.12rem 0 rgba(15,23,42,.22);
}
.door-open-3d::after {
  content: '';
  position: absolute;
  right: 0.03rem;
  top: 0.47rem;
  width: 0.13rem;
  height: 0.13rem;
  border-radius: 50%;
  background: #fde68a;
  box-shadow: 0 0 0.15rem rgba(253,230,138,.9);
}
.door-open-3d .frame {
  position: absolute;
  left: 0.02rem;
  top: 0;
  width: 0.88rem;
  height: 1.22rem;
  border: 0.08rem solid rgba(255,255,255,.85);
  border-radius: 0.14rem;
  background: linear-gradient(180deg,rgba(15,23,42,.28),rgba(15,23,42,.05));
}
.nav-icon-auction-room-php i { display: none; }
.nav-icon-auction-room-php .door-open-3d { transform: scale(1.05); }
.nav-icon-dang-ky { background: linear-gradient(145deg,#fb7185,#e11d48 62%,#881337); }
.nav-icon-lich-su-phien { background: linear-gradient(145deg,#c084fc,#9333ea 62%,#581c87); }
.nav-icon-thong-tin-cong-ty { background: linear-gradient(145deg,#94a3b8,#475569 62%,#1e293b); }
.nav-icon-quan-ly-tai-khoan { background: linear-gradient(145deg,#38bdf8,#0284c7 62%,#075985); }
.nav-icon-phong-ban { background: linear-gradient(145deg,#4ade80,#16a34a 62%,#14532d); }
.nav-icon-backup-php { background: linear-gradient(145deg,#facc15,#ca8a04 62%,#713f12); }

.sidebar-footer {
  padding: 0 0.5rem 1rem;
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 49;
}

/* ============================
   Main Layout
   ============================ */

.main-content {
  transition: margin-left 0.3s ease;
  min-height: 100vh;
}
.main-content.sidebar-open { margin-left: 260px; }
.main-content.sidebar-closed { margin-left: 68px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(248,250,252,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}
.topbar-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar-user-info { text-align: right; }
.topbar-user-name { font-size: 0.875rem; font-weight: 600; line-height: 1.25; }
.topbar-user-role { font-size: 0.7rem; color: var(--muted-foreground); }
.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-foreground);
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.page-container {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================
   Buttons
   ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; min-width: 36px; min-height: 36px; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--muted); }

.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.btn-danger:hover:not(:disabled) { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  border: none;
}
.btn-ghost:hover:not(:disabled) { background: var(--muted); color: var(--foreground); }

/* ============================
   Forms
   ============================ */

.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--foreground);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.form-input.with-icon { padding-left: 2.5rem; }
.form-input-wrapper { position: relative; }
.form-input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  pointer-events: none;
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-error { font-size: 0.8rem; color: var(--destructive); margin-top: 0.25rem; }

/* ============================
   Cards
   ============================ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.25rem; }

.stats-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.stats-card:hover { box-shadow: var(--shadow-md); }
.stats-card-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.stats-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
}
.stats-card-trend {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}
.stats-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

/* ============================
   Table
   ============================ */

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--muted-foreground);
  background: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:hover td { background: var(--muted); }
/* Bảng vừa khung: toàn bộ thông tin hiển thị, không cần kéo ngang. */
.table-fit { table-layout: fixed; }
.table-fit th, .table-fit td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding: 0.55rem 0.6rem;
}
.table-fit .cell-money { white-space: nowrap; }
.table-fit th.cell-actions { width: 4.4rem; }
.table-actions-col { flex-direction: column; align-items: stretch; }
.table-actions-col .btn { width: 100%; justify-content: center; }
.table-actions-col form { display: flex; }
.table-actions-col form .btn { flex: 1; }
.table-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}

/* ============================
   Badges
   ============================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  white-space: nowrap;
}
.badge-muted { background: var(--muted); color: var(--muted-foreground); }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-emerald { background: #d1fae5; color: #047857; }
.badge-sky { background: #e0f2fe; color: #0369a1; }

/* ============================
   Modal / Dialog
   ============================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--card);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
.modal-wide { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--muted); color: var(--foreground); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ============================
   Page Header
   ============================ */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }
.page-header p { color: var(--muted-foreground); font-size: 0.875rem; margin-top: 0.25rem; }

/* ============================
   Auth Layout
   ============================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--background);
}
.auth-container { width: 100%; max-width: 420px; }
.auth-header { text-align: center; margin-bottom: 2.5rem; }
.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  background: var(--primary);
  margin-bottom: 1rem;
  color: var(--primary-foreground);
  font-size: 1.5rem;
}
.auth-header h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; }
.auth-header p { color: var(--muted-foreground); margin-top: 0.5rem; }
.auth-card {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.auth-footer a { color: var(--primary); font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

.auth-divider {
  position: relative;
  margin-bottom: 1.5rem;
}
.auth-divider-line {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
}
.auth-divider-line::before {
  content: '';
  width: 100%;
  border-top: 1px solid var(--border);
}
.auth-divider-text {
  position: relative;
  display: flex;
  justify-content: center;
  font-size: 0.75rem;
  text-transform: uppercase;
}
.auth-divider-text span {
  background: var(--card);
  padding: 0 0.75rem;
  color: var(--muted-foreground);
}

/* ============================
   Empty State
   ============================ */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted-foreground);
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}
.empty-state p { font-size: 0.875rem; }

/* ============================
   Loading Spinner
   ============================ */

.spinner-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
}

/* ============================
   Alert / Toast
   ============================ */

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: rgba(239,68,68,0.1);
  color: var(--destructive);
  border: 1px solid rgba(239,68,68,0.2);
}
.alert-success {
  background: rgba(34,197,94,0.1);
  color: #15803d;
  border: 1px solid rgba(34,197,94,0.2);
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  animation: fadeIn 0.2s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast-success { background: #15803d; color: #fff; }
.toast-error { background: var(--destructive); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }

/* ============================
   Search / Filter Bar
   ============================ */

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
.search-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

/* ============================
   Dropdown
   ============================ */

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 0.25rem;
  animation: fadeIn 0.15s ease;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--foreground);
}
.dropdown-item:hover { background: var(--muted); }
.dropdown-item.text-destructive:hover { background: rgba(239,68,68,0.1); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 0.25rem 0; }

/* ============================
   Grid Layouts
   ============================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ============================
   List Items
   ============================ */

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}
.list-item:last-child { border-bottom: none; }
.list-item-content { min-width: 0; flex: 1; }
.list-item-title { font-size: 0.875rem; font-weight: 500; }
.list-item-subtitle { font-size: 0.8rem; color: var(--muted-foreground); margin-top: 0.15rem; }
.list-item-meta { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ============================
   Responsive
   ============================ */

@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar.open { width: 260px; }
  .sidebar.closed { width: 0; }
  .sidebar-overlay { display: block; }
  .sidebar-overlay.hidden { display: none; }
  .main-content.sidebar-open { margin-left: 0; }
  .main-content.sidebar-closed { margin-left: 0; }
  .page-container { padding: 1rem; }
  .page-header { flex-direction: column; }
  .search-bar { flex-direction: column; }
  .search-input { max-width: 100%; }
  .topbar { padding: 0 1rem; }
  .topbar-user-info { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { margin: 0.5rem; max-height: 90vh; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .table th, .table td { padding: 0.5rem 0.6rem; }
  .table-fit th, .table-fit td { font-size: 0.78rem; padding: 0.45rem 0.45rem; }
  .table-fit th.cell-actions { width: 3.6rem; }
}

/* ============================
   Scrollbar
   ============================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================
   Misc
   ============================ */

.divider { border-top: 1px solid var(--border); margin: 1rem 0; }

.clickable { cursor: pointer; }
.select-none { user-select: none; }
.object-cover { object-fit: cover; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }

/* Original app recreation helpers */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: center;
}
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
}
.tab {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab.active { color: var(--primary); border-color: var(--primary); }
.session-grid, .winner-grid, .dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.session-card, .winner-card, .history-card, .dept-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}
.session-card h3 { font-size: 1rem; line-height: 1.35; margin-top: 0.2rem; }
.session-meta { margin: 1rem 0; color: var(--muted-foreground); font-size: 0.85rem; display: grid; gap: 0.35rem; }
.session-meta i { width: 18px; color: var(--primary); }
.session-price { background: var(--muted); border-radius: 0.6rem; padding: 0.75rem; display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.session-price span, .winner-card span, .winner-box span { color: var(--muted-foreground); font-size: 0.75rem; display: block; }
.session-price strong { color: var(--primary); }
.session-actions { display: flex; justify-content: flex-end; gap: 0.25rem; }
.winner-box { display: flex; gap: 0.75rem; align-items: center; background: #fef3c7; color: #92400e; border-radius: 0.6rem; padding: 0.75rem; margin-bottom: 0.75rem; }
.winner-box i { font-size: 1.25rem; }
.winner-box.mini { margin: 0.75rem 0; background: #ecfdf5; color: #047857; }
.winner-head { display: flex; gap: 0.85rem; align-items: center; margin-bottom: 1rem; }
.winner-head i { color: #d97706; background: #fef3c7; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 999px; }
.winner-head strong { display: block; font-size: 1.05rem; }
.folder-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.folder-child { margin-left: 1.5rem; }
.history-list { display: grid; gap: 0.75rem; }
.history-card { display: grid; grid-template-columns: auto 44px 1fr; gap: 0.8rem; align-items: flex-start; }
.history-icon { width: 44px; height: 44px; border-radius: 999px; background: var(--primary-light); color: var(--primary); display: grid; place-items: center; }
.history-body h3 { font-size: 0.95rem; margin: 0.4rem 0; }
.history-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; color: var(--muted-foreground); font-size: 0.78rem; margin-top: 0.65rem; }
.round-card { display:flex; justify-content:space-between; align-items:center; gap:1rem; padding:.85rem 0; border-bottom:1px solid var(--border); }
.round-card:last-child { border-bottom:0; }
.user-actions { display:flex; flex-wrap:wrap; gap:.25rem; justify-content:flex-end; }
.inline-form { display:inline-flex; gap:.25rem; align-items:center; }
.mini-input { width:130px; height:32px; border:1px solid var(--border); border-radius:.4rem; padding:.25rem .45rem; font-size:.75rem; }
.upload-drop { display:block; text-align:center; border:2px dashed var(--border); border-radius:.75rem; padding:2rem; cursor:pointer; transition:border-color .2s; }
.upload-drop:hover { border-color: var(--primary); }
.bg-muted { background: var(--muted); border-radius:.5rem; }
.text-amber { color:#b45309; }
.version-pill { text-align:center; color:rgba(241,245,249,.4); font-size:.7rem; margin-bottom:.4rem; letter-spacing:.05em; }
.update-banner { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; background:linear-gradient(90deg,#1e3a8a,#2563eb); color:#fff; padding:.85rem 1.1rem; border-radius:.6rem; margin-bottom:1.25rem; box-shadow:var(--shadow-md); }
.update-banner i { font-size:1.2rem; }
.update-banner div { flex:1; min-width:200px; font-size:.9rem; }
.update-banner .btn-primary { background:#fff; color:#1d4ed8; }
@media print {
  .sidebar, .topbar, .page-header, .tabs, .filter-grid, .session-grid, .history-list, .btn:not(.print-keep) { display: none !important; }
  .main-content.sidebar-open { margin-left: 0 !important; }
  .print-doc { display: block !important; box-shadow: none; border: none; }
}

/* Plain PHP layout responsive overrides */
@media (max-width: 768px) {
  body { min-width: 0; }
  /* Sidebar luôn là drawer cố định bên trái (ẩn off-canvas, bấm menu để mở) */
  .sidebar.open {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 24px rgba(0,0,0,0.25);
    z-index: 60;
  }
  .sidebar.open.mobile-open { transform: translateX(0); }
  .sidebar-logo { min-height: 82px; height: auto; padding: 0.65rem 1rem; }
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1rem 0.5rem;
    overflow-y: auto;
    flex: 1;
  }
  .sidebar-link {
    flex: 0 0 auto;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
  }
  .sidebar-section-title { display: block; }
  .sidebar-footer {
    padding: 0 0.5rem 1rem;
    border-top: 1px solid var(--sidebar-border);
  }
  .sidebar-footer .sidebar-link { justify-content: flex-start; }
  .main-content.sidebar-open { margin-left: 0; }
  .topbar { position: sticky; padding-left: 0.75rem; }
  .topbar-menu { display: inline-flex !important; }
  .sidebar-overlay.show { display: block; }
  .table-container { width: 100%; }
  .page-header .flex { width: 100%; flex-wrap: wrap; }
  .btn { white-space: normal; }
}

.topbar-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  flex-shrink: 0;
}
.topbar-menu:hover { background: var(--muted); }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 55;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 520px) {
  .sidebar-logo-text p { display: none; }
  .page-container { padding: 0.85rem; }
  .card-body, .card-header { padding: 1rem; }
  .list-item { align-items: flex-start; flex-direction: column; }
  .list-item-meta { flex-wrap: wrap; }
}

/* Auction session editor — reference layout */
.auction-editor {
  overflow: hidden;
  background: #f8fafc;
  border-color: #d9dee8;
}
.auction-editor-head {
  min-height: 34px;
  padding: 0.35rem 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f4f6fa;
}
.auction-editor-head h2 {
  font-size: 0.92rem;
  font-weight: 800;
  color: #061735;
}
.auction-window-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1;
}
.awc-btn {
  width: 1.2rem;
  height: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.2rem;
  background: transparent;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.awc-btn:hover { background: #e2e8f0; color: #0f172a; }
.awc-btn.close { color: #ef4444; }
.awc-btn.close:hover { background: #fee2e2; color: #b91c1c; }
.auction-editor.is-maximized {
  position: fixed;
  inset: 0.45rem;
  z-index: 250;
  margin: 0 !important;
  overflow: auto;
  box-shadow: 0 24px 80px rgba(15,23,42,.28);
}
.auction-editor.is-maximized .auction-editor-form,
.auction-editor.is-maximized.ar-room-editor { min-height: calc(100vh - .9rem); }
.auction-editor.is-minimized .auction-editor-body,
.auction-editor.is-minimized .auction-editor-footer,
.auction-editor.is-minimized .auction-editor-form { display: none; }
.auction-editor-form { display: flex; flex-direction: column; min-height: min(730px, calc(100vh - 110px)); }
.auction-editor-body { padding: 0.45rem; flex: 1; }
.auction-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.55rem 0.75rem;
}
.auction-field { display: flex; flex-direction: column; gap: 0.22rem; min-width: 0; position: relative; }
.auction-field label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0f1f3d;
}
.auction-field small { font-size: 0.62rem; color: #64748b; }
.auction-field.span-12 { grid-column: span 12; }
.auction-field.span-6 { grid-column: span 6; }
.auction-field.span-4 { grid-column: span 4; }
.auction-editor .form-input,
.auction-editor .form-select {
  height: 1.55rem;
  min-height: 1.55rem;
  padding: 0.23rem 0.45rem;
  border-color: #d6dce8;
  border-radius: 0.22rem;
  background: #f8fafc;
  font-size: 0.72rem;
}
.auction-editor select.form-select { padding-right: 1.65rem; }
.money-field input { padding-right: 2.15rem !important; }
.money-field span {
  position: absolute;
  right: 0.45rem;
  bottom: 0.25rem;
  color: #64748b;
  font-size: 0.62rem;
  pointer-events: none;
}
.auction-price-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.55rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #b9c8ee;
  border-radius: 0.25rem;
  background: #eef3fb;
}
.auction-price-band .form-input { background: #fff; }
.auction-price-band label,
.current-field label { color: #1d4ed8; }
.auction-current-price {
  height: 1.55rem;
  display: flex;
  align-items: center;
  padding: 0.23rem 0.45rem;
  border: 1px solid #8da9e8;
  border-radius: 0.2rem;
  background: #dfe7fb;
  color: #1d4ed8;
  font-size: 0.9rem;
  font-weight: 900;
}
.section-caption {
  margin: 0.55rem 0 0.18rem;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
}
.qualified-table-wrap {
  overflow-x: auto;
  border: 1px solid #dbe1ec;
  border-radius: 0.28rem;
  background: #fff;
}
.qualified-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.qualified-table th {
  padding: 0.35rem 0.45rem;
  text-align: left;
  color: #64748b;
  background: #f3f5f8;
  border-bottom: 1px solid #dbe1ec;
  font-weight: 800;
}
.qualified-table td {
  padding: 0.36rem 0.45rem;
  border-bottom: 1px solid #edf1f7;
  color: #334155;
}
.qualified-table tbody tr:last-child td { border-bottom: 0; }
.qualified-table tbody tr.winner-row td { background: #fff7ed; }
.choose-win {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.24rem 0.55rem;
  border: 1px solid #8da9e8;
  border-radius: 0.25rem;
  background: #f8fafc;
  color: #1d4ed8;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}
.choose-win.active { background: #f59e0b; border-color: #d97706; color: #fff; }
.auction-rounds-accordion {
  margin-top: 0.45rem;
  border: 1px solid #dbe1ec;
  border-radius: 0.25rem;
  background: #f8fafc;
}
.auction-rounds-accordion summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.36rem 0.55rem;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.auction-rounds-accordion summary::-webkit-details-marker { display: none; }
.auction-rounds-accordion[open] summary .fa-chevron-down { transform: rotate(180deg); }
.rounds-content { padding: 0.4rem 0.55rem 0.6rem; border-top: 1px solid #e2e8f0; }
.round-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #edf1f7;
  font-size: 0.72rem;
}
.round-row span { flex: 1; color: #64748b; }
.auction-editor-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  border-top: 1px solid #dbe1ec;
  background: rgba(248, 250, 252, 0.96);
  backdrop-filter: blur(8px);
}
.footer-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn-reset {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fff;
  font-size: 0.7rem;
  padding: 0.28rem 0.55rem;
}
.empty-state.compact { padding: 1rem; }
.empty-state.compact i { font-size: 1.1rem; margin-bottom: 0.35rem; }

@media (max-width: 900px) {
  .auction-editor-form { min-height: auto; }
  .auction-field.span-6,
  .auction-field.span-4 { grid-column: span 12; }
  .auction-price-band { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .auction-editor-head { align-items: flex-start; }
  .auction-window-controls { display: none; }
  .auction-editor-body { padding: 0.65rem; }
  .auction-form-grid { gap: 0.65rem; }
  .auction-editor .form-input,
  .auction-editor .form-select,
  .auction-current-price { height: 2.05rem; min-height: 2.05rem; font-size: 0.82rem; }
  .auction-editor-footer { position: static; flex-direction: column; align-items: stretch; }
  .footer-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .auction-editor-footer .btn { width: 100%; }
}
