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

:root {
  --blue-50: #e8f1f8; --blue-100: #c5daea; --blue-200: #9ec3db;
  --blue-500: #1f6694; --blue-600: #184E77; --blue-700: #184E77; --blue-800: #123d5e;
  --green-50: #f0fdf4; --green-600: #16a34a;
  --red-50: #fef2f2; --red-600: #dc2626;
  --amber-50: #fffbeb; --amber-600: #d97706;
  --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0; --gray-300: #cbd5e1;
  --gray-400: #94a3b8; --gray-500: #64748b; --gray-600: #475569; --gray-700: #334155;
  --gray-800: #1e293b; --gray-900: #0f172a;
  --radius: 10px; --radius-sm: 6px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--gray-900); background: var(--gray-50);
  line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container { max-width: 640px; margin: 0 auto; padding: 0 16px; width: 100%; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 0 24px; width: 100%; }

header {
  background: var(--blue-700); padding: 14px 0;
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 960px; margin: 0 auto; padding: 0 24px; width: 100%;
  display: flex; justify-content: space-between; align-items: center;
}
.header-nav { display: flex; gap: 16px; align-items: center; }
.header-link {
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.8);
  text-decoration: none; transition: color 0.15s;
}
.header-link:hover { color: #fff; }
.logo { font-size: 15px; font-weight: 600; color: #fff; text-decoration: none; letter-spacing: -0.2px; }

main { flex: 1; padding: 28px 16px 48px; }

footer {
  border-top: 1px solid var(--gray-200); padding: 16px 0;
  text-align: center; color: var(--gray-400); font-size: 12px; background: #fff;
}

/* Card */
.card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 24px 20px;
}
.card + .card { margin-top: 16px; }

/* Centered message */
.centered-message { text-align: center; padding: 64px 0; }
.centered-message h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.centered-message .subtitle { font-size: 15px; color: var(--gray-500); max-width: 360px; margin: 0 auto; }
.centered-message .hint { margin-top: 20px; font-size: 13px; color: var(--gray-400); }
.centered-message .message { font-size: 15px; color: var(--gray-600); }
.icon-check { font-size: 44px; margin-bottom: 8px; display: block; }

/* Petition */
.petition h1 { font-size: 22px; font-weight: 700; line-height: 1.3; }
.petition-body { margin-top: 14px; font-size: 14px; line-height: 1.75; color: var(--gray-600); }
.petition-body p { margin-bottom: 10px; }
.sig-count { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--gray-100); display: flex; align-items: center; gap: 10px; }
.sig-count-number {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--green-50); color: var(--green-600);
  font-weight: 700; font-size: 16px; width: 36px; height: 36px; border-radius: 50%;
}
.sig-count-label { font-size: 13px; color: var(--gray-500); }

/* Form */
.sign-form h2 { font-size: 17px; font-weight: 700; margin-bottom: 20px; }

.field { margin-bottom: 18px; }
.field label {
  display: block; font-weight: 600; font-size: 13px; color: var(--gray-700);
  margin-bottom: 5px;
}
.field input[type="text"], .field input[type="email"], .field input[type="tel"],
.field input[type="password"], .field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; color: var(--gray-900);
  background: #fff; transition: border-color 0.15s;
  -webkit-appearance: none;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.field input::placeholder, .field textarea::placeholder { color: var(--gray-400); }
.field small { display: block; margin-top: 4px; color: var(--gray-400); font-size: 12px; }
.field textarea { resize: vertical; min-height: 100px; }

/* Toggle */
.verify-toggle {
  display: flex; background: var(--gray-100); border-radius: var(--radius-sm);
  padding: 3px; gap: 2px; margin-top: 5px;
}
.toggle-btn {
  flex: 1; padding: 9px 14px; border: none; background: transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; color: var(--gray-500);
  border-radius: 4px; transition: all 0.15s; font-family: inherit;
}
.toggle-btn.active { background: #fff; color: var(--blue-600); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

/* Canvas */
.canvas-wrapper {
  border: 2px dashed var(--gray-300); border-radius: var(--radius-sm);
  background: #fff; cursor: crosshair; touch-action: none; overflow: hidden;
}
.canvas-wrapper canvas { display: block; width: 100%; height: 150px; }

/* Attestation */
.attestation label {
  display: flex; align-items: flex-start; gap: 8px;
  font-weight: normal; font-size: 13px; color: var(--gray-500); cursor: pointer;
}
.attestation input[type="checkbox"] { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--blue-600); }

/* Buttons */
.btn-primary {
  display: block; width: 100%; background: var(--blue-600); color: #fff; border: none;
  padding: 11px 20px; font-size: 14px; font-weight: 600; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; text-align: center; transition: background 0.15s;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { background: var(--blue-700); }
.btn-primary:active { background: var(--blue-800); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-primary.auto-width { width: auto; display: inline-block; }

.btn-secondary {
  display: inline-block; background: #fff; color: var(--gray-700);
  border: 1px solid var(--gray-200); padding: 8px 14px;
  font-size: 13px; font-weight: 500; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; transition: all 0.15s; font-family: inherit;
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-danger {
  display: inline-block; background: #fff; color: var(--red-600);
  border: 1px solid #fecaca; padding: 8px 14px;
  font-size: 13px; font-weight: 500; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn-danger:hover { background: var(--red-50); }

.btn-warn {
  display: inline-block; background: #fff; color: var(--amber-600);
  border: 1px solid #fde68a; padding: 8px 14px;
  font-size: 13px; font-weight: 500; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn-warn:hover { background: var(--amber-50); }

.btn-link {
  background: none; border: none; color: var(--blue-600); cursor: pointer;
  font-size: 13px; text-decoration: none; padding: 4px 0; font-family: inherit; font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

/* Code input */
.code-form { max-width: 240px; margin: 24px auto 0; }
.code-input {
  text-align: center; font-size: 28px !important; font-weight: 700;
  letter-spacing: 8px; padding: 12px !important;
  font-family: 'SF Mono', 'Menlo', monospace;
}

/* Resend row */
.resend-row {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; justify-content: center;
}
.resend-sep { color: var(--gray-300); }

/* Verified badge */
.verified-badge {
  display: inline-block; background: var(--green-50); color: var(--green-600);
  font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 16px; margin-bottom: 20px;
}

/* Field error */
.field-error { color: var(--red-600); font-size: 12px; min-height: 14px; display: block; margin-top: 3px; }

/* Error box */
.error-box {
  background: var(--red-50); border: 1px solid #fecaca; color: var(--red-600);
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px;
}

/* Badge */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-open { background: var(--green-50); color: var(--green-600); }
.badge-closed { background: var(--red-50); color: var(--red-600); }

/* Attachment links */
.attachment-link {
  display: inline-block; margin-right: 12px; margin-bottom: 6px;
  font-size: 13px; color: var(--blue-600); text-decoration: none;
  padding: 4px 10px; background: var(--blue-50); border-radius: 4px;
}
.attachment-link:hover { background: var(--blue-100); }

/* Address autocomplete */
.autocomplete-wrapper { position: relative; }
.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0; background: #fff;
  border: 1px solid var(--gray-200); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08); z-index: 50; max-height: 180px; overflow-y: auto;
}
.autocomplete-item {
  padding: 9px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--gray-100);
}
.autocomplete-item:hover { background: var(--blue-50); }
.autocomplete-item:last-child { border-bottom: none; }

/* Owner warning */
.owner-warning {
  background: var(--amber-50); border: 1px solid #fde68a;
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px; font-size: 13px;
}
.owner-warning p { margin-bottom: 6px; }
.owner-warning-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Admin */
.admin { max-width: 1100px; margin: 0 auto; width: 100%; }
.admin h1 { font-size: 20px; font-weight: 700; }
.admin h2 { font-size: 15px; font-weight: 600; color: var(--gray-700); }

.admin-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.admin-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.admin-login { max-width: 340px; margin: 40px auto; width: 100%; }
.admin-login h1 { margin-bottom: 20px; }

.petition-url {
  font-family: 'SF Mono', 'Menlo', monospace; font-size: 12px;
  background: var(--gray-100); padding: 2px 6px; border-radius: 3px;
  color: var(--gray-600); text-decoration: none;
}
.petition-url:hover { background: var(--gray-200); }

.inline-form { display: inline; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.empty { color: var(--gray-400); padding: 36px 0; text-align: center; font-size: 13px; }

/* Dashboard */
.dash-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
}
.dash-header h1 { font-size: 22px; font-weight: 700; }
.dash-new-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue-600); color: #fff; border: none;
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  border-radius: 8px; text-decoration: none; transition: background 0.15s;
}
.dash-new-btn:hover { background: var(--blue-700); }

.dash-empty { text-align: center; padding: 60px 0; }
.dash-empty p { color: var(--gray-400); margin-bottom: 16px; font-size: 15px; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.dash-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: 12px;
  overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-card:hover { border-color: var(--blue-200); box-shadow: 0 4px 16px rgba(59,130,246,0.08); }

.dash-card-link { display: block; padding: 20px; text-decoration: none; color: inherit; }

.dash-card-top { margin-bottom: 10px; }

.dash-status {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.dash-status-open { background: #dcfce7; color: #15803d; }
.dash-status-closed { background: #fee2e2; color: #b91c1c; }

.dash-card-title {
  font-size: 17px; font-weight: 700; color: var(--gray-900);
  line-height: 1.3; margin-bottom: 14px;
}

.dash-card-stats { display: flex; gap: 20px; }

.dash-stat { }
.dash-stat-num {
  display: block; font-size: 28px; font-weight: 800; color: var(--blue-600); line-height: 1;
}
.dash-stat-muted .dash-stat-num { color: var(--gray-400); font-size: 20px; }
.dash-stat-label {
  display: block; font-size: 11px; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;
}

.dash-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50);
}
.dash-card-slug {
  font-family: 'SF Mono','Menlo',monospace; font-size: 12px; color: var(--gray-400);
}
.dash-card-actions { display: flex; gap: 12px; }
.dash-card-actions a {
  font-size: 13px; font-weight: 500; color: var(--blue-600);
  text-decoration: none; transition: color 0.15s;
}
.dash-card-actions a:hover { color: var(--blue-800); text-decoration: underline; }

.dash-logout { text-align: center; margin-top: 24px; }

/* Signature cards */
.sig-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px;
}
.sig-card-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sig-card-main { flex: 1; min-width: 0; }
.sig-card-right { flex-shrink: 0; text-align: right; }
.sig-card-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.sig-card-date { font-size: 12px; color: var(--gray-400); }
.sig-card-detail { font-size: 13px; color: var(--gray-500); line-height: 1.4; }
.sig-card-actions {
  display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100);
}
.sig-preview { max-width: 90px; max-height: 32px; border-radius: 3px; }

/* Subscribe */
.sub-person { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--gray-100); }
.sub-person:last-of-type { border-bottom: none; }
.sub-code-entry { margin-bottom: 12px; }

/* Blog: Layout with sidebar */
.blog-layout { display: flex; gap: 24px; margin-top: 24px; }
.blog-sidebar {
  width: 200px; flex-shrink: 0; position: sticky; top: 64px; align-self: flex-start;
}
.blog-main { flex: 1; min-width: 0; }
.blog-main .post:first-child { margin-top: 0; }
.sidebar-nav {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.sidebar-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--gray-400); margin-bottom: 8px;
}
.sidebar-nav a {
  display: block; padding: 8px 12px; font-size: 13px; font-weight: 500;
  color: var(--gray-600); text-decoration: none; border-radius: var(--radius-sm);
  transition: all 0.15s; line-height: 1.4;
}
.sidebar-nav a:hover { background: var(--gray-50); color: var(--gray-900); }
.sidebar-nav a.active { background: var(--blue-50); color: var(--blue-700); font-weight: 600; }
.sidebar-nav .nav-date {
  display: block; font-size: 11px; color: var(--gray-400); margin-top: 2px;
}

/* Blog: Hero */
.hero { text-align: center; padding: 48px 0 16px; }
.hero h1 { font-size: 28px; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.3px; }
.hero .subtitle { font-size: 16px; color: var(--gray-500); max-width: 460px; margin: 0 auto; line-height: 1.6; }

/* Blog: Post */
.post {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: 12px; margin-top: 28px; overflow: hidden;
}
.post + .post { margin-top: 32px; }
.post-header {
  padding: 28px 28px 0;
}
.post-date {
  display: inline-block; font-size: 13px; font-weight: 600;
  color: var(--blue-600); text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.post-title {
  font-size: 22px; font-weight: 800; line-height: 1.3;
  color: var(--gray-900); letter-spacing: -0.2px;
}
.post-meta {
  font-size: 13px; color: var(--gray-400); margin-top: 6px;
}
.post-body {
  padding: 20px 28px 28px;
}
.post-body h3 {
  font-size: 17px; font-weight: 700; margin: 24px 0 10px; color: var(--gray-800);
}
.post-body p {
  font-size: 16px; color: var(--gray-600); line-height: 1.8; margin-bottom: 12px;
}
.post-body ul, .post-body ol {
  font-size: 16px; color: var(--gray-600); line-height: 1.8;
  margin: 10px 0 14px 24px;
}
.post-body li { margin-bottom: 6px; }

/* Blog: Post lede (intro paragraph) */
.post-lede {
  font-size: 17px; color: var(--gray-700); line-height: 1.8;
  padding-bottom: 20px; margin-bottom: 20px;
  border-bottom: 1px solid var(--gray-100);
}

/* Blog: Callout box (neutral, not red) */
.callout-box {
  background: var(--blue-50); border: 1px solid var(--blue-200);
  border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0;
  font-size: 15px; color: var(--gray-700); line-height: 1.7;
}
.callout-box strong { color: var(--gray-900); }
.callout-box ul { margin: 8px 0 0 20px; font-size: 15px; }
.callout-box li { margin-bottom: 4px; }

/* Blog: Policy quotes */
.policy-quote {
  background: var(--gray-50); border-left: 3px solid var(--gray-300);
  padding: 14px 20px; margin: 14px 0;
  font-size: 15px; color: var(--gray-600); line-height: 1.8;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
.policy-quote .quote-source {
  display: block; margin-top: 8px; font-style: normal;
  font-size: 13px; color: var(--gray-400); font-weight: 600;
}

/* Blog: Statute reference */
.statute {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 13px; background: var(--blue-50); color: var(--blue-700);
  padding: 2px 8px; border-radius: 3px; white-space: nowrap;
}

/* Blog: Section numbering */
.section-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--gray-700); color: #fff;
  font-size: 12px; font-weight: 700; border-radius: 50%; margin-right: 8px;
  flex-shrink: 0; vertical-align: middle;
}

/* Blog: Collapsible analysis sections */
.analysis-section {
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  margin-bottom: 10px; overflow: hidden;
}
.analysis-section summary {
  padding: 14px 18px; font-size: 15px; font-weight: 600;
  color: var(--gray-800); cursor: pointer; list-style: none;
  display: flex; align-items: center; transition: background 0.15s;
}
.analysis-section summary::-webkit-details-marker { display: none; }
.analysis-section summary::after {
  content: '+'; margin-left: auto; font-size: 18px; font-weight: 400;
  color: var(--gray-400); transition: transform 0.2s;
}
.analysis-section[open] summary::after { content: '\2212'; }
.analysis-section summary:hover { background: var(--gray-50); }
.analysis-section[open] summary {
  border-bottom: 1px solid var(--gray-100); background: var(--gray-50);
}
.analysis-content {
  padding: 16px 18px;
}
.analysis-content p {
  font-size: 15px; color: var(--gray-600); line-height: 1.8; margin-bottom: 10px;
}
.analysis-content p:last-child { margin-bottom: 0; }

/* Blog: Post footer info */
.post-footer-info {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--gray-100);
  font-size: 13px; color: var(--gray-400); line-height: 1.6;
}

/* Blog: Video */
.video-wrapper {
  margin: 20px 0; border-radius: var(--radius); overflow: hidden;
  background: #000; text-align: center;
}
.video-wrapper video { display: block; margin: 0 auto; }
.video-caption {
  font-size: 13px; color: var(--gray-400); padding: 10px 0 4px;
  text-align: center; background: #000;
}

/* Blog: Contact toggle */
.contact-toggle { text-align: center; margin: 24px 0; }
.contact-section { display: none; margin-top: 24px; }
.contact-section.open { display: block; }

/* Responsive */
@media (max-width: 640px) {
  main { padding: 20px 12px 36px; }
  .card { padding: 18px 14px; }
  .petition h1 { font-size: 19px; }
  .sign-form h2 { font-size: 16px; }
  .centered-message { padding: 40px 0; }
  .centered-message h1 { font-size: 20px; }
  .canvas-wrapper canvas { height: 130px; }

  .container-wide { padding: 0 14px; }
  .header-inner { padding: 0 14px; }
  .hero { padding: 32px 0 8px; }
  .hero h1 { font-size: 22px; }
  .hero .subtitle { font-size: 15px; }
  .post-header { padding: 20px 18px 0; }
  .post-body { padding: 16px 18px 20px; }
  .post-title { font-size: 18px; }
  .post-body p, .post-body ul, .post-body ol { font-size: 15px; }
  .post-body h3 { font-size: 15px; }
  .post-lede { font-size: 15px; }
  .callout-box { font-size: 14px; padding: 14px 16px; }
  .policy-quote { font-size: 14px; padding: 12px 14px; }
  .analysis-content p { font-size: 14px; }
  .header-nav { gap: 12px; }
  .header-link { font-size: 12px; }
  .blog-layout { flex-direction: column; }
  .blog-sidebar { position: static; width: 100%; margin-bottom: 0; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .sidebar-nav a { white-space: nowrap; }

  .admin-header { flex-direction: column; gap: 10px; }
  .admin-actions {
    width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  }
  .admin-actions .btn-secondary, .admin-actions .btn-danger, .admin-actions .btn-primary {
    text-align: center; font-size: 13px; padding: 12px 8px;
  }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card-title { font-size: 16px; }
  .dash-stat-num { font-size: 24px; }
  .admin-actions .btn-link { grid-column: 1 / -1; text-align: center; }
  .admin h1 { font-size: 17px; }
  .admin h2 { font-size: 13px; }
  .petition-url { display: block; margin-top: 4px; font-size: 11px; word-break: break-all; }
  .sig-card-row { flex-direction: column; gap: 6px; }
  .sig-card-right { text-align: left; }
  .sig-card-name { font-size: 13px; }
  .sig-card-detail { font-size: 12px; }
  .sig-card-actions .btn-warn, .sig-card-actions .btn-danger, .sig-card-actions .btn-secondary {
    font-size: 11px; padding: 6px 10px;
  }
}
