:root {
  --bg: #0a0a0f;
  --surface: #13131d;
  --surface2: #1c1c2e;
  --border: rgba(255,255,255,0.07);
  --accent: #6c63ff;
  --accent2: #ff6584;
  --accent3: #43e8b0;
  --text: #f0f0f8;
  --muted: #8888aa;
  --glow: rgba(108,99,255,0.25);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; min-height: 100vh; }
.hidden { display: none !important; }

/* AUTH GATE */
.auth-gate { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3rem; max-width: 400px; width: 100%; text-align: center; position: relative; }
.auth-card .logo-line { margin-bottom: 1.5rem; justify-content: center; }
.auth-card .logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.8rem; background: linear-gradient(135deg, var(--accent), var(--accent3)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-card .logo span { color: var(--accent2); -webkit-text-fill-color: var(--accent2); }
.auth-card h2 { font-family: 'Syne', sans-serif; font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }
.auth-error { color: var(--accent2); font-size: 0.85rem; margin-top: 1rem; min-height: 1.2rem; }
.auth-admin { background: rgba(67,232,176,0.08); border: 1px solid rgba(67,232,176,0.25); color: var(--text); border-radius: 10px; padding: 0.7rem 1rem; font-size: 0.85rem; margin-bottom: 1.4rem; text-align: center; }
.auth-admin strong { color: var(--accent3); }
.auth-restricted { background: rgba(255,200,80,0.08); border: 1px solid rgba(255,200,80,0.25); color: #ffc850; border-radius: 10px; padding: 0.7rem 1rem; font-size: 0.8rem; line-height: 1.5; margin-bottom: 1.4rem; text-align: left; }

/* ADMIN WELCOME */
.admin-welcome { display: flex; align-items: center; gap: 0.8rem; background: var(--surface); border: 1px solid rgba(67,232,176,0.2); border-radius: 12px; padding: 0.9rem 1.2rem; margin-bottom: 1.5rem; }
.admin-welcome-icon { font-size: 1.4rem; }
.admin-welcome-text { font-size: 0.95rem; color: var(--text); }
.admin-welcome-text strong { color: var(--accent3); }
.admin-welcome-sub { font-size: 0.78rem; color: var(--muted); }

.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0.3rem; line-height: 1; transition: color 0.2s; }
.modal-close:hover { color: var(--text); }

/* NAV */
.logo-line { display: flex; align-items: center; gap: 0.6rem; }
.logo-img { width: 40px; height: 40px; flex-shrink: 0; display: block; }
.logo-img-sm { width: 34px; height: 34px; }
.logo-link { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.admin-nav { background: rgba(10,10,15,0.9); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 64px; position: sticky; top: 0; z-index: 100; }
.admin-nav .logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.3rem; background: linear-gradient(135deg, var(--accent), var(--accent3)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.admin-nav .logo span { color: var(--accent2); -webkit-text-fill-color: var(--accent2); }
.admin-badge { background: rgba(255,101,132,0.15); color: var(--accent2); font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 6px; margin-left: 0.5rem; vertical-align: middle; -webkit-text-fill-color: var(--accent2); }
.admin-nav-right { display: flex; align-items: center; gap: 1rem; }
.admin-user { font-size: 0.85rem; color: var(--muted); }
.admin-user-btn { display: flex; align-items: center; gap: 0.55rem; background: none; border: none; cursor: pointer; padding: 0.3rem 0.5rem; border-radius: 10px; transition: background 0.2s; }
.admin-user-btn:hover { background: rgba(255,255,255,0.05); }
.admin-avatar, .admin-avatar-circle { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.admin-avatar-circle { background: linear-gradient(135deg, var(--accent), var(--accent3)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; }
.admin-avatar[hidden], .admin-avatar-circle[hidden],
.admin-profile-avatar[hidden], .admin-profile-avatar-circle[hidden] { display: none !important; }

/* ADMIN PROFILE MODAL */
.admin-profile-card { display: flex; align-items: center; gap: 1rem; background: var(--surface2); border: 1px solid var(--border); padding: 1rem; border-radius: 12px; margin-bottom: 1rem; }
.admin-profile-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.admin-profile-avatar-circle { background: linear-gradient(135deg, var(--accent), var(--accent3)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; }
.admin-profile-name { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1rem; }
.admin-profile-email { font-size: 0.8rem; color: var(--muted); }

/* BUTTONS */
.btn-primary { background: linear-gradient(135deg, var(--accent), #9b88ff); color: #fff; border: none; cursor: pointer; padding: 0.8rem 2rem; border-radius: 12px; font-size: 1rem; font-weight: 600; font-family: 'DM Sans', sans-serif; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 4px 24px var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px var(--glow); }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--muted); padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; transition: color 0.2s, border-color 0.2s; }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 0.35rem 0.7rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; cursor: pointer; border: none; font-family: 'DM Sans', sans-serif; transition: all 0.2s; }
.btn-approve { background: rgba(67,232,176,0.15); color: var(--accent3); }
.btn-approve:hover { background: var(--accent3); color: #000; }
.btn-reject { background: rgba(255,101,132,0.15); color: var(--accent2); }
.btn-reject:hover { background: var(--accent2); color: #fff; }
.btn-delete { background: rgba(255,255,255,0.05); color: var(--muted); }
.btn-delete:hover { background: #ff4757; color: #fff; }
.btn-edit { background: rgba(108,99,255,0.15); color: var(--accent); }
.btn-edit:hover { background: var(--accent); color: #fff; }
.btn-preview { background: rgba(255,200,80,0.15); color: #ffc850; }
.btn-preview:hover { background: #ffc850; color: #000; }

/* DASHBOARD */
.dashboard { padding: 2rem; max-width: 1400px; margin: 0 auto; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.3rem; display: flex; align-items: center; gap: 1rem; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.si-blue   { background: rgba(108,99,255,0.15); }
.si-yellow { background: rgba(255,200,80,0.15); }
.si-green  { background: rgba(67,232,176,0.12); }
.si-purple { background: rgba(180,100,255,0.12); }
.si-red    { background: rgba(255,101,132,0.12); }
.si-pink   { background: rgba(255,150,180,0.12); }
.stat-num { font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat-lbl { font-size: 0.78rem; color: var(--muted); }

/* TABS */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab { background: none; border: none; color: var(--muted); padding: 0.8rem 1.5rem; font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* FILTERS */
.filter-bar { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-select { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.9rem; padding: 0.6rem 1rem; outline: none; cursor: pointer; }
.filter-select option { background: var(--surface); }
.filter-search { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.9rem; padding: 0.6rem 1rem; outline: none; min-width: 250px; }
.filter-search:focus { border-color: var(--accent); }

/* TABLE */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.admin-table th { background: var(--surface2); text-align: left; padding: 0.8rem 1rem; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 0.7rem 1rem; font-size: 0.88rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(108,99,255,0.03); }
.table-loading { text-align: center; color: var(--muted); padding: 2rem !important; }
.table-title { font-weight: 600; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* PAGER */
.pager-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; padding: 0.2rem 0.2rem 0; }
.pager-info { font-size: 0.82rem; color: var(--muted); }
.pager-controls { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.pager-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.82rem; padding: 0.4rem 0.75rem; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.pager-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-btn.pager-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* STATUS BADGES */
.status-badge { display: inline-flex; padding: 0.2rem 0.6rem; border-radius: 100px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.status-pending  { background: rgba(255,200,80,0.15); color: #ffc850; }
.status-approved { background: rgba(67,232,176,0.12); color: var(--accent3); }
.status-rejected { background: rgba(255,101,132,0.12); color: var(--accent2); }
.status-open     { background: rgba(255,101,132,0.12); color: var(--accent2); }
.status-resolved { background: rgba(67,232,176,0.12); color: var(--accent3); }

/* TOAST */
.toast { position: fixed; bottom: 2rem; right: 2rem; z-index: 9999; background: var(--surface2); border: 1px solid rgba(67,232,176,0.4); color: var(--accent3); padding: 0.9rem 1.4rem; border-radius: 12px; font-size: 0.9rem; font-weight: 500; transform: translateY(80px); opacity: 0; transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1.5rem; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 2rem; width: 100%; max-width: 420px; position: relative; }
.modal h3 { font-family: 'Syne', sans-serif; font-size: 1.3rem; margin-bottom: 1.2rem; }
.modal-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin: 0.8rem 0 0.3rem; }
.modal-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.9rem; padding: 0.65rem 0.9rem; outline: none; }
.modal-input:focus { border-color: var(--accent); }
.modal-input option { background: var(--surface); }
.modal-textarea { resize: vertical; min-height: 110px; }
.table-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }
.btn-clear-history { margin-left: auto; font-size: 0.85rem; padding: 0.5rem 0.9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.7rem; margin-top: 1.4rem; }
.btn-sm-modal { padding: 0.55rem 1.2rem; font-size: 0.85rem; border-radius: 8px; }

/* PREVIEW MODAL */
.modal-preview { max-width: 720px; }
.preview-container { margin-top: 0.5rem; height: 65vh; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg); }
.preview-container iframe { width: 100%; height: 100%; border: none; background: #fff; }

/* REVIEW VIEW MODAL */
.modal-review { max-width: 560px; }
.review-view-stars { font-size: 1.3rem; color: #ffc850; margin-bottom: 0.5rem; }
.review-view-name { font-weight: 700; color: var(--text); margin-bottom: 0.8rem; }
.review-view-msg { color: var(--muted); line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); background: var(--surface2); border-radius: 10px; padding: 1rem; }
.review-view-status { margin-top: 1rem; }

@media (max-width: 768px) {
  .dashboard { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-direction: column; }
  .filter-search { min-width: unset; width: 100%; }
  .admin-nav { padding: 0 1rem; }

  /* PREVIEW MODAL — compact on phones so it fits the screen */
  .modal-preview { padding: 1.5rem 1rem 1.25rem; }
  .preview-container { height: 45vh; }
  .modal-actions { margin-top: 1rem; }
}

@media (max-width: 480px) {
  .auth-gate { padding: 1rem; }
  .auth-card { padding: 2rem 1.2rem; }
  .auth-card .logo { font-size: 1.4rem; }
  .logo-img-sm { width: 30px; height: 30px; }
}
