:root {
  --bg: #0a0f1a;
  --panel: #111827;
  --panel-border: #1f2937;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #4ade80;
  --accent-dark: #22c55e;
  --accent-glow: rgba(74, 222, 128, 0.12);
  --danger: #ef4444;
  --warn: #f59e0b;
  --row-border: #1f2937;
  --row-hover: rgba(74, 222, 128, 0.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 16px 16px 24px;
}

.wrap {
  max-width: 1400px;
  margin: 0 auto;
}

/* ── HEADER ── */
.header {
  text-align: center;
  margin-bottom: 14px;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.success-status {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.success-status.show { display: flex; }

.check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

/* ── RECORD PANEL (PREMIUM 3-COLUMN GRID DASHBOARD — 7/7/6) ── */
.record-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;

  /* Flat grid: 20 fields flow down 7 rows, then across — 7 / 7 / 6 */
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(9, auto);
  grid-template-columns: repeat(3, 1fr);
  gap: 5px 10px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.02);
  min-width: 0;
  transition: background 0.12s, border-color 0.12s;
}

.field-row:hover {
  background: var(--row-hover);
  border-color: var(--accent-glow);
}

.num-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.field-icon {
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.field-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.field-label {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1px;
}

.field-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  line-height: 1.35;

  /* Default: single line with ellipsis for URLs etc. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Multi-line wrap for Address and Call Centre Message (max 2 lines) */
[data-field="address1"] .field-value,
[data-field="address2"] .field-value,
[data-field="callCentreMessage"] .field-value {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Arabic text direction */
.field-value.arabic-mixed {
  direction: rtl;
  text-align: left;
}

/* Copy button */
.btn-copy {
  background: transparent;
  border: 1px solid var(--accent-dark);
  color: var(--accent);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.btn-copy:hover {
  background: var(--accent-glow);
}

.btn-copy.copied {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Test Card compact box */
.test-card-box {
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid var(--accent-dark);
  border-radius: 8px;
  padding: 5px 10px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.test-card-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.test-card-number {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.8px;
  font-family: 'SF Mono', Monaco, monospace;
}

.test-only-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Hostinger link */
.hostinger-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  font-size: 10px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

/* ── ACTION BAR ── */
.action-bar {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-outline, .btn-primary {
  border-radius: 8px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.12s;
  border: none;
}

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

.btn-outline:hover {
  border-color: var(--accent-dark);
  background: var(--accent-glow);
}

.btn-primary {
  background: var(--accent);
  color: #064e3b;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-outline:disabled, .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── STATUS ── */
.status-msg {
  display: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 10px;
  text-align: center;
}

.status-msg.show { display: block; }
.status-msg.ok { background: rgba(74,222,128,0.1); color: var(--accent); border: 1px solid var(--accent-dark); }
.status-msg.error { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid var(--danger); }
.status-msg.warn { background: rgba(245,158,11,0.1); color: var(--warn); border: 1px solid var(--warn); }

/* ── FOOTER ── */
.footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.lock-icon { margin-right: 3px; }

/* ── RESPONSIVE ── */
/* Tablet: 2 columns, 10 / 10 */
@media (max-width: 1099px) {
  .record-panel {
    grid-template-rows: repeat(13, auto);
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: 1 column, normal row flow */
@media (max-width: 699px) {
  body { padding: 12px 10px 20px; }
  .record-panel {
    display: block;
    padding: 8px;
  }
  .field-row {
    padding: 6px 8px;
    margin-bottom: 4px;
  }
  .field-value { font-size: 12px; }
  .field-label { font-size: 8px; }
  .btn-copy { padding: 3px 6px; font-size: 10px; }
  .num-badge { width: 20px; height: 20px; font-size: 9px; }
  .field-icon { font-size: 12px; width: 16px; }
  .action-bar { grid-template-columns: 1fr; gap: 6px; }
  .header h1 { font-size: 18px; }
  .test-card-box { padding: 4px 8px; gap: 6px; }
  .test-card-type { font-size: 11px; }
  .test-card-number { font-size: 12px; }
}

/* ── V9.3 RESOURCE LINK FIELDS ── */
.resource-links { display:flex; flex-direction:column; gap:5px; margin-top:3px; }
.resource-link { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--text); text-decoration:none; border:1px solid var(--panel-border); border-radius:7px; padding:5px 8px; font-size:12px; background:rgba(255,255,255,.025); }
.resource-link span { color:var(--accent); font-size:10px; font-weight:700; white-space:nowrap; }
.resource-link:hover { border-color:var(--accent-dark); background:var(--accent-glow); }
.resource-row { align-items:flex-start; }
@media (min-width: 1100px) {
  .record-panel { grid-template-rows: repeat(9, auto); }
}

/* ── V9.3.1 FINAL UI POLISH ── */
/* Address 3 must remain readable instead of being visually truncated. */
[data-field="address3"] .field-value {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  display: block;
}

/* Keep action hierarchy crisp: Copy All primary; Generate/Export secondary. */
.action-bar .btn-outline,
.action-bar .btn-primary {
  min-height: 44px;
}

@media (max-width: 699px) {
  body { padding: 16px 14px 28px; }
  .wrap { max-width: 100%; }
  .header { margin-bottom: 20px; }
  .header h1 { font-size: 26px; line-height: 1.2; margin-bottom: 8px; }
  .success-status { font-size: 17px; gap: 8px; }
  .check-icon { width: 22px; height: 22px; font-size: 14px; }

  .record-panel { padding: 14px; border-radius: 18px; margin-bottom: 22px; }
  .field-row {
    gap: 10px;
    padding: 12px 12px;
    margin-bottom: 8px;
    border-radius: 14px;
    min-height: 68px;
  }
  .field-row:last-child { margin-bottom: 0; }
  .num-badge { width: 34px; height: 34px; font-size: 14px; }
  .field-icon { width: 24px; font-size: 19px; }
  .field-content { overflow: visible; }
  .field-label { font-size: 12px; letter-spacing: .7px; margin-bottom: 4px; }
  .field-value { font-size: 18px; line-height: 1.38; }

  [data-field="address1"] .field-value,
  [data-field="address2"] .field-value,
  [data-field="address3"] .field-value,
  [data-field="callCentreMessage"] .field-value {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
  }

  .btn-copy {
    min-width: 88px;
    min-height: 46px;
    padding: 10px 13px;
    border-radius: 10px;
    font-size: 15px;
    justify-content: center;
  }
  .hostinger-link { font-size: 13px; margin-top: 5px; min-height: 30px; align-items: center; }

  .resource-row { align-items: flex-start; }
  .resource-links { gap: 8px; margin-top: 5px; }
  .resource-link {
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 17px;
  }
  .resource-link span { font-size: 13px; }

  .action-bar { grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }
  .action-bar .btn-outline,
  .action-bar .btn-primary {
    min-height: 58px;
    border-radius: 13px;
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 650;
  }
  .action-bar .btn-outline { border-color: #2b3749; background: rgba(255,255,255,.012); }
  #generateBtn { border-color: var(--accent-dark); background: rgba(34,197,94,.08); }
  #copyAllBtn { box-shadow: 0 8px 24px rgba(34,197,94,.12); }
  #exportBtn { background: rgba(255,255,255,.018); }

  .status-msg { padding: 12px 14px; border-radius: 11px; font-size: 14px; }
  .footer-note { font-size: 12px; line-height: 1.45; margin-top: 10px; }
}

/* Very narrow phones: keep touch targets large while allowing values room. */
@media (max-width: 420px) {
  body { padding-left: 10px; padding-right: 10px; }
  .record-panel { padding: 9px; }
  .field-row { padding: 11px 9px; gap: 8px; }
  .num-badge { width: 30px; height: 30px; font-size: 13px; }
  .field-icon { width: 20px; font-size: 17px; }
  .field-label { font-size: 11px; }
  .field-value { font-size: 17px; }
  .btn-copy { min-width: 78px; min-height: 44px; padding: 9px 10px; font-size: 14px; }
  .resource-link { font-size: 16px; }
}


/* V9.3.2 — Persistent copy progress
   A copied field stays visibly completed until the next record loads. */
.btn-copy.copied {
  background: var(--accent) !important;
  color: #052e16 !important;
  border-color: var(--accent) !important;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.16);
}

#copyAllBtn.copied {
  background: var(--accent-dark) !important;
  color: #052e16 !important;
  border-color: var(--accent-dark) !important;
}

@media (max-width: 699px) {
  .btn-copy.copied {
    min-width: 104px;
  }
}


/* V9.3.3 — Click/Tap the whole field to copy (desktop + mobile) */
.click-copy-row {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.click-copy-row:hover {
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.075);
  transform: translateY(-1px);
}

.click-copy-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.click-copy-row .copy-state {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0;
  transition: opacity .15s ease;
  text-transform: none;
  letter-spacing: 0;
}

.click-copy-row:hover .copy-state,
.click-copy-row:focus-visible .copy-state {
  opacity: .8;
}

.click-copy-row.copied {
  border-color: var(--accent) !important;
  background: rgba(74, 222, 128, 0.12) !important;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.10);
}

.click-copy-row.copied .num-badge {
  background: var(--accent);
  color: #052e16;
}

.click-copy-row.copied .copy-state {
  opacity: 1;
  color: var(--accent);
}

.click-copy-row.copied .field-label-text::before {
  content: "✓ ";
  color: var(--accent);
}

@media (max-width: 699px) {
  .click-copy-row {
    min-height: 72px;
    -webkit-tap-highlight-color: rgba(74, 222, 128, 0.12);
  }

  .click-copy-row .copy-state {
    opacity: .72;
    font-size: 11px;
  }

  .click-copy-row.copied .copy-state {
    opacity: 1;
    font-size: 12px;
  }
}


/* V9.3.4 — Copied state is manually toggleable.
   First click/tap copies + marks; second click/tap removes the mark. */
.click-copy-row.copied:hover .copy-state {
  opacity: 1;
}
\n\n/* ── V9.3.6 FINAL — Strong Generate New hierarchy ── */\n#generateBtn {\n  position: relative;\n  overflow: hidden;\n  border: 1px solid var(--accent) !important;\n  background: linear-gradient(180deg, rgba(34,197,94,.24), rgba(22,163,74,.14)) !important;\n  color: #f0fdf4 !important;\n  font-weight: 800 !important;\n  letter-spacing: .1px;\n  box-shadow: 0 0 0 1px rgba(74,222,128,.08), 0 8px 24px rgba(34,197,94,.14);\n}\n#generateBtn:hover:not(:disabled) {\n  background: linear-gradient(180deg, rgba(34,197,94,.34), rgba(22,163,74,.22)) !important;\n  box-shadow: 0 0 0 2px rgba(74,222,128,.13), 0 10px 28px rgba(34,197,94,.20);\n  transform: translateY(-1px);\n}\n#generateBtn:active:not(:disabled) { transform: translateY(0); }\n#generateBtn .icon { font-size: 1.15em; font-weight: 900; }\n#generateBtn.generating { opacity: .88; cursor: wait; }\n#generateBtn.generated {\n  background: var(--accent) !important;\n  color: #052e16 !important;\n  border-color: var(--accent) !important;\n}\n#generateBtn .spin { display:inline-block; animation: generate-spin .75s linear infinite; }\n@keyframes generate-spin { to { transform: rotate(360deg); } }\n\n@media (min-width: 700px) {\n  #generateBtn { min-height: 52px; font-size: 15px; }\n}\n@media (max-width: 699px) {\n  #generateBtn {\n    min-height: 64px !important;\n    font-size: 19px !important;\n    border-width: 2px !important;\n    box-shadow: 0 8px 26px rgba(34,197,94,.18);\n  }\n  #generateBtn .icon { font-size: 23px; }\n}\n

/* V10.3.3 — Dual Test Password field */
.password-stack {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.password-copy-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--row-border);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.password-copy-item:hover {
  border-color: var(--accent);
  background: rgba(74,222,128,.07);
}
.password-copy-item.copied {
  border-color: var(--accent);
  background: rgba(74,222,128,.12);
}
.password-slot-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.password-slot-value {
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.password-copy-state {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
}
@media (max-width: 699px) {
  .password-copy-item {
    grid-template-columns: 1fr;
    gap: 4px;
    min-height: 56px;
  }
  .password-slot-value { font-size: 17px; }
  .password-copy-state { font-size: 11px; }
}
