:root {
  --vf-green: #2E7D32;
  --vf-green-dark: #1B5E20;
  --vf-orange: #F57C00;
  --vf-orange-dark: #E65100;
  --bg: #F5F7F5;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #c62828;
  --success: #2E7D32;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--vf-green); text-decoration: none; }
a:hover { color: var(--vf-green-dark); text-decoration: underline; }

.nav {
  background: var(--vf-green);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
}
.nav .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
.nav .brand img { height: 32px; }
.nav .brand a { color: #fff; }
.nav .actions a { color: #fff; margin-left: 16px; }
.nav .actions a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

h1, h2, h3 { color: var(--vf-green-dark); margin-top: 0; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

.btn {
  display: inline-block;
  background: var(--vf-green);
  color: #fff;
  padding: 9px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: var(--vf-green-dark); color: #fff; text-decoration: none; }
.btn.btn-orange { background: var(--vf-orange); }
.btn.btn-orange:hover { background: var(--vf-orange-dark); }
.btn.btn-ghost { background: transparent; color: var(--vf-green); border: 1px solid var(--vf-green); }
.btn.btn-ghost:hover { background: var(--vf-green); color: #fff; }
.btn.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { background: #aaa; cursor: not-allowed; }

label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=tel], input[type=date], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--vf-green);
  box-shadow: 0 0 0 3px rgba(46,125,50,.15);
}
.form-row { margin-bottom: 16px; }
.help { font-size: 13px; color: var(--muted); margin-top: 4px; }

.error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c6;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #fafafa; font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fafafa; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.stat .label { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.stat .value { font-size: 28px; font-weight: 700; color: var(--vf-green-dark); margin-top: 4px; }

.login-wrap { max-width: 420px; margin: 80px auto; padding: 0 20px; }
.login-wrap .card { padding: 28px; }
.login-wrap .brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-wrap .brand-row img { height: 40px; }
.login-wrap h1 { font-size: 22px; margin: 0; }

.muted { color: var(--muted); }
.row-flex { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.toolbar .toolbar-actions { display: flex; gap: 10px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.badge.active { background: #e8f5e9; color: var(--vf-green-dark); }
.badge.inactive { background: #f5f5f5; color: var(--muted); }

.qr-block { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.qr-block .qr-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #fafafa; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 14px; word-break: break-all;
}

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0; }

/* ---------------- question editor ---------------- */
.q-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafafa;
}
.q-card .q-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}

/* ---------------- public sign page ---------------- */
.public-page { max-width: 100%; }

.public-header {
  position: relative;
  min-height: 280px;
  background-size: cover;
  background-position: center;
  color: #fff;
}
.public-header-overlay {
  background: linear-gradient(180deg, rgba(27,94,32,.2) 0%, rgba(27,94,32,.78) 100%);
  min-height: 280px;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 24px 28px;
}
.public-header-bar {
  display: flex; justify-content: space-between; align-items: center;
}
.public-logo { height: 56px; background: #fff; border-radius: 50%; padding: 4px; }
.lang-toggle {
  background: rgba(255,255,255,.95);
  border-radius: 999px;
  padding: 4px;
  display: inline-flex;
}
.lang-toggle a {
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: var(--vf-green-dark);
}
.lang-toggle a.active { background: var(--vf-green); color: #fff; }

.public-titles { text-align: center; }
.public-titles h1 {
  color: #fff;
  font-size: 28px;
  margin: 0 0 6px;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.public-titles h2 {
  color: rgba(255,255,255,.9);
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 10px;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.public-target, .public-count {
  color: rgba(255,255,255,.95);
  font-size: 14px;
  margin: 4px 0;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.public-count { font-weight: 700; font-size: 16px; }

.public-main {
  max-width: 760px;
  margin: -20px auto 0;
  padding: 0 16px 40px;
  position: relative;
}

.intro-card .intro-body {
  white-space: normal;
  font-size: 15.5px;
}

.sign-card { margin-top: 16px; }

.closed-banner { background: #fffde7; border-color: #fbc02d; }

.choice-row { display: flex; gap: 16px; flex-wrap: wrap; }
.choice-row label, .choice-stack label {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: normal; font-size: 15px; margin-bottom: 0;
}
.choice-stack {
  display: flex; flex-direction: column; gap: 8px;
}

.sig-wrap {
  border: 2px dashed var(--vf-green);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  position: relative;
}
#sig-pad {
  display: block;
  width: 100%;
  height: 200px;
  touch-action: none;
  cursor: crosshair;
  background: #fff;
}
.sig-actions {
  display: flex; justify-content: flex-end;
  padding: 6px 0 0;
}

.consent { background: #f1f8e9; border: 1px solid #c8e6c9; padding: 12px 14px; border-radius: 6px; }
.consent label {
  font-weight: normal;
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; line-height: 1.5;
}
.consent input[type=checkbox] { margin-top: 4px; }
