:root {
  --hf-blue: #1556A3;
  --hf-navy: #173F70;
  --hf-gold: #F9B411;
  --text-main: #111827;
  --text-secondary: #4B5563;
  --bg-page: #F5F7FB;
  --bg-panel: #FFFFFF;
  --border: #E2E8F0;
  --error: #B91C1C;
  --success: #15803D;
  --radius: 10px;
  --focus-ring: 0 0 0 3px rgba(21, 86, 163, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--hf-navy);
  color: #fff;
}

.header-logo {
  height: 40px;
  width: auto;
  background: #fff;
  border-radius: 6px;
  padding: 3px;
}

.site-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.header-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

/* Layout */
.app-grid {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 430px 630px;
  gap: 18px;
  align-items: start;
}

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

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  min-width: 0;
}

.panel h2 {
  margin: 0 0 14px 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--hf-navy);
}

/* Form */
.field { margin-bottom: 14px; min-width: 0; }
.field-row { display: flex; gap: 12px; min-width: 0; }
.field-narrow { max-width: 90px; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.req { color: var(--error); }

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 9px 11px;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-main);
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: var(--hf-blue);
  box-shadow: var(--focus-ring);
}

.error {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--error);
  min-height: 1em;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary { background: var(--hf-blue); color: #fff; }
.btn-primary:hover { background: var(--hf-navy); }
.btn-primary:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
}
.btn-primary:disabled:hover { background: #9CA3AF; }

.btn-secondary { background: #fff; color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: #F3F4F6; }

.status-msg {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 1.2em;
}
.status-msg.ok { color: var(--success); }
.status-msg.fail { color: var(--error); }

/* Preview */
.preview-frame {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  background: #FAFBFD;
  overflow: visible;
}

/* On narrow screens the fixed-width signature can't fit; let the preview
   box itself scroll horizontally so the page doesn't scroll sideways. */
@media (max-width: 1100px) {
  .preview-frame {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

#signature-preview {
  display: block;
}

/* Instructions */
.instructions {
  max-width: 960px;
  margin: 0 auto 30px;
  padding: 0 20px;
}

.instructions details {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.instructions summary {
  font-weight: 700;
  color: var(--hf-navy);
  cursor: pointer;
  font-size: 0.95rem;
}

.instructions ol {
  margin: 12px 0 4px;
  padding-left: 20px;
}

.instructions li {
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-main);
}

/* Footer */
.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 4px 20px 32px;
  text-align: center;
}

.footer-brand {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
}

.footer-muted {
  color: #5B6472;
}

.footer-strong {
  color: var(--hf-navy);
  font-weight: 700;
}

.footer-links {
  margin: 0;
  font-size: 0.8rem;
  color: #5B6472;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-links a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 3px;
}

/* Policy pages (terms.html / privacy.html) */
.policy-main {
  max-width: 720px;
  margin: 32px auto;
  padding: 0 20px 20px;
}

.policy-return {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hf-blue);
  text-decoration: none;
}

.policy-return:hover { text-decoration: underline; }

.policy-return:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

.policy-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
}

.policy-content h1 {
  margin: 0 0 6px 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--hf-navy);
}

.policy-content .effective-date {
  margin: 0 0 28px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.policy-content h2 {
  margin: 28px 0 10px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--hf-navy);
}

.policy-content h2:first-of-type { margin-top: 0; }

.policy-content p {
  margin: 0 0 14px 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-main);
}

.policy-content ul {
  margin: 0 0 14px 0;
  padding-left: 22px;
}

.policy-content li {
  margin-bottom: 6px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
}

.policy-content a {
  color: var(--hf-blue);
}

.policy-content a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 3px;
}

.policy-return-bottom {
  display: inline-block;
  margin-top: 28px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hf-blue);
  text-decoration: none;
}

.policy-return-bottom:hover { text-decoration: underline; }

.policy-return-bottom:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

@media (max-width: 600px) {
  .policy-content { padding: 24px 20px; }
}
