:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --success-bg: #f0fdf4;
  --success-border: #16a34a;
  --success-text: #15803d;
  --warn-bg: #fff7ed;
  --warn-border: #ea580c;
  --warn-text: #c2410c;
  --surface: #ffffff;
  --bg: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

html { font-size: 16px; }

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

/* ── Header ── */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
  text-align: center;
}

.site-header .logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.site-header .badge {
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.site-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-header .subtitle {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-top: 3px;
}

/* ── Main ── */
main {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

/* ── Status bar ── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e40af;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 18px;
}

.status-bar.ready {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.status-bar.error {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Search card ── */
.search-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.search-card label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text);
}

.search-card .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.tin-input {
  flex: 1;
  height: 52px;
  font-size: 1.1rem;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  letter-spacing: 0.5px;
}

.tin-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

.tin-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.tin-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

.btn-search {
  height: 52px;
  padding: 0 22px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-search:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-search:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-search:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* ── Results ── */
#result-area {
  min-height: 20px;
}

.result-card {
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.result-card.not-found {
  background: var(--success-bg);
  border: 1.5px solid var(--success-border);
}

.result-card.found {
  background: var(--warn-bg);
  border: 1.5px solid var(--warn-border);
}

.result-card .result-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
  line-height: 1;
}

.result-card .result-headline {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.35;
}

.not-found .result-headline { color: var(--success-text); }
.found .result-headline { color: var(--warn-text); }

.result-card .result-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* detail table */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.85rem;
}

.detail-table tr:not(:last-child) td {
  border-bottom: 1px solid var(--border);
}

.detail-table td {
  padding: 8px 4px;
  vertical-align: top;
}

.detail-table td:first-child {
  font-weight: 600;
  color: var(--text);
  width: 42%;
  padding-right: 10px;
}

.detail-table td:last-child {
  color: var(--text-muted);
  word-break: break-all;
}

.match-count {
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--warn-border);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  display: inline-block;
  margin-bottom: 10px;
}

.record-separator {
  border: none;
  border-top: 2px dashed var(--warn-border);
  margin: 14px 0;
  opacity: 0.4;
}

/* ── Info section ── */
.info-section {
  margin-top: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.info-section h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.info-section ul {
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.info-section ul li {
  margin-bottom: 4px;
}

/* ── Footer ── */
.site-footer {
  background: #1e293b;
  color: #94a3b8;
  text-align: center;
  padding: 20px 16px;
  font-size: 0.8rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-bottom: 12px;
}

.footer-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.2s;
}

.footer-nav a:hover { color: #fff; }

.footer-copy {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.7;
}

.footer-updated {
  color: #475569;
  font-size: 0.76rem;
}

/* ── Sub-pages ── */
.page-container {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.page-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
}

.page-card h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.page-card h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--text);
}

.page-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.7;
}

.page-card ul, .page-card ol {
  padding-left: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.page-card .back-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.page-card .back-link:hover { text-decoration: underline; }

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.step-num {
  background: var(--primary);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.result-example {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.85rem;
  margin: 10px 0;
}

.result-example.success {
  background: var(--success-bg);
  border-left: 4px solid var(--success-border);
  color: var(--success-text);
}

.result-example.warning {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-border);
  color: var(--warn-text);
}

/* ── Privacy badge on main page ── */
.privacy-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ── Responsive ── */
@media (max-width: 400px) {
  .site-header h1 { font-size: 1.1rem; }
  .tin-input { font-size: 1rem; }
  .btn-search { padding: 0 14px; font-size: 0.9rem; }
}
