/* PlagiTrack — Nexus-inspired theme + green accents */
:root, [data-theme="dark"] {
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --primary-light: #4ade80;
  --brand-orange: #FF4A17;
  --brand-orange-dark: #E03D0F;
  --brand-orange-light: #FF7A52;
  --accent: #FF4A17;
  --accent-2: #22c55e;
  --success: #22c55e;
  --warning: #FF7A52;
  --danger: #ef4444;
  --admin: #dc2626;
  --agent: #22c55e;
  --bg: #0B0B0C;
  --bg-card: #181818;
  --bg-elevated: #1A1A1D;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --text: #FAFAFA;
  --text-muted: #A1A1AA;
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.22);
  --shadow-btn: 0 4px 14px rgba(255, 74, 23, 0.22);
  --shadow-btn-hover: 0 6px 18px rgba(0, 0, 0, 0.28);
  --surface-accent: #FF4A17;
  --surface-green: #22c55e;
  --gradient: #FF4A17;
  --gradient-hero: #0B0B0C;
  --sidebar-gradient: #111113;
  --radius: 16px;
  --radius-sm: 12px;
  --font: 'Poppins', system-ui, sans-serif;
  --font-display: 'Poppins', system-ui, sans-serif;
  --nav-h: 72px;
  --sidebar-w: 256px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #FAFAFA;
  --bg-card: #ffffff;
  --bg-elevated: #F4F4F5;
  --bg-glass: rgba(24, 24, 24, 0.04);
  --border: rgba(24, 24, 24, 0.1);
  --sidebar-border: rgba(24, 24, 24, 0.08);
  --text: #181818;
  --text-muted: #71717A;
  --shadow: 0 20px 40px -12px rgba(24, 24, 24, 0.08);
  --shadow-sm: 0 4px 16px rgba(24, 24, 24, 0.06);
  --gradient-hero: #FAFAFA;
  --sidebar-gradient: #ffffff;
  --primary-light: #16a34a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background 0.35s, color 0.35s;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(34, 197, 94, 0.35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(249, 115, 22, 0.45); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Glass card */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.glass:hover { border-color: rgba(34, 197, 94, 0.2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; transition: all var(--transition);
  white-space: nowrap; text-align: center; line-height: 1.25;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  min-height: 42px;
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--brand-orange); color: #fff; box-shadow: var(--shadow-btn); }
.btn-primary:hover { background: var(--brand-orange-dark); transform: translateY(-1px); box-shadow: var(--shadow-btn-hover); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: var(--bg-glass); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-elevated); border-color: rgba(255, 74, 23, 0.35); }
.btn-accent { background: var(--brand-orange); color: #fff; box-shadow: var(--shadow-btn); }
.btn-accent:hover { background: var(--brand-orange-dark); transform: translateY(-1px); }
.btn-admin { background: #dc2626; color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,0.25); }
.btn-agent { background: var(--surface-green); color: #fff; box-shadow: 0 4px 14px rgba(34, 197, 94, 0.25); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.35); }
.btn-danger:hover { background: rgba(239,68,68,0.18); }
.btn-sm { padding: 8px 15px; font-size: 0.8rem; border-radius: 10px; min-height: 38px; }
.btn-lg { padding: 14px 30px; font-size: 1rem; border-radius: 14px; min-height: 48px; }
.btn-block { width: 100%; }
.btn-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px;
}
.btn-row .btn { flex: 1 1 140px; min-width: 0; }
.action-btns {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.action-btns .btn { flex: 1 1 auto; min-width: 88px; }
.table-actions { min-width: 116px; vertical-align: middle; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn.is-loading { opacity: 0.9; cursor: wait; pointer-events: none; }
.btn-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  border-radius: 50%; animation: btnSpin 0.65s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }
.report-upload-btn { min-height: 44px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; letter-spacing: 0.02em; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 13px 16px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem; font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); opacity: 0.65; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 100px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-primary { background: rgba(34,197,94,0.18); color: var(--primary-light); }
.badge-accent { background: rgba(255, 74, 23, 0.18); color: var(--brand-orange-light); }
.badge-warn { background: rgba(245,158,11,0.18); color: var(--warning); }
.badge-success { background: rgba(16,185,129,0.18); color: var(--success); }
.badge-academic { background: rgba(255, 74, 23,0.18); color: var(--primary-light); }
.badge-advanced { background: rgba(16,185,129,0.18); color: var(--accent); }

/* Status pills */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 100px; font-size: 0.74rem; font-weight: 600;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-submitted { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.status-under_review, .status-pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-processing, .status-in_progress { background: rgba(6,182,212,0.15); color: #06b6d4; }
.status-report_ready { background: rgba(34,197,94,0.15); color: var(--primary-light); }
.status-completed { background: rgba(16,185,129,0.15); color: var(--success); }
.status-rejected { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Modals */
.payment-modal {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(6px); padding: 24px;
  animation: fadeIn 0.25s ease;
}
.payment-modal.hidden { display: none; }
.payment-modal-card { max-width: 480px; width: 100%; padding: 28px; animation: scaleIn 0.3s ease; }
.proof-modal-card {
  max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.proof-modal-body { overflow-y: auto; flex: 1; min-height: 0; }
.proof-modal-img {
  max-width: 100%; max-height: 50vh; width: auto; height: auto;
  object-fit: contain; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 0 auto;
}
.proof-modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.user-manage-modal { max-width: 640px; max-height: 92vh; overflow-y: auto; }
.user-sub-list { margin: 16px 0; }
.user-sub-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--bg-glass); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
}
.upload-zone.mini { padding: 20px; text-align: center; }
.file-input-hidden {
  position: absolute; width: 0; height: 0; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.report-upload-zone {
  position: relative;
}
.file-input-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.report-upload-zone .report-browse-btn {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
.report-processing-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 0.85rem;
  color: var(--text);
}
.report-processing-banner .btn-spinner { width: 18px; height: 18px; flex-shrink: 0; }
.report-processing-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--accent);
}
.report-processing-inline .btn-spinner { width: 14px; height: 14px; }
.report-upload-wrap-ai { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.report-submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.report-submit-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text);
}
.report-submit-icon { font-size: 1.25rem; }
.report-submit-btn { min-height: 44px; padding: 10px 24px; font-weight: 700; }
.client-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.client-file-link:hover { color: #4ade80; }
.client-file-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.customer-report-buffer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}
.customer-report-buffer .btn-spinner { width: 16px; height: 16px; flex-shrink: 0; }
.customer-report-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.customer-report-cell.ready .customer-report-score { color: var(--success); font-size: 0.9rem; }
.customer-orders-table { min-width: 880px; }
.customer-score-val { color: var(--success); font-size: 0.95rem; font-weight: 700; }
.customer-score-val.muted { color: var(--text-muted); font-weight: 600; font-size: 0.85rem; }
.customer-orders-table th:nth-child(4),
.customer-orders-table th:nth-child(5) { min-width: 130px; }
.processing-job-card { position: relative; padding-top: 8px; }
.job-card-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.job-card-close-btn:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}
.processing-jobs-card.collapsed .processing-jobs-body { display: none; }
.processing-jobs-card.collapsed .job-panel-close-btn .close-label { display: none; }
.processing-jobs-card:not(.collapsed) .job-panel-close-btn::after { content: none; }
.processing-jobs-card.collapsed .job-panel-close-btn::after { content: 'Show'; margin-left: 4px; }


.report-upload-icon { font-size: 1.75rem; display: block; margin-bottom: 8px; }
.report-upload-text { margin: 0 0 4px; font-weight: 600; font-size: 0.9rem; }
.report-upload-hint { display: block; color: var(--text-muted); margin-bottom: 12px; }
.report-browse-btn { margin-top: 4px; }
.report-file-preview { margin-top: 10px; }
.report-file-preview.hidden { display: none; }
.report-selected-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: var(--radius-sm);
}
.report-selected-icon { font-size: 1.4rem; flex-shrink: 0; }
.report-selected-info { flex: 1; min-width: 0; }
.report-selected-info strong { display: block; font-size: 0.9rem; word-break: break-all; }
.report-selected-info small { color: var(--text-muted); font-size: 0.8rem; }
.report-selected-card.is-uploading {
  background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.35);
}
.report-selected-card .btn-spinner.report-selected-icon {
  width: 22px; height: 22px; border-width: 2px;
  border-color: rgba(34, 197, 94, 0.25); border-top-color: var(--primary);
}
.report-current-file { margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }

/* User portal — ready reports */
.ready-report-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 16px 18px; margin-bottom: 10px;
  background: rgba(34, 197, 94, 0.06); border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-sm);
}
.ready-report-card:last-child { margin-bottom: 0; }
.ready-report-info { flex: 1; min-width: 200px; }
.ready-report-info strong { display: inline-block; margin-right: 8px; }
.ready-report-info small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 0.82rem; }
.ready-report-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.ready-report-actions .btn { min-width: 120px; }
.report-file-tag { font-size: 0.82rem; color: var(--primary-light); }

/* Your Reports page — full width */
.reports-page-wrap { width: 100%; }
.reports-page-header {
  margin-bottom: 22px; align-items: flex-start;
}
.reports-page-header h3 { font-size: 1.2rem; margin-bottom: 6px; }
.reports-page-intro {
  font-size: 0.88rem; color: var(--text-muted); margin: 0; max-width: 640px;
}
.reports-grid {
  display: flex; flex-direction: column; gap: 16px; width: 100%;
}
.report-full-card {
  width: 100%; padding: 22px 24px;
  display: flex; flex-direction: column; gap: 18px;
  border: 1px solid var(--border); transition: border-color var(--transition), box-shadow var(--transition);
}
.report-full-card:hover { border-color: rgba(34, 197, 94, 0.35); box-shadow: var(--shadow-sm); }
.report-full-body {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 20px; width: 100%;
}
.report-full-doc {
  display: flex; align-items: flex-start; gap: 14px; flex: 1 1 280px; min-width: 0;
}
.report-full-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }
.report-full-titles strong { display: block; font-size: 1.05rem; margin-bottom: 6px; word-break: break-word; }
.report-full-titles .badge { margin-bottom: 6px; }
.report-full-titles small { display: block; color: var(--text-muted); font-size: 0.8rem; }
.report-full-meta {
  display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 16px;
  flex: 2 1 480px; width: 100%;
}
.report-meta-item { display: flex; flex-direction: column; gap: 4px; }
.report-meta-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
}
.report-meta-value { font-size: 0.9rem; font-weight: 600; word-break: break-word; }
.report-meta-highlight { color: var(--success); font-size: 1rem; }
.report-full-actions {
  width: 100%; justify-content: flex-end; padding-top: 4px; border-top: 1px solid var(--border);
}
.reports-empty {
  padding: 56px 24px; text-align: center; color: var(--text-muted);
  background: var(--bg-glass); border: 1px dashed var(--border); border-radius: var(--radius);
  width: 100%;
}
.reports-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.reports-empty strong { display: block; color: var(--text); margin-bottom: 8px; }
.reports-empty p { max-width: 360px; margin: 0 auto 16px; font-size: 0.9rem; line-height: 1.6; }

/* Report preview modal */
.report-preview-modal { padding: 16px; }
.report-preview-card {
  max-width: 960px; width: 100%; max-height: 92vh;
  display: flex; flex-direction: column; padding: 24px;
}
.report-preview-meta { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.82rem; }
.report-preview-body {
  flex: 1; min-height: 360px; max-height: calc(92vh - 200px);
  overflow: hidden; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-elevated);
}
.report-preview-frame {
  width: 100%; height: 100%; min-height: 360px;
  border: none; display: block; background: #fff;
}
.report-preview-fallback {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 280px; padding: 32px 24px; text-align: center; color: var(--text-muted);
}
.report-preview-actions { margin-top: 16px; margin-bottom: 0; }
.payment-modal .card-header { display: flex; justify-content: space-between; align-items: center; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; max-width: 920px; }
.settings-tabs { padding: 14px; display: flex; flex-direction: column; gap: 6px; height: fit-content; }
.settings-tab {
  padding: 13px 16px; border: none; background: none; color: var(--text-muted);
  text-align: left; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-size: 0.88rem;
  transition: all var(--transition);
}
.settings-tab:hover { background: var(--bg-glass); color: var(--text); }
.settings-tab.active { background: rgba(34, 197, 94, 0.12); color: var(--primary-light); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-orange); }
.settings-panel { padding: 28px; }
.pref-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; font-size: 0.9rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.pref-row:last-child { border-bottom: none; }

/* Helpdesk */
.ticket-row {
  padding: 16px 18px; margin-bottom: 10px; background: var(--bg-glass);
  border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--border);
  transition: all var(--transition);
}
.ticket-row:hover { border-color: var(--primary); background: rgba(34,197,94,0.06); transform: translateX(4px); }
.ticket-modal-card { max-width: 640px; max-height: 90vh; overflow-y: auto; }
.ticket-thread { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.ticket-msg { padding: 16px; border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--border); }
.ticket-msg.user { border-left: 3px solid var(--primary); }
.ticket-msg.admin, .ticket-msg.agent { border-left: 3px solid var(--accent); }
.ticket-msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.88rem; }
.ticket-msg p { font-size: 0.9rem; line-height: 1.6; margin-bottom: 6px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); padding: 14px 18px;
  background: var(--bg-glass); border-bottom: 1px solid var(--border);
}
td { padding: 15px 18px; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: rgba(34,197,94,0.04); }
tbody tr:last-child td { border-bottom: none; }

/* Toast & popup */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 500;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm); padding: 14px 42px 14px 18px; font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow); transform: translateY(80px); opacity: 0; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 380px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-msg { display: block; line-height: 1.5; }
.toast-close,
.popup-alert-close {
  position: absolute; top: 8px; right: 10px;
  width: 28px; height: 28px; border: none; border-radius: 8px;
  background: rgba(255,255,255,0.06); color: var(--text-muted);
  font-size: 1.2rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: background var(--transition), color var(--transition);
}
.toast-close:hover,
.popup-alert-close:hover { background: rgba(255,74,23,0.15); color: var(--text); }

.popup-alert {
  position: fixed; top: 88px; right: 24px; z-index: 400;
  background: var(--bg-elevated); border: 1px solid rgba(34,197,94,0.4);
  border-radius: var(--radius); padding: 36px 24px 20px; box-shadow: var(--shadow);
  max-width: 360px; animation: slideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.popup-alert-msg {
  display: block; margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); line-height: 1.5;
}

/* Login screen — see TurniCheckr-style block below */

/* Dashboard layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-gradient);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); padding: 0 20px;
  border-bottom: 1px solid var(--sidebar-border); flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.05rem; color: var(--text);
}
.sidebar-logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--gradient); display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(255, 74, 23, 0.35);
}
.sidebar-user {
  padding: 16px; border-bottom: 1px solid var(--sidebar-border); flex-shrink: 0;
}
.sidebar-user-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg-glass); border: 1px solid var(--border);
}
.sidebar-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient); display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem; color: #fff; flex-shrink: 0;
}
.sidebar-user-info strong { display: block; font-size: 0.88rem; font-weight: 600; }
.sidebar-user-info span { font-size: 0.75rem; color: var(--text-muted); }
.sidebar-brand {
  padding: 24px 20px; border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-weight: 800; font-size: 1.08rem;
  background: var(--text); color: var(--primary-light);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.sidebar-brand small {
  display: block; font-size: 0.68rem; font-weight: 500; color: var(--text-muted);
  margin-top: 3px; -webkit-text-fill-color: var(--text-muted);
}
.sidebar-nav {
  flex: 1; padding: 16px 12px; overflow-y: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; width: 0; height: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 14px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted);
  background: none; border: none; cursor: pointer; font-family: inherit;
  text-align: left; transition: all var(--transition); margin-bottom: 2px;
}
.sidebar-logo-icon.admin {
  background: #dc2626;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}
.sidebar-logo-icon.agent {
  background: var(--surface-green);
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35);
}
.sidebar-avatar.admin { background: #dc2626; }
.sidebar-avatar.agent { background: var(--surface-green); }
.sidebar-staff .nav-item.active {
  background: rgba(255, 74, 23, 0.12);
}
.sidebar-staff.sidebar-admin .nav-item.active {
  background: rgba(220, 38, 38, 0.12); color: #f87171;
}
.sidebar-staff.sidebar-admin .nav-item.active::before { background: #dc2626; }
.sidebar-staff.sidebar-agent .nav-item.active {
  background: rgba(8, 145, 178, 0.12); color: #22d3ee;
}
.sidebar-staff.sidebar-agent .nav-item.active::before { background: #22c55e; }
.sidebar-staff.sidebar-admin .nav-item.active .nav-icon { color: #f87171; }
.sidebar-staff.sidebar-agent .nav-item.active .nav-icon { color: #22d3ee; }
.nav-icon {
  width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0; opacity: 0.7;
}
.nav-item svg, .nav-item .nav-icon { flex-shrink: 0; opacity: 0.7; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item:hover svg, .nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active {
  background: rgba(255, 74, 23, 0.15); color: var(--primary-light); font-weight: 600;
}
.nav-item.active svg, .nav-item.active .nav-icon { opacity: 1; color: var(--primary-light); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.sidebar-nav .nav-item { position: relative; }
.nav-badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 700;
  display: inline-grid; place-items: center;
}
.nav-badge.hidden { display: none; }
.nav-badge.nav-badge-info {
  background: rgba(255, 74, 23,0.18); color: var(--primary-light);
}
.sidebar-admin .nav-badge.nav-badge-info {
  background: rgba(248,113,113,0.15); color: #fca5a5;
}
.sidebar-agent .nav-badge.nav-badge-info {
  background: rgba(45,212,191,0.15); color: #5eead4;
}
.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99;
  backdrop-filter: blur(2px); animation: fadeIn 0.2s ease;
}

.main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 0 28px; height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky; top: 0; z-index: 90;
}
.topbar h1 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user-name { font-size: 0.85rem; color: var(--text-muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 28px 32px; flex: 1; max-width: 1400px; width: 100%; }
.page { display: none; }
.page.active { display: block; animation: pageIn 0.35s ease; }

/* Welcome banner */
.welcome-banner {
  padding: 28px 32px; margin-bottom: 24px; border-radius: var(--radius);
  background: rgba(255, 74, 23, 0.1);
  border: 1px solid rgba(255, 74, 23, 0.22); position: relative; overflow: hidden;
}
.welcome-banner::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(34,197,94,0.15);
}
.welcome-banner h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; margin-bottom: 6px; position: relative; }
.welcome-banner p { color: var(--text-muted); font-size: 0.92rem; position: relative; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.stat-card {
  padding: 24px; position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient); opacity: 0.85;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .lbl { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 10px; font-weight: 500; }
.stat-card .val {
  font-family: var(--font-display); font-size: 1.85rem; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.1;
}
.stat-card .sub { font-size: 0.72rem; color: var(--success); margin-top: 6px; }

.card { padding: 26px; margin-bottom: 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.card-header h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* Quick actions */
.quick-actions { display: flex; flex-direction: column; gap: 10px; }
.quick-actions .btn { justify-content: flex-start; padding: 14px 18px; font-size: 0.88rem; }

/* Empty state */
.empty-state {
  padding: 48px 24px; text-align: center; color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.6; }
.empty-state p { font-size: 0.9rem; max-width: 280px; margin: 0 auto; }

/* Service tabs */
.service-tabs {
  display: flex; gap: 6px; margin-bottom: 24px;
  background: var(--bg-glass); padding: 6px; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.service-tab {
  flex: 1; padding: 12px 16px; border-radius: 10px; border: none;
  background: transparent; color: var(--text-muted); font-weight: 600;
  font-size: 0.875rem; cursor: pointer; font-family: inherit; transition: all var(--transition);
}
.service-tab:hover { color: var(--text); }
.service-tab.active { color: #fff; }
.service-tab.active:not(.academic):not(.advanced) { background: var(--primary); box-shadow: 0 4px 12px rgba(34,197,94,0.35); }
.service-tab.active.academic { background: var(--surface-green); box-shadow: var(--shadow-btn); }
.service-tab.active.advanced { background: var(--brand-orange); box-shadow: var(--shadow-btn); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 28px; text-align: center; cursor: pointer; transition: all var(--transition);
  background: var(--bg-glass);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary); background: rgba(34,197,94,0.06);
  transform: scale(1.01);
}

/* Package cards */
.pkg-card { padding: 30px; position: relative; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); cursor: pointer; }
.pkg-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.pkg-card.featured { border-color: rgba(34,197,94,0.5); box-shadow: 0 0 0 1px rgba(34,197,94,0.2), var(--shadow-sm); }
.pkg-card.selected {
  border-color: var(--primary); background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22), var(--shadow);
  transform: translateY(-4px);
}
.pkg-card.selected:hover { transform: translateY(-4px); }
.pkg-selected-tag {
  position: absolute; top: -12px; right: 16px;
  background: var(--success); color: #fff; font-size: 0.68rem; font-weight: 700;
  padding: 5px 14px; border-radius: 100px; text-transform: uppercase; letter-spacing: 0.04em;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.pkg-card .tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--gradient); color: #fff; font-size: 0.68rem; font-weight: 700;
  padding: 5px 16px; border-radius: 100px; text-transform: uppercase; letter-spacing: 0.04em;
}
.pkg-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.pkg-validity { font-size: 0.78rem; color: var(--success); margin: 6px 0 10px; }

.logo-img { display: block; height: 68px; width: auto; object-fit: contain; }
.sidebar-logo-img { display: block; height: 52px; width: auto; max-width: 100%; object-fit: contain; }
.table-download-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.table-download-actions .btn-ai-dl { background: linear-gradient(135deg, #10b981, #059669); border-color: transparent; }

.pricing-toolbar {
  display: flex; justify-content: flex-end; margin-bottom: 28px;
}
.portal-pricing-toolbar { margin-bottom: 16px; }
.pricing-service-title {
  text-align: center; font-size: 1rem; font-weight: 700; margin: 0 0 20px;
}
.pricing-service-title.academic { color: var(--primary-light); }
.pricing-service-title.advanced { color: #34d399; }
.pricing-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px;
}
.pricing-plan-grid { grid-template-columns: repeat(3, 1fr); }

.currency-switcher { position: relative; }
.currency-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 0.88rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.currency-trigger:hover { border-color: var(--primary); }
.currency-globe, .currency-chevron {
  width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.currency-chevron { width: 16px; height: 16px; opacity: 0.6; }
.currency-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 160px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; z-index: 300;
}
.currency-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: none; border-radius: 10px;
  background: transparent; color: var(--text); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; font-family: inherit; text-align: left;
}
.currency-option:hover { background: var(--bg-glass); }
.currency-option.active { color: var(--primary-light); background: rgba(255, 74, 23,0.1); }
.currency-option.active::after {
  content: '✓'; margin-left: auto; font-size: 0.85rem; color: var(--primary-light);
}
.currency-region {
  font-size: 0.72rem; font-weight: 500; color: var(--text-muted); min-width: 22px;
}

.custom-plan-card {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 24px 28px; margin-top: 8px; border-radius: 18px;
  border: 1px solid rgba(255, 74, 23, 0.35);
  background: rgba(255, 74, 23, 0.08);
}
.custom-plan-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: var(--brand-orange);
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(255, 74, 23, 0.28);
}
.custom-plan-icon svg {
  width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.custom-plan-body { flex: 1; min-width: 200px; }
.custom-plan-body h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.custom-plan-body p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; margin: 0; }
.custom-plan-wa {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 100px; font-weight: 700; font-size: 0.88rem;
  background: #22c55e; color: #fff; text-decoration: none; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(34,197,94,0.35); border: none;
}
.custom-plan-wa svg {
  width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2;
}
.custom-plan-wa:hover { background: #16a34a; color: #fff; transform: translateY(-1px); }
.pkg-price { font-family: var(--font-display); font-size: 2.3rem; font-weight: 800; margin: 14px 0 6px; letter-spacing: -0.03em; }
.pkg-credits { color: var(--accent); font-weight: 700; font-size: 0.95rem; margin-bottom: 16px; }

/* Payment methods */
.pay-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.pay-method {
  padding: 16px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; text-align: center; font-size: 0.85rem; font-weight: 600;
  transition: all var(--transition); background: var(--bg-glass);
}
.pay-method:hover { border-color: rgba(34,197,94,0.3); }
.pay-method.selected { border-color: var(--primary); background: rgba(34,197,94,0.12); box-shadow: 0 0 0 3px rgba(34,197,94,0.1); }
.pay-method .icon { font-size: 1.5rem; margin-bottom: 8px; }

/* Promo banner */
.promo-banner {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(16,185,129,0.28); border-radius: var(--radius);
  padding: 22px 26px; margin-top: 22px; text-align: center;
}
.promo-banner strong { color: var(--accent); }
.promo-banner a { color: var(--primary-light); font-weight: 700; }

/* Theme & notif */
.theme-btn, .notif-btn {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  background: var(--bg-glass); border: 1px solid var(--border);
  cursor: pointer; display: grid; place-items: center; font-size: 1.1rem;
  transition: all var(--transition);
}
.theme-btn:hover, .notif-btn:hover { background: var(--bg-elevated); border-color: rgba(34,197,94,0.3); }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 50%; background: var(--danger); color: #fff;
  font-size: 0.62rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--bg-card);
}

.credit-display { display: flex; gap: 10px; flex-wrap: wrap; }
.credit-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 600;
  background: var(--bg-glass); border: 1px solid var(--border);
  transition: border-color var(--transition);
}
.credit-pill.academic { border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); }
.credit-pill.advanced { border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.08); }

.logo-mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--gradient);
  display: grid; place-items: center; font-weight: 800; color: #fff;
}

.mobile-toggle {
  display: none; background: var(--bg-glass); border: 1px solid var(--border);
  color: var(--text); font-size: 1.3rem; cursor: pointer; width: 42px; height: 42px;
  border-radius: var(--radius-sm); transition: background var(--transition);
}
.mobile-toggle:hover { background: var(--bg-elevated); }

/* WhatsApp */
.whatsapp-float {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 28px rgba(37, 211, 102, 0.45);
  transition: transform 0.25s, box-shadow 0.25s;
}
.whatsapp-float:hover { transform: scale(1.1); box-shadow: 0 12px 36px rgba(37, 211, 102, 0.55); }
.whatsapp-float svg { width: 30px; height: 30px; fill: currentColor; }

/* Hero auth card */
.auth-card { padding: 32px; border-radius: 20px; }
.auth-card h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.auth-card .sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 22px; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg-glass); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.auth-tab {
  flex: 1; padding: 10px; border: none; border-radius: 8px; background: transparent;
  color: var(--text-muted); font-size: 0.875rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.auth-tab.active { background: var(--gradient); color: #fff; box-shadow: var(--shadow-btn); }
.auth-panel { display: none; }
.auth-panel.active { display: block; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 0.82rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary-light); font-weight: 600; }

/* TurniCheckr-style dashboard */
.dash-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 28px;
}
.dash-header h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.dash-header p { font-size: 0.9rem; color: var(--text-muted); }
.credits-card {
  padding: 24px; margin-bottom: 24px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
}
.credits-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.credits-card-head h3 { font-size: 0.95rem; font-weight: 600; }
.credits-card-head span { font-size: 0.82rem; color: var(--text-muted); }
.credits-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.credit-block label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); display: block; margin-bottom: 8px; }
.credit-block .credit-val { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; }
.credit-block.academic .credit-val { color: var(--primary-light); }
.credit-block.advanced .credit-val { color: var(--accent); }
.credit-progress { height: 6px; background: var(--bg-glass); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.credit-progress-fill { height: 100%; border-radius: 99px; background: var(--gradient); transition: width 0.4s ease; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.status-card {
  padding: 20px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  transition: border-color var(--transition), transform var(--transition);
}
.status-card:hover { transform: translateY(-2px); border-color: rgba(255, 74, 23,0.2); }
.status-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.status-card-icon.pending { background: rgba(245,158,11,0.12); color: #f59e0b; }
.status-card-icon.processing { background: rgba(255, 74, 23,0.12); color: #FF7A52; }
.status-card-icon.ready { background: rgba(34,197,94,0.12); color: #4ade80; }
.status-card-icon.completed { background: rgba(16,185,129,0.12); color: #10b981; }
.status-card-info .val { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.status-card-info .lbl { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
  background: var(--bg);
}
.login-screen::before { display: none; }
.login-screen.login-admin { background: var(--bg); }
.login-screen.login-agent { background: var(--bg); }
.login-box {
  width: 100%; max-width: 440px; padding: 44px 40px; position: relative; z-index: 1;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: 0 28px 72px rgba(0,0,0,0.28), 0 0 0 1px rgba(255,255,255,0.04) inset;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo-mark {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px;
  font-size: 1.25rem; font-weight: 800; display: grid; place-items: center;
  background: var(--gradient); color: #fff;
  box-shadow: 0 10px 28px rgba(255, 74, 23,0.35);
}
.login-brand .logo-mark.admin {
  background: #dc2626;
  box-shadow: 0 10px 28px rgba(220,38,38,0.25);
}
.login-brand .logo-mark.agent {
  background: var(--surface-green);
  box-shadow: 0 10px 28px rgba(34, 197, 94,0.35);
}
.login-role-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 5px 14px; border-radius: 100px; margin-bottom: 14px;
}
.login-role-badge.admin { background: rgba(220,38,38,0.15); color: #f87171; }
.login-role-badge.agent { background: rgba(34, 197, 94,0.15); color: #4ade80; }
.login-logo-img { display: block; height: 110px; width: auto; margin: 0 auto 14px; object-fit: contain; }
.login-brand .login-logo-img + p { margin-top: 0; }
.login-brand p { font-size: 0.88rem; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.login-tabs {
  display: flex; gap: 4px; background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px; margin-bottom: 24px;
}
.login-tab {
  flex: 1; padding: 11px 16px; border: none; border-radius: 9px;
  background: transparent; color: var(--text-muted); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.login-tab:hover { color: var(--text); }
.login-tab.active {
  background: var(--gradient); color: #fff;
  box-shadow: var(--shadow-btn);
}
.login-box .form-group { margin-bottom: 18px; }
.login-box .form-group label { font-size: 0.82rem; font-weight: 600; margin-bottom: 7px; display: block; }
.login-box input {
  width: 100%; padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text); font-size: 0.92rem; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-box input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 74, 23,0.15);
}
.login-submit { margin-top: 6px; padding: 13px 20px; font-size: 0.95rem; font-weight: 700; border-radius: 12px; }
.login-footer { text-align: center; margin-top: 22px; font-size: 0.84rem; color: var(--text-muted); }
.login-footer a { color: var(--primary-light); font-weight: 600; text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

.dash-subscriptions { margin-bottom: 24px; }
.dash-subscriptions-list { display: flex; flex-direction: column; gap: 14px; }
.dash-subscriptions-list .sub-active-card { margin-bottom: 0; padding: 18px 20px; }
.sub-active-top {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 8px;
}
.sub-active-name { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.sub-active-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sub-active-meta { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 14px; line-height: 1.5; }
.dash-subscriptions-list .sub-active-card .credit-progress { margin: 0; }
.sub-manage-footer {
  display: flex; justify-content: center; align-items: center;
  padding-top: 18px; margin-top: 6px;
}
.sub-manage-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 28px; border-radius: 100px; font-weight: 600; font-size: 0.88rem;
  background: var(--bg-glass); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.sub-manage-btn .nav-icon { width: 16px; height: 16px; opacity: 0.85; }
.sub-manage-btn:hover {
  border-color: var(--primary); background: rgba(255, 74, 23,0.08); transform: translateY(-1px);
}
.credit-val-total { font-size: 0.55em; font-weight: 600; color: var(--text-muted); margin-left: 2px; }
.sub-page-active { padding: 16px 18px; margin-bottom: 20px; border-radius: 14px; }

/* Admin — Orders by Service */
.service-breakdown-wrap { padding: 4px 0 0; }
.service-breakdown { display: flex; flex-direction: column; gap: 16px; }
.service-breakdown-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; border-radius: 12px; background: var(--bg-glass);
  border: 1px solid var(--border);
}
.service-breakdown-label { display: flex; align-items: center; gap: 12px; min-width: 0; }
.service-breakdown-label strong { display: block; font-size: 0.92rem; font-weight: 700; }
.service-breakdown-label small { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.service-breakdown-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.service-breakdown-dot.academic { background: #FF7A52; box-shadow: 0 0 0 4px rgba(255, 74, 23,0.2); }
.service-breakdown-dot.advanced { background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,0.2); }
.service-breakdown-bar-wrap {
  display: flex; align-items: center; gap: 12px; flex: 1; max-width: 220px;
}
.service-breakdown-bar {
  flex: 1; height: 8px; border-radius: 100px; background: var(--bg-elevated); overflow: hidden;
}
.service-breakdown-fill { height: 100%; border-radius: 100px; transition: width 0.4s ease; }
.service-breakdown-fill.academic { background: #FF7A52; }
.service-breakdown-fill.advanced { background: #22c55e; }
.service-breakdown-val {
  font-size: 1.1rem; font-weight: 800; min-width: 28px; text-align: right;
  font-family: var(--font-display, inherit);
}
.service-breakdown-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px;
}
.svc-stat-chip {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 11px; background: var(--bg-elevated); border: 1px solid var(--border);
}
.svc-stat-chip em {
  display: block; font-style: normal; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 2px;
}
.svc-stat-chip strong { font-size: 1.15rem; font-weight: 800; line-height: 1; }
.svc-stat-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.svc-stat-chip.pending strong { color: #f59e0b; }
.svc-stat-chip.unclaimed strong { color: #FF7A52; }
.svc-stat-chip.completed strong { color: #34d399; }
.svc-stat-chip.credits strong { color: var(--primary-light); }
.glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-card::before { background: var(--gradient); }
.nav-icon { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Subscription banner & plans */
.sub-banner {
  padding: 18px 22px; border-radius: var(--radius-sm); margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
}
.sub-banner-none {
  background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.35);
}
.sub-banner-none strong { color: #f59e0b; display: block; font-size: 0.95rem; }
.sub-banner-none p { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.sub-banner-active {
  background: rgba(255, 74, 23, 0.1);
  border: 1px solid rgba(255, 74, 23,0.25);
}
.sub-active-card {
  padding: 22px 24px; border-radius: var(--radius); margin-bottom: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
}
.sub-active-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.sub-active-head h3 { font-size: 1rem; font-weight: 700; }
.sub-active-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan-card {
  padding: 24px; border-radius: var(--radius); position: relative;
  background: var(--bg-card); border: 1px solid var(--border);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.plan-card:hover { transform: translateY(-4px); border-color: rgba(255, 74, 23,0.3); box-shadow: var(--shadow-sm); }
.plan-card.popular { border-color: rgba(255, 74, 23,0.45); box-shadow: 0 0 0 1px rgba(255, 74, 23,0.15); }
.plan-card.selected { border-color: var(--primary); background: rgba(255, 74, 23,0.06); }
.plan-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 0.65rem; font-weight: 700;
  padding: 4px 14px; border-radius: 100px; text-transform: uppercase; letter-spacing: 0.05em;
}
.plan-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.plan-tag {
  font-size: 0.68rem; font-weight: 600; padding: 3px 10px; border-radius: 100px;
  background: var(--bg-glass); color: var(--text-muted); border: 1px solid var(--border);
}
.plan-card h4 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.plan-card .plan-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; min-height: 40px; }
.plan-price { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin: 10px 0 4px; }
.plan-price small { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.plan-per { font-size: 0.78rem; color: var(--primary-light); font-weight: 600; margin-bottom: 14px; }
.plan-features { list-style: none; margin-bottom: 18px; }
.plan-features li { font-size: 0.8rem; color: var(--text-muted); padding: 5px 0; display: flex; gap: 8px; align-items: flex-start; }
.plan-features li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }

/* Support page */
.support-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.support-card { padding: 26px; }
.support-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.support-desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 18px; }
.support-links { list-style: none; }
.support-links li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.support-links li:last-child { border-bottom: none; }
.support-icon { font-size: 1.3rem; flex-shrink: 0; }
.support-links a { color: var(--primary-light); font-weight: 600; }
.support-quick-links { display: flex; flex-direction: column; gap: 8px; }
.support-link-btn {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px;
  background: var(--bg-glass); border: 1px solid var(--border); color: var(--text);
  font-size: 0.88rem; font-weight: 500; cursor: pointer; font-family: inherit; text-decoration: none;
  transition: all var(--transition); text-align: left;
}
.support-link-btn:hover { border-color: rgba(255, 74, 23,0.3); background: rgba(255, 74, 23,0.06); }
.support-info-full { grid-column: 1 / -1; }
.support-tips { list-style: none; }
.support-tips li { font-size: 0.88rem; color: var(--text-muted); padding: 8px 0 8px 18px; position: relative; line-height: 1.6; }
.support-tips li::before { content: '•'; position: absolute; left: 0; color: var(--primary-light); }

/* Settings profile & sounds */
.profile-upload-wrap { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.profile-avatar-preview {
  width: 80px; height: 80px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--gradient); display: grid; place-items: center;
  font-weight: 700; font-size: 1.4rem; color: #fff; border: 3px solid var(--border);
}
.profile-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.settings-id-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
  padding: 14px 16px; background: var(--bg-glass); border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.settings-id-row label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); width: 100%; margin-bottom: 4px; }
.settings-id-value { font-family: monospace; font-size: 0.9rem; font-weight: 600; flex: 1; word-break: break-all; }
.sound-setting-row {
  display: grid; grid-template-columns: 1fr minmax(160px, 200px) auto; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 10px; border-radius: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.sound-setting-row:last-child { border-bottom: none; margin-bottom: 0; }
.sound-setting-row label { font-size: 0.88rem; font-weight: 600; flex: 1; min-width: 140px; }
.sound-setting-row select { max-width: none; width: 100%; flex: unset; }
.sound-setting-actions { display: flex; gap: 8px; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Notifications panel */
.notif-panel {
  position: fixed; top: 0; right: 0; width: 380px; max-width: 100vw; height: 100vh;
  background: var(--bg-card); border-left: 1px solid var(--border); z-index: 300;
  display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,0.25);
  animation: notifSlideIn 0.28s ease;
}
@keyframes notifSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.notif-panel-head h3 { font-size: 1.05rem; font-weight: 700; }
.notif-panel-body { flex: 1; overflow-y: auto; padding: 12px 16px 20px; }
.notif-item {
  display: flex; gap: 14px; padding: 14px; border-radius: 12px; margin-bottom: 8px;
  background: var(--bg-glass); border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.notif-item:hover { background: rgba(255, 74, 23,0.05); border-color: rgba(255, 74, 23,0.15); }
.notif-item.notif-unread { border-left: 3px solid var(--primary); background: rgba(255, 74, 23,0.06); }
.notif-item-icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  font-size: 1.15rem; flex-shrink: 0; background: var(--bg-elevated);
}
.notif-item-icon.notif-report { background: rgba(16,185,129,0.12); }
.notif-item-icon.notif-order { background: rgba(255, 74, 23,0.12); }
.notif-item-icon.notif-payment { background: rgba(245,158,11,0.12); }
.notif-item-icon.notif-ticket { background: rgba(255, 74, 23, 0.12); }
.notif-item-icon.notif-credit { background: rgba(34, 197, 94, 0.12); }
.notif-item-icon.notif-alert { background: rgba(239,68,68,0.12); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.notif-type-badge {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 100px; background: var(--bg-elevated); color: var(--text-muted);
}
.notif-type-badge.notif-report { color: #10b981; background: rgba(16,185,129,0.12); }
.notif-type-badge.notif-order { color: #FF7A52; background: rgba(255, 74, 23,0.12); }
.notif-type-badge.notif-payment { color: #f59e0b; background: rgba(245,158,11,0.12); }
.notif-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.notif-message { font-size: 0.86rem; line-height: 1.55; color: var(--text); word-break: break-word; }
.notif-empty { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.notif-empty-icon { font-size: 2.2rem; margin-bottom: 12px; opacity: 0.5; }
.notif-empty strong { display: block; color: var(--text); margin-bottom: 8px; }
.notif-empty p { font-size: 0.85rem; line-height: 1.6; }
.notif-item.notif-clickable { cursor: pointer; }
.notif-item.notif-clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.row-highlight-flash {
  animation: rowFlash 2.5s ease;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
@keyframes rowFlash {
  0%, 100% { background: transparent; }
  15%, 45% { background: rgba(255, 74, 23, 0.14); }
}
.badge-drillbit { background: rgba(255, 74, 23,0.15); color: #FF7A52; }
.badge-turnitin { background: rgba(16,185,129,0.15); color: #34d399; }
.service-tab.locked { opacity: 0.45; cursor: not-allowed; }

.card-header-tools {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header-tools h3 { margin: 0; }
.admin-search {
  padding: 9px 14px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); min-width: 220px; max-width: 100%; flex: 1;
}
.user-pick-list { margin-top: 8px; max-height: 220px; overflow-y: auto; }
.user-pick-hint, .user-pick-empty { font-size: 0.85rem; color: var(--text-muted); padding: 10px 0; margin: 0; }
.user-pick-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); cursor: pointer; font-family: inherit;
}
.user-pick-item:hover { border-color: var(--primary); }
.user-pick-item.selected { border-color: var(--primary); background: rgba(255, 74, 23,0.1); }
.user-pick-item strong { font-size: 0.9rem; }
.user-pick-item span { font-size: 0.78rem; color: var(--text-muted); }
.user-pick-selected { font-size: 0.85rem; color: var(--success); margin-top: 8px; }

.payments-admin-list { display: flex; flex-direction: column; gap: 12px; }
.payment-admin-card { padding: 16px 18px; }
.payment-admin-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.payment-admin-head strong { display: block; font-size: 0.95rem; }
.payment-admin-head small { color: var(--text-muted); font-size: 0.78rem; }
.payment-admin-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px;
  font-size: 0.85rem; margin-bottom: 14px;
}
.payment-admin-meta em { display: block; font-style: normal; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 2px; }
.payment-admin-actions .pay-action-group {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.payment-admin-actions .btn { margin: 0; white-space: normal; }

.payments-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.payments-table { width: 100%; min-width: 720px; }
.pay-actions-cell { white-space: normal; }
.pay-action-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-actions-cell .btn { margin: 0; white-space: normal; font-size: 0.78rem; }

@media (max-width: 900px) {
  .payments-table { min-width: 0; }
  .payments-table thead { display: none; }
  .payments-table tbody tr {
    display: block; margin-bottom: 14px; padding: 14px;
    background: var(--bg-glass); border: 1px solid var(--border); border-radius: 12px;
  }
  .payments-table tbody td {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 8px 0; border: none; text-align: right; font-size: 0.88rem;
  }
  .payments-table tbody td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--text-muted); text-align: left; flex-shrink: 0;
  }
  .payments-table tbody td.pay-actions-cell {
    flex-direction: column; align-items: stretch; gap: 8px;
  }
  .payments-table tbody td.pay-actions-cell::before { margin-bottom: 4px; }
  .payments-table tbody td.pay-actions-cell .btn { width: 100%; margin: 0; }
}

@media (max-width: 1024px) {
  .stats-grid, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .credits-row { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .pricing-grid, .pricing-plan-grid { grid-template-columns: repeat(2, 1fr); }
  .support-grid { grid-template-columns: 1fr; }
  .topbar-right .btn-ghost.btn-sm { padding: 8px 12px; font-size: 0.78rem; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-toggle { display: grid; place-items: center; }
  .stats-grid, .grid-3, .status-grid, .plan-grid { grid-template-columns: 1fr; }
  .content { padding: 18px 16px; }
  .pay-methods { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; gap: 10px; }
  .topbar h1 { font-size: 1.05rem; line-height: 1.3; }
  .welcome-banner { padding: 22px 20px; }
  .settings-tabs { flex-direction: row; flex-wrap: wrap; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  th, td { padding: 12px 12px; }
  .toast {
    left: 16px; right: 16px; bottom: 16px; max-width: none;
  }
  .popup-alert {
    left: 16px; right: 16px; top: auto; bottom: 88px; max-width: none;
  }
  .card-header .btn { min-height: 42px; }
  .login-box { padding: 32px 24px; border-radius: 20px; }
  .login-brand h2 { font-size: 1.3rem; }
  .sub-manage-btn { width: 100%; max-width: 280px; }
  .service-breakdown-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .service-breakdown-bar-wrap { max-width: none; }
  .service-breakdown-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-left, .topbar-right { width: 100%; justify-content: space-between; }
  .topbar-right { justify-content: flex-start; gap: 8px; }
  .topbar-right .btn-ghost.btn-sm { flex: 1 1 calc(50% - 4px); justify-content: center; min-height: 44px; }
  .topbar-right .topbar-link-compact { font-size: 0.72rem; padding: 8px 10px; }
  .credit-display { width: 100%; }
  .credit-pill { flex: 1 1 auto; justify-content: center; font-size: 0.72rem; padding: 8px 10px; min-height: 40px; }
  .col-hide-sm { display: none !important; }
  .action-btns {
    flex-direction: column; align-items: stretch; width: 100%; gap: 8px;
  }
  .action-btns .btn {
    width: 100%; min-height: 44px; white-space: normal;
  }
  .table-wrap td:has(.btn + .btn) {
    display: flex; flex-direction: column; gap: 8px; min-width: 124px;
  }
  .table-wrap td:has(.btn + .btn) .btn {
    width: 100%; min-height: 44px; margin: 0; white-space: normal;
  }
  .table-wrap td:has(.btn:only-child) .btn {
    width: 100%; min-height: 44px; white-space: normal;
  }
  .ready-report-card {
    flex-direction: column; align-items: stretch; text-align: left;
  }
  .ready-report-actions {
    flex-direction: column; width: 100%;
  }
  .ready-report-actions .btn {
    width: 100%; min-height: 48px; justify-content: center;
  }
  .report-full-meta { grid-template-columns: 1fr 1fr; }
  .report-full-actions { flex-direction: column; }
  .report-full-actions .btn { width: 100%; min-height: 48px; }
  .pkg-card.selected { transform: none; }
  .pkg-card.selected:hover { transform: none; }
  .report-browse-btn { width: 100%; min-height: 44px; }
  .report-selected-card {
    flex-direction: column; align-items: stretch; text-align: center; gap: 10px;
  }
  .report-selected-card .btn { width: 100%; min-height: 44px; }
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; min-height: 48px; flex: 1 1 auto; }
  .quick-actions .btn { min-height: 48px; justify-content: center; }
  .order-detail .btn { width: 100%; min-height: 44px; }
  .claim-btn, .btn-admin.btn-sm, .btn-agent.btn-sm {
    width: 100%; min-height: 44px; white-space: normal;
  }
  th, td { padding: 10px 8px; font-size: 0.8rem; }
  .btn { white-space: normal; }
  .payment-modal { padding: 12px; align-items: flex-end; }
  .payment-modal-card { max-height: 92vh; overflow-y: auto; padding: 20px 16px; }
  .report-preview-modal { padding: 8px; align-items: flex-end; }
  .report-preview-card { padding: 16px; max-height: 96vh; }
  .report-preview-body { min-height: 50vh; max-height: calc(96vh - 210px); }
  .report-preview-frame { min-height: 50vh; }
  .whatsapp-float { bottom: 18px; right: 18px; width: 52px; height: 52px; }
  .theme-btn, .notif-btn, .mobile-toggle { min-width: 44px; min-height: 44px; }
  .topbar-user-name { max-width: 100%; flex: 1 1 100%; }
}

/* Agent operations dashboard */
.ops-status-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px;
}
.ops-status-card {
  padding: 16px 14px; border-radius: 12px; text-align: center; color: #fff;
  box-shadow: var(--shadow-sm);
}
.ops-status-card em { display: block; font-style: normal; font-size: 0.72rem; opacity: 0.92; margin-bottom: 8px; }
.ops-status-card strong { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.ops-status-card.orange { background: #FF4A17; }
.ops-status-card.amber { background: #f59e0b; }
.ops-status-card.teal { background: #22c55e; }
.ops-status-card.green { background: #16a34a; }
.ops-status-card.red { background: #ef4444; }
.ops-work-stats { width: 100%; margin-bottom: 20px; }
.ops-work-stats th, .ops-work-stats td { padding: 12px 16px; text-align: left; }
.ops-chart-row { display: flex; align-items: flex-end; gap: 12px; min-height: 120px; padding: 16px 0; }
.ops-chart-bar { flex: 1; text-align: center; }
.ops-chart-bar .bar {
  height: var(--h, 20px); max-height: 80px; min-height: 8px;
  background: #22c55e; border-radius: 8px 8px 0 0; margin: 0 auto 8px; width: 70%;
}
.ops-chart-bar span { font-size: 0.72rem; color: var(--text-muted); }
.ops-records-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.ops-search { flex: 1; min-width: 180px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); }
.ops-filter-select { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); }

/* Admin analytics — service summary */
.admin-service-summary { padding: 4px 0 8px; }
.admin-svc-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.admin-svc-card {
  display: flex; align-items: center; gap: 14px; padding: 20px;
  background: var(--bg-elevated); border-radius: 12px; border: 1px solid var(--border);
}
.admin-svc-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.admin-svc-dot.academic { background: #FF4A17; }
.admin-svc-dot.advanced { background: #22c55e; }
.admin-svc-card strong { display: block; font-size: 1rem; }
.admin-svc-card small { color: var(--text-muted); font-size: 0.78rem; }
.admin-svc-count { margin-left: auto; font-size: 1.75rem; font-weight: 800; color: var(--text); }

/* Portal API page */
.sidebar-user-role {
  display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 74, 23, 0.15); color: var(--primary-light); margin-top: 4px;
}
.sidebar-user-id { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; font-family: monospace; }
.api-status-pill {
  font-size: 0.78rem; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: rgba(34, 197, 94, 0.12); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.25);
}
.api-key-card { padding: 24px; margin-bottom: 20px; border: 1px solid var(--border); }
.api-key-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.api-key-head h3 { margin: 0 0 6px; font-size: 1.05rem; }
.api-key-head p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.api-key-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.api-key-value {
  flex: 1; min-width: 200px; padding: 12px 14px; border-radius: 10px;
  background: var(--bg-elevated); border: 1px dashed var(--border);
  font-size: 0.82rem; word-break: break-all;
}
.api-key-note { margin: 14px 0 0; font-size: 0.82rem; color: var(--text-muted); }
.api-key-note code, .api-code-block code { font-size: 0.8rem; }
.api-code-block {
  background: var(--bg-elevated); border-radius: 10px; padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--border); overflow-x: auto;
}
.api-code-block pre { margin: 0; font-size: 0.78rem; line-height: 1.55; white-space: pre-wrap; word-break: break-all; }
.api-limits-list { list-style: none; margin: 0; padding: 0; }
.api-limits-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem;
}
.api-limits-list li:last-child { border-bottom: none; }
.api-limits-list span { color: var(--text-muted); }
.api-method {
  display: inline-block; font-size: 0.68rem; font-weight: 800; padding: 3px 8px; border-radius: 6px;
  font-family: monospace; letter-spacing: 0.03em;
}
.api-method.get { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.api-method.post { background: rgba(255, 74, 23, 0.15); color: #FF4A17; }
.api-grid { align-items: stretch; }
@media (max-width: 768px) {
  .admin-svc-cards { grid-template-columns: 1fr; }
  .api-key-row input { width: 100%; }
}

.ai-unavailable-box {
  padding: 14px 16px; border-radius: 12px; margin-top: 10px;
  background: rgba(255, 74, 23, 0.08); border: 1px solid rgba(255, 74, 23, 0.25);
}
.ai-unavailable-box strong { display: block; font-size: 0.9rem; margin-bottom: 10px; }
.ai-unavailable-info { display: flex; gap: 12px; align-items: flex-start; }
.ai-info-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: #FF7A52; color: #fff; font-size: 0.8rem; font-weight: 800;
  display: grid; place-items: center; font-style: normal;
}
.ai-unavailable-info p { font-size: 0.82rem; margin-bottom: 6px; color: var(--text-muted); }
.ai-unavailable-info ul { margin: 0; padding-left: 18px; font-size: 0.8rem; color: var(--text-muted); line-height: 1.55; }
.ai-unavailable-tag {
  display: inline-block; padding: 4px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 700;
  background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3);
}
.ai-cell-unavail { color: var(--text-muted); font-size: 0.82rem; font-style: italic; }

.refer-card { padding: 24px; }
.refer-link-row input { flex: 1; min-width: 200px; }
.file-process-note { font-size: 0.8rem; color: var(--success); margin-top: 8px; }

.nx-marquee {
  overflow: hidden; border-block: 1px solid var(--border);
  background: #181818; padding: 18px 0;
}
.nx-marquee-track {
  display: flex; gap: 56px; width: max-content; animation: nx-scroll 22s linear infinite;
  font-size: clamp(0.9rem, 2vw, 1.1rem); font-weight: 700; color: var(--text-muted); white-space: nowrap;
  align-items: center;
}
.nx-marquee-track .nx-stroke-text {
  font-size: clamp(1.4rem, 4vw, 2.4rem); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  -webkit-text-stroke: 1.5px #FF4A17; -webkit-text-fill-color: transparent; color: transparent;
}
.nx-marquee-track span:not(.nx-stroke-text) { color: var(--primary-light); }
@keyframes nx-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.nx-promo-section {
  position: relative; overflow: hidden; padding: 48px 0 56px; background: #181818;
}
.nx-promo-marquee { overflow: hidden; margin-bottom: 32px; }
.nx-promo-marquee-track {
  display: flex; gap: 48px; width: max-content; animation: nx-scroll 20s linear infinite;
}
.nx-promo-marquee-track span {
  flex-shrink: 0; font-size: clamp(2rem, 6vw, 3.75rem); font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; white-space: nowrap;
  -webkit-text-stroke: 1.5px #FF4A17; -webkit-text-fill-color: transparent; color: transparent;
}
.nx-promo-inner { position: relative; z-index: 1; }
.nx-promo-card {
  max-width: 820px; margin: 0 auto; padding: 40px 36px; text-align: center;
  background: #0a0a0a; border: 1px solid rgba(42, 42, 46, 0.5); border-radius: 20px;
}
.nx-promo-card h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 800; margin-bottom: 14px; }
.nx-promo-card p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.65; margin-bottom: 24px; max-width: 620px; margin-inline: auto; }
.nx-promo-card a { color: var(--primary-light); font-weight: 600; }
.nx-promo-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.completion-chart-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.completion-chart-sub { font-size: 0.82rem; color: var(--text-muted); display: block; margin-top: 4px; font-weight: 500; }
.completion-range-tabs { display: flex; gap: 8px; }
.completion-range-tab {
  padding: 8px 14px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-glass); color: var(--text-muted); cursor: pointer;
}
.completion-range-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.completion-chart-body { padding: 8px 4px 4px; }
.completion-chart-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 10px;
  align-items: end; min-height: 140px; padding: 12px 0;
}
.completion-day { text-align: center; min-width: 0; }
.completion-bar-wrap { height: 88px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 8px; }
.completion-bar {
  width: 70%; max-width: 28px; height: var(--h, 8%); min-height: 6px; max-height: 88px;
  background: #22c55e; border-radius: 8px 8px 0 0; transition: height 0.35s ease;
}
.completion-day.is-today .completion-bar { background: #FF4A17; }
.completion-day strong { display: block; font-size: 0.82rem; font-weight: 800; }
.completion-day-label { font-size: 0.65rem; color: var(--text-muted); display: block; margin-top: 2px; }
.completion-chart-footer {
  display: flex; gap: 12px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px;
}
.completion-stat-pill {
  flex: 1; min-width: 120px; padding: 12px 16px; border-radius: 12px; background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.completion-stat-pill em { display: block; font-size: 0.72rem; color: var(--text-muted); font-style: normal; margin-bottom: 4px; }
.completion-stat-pill strong { font-size: 1.25rem; font-weight: 800; color: var(--primary-light); }
.completion-stat-pill span { font-size: 0.72rem; color: var(--text-muted); margin-left: 6px; }

.agent-stats-admin { display: grid; gap: 20px; }
.agent-leaderboard-table { width: 100%; border-collapse: collapse; }
.agent-leaderboard-table th {
  text-align: left; font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.agent-leaderboard-table th:nth-child(1) { width: 48px; }
.agent-leaderboard-table th:nth-child(3),
.agent-leaderboard-table th:nth-child(4) { text-align: right; }
.agent-leaderboard-table td {
  padding: 14px; font-size: 0.92rem; border-bottom: 1px solid var(--border);
}
.agent-leaderboard-table tr:last-child td { border-bottom: none; }
.agent-leaderboard-table tr:hover td { background: var(--bg-glass); }
.agent-leaderboard-table .lb-rank { color: var(--brand-orange-light); font-weight: 700; font-size: 0.95rem; }
.agent-leaderboard-table .lb-agent { font-weight: 700; }
.agent-leaderboard-table .lb-num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.agent-leaderboard-table .lb-today { color: var(--brand-orange-light); }
.agent-daily-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.agent-daily-tab {
  padding: 8px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-glass); color: var(--text-muted); cursor: pointer;
  transition: all var(--transition);
}
.agent-daily-tab:hover { border-color: rgba(34, 197, 94, 0.35); color: var(--text); }
.agent-daily-tab.active { background: var(--gradient); color: #fff; border-color: transparent; box-shadow: var(--shadow-btn); }
.agent-stat-day { padding: 0; border-radius: 12px; background: transparent; border: none; }
.agent-stat-day h4 { font-size: 0.85rem; margin-bottom: 12px; color: var(--text-muted); font-weight: 600; }

/* Refer & Earn page */
.refer-hero {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 24px; margin-bottom: 24px;
}
.refer-hero-card {
  padding: 32px; border-radius: var(--radius); border: 1px solid var(--border);
  background: rgba(34, 197, 94, 0.08);
}
.refer-hero-card h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 10px; }
.refer-hero-card h2 em { font-style: normal; color: var(--brand-orange-light); }
.refer-hero-card p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 20px; }
.refer-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-content: start; }
.refer-stat-chip {
  padding: 20px 16px; border-radius: 14px; background: var(--bg-elevated);
  border: 1px solid var(--border); text-align: center;
  display: flex; flex-direction: column; justify-content: center; min-height: 100px;
}
.refer-stat-chip strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--primary-light); }
.refer-stat-chip span { font-size: 0.75rem; color: var(--text-muted); }
.refer-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 24px 0; }
.refer-step {
  padding: 22px 18px; border-radius: 14px; background: var(--bg-glass); border: 1px solid var(--border); text-align: center;
}
.refer-step-num {
  width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--gradient); display: grid; place-items: center; font-weight: 800; font-size: 0.9rem;
}
.refer-step h4 { font-size: 0.9rem; margin-bottom: 6px; }
.refer-step p { font-size: 0.78rem; color: var(--text-muted); }
.refer-share-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.refer-page-link-box,
.refer-link-row {
  display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; margin-top: 10px;
  padding: 6px 6px 6px 14px; border-radius: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.refer-page-link-box input,
.refer-link-row input,
.field-input {
  flex: 1; min-width: 200px; padding: 11px 12px;
  background: transparent; border: none; border-radius: 8px;
  color: var(--text); font-size: 0.84rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.4;
}
.refer-page-link-box input,
.refer-link-row input {
  color: var(--primary-light);
}
.refer-page-link-box input:focus,
.refer-link-row input:focus,
.field-input:focus,
.field-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 74, 23, 0.2);
}
.refer-page-link-box .btn,
.refer-link-row .btn { flex-shrink: 0; align-self: center; }
.refer-link-row { margin-top: 14px; padding: 6px 6px 6px 14px; }

.field-select,
.sound-setting-row select,
.sound-select,
#prefTheme {
  padding: 11px 36px 11px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem; font-family: inherit;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-select:focus,
.sound-setting-row select:focus,
.sound-select:focus,
#prefTheme:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 74, 23, 0.12);
}
.field-select option,
.sound-select option,
#prefTheme option {
  background: var(--bg-card); color: var(--text);
}
#notificationSoundSettings { display: flex; flex-direction: column; gap: 0; }
.refer-list { margin-top: 20px; }
.refer-list-item {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--border); font-size: 0.88rem;
}
.refer-list-item:last-child { border-bottom: none; }
.refer-landing {
  padding: 80px 0; background: var(--gradient-hero);
}
.refer-landing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.refer-landing h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; margin-bottom: 16px; }
.refer-landing h2 em { font-style: normal; color: var(--brand-orange-light); }
.refer-landing-visual { padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); }
@media (max-width: 900px) {
  .refer-hero, .refer-landing-grid { grid-template-columns: 1fr; }
  .refer-steps, .refer-stats-row { grid-template-columns: 1fr; }
  .sound-setting-row { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 1024px) {
  .ops-status-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .ops-status-row { grid-template-columns: 1fr; }
}

/* Report re-upload */
.report-existing-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 12px; border-radius: 12px;
  background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.22);
}
.report-existing-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.report-existing-info small { display: block; color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }
.report-existing-icon { font-size: 1.4rem; flex-shrink: 0; }
.report-existing-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.completed-job-card { margin-bottom: 14px; padding: 16px; border-radius: 14px; }
.completed-job-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ── Mobile enhancements ── */
html { -webkit-text-size-adjust: 100%; }
body { padding-bottom: env(safe-area-inset-bottom); }

.service-tabs, #uploadServiceTabs {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none;
}
.service-tabs::-webkit-scrollbar, #uploadServiceTabs::-webkit-scrollbar { display: none; }
.service-tab { flex-shrink: 0; min-height: 44px; }

.upload-zone, .dropzone {
  padding: 28px 16px; min-height: 140px;
}
.upload-meta, .file-meta-row { flex-wrap: wrap; gap: 8px; }

.credits-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.credit-block { min-width: 0; }

.table-wrap .data-table { width: 100%; min-width: 0; }

@media (max-width: 900px) {
  .table-wrap .data-table:not(.payments-table) { min-width: 0; }
  .table-wrap .data-table:not(.payments-table) thead { display: none; }
  .table-wrap .data-table:not(.payments-table) tbody tr {
    display: block; margin-bottom: 14px; padding: 14px;
    background: var(--bg-glass); border: 1px solid var(--border); border-radius: 12px;
  }
  .table-wrap .data-table:not(.payments-table) tbody td {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 8px 0; border: none; text-align: right; font-size: 0.88rem;
  }
  .table-wrap .data-table:not(.payments-table) tbody td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--text-muted); text-align: left; flex-shrink: 0;
  }
  .table-wrap .data-table:not(.payments-table) tbody td.table-actions,
  .table-wrap .data-table:not(.payments-table) tbody td[data-label="Action"] {
    flex-direction: column; align-items: stretch;
  }
  .table-wrap .data-table:not(.payments-table) tbody td .btn { width: 100%; min-height: 44px; }
}

@media (max-width: 768px) {
  #sidebarClose { display: grid !important; place-items: center; }
  .sidebar-header { justify-content: space-between; }
  .sidebar-user-inner { gap: 10px; }
  .sidebar-user-info { min-width: 0; }
  .sidebar-user-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash-subscriptions-list .sub-active-card { padding: 14px 16px; }
  .sub-active-top { flex-direction: column; align-items: flex-start; }
  .plan-grid, .pricing-plan-grid { grid-template-columns: 1fr; }
  .credits-row { grid-template-columns: 1fr; }
  .welcome-banner .btn-row { flex-direction: column; }
  .welcome-banner .btn-row .btn { width: 100%; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .ticket-compose .btn-row { flex-direction: column; }
  .refer-link-row { flex-direction: column; }
  .refer-link-row input, .refer-link-row .btn { width: 100%; }
  .api-key-row { flex-direction: column; align-items: stretch; }
  .sub-checkout-row { flex-direction: column; }
  .sub-checkout-row .btn { width: 100%; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .content { padding: 14px 12px; }
  .quick-actions { grid-template-columns: 1fr; }
  .credit-pill { font-size: 0.68rem; padding: 7px 8px; }
  .login-box { padding: 28px 18px; margin: 12px; width: calc(100% - 24px); }
  .stats-grid .stat-card { padding: 16px 14px; }
  .hero-cta .btn { width: 100%; justify-content: center; }
}

/* Anti-copy protection */
html.pt-protected,
body.pt-protected {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html.pt-protected input,
html.pt-protected textarea,
html.pt-protected select,
html.pt-protected [data-allow-copy],
html.pt-protected .allow-copy,
html.pt-protected [contenteditable="true"],
body.pt-protected input,
body.pt-protected textarea,
body.pt-protected select,
body.pt-protected [data-allow-copy],
body.pt-protected .allow-copy,
body.pt-protected [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

html.pt-protected img,
body.pt-protected img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: auto;
}

html.pt-devtools body::after {
  content: 'Protected content — copying is disabled.';
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-weight: 600;
  color: #fff;
  background: rgba(8, 10, 14, 0.92);
  backdrop-filter: blur(14px);
  pointer-events: all;
}

/* Full-screen mobile panels */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.app-layout,
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  width: 100%;
  max-width: 100vw;
}

@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: max(14px, env(safe-area-inset-top));
  }
  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .toast {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  body { overscroll-behavior-x: none; }
  .app-layout { flex-direction: column; }
  .main {
    width: 100%;
    max-width: 100vw;
    min-height: 100dvh;
  }
  .content {
    width: 100%;
    max-width: 100%;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .login-screen {
    padding: 12px;
    align-items: flex-start;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .login-box {
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .payment-modal,
  .report-preview-modal {
    padding: 8px;
    align-items: flex-end;
  }
  .payment-modal .card,
  .report-preview-card {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: 0;
    border-radius: 18px 18px 0 0;
  }
  .report-preview-body {
    max-height: calc(92dvh - 140px);
    overflow: auto;
  }
  .report-preview-frame {
    width: 100%;
    min-height: 55dvh;
    border: 0;
  }
  .sidebar {
    width: min(88vw, 300px);
    max-width: 300px;
    height: 100dvh;
    z-index: 300;
  }
  .table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-actions,
  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-actions .btn,
  .btn-row .btn {
    width: 100%;
    min-height: 46px;
  }
  .dash-subscriptions-list .sub-active-card {
    width: 100%;
  }
  .upload-zone {
    min-height: 140px;
  }
  .sub-checkout-row,
  .api-key-row {
    flex-direction: column;
    align-items: stretch;
  }
  .sub-checkout-row .btn,
  .api-key-row .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 0.98rem; }
  .nav-item { min-height: 46px; }
  .quick-actions { gap: 10px; }
  .stats-grid .stat-card h3 { font-size: 1.35rem; }
  .credit-block { padding: 14px; }
  .plan-card { padding: 18px 16px; }
}
