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

:root {
  --bg:              #f5f6f8;
  --surface:         #ffffff;
  --border:          #e2e4e9;
  --text:            #1a1d23;
  --text-muted:      #6b7280;
  --primary:         #2563eb;
  --primary-hover:   #1d4ed8;
  --success-bg:      #f0fdf4;
  --success-border:  #bbf7d0;
  --success-text:    #166534;
  --warning-bg:      #fffbeb;
  --warning-border:  #fde68a;
  --warning-text:    #92400e;
  --error-bg:        #fef2f2;
  --error-border:    #fecaca;
  --error-text:      #991b1b;
  --radius:          8px;
  --shadow:          0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
}

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

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  background: #1a1d23;
  color: white;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner { max-width: 920px; margin: 0 auto; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.logo-mark { font-size: 18px; color: #60a5fa; }
.logo-text  { font-size: 18px; font-weight: 700; letter-spacing: -0.4px; }
.logo-badge {
  font-size: 11px;
  font-weight: 500;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  padding: 2px 8px;
  border-radius: 20px;
}

.tagline   { color: rgba(255,255,255,0.65); font-size: 14px; margin-bottom: 6px; }
.disclaimer {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.07);
  padding: 2px 10px;
  border-radius: 4px;
  display: inline-block;
}

/* ── Main layout ─────────────────────────────────────────────────────────── */
.main { padding: 32px 16px 48px; }

.container {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 700px) {
  .container { grid-template-columns: 1fr; }
}

/* ── Panels ──────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }

.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.optional { font-weight: 400; color: var(--text-muted); }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.input--locked {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}
.hint code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
}

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}
.radio-label:hover { background: var(--bg); }
.radio-label input[type="radio"]:checked + span { font-weight: 500; }

.btn-submit {
  width: 100%;
  margin-top: 8px;
  padding: 11px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-submit:hover  { background: var(--primary-hover); }
.btn-submit:active { transform: scale(0.99); }

/* ── Result panel ────────────────────────────────────────────────────────── */
.result-panel { display: none; }
.result-panel.visible { display: block; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.status-badge--valid   { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.status-badge--review  { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.status-badge--invalid { background: var(--error-bg);   color: var(--error-text);   border: 1px solid var(--error-border); }

.explanation-box {
  padding: 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 12px;
}
.explanation-box--valid   { background: var(--success-bg); border: 1px solid var(--success-border); }
.explanation-box--review  { background: var(--warning-bg); border: 1px solid var(--warning-border); }
.explanation-box--invalid { background: var(--error-bg);   border: 1px solid var(--error-border); }

.action-box {
  background: #f0f4ff;
  border: 1px solid #c7d7fe;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.action-box strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 4px;
}

.invoice-note {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.invoice-note strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.invoice-note code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text);
}

.json-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s;
}
.json-toggle:hover { background: var(--bg); }

.json-output {
  display: none;
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px;
  border-radius: var(--radius);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 8px;
  white-space: pre;
  overflow-x: auto;
}
.json-output.visible { display: block; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px 32px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.feedback-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.feedback-link:hover { text-decoration: underline; }
