/* ============================================================
   SmartScan — Dark Theme UI
   ============================================================ */

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

:root {
  --bg: #0d0f14;
  --bg-card: #161920;
  --bg-input: #1e2230;
  --bg-hover: #252a38;
  --border: #2a2f42;
  --border-focus: #4f6ef7;
  --text: #e8eaf0;
  --text-muted: #7b829a;
  --text-dim: #4a5070;
  --accent: #4f6ef7;
  --accent-hover: #6080ff;
  --accent-glow: rgba(79, 110, 247, 0.15);
  --success: #2ecc71;
  --error: #e74c3c;
  --warning: #f39c12;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.header {
  background: rgba(22, 25, 32, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  letter-spacing: 0.3px;
}

/* ============================================================
   Card
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* ============================================================
   Form
   ============================================================ */

.section-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}

.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.url-input-wrap {
  position: relative;
}

.url-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.url-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-input::placeholder {
  color: var(--text-dim);
}

.url-input.input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.url-error {
  font-size: 12px;
  color: #ef4444;
  margin-top: 6px;
}

/* ============================================================
   Targets Grid
   ============================================================ */

.targets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.target-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.target-item:hover {
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

.target-item input[type="checkbox"] {
  display: none;
}

.target-item:has(input:checked) {
  border-color: var(--accent);
  background: rgba(79, 110, 247, 0.1);
}

.target-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.target-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.target-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ============================================================
   Form Row
   ============================================================ */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

.form-group--half {
  margin-bottom: 0;
}

/* ============================================================
   Radio Group
   ============================================================ */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s;
  user-select: none;
}

.radio-item:has(input:checked) {
  border-color: var(--accent);
  background: rgba(79, 110, 247, 0.08);
}

.radio-item input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.radio-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.radio-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   Checkbox Group
   ============================================================ */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
  transition: border-color 0.2s;
}

.checkbox-item:has(input:checked) {
  border-color: var(--accent);
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--accent);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(79, 110, 247, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-scan-locked {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.feature-locked {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.lock-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(79, 110, 247, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: middle;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

.btn-large {
  padding: 14px 32px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-icon {
  font-size: 16px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.rate-limit-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 10px;
}

/* ============================================================
   Progress Section
   ============================================================ */

.progress-card {
  border-color: var(--accent);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.progress-title {
  font-size: 18px;
  font-weight: 600;
}

.job-id-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7b9fff);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

.progress-status {
  font-size: 13px;
  color: var(--text-muted);
}

/* Pulse animation for running state */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.progress-fill.running {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================================
   Results Section
   ============================================================ */

.results-card {
  border-color: var(--success);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.results-title {
  font-size: 18px;
  font-weight: 600;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.summary-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.summary-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  display: block;
  line-height: 1;
  margin-bottom: 6px;
}

.summary-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

/* ============================================================
   Error Section
   ============================================================ */

.error-card {
  border-color: var(--error);
}

.error-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.error-icon {
  font-size: 24px;
}

.error-header h3 {
  font-size: 18px;
  color: var(--error);
}

.error-message {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.2);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
}

/* ============================================================
   Preview Section
   ============================================================ */

.preview-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.preview-panel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.preview-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 10px 14px;
  background: rgba(79, 110, 247, 0.07);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.copy-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.copy-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.doc-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(79, 110, 247, 0.12);
  color: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}

.preview-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 8px 14px 4px;
}

.preview-badge-row {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  background: rgba(79, 110, 247, 0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* List rows */
.preview-list {
  padding: 4px 0;
}

.preview-row {
  padding: 5px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text);
}

.preview-row:last-child { border-bottom: none; }

.preview-row a {
  color: var(--accent);
  text-decoration: none;
}
.preview-row a:hover { text-decoration: underline; }

/* Links table */
.links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 4px;
}

.links-table tr {
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.links-table tr:last-child { border-bottom: none; }

.links-table td {
  padding: 5px 14px;
  vertical-align: top;
}

.links-table a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.links-table a:hover { text-decoration: underline; }

.link-text {
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Socials */
.socials-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
}

.social-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.social-platform {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.social-url {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.social-url:hover { text-decoration: underline; }

/* Meta table */
.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.meta-table tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.meta-table td {
  padding: 7px 14px;
  vertical-align: top;
}

.meta-key {
  color: var(--text-muted);
  font-size: 12px;
  width: 110px;
  flex-shrink: 0;
}

.meta-val {
  color: var(--text);
  word-break: break-all;
}

.og-thumb {
  max-height: 80px;
  max-width: 200px;
  border-radius: 4px;
  margin-top: 4px;
  border: 1px solid var(--border);
}

/* Images grid */
.images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
}

.preview-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Text / Headings */
.headings-list {
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.heading-item {
  font-size: 13px;
  color: var(--text);
  padding-left: calc((var(--lvl, 1) - 1) * 14px);
}

.heading-item.h1 { --lvl: 1; font-weight: 700; }
.heading-item.h2 { --lvl: 2; font-weight: 600; }
.heading-item.h3 { --lvl: 3; color: var(--text-muted); }
.heading-item.h4 { --lvl: 4; color: var(--text-muted); font-size: 12px; }
.heading-item.h5 { --lvl: 5; color: var(--text-dim); font-size: 12px; }
.heading-item.h6 { --lvl: 6; color: var(--text-dim); font-size: 11px; }

.text-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 14px 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}

/* ============================================================
   Header Nav & Auth
   ============================================================ */

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 24px;
  flex: 1;
}

.nav-link {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-admin {
  color: var(--warning);
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-sm {
  padding: 7px 16px;
  font-size: 13px;
}

.usage-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  white-space: nowrap;
}

.user-menu {
  position: relative;
}

.user-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s;
  white-space: nowrap;
}

.user-btn:hover {
  border-color: var(--text-dim);
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 150px;
  z-index: 200;
}

.user-dropdown.open {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

/* ============================================================
   Auth pages
   ============================================================ */

.main--narrow {
  max-width: 460px;
}

.auth-card {
  margin-top: 20px;
}

.auth-error {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: var(--error);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-success {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: var(--success);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.auth-alt {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 20px;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237b829a' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* ============================================================
   Dashboard
   ============================================================ */

.plan-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.plan-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
}

.plan-badge.premium {
  border-color: var(--warning);
  color: var(--warning);
}

.plan-badge.super_admin {
  border-color: var(--accent);
  color: var(--accent);
}

.plan-usage {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-usage-label {
  font-size: 13px;
  color: var(--text-muted);
}

.plan-progress {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  max-width: 300px;
}

.plan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7b9fff);
  border-radius: 3px;
  transition: width 0.4s;
}

/* Job history table */
.jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.jobs-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}

.jobs-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.jobs-table tr:last-child td {
  border-bottom: none;
}

.job-url {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.status-ok { background: rgba(46,204,113,0.15); color: var(--success); }
.status-err { background: rgba(231,76,60,0.15); color: var(--error); }
.status-run { background: rgba(79,110,247,0.15); color: var(--accent); }

.btn-xs {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
}

.loading-text {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}

.empty-text {
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 0;
}

.error-text {
  color: var(--error);
  font-size: 13px;
}

/* ============================================================
   Pricing
   ============================================================ */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}

.pricing-card--featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

.pricing-card--current {
  border-color: var(--success);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.pricing-badge--green {
  background: var(--success);
}

.pricing-header {
  text-align: center;
  margin-bottom: 20px;
}

.pricing-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}

.pricing-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.pricing-price {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.pricing-period {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.pricing-features {
  list-style: none;
  font-size: 13px;
  color: var(--text);
  flex: 1;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pricing-features .dim {
  color: var(--text-dim);
}

.pricing-btn {
  width: 100%;
  justify-content: center;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.compare-table th {
  padding: 8px 14px;
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}

.compare-table td {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.compare-table tr:last-child td {
  border-bottom: none;
}

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-icon {
  font-size: 40px;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   Admin Panel
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.tab-btn {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  padding-top: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.stat-card--warn {
  border-color: var(--warning);
}

.stat-val {
  font-size: 40px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.msg-unread td:first-child {
  font-weight: 700;
}

.msg-unread {
  background: rgba(79, 110, 247, 0.04);
}

.msg-preview {
  color: var(--text-muted);
  max-width: 200px;
}

.msg-body-row td {
  background: var(--bg-input);
}

.msg-body {
  padding: 12px 16px !important;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.6;
}

.role-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* ============================================================
   Scan page
   ============================================================ */

.scan-header-card {
  padding: 18px 24px;
}

.scan-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.scan-url-block {
  min-width: 0;
}

.scan-url-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.scan-url {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 520px;
}

.scan-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.scan-bg-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.worker-warning {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
  font-size: 13px;
}
.worker-warning a {
  color: #f59e0b;
  font-weight: 600;
  text-decoration: underline;
}

.scan-bg-note a {
  color: var(--accent);
  text-decoration: none;
}

/* Scan history links in dashboard */
.scan-history-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
.scan-history-link:hover { text-decoration: underline; }

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.premium-history-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
  background: rgba(243,156,18,0.1);
  border: 1px solid rgba(243,156,18,0.25);
  padding: 3px 10px;
  border-radius: 10px;
}

.free-history-badge {
  font-size: 12px;
  color: var(--text-muted);
}

.upgrade-inline {
  color: var(--accent);
  text-decoration: none;
  margin-left: 6px;
  font-weight: 600;
}
.upgrade-inline:hover { text-decoration: underline; }

.history-locked {
  text-align: center;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.history-locked-icon {
  font-size: 36px;
}

.history-locked-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.history-locked-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.6;
}

/* ============================================================
   Hero
   ============================================================ */

.hero-section {
  text-align: center;
  padding: 8px 0 4px;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.8px;
  margin-bottom: 10px;
  line-height: 1.2;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   How It Works
   ============================================================ */

.hiw-section {
  padding: 8px 0;
}

.hiw-title {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.4px;
}

.hiw-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.hiw-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.hiw-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  position: relative;
}

.hiw-num {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hiw-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.hiw-step-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.hiw-step-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.hiw-highlight {
  background: linear-gradient(135deg, rgba(79,110,247,0.08) 0%, rgba(79,110,247,0.03) 100%);
  border: 1px solid rgba(79,110,247,0.25);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.hiw-highlight-inner {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.hiw-highlight-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.hiw-highlight-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.hiw-highlight-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============================================================
   FAQ
   ============================================================ */

.faq-section {
  padding: 8px 0;
}

.faq-title {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: -0.4px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item[open] {
  border-color: var(--accent);
}

.faq-q {
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  gap: 12px;
}

.faq-q::-webkit-details-marker { display: none; }

.faq-q::after {
  content: "+";
  font-size: 20px;
  font-weight: 300;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.faq-item[open] .faq-q::after {
  transform: rotate(45deg);
}

.faq-a {
  padding: 0 20px 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.faq-a code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

.footer--full {
  padding: 0;
  text-align: left;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}

.footer-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.footer-tagline {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.footer-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-link {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 0;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--text);
}

.footer-link--partner {
  color: var(--accent);
  font-weight: 500;
}

.footer-link--partner:hover {
  color: var(--accent-hover);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  max-width: 100%;
}

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

@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 380px;
    margin: 0 auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-nav {
    display: none;
  }

  .hiw-grid {
    grid-template-columns: 1fr;
  }

  .hiw-highlight-inner {
    flex-direction: column;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .hero-title {
    font-size: 24px;
  }

  .hero-sub {
    font-size: 14px;
  }

  .scan-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .scan-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .plan-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .main {
    padding: 16px 12px 40px;
    gap: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .targets-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .card {
    padding: 16px;
  }

  .section-title {
    font-size: 18px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .compare-table {
    font-size: 12px;
  }

  .compare-table th,
  .compare-table td {
    padding: 6px 10px;
  }

  .footer-bottom {
    font-size: 11px;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

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

  .header-inner {
    padding: 10px 12px;
  }

  .logo-sub {
    display: none;
  }

  .hiw-step {
    padding: 20px 16px;
  }
}
