* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --brand-900: #1a2440;
  --brand-700: #2b3b66;
  --brand-500: #4b67d4;
  --brand-400: #5f7df0;
  --brand-100: #eef2ff;
  --accent-500: #ff7a59;
  --neutral-900: #18202e;
  --neutral-700: #3b465c;
  --neutral-500: #6b778c;
  --neutral-200: #e7ecf5;
  --neutral-100: #f5f7fb;
  --success-500: #2f8f68;
  --danger-500: #e85b5b;
  --shadow-soft: 0 16px 40px rgba(26, 36, 64, 0.12);
  --shadow-card: 0 10px 26px rgba(26, 36, 64, 0.1);
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
  background: radial-gradient(circle at top, #ffffff 0%, #f0f3ff 35%, #e9eef9 100%);
  color: var(--neutral-900);
}

.public-mode .layout {
  grid-template-columns: 1fr;
}

.public-mode header,
.public-mode .hero {
  margin-bottom: 14px;
}

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  box-shadow: var(--shadow-card);
}

.brand-name {
  font-weight: 700;
  font-size: 20px;
  color: var(--brand-900);
}

.brand-sub {
  font-size: 13px;
  color: var(--neutral-500);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.pill.outline {
  background: transparent;
  border: 1px solid var(--brand-400);
  color: var(--brand-400);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
  padding: 22px 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(75, 103, 212, 0.08), rgba(95, 125, 240, 0.16));
  border: 1px solid rgba(75, 103, 212, 0.2);
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
  color: var(--brand-900);
}

.hero p {
  margin: 0;
  color: var(--neutral-700);
  font-size: 15px;
}

.hero-stats {
  display: grid;
  gap: 12px;
}

.stat {
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--neutral-200);
  box-shadow: 0 6px 16px rgba(26, 36, 64, 0.08);
}

.stat-value {
  font-weight: 700;
  color: var(--brand-700);
}

.stat-label {
  font-size: 12px;
  color: var(--neutral-500);
  margin-top: 4px;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
}

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

.panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--neutral-200);
  margin-bottom: 16px;
}

.panel h2 {
  margin-top: 0;
  font-size: 18px;
  color: var(--brand-900);
}

.auth-panel {
  padding: 16px 18px;
}

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.auth-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-900);
}

.auth-sub {
  font-size: 13px;
  color: var(--neutral-500);
  margin-top: 4px;
}

.auth-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-form-inline {
  margin-top: 12px;
}

.auth-form-inline input {
  flex: 1 1 180px;
  height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--neutral-200);
  background: #ffffff;
  font-size: 14px;
}

.auth-form-inline input::placeholder {
  color: var(--neutral-500);
}

.auth-form-inline button {
  height: 38px;
}

.auth-form input {
  flex: 1 1 180px;
  height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--neutral-200);
  background: #ffffff;
  font-size: 14px;
}

.auth-form input::placeholder {
  color: var(--neutral-500);
}

.auth-form button {
  height: 38px;
}

.auth-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-admin {
  display: grid;
  gap: 12px;
}

.user-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-admin-list {
  display: grid;
  gap: 10px;
}

.user-create {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 1.4fr 160px auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--neutral-200);
  background: #ffffff;
}

.user-create input,
.user-create select {
  height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--neutral-200);
  background: #ffffff;
  font-size: 14px;
}

.user-create input::placeholder {
  color: var(--neutral-500);
}

.user-create button {
  justify-self: start;
  height: 40px;
}

.user-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--neutral-200);
  background: #fbfcff;
}

.user-name {
  font-weight: 600;
  color: var(--neutral-900);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.user-actions select,
.user-actions input {
  min-width: 180px;
  height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--neutral-200);
  background: #ffffff;
  font-size: 14px;
}

.user-actions input::placeholder {
  color: var(--neutral-500);
}

@media (max-width: 960px) {
  .user-create {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 1fr;
  }
}
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.form-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.list button {
  text-align: left;
  border: 1px solid transparent;
  background: #f7f9ff;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--neutral-700);
  transition: all 0.2s ease;
}

.list button:hover {
  border-color: var(--brand-400);
  background: #eef2ff;
}

.list button.active {
  border-color: var(--brand-500);
  background: #e8edff;
  color: var(--brand-900);
  font-weight: 600;
}

button {
  border: none;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 14px rgba(75, 103, 212, 0.2);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(75, 103, 212, 0.25);
}

button.secondary {
  background: #ffffff;
  color: var(--brand-700);
  border: 1px solid var(--neutral-200);
  box-shadow: none;
}

button.secondary:hover {
  box-shadow: 0 6px 12px rgba(26, 36, 64, 0.08);
}

button.danger {
  background: #fff0f0;
  color: var(--danger-500);
  border: 1px solid rgba(232, 91, 91, 0.35);
  box-shadow: none;
}

.status {
  min-height: 24px;
  margin: 10px 0 16px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(47, 143, 104, 0.1);
  color: var(--success-500);
  font-weight: 600;
}

.status.error {
  background: rgba(232, 91, 91, 0.12);
  color: var(--danger-500);
}

.field-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.5fr 1.2fr 1.2fr 1.2fr auto;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.field-row input,
.field-row select,
textarea,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--neutral-200);
  border-radius: 10px;
  background: #ffffff;
  color: var(--neutral-900);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-row input:focus,
.field-row select:focus,
textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(95, 125, 240, 0.2);
}

textarea {
  min-height: 40px;
  resize: vertical;
}

.field-row .required {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--neutral-500);
}

.link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.link-row input {
  flex: 1;
}

.empty {
  color: var(--neutral-500);
  font-size: 14px;
}

.submission {
  border: 1px solid var(--neutral-200);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fbfcff;
}

.submission h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.public-form-head {
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--neutral-200);
  box-shadow: var(--shadow-card);
}

.public-form-head h3 {
  margin: 8px 0 6px;
  font-size: 22px;
  color: var(--brand-900);
}

.public-form {
  display: grid;
  gap: 14px;
}

.form-field {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--neutral-200);
  background: #ffffff;
}

.form-label {
  font-weight: 600;
  color: var(--neutral-900);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--neutral-200);
  background: #ffffff;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(95, 125, 240, 0.2);
}

.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--neutral-200);
  background: #f9fbff;
  font-size: 13px;
  color: var(--neutral-700);
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-input {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid var(--neutral-200);
  display: inline-grid;
  place-items: center;
  background: #ffffff;
  margin: 0;
}

.option-input[type="checkbox"] {
  border-radius: 4px;
}

.option-input::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.2s ease;
}

.option-input[type="checkbox"]::after {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.option-item:has(.option-input:checked) {
  border-color: var(--brand-400);
  background: #eef2ff;
  color: var(--brand-900);
}

.option-input:checked {
  border-color: var(--brand-400);
}

.option-input:checked::after {
  background: var(--brand-400);
}

.option-label {
  font-weight: 600;
}

.form-image {
  display: grid;
  gap: 8px;
}

.form-image img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--neutral-200);
  background: #f5f7fb;
}

.form-image-empty {
  padding: 18px;
  border-radius: 12px;
  border: 1px dashed var(--neutral-200);
  background: #f9fbff;
  color: var(--neutral-500);
  font-size: 13px;
  text-align: center;
}

.form-image-caption {
  font-size: 12px;
  color: var(--neutral-500);
}

.public-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 600;
}

.public-empty {
  padding: 32px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--neutral-200);
  text-align: center;
  box-shadow: var(--shadow-card);
}

.public-empty h3 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--brand-900);
}

.public-empty p {
  margin: 0;
  color: var(--neutral-500);
}

.public-contact {
  margin-top: 16px;
  font-size: 13px;
  color: var(--neutral-500);
  text-align: center;
}

.public-contact a {
  color: var(--brand-500);
  text-decoration: none;
  font-weight: 600;
}

.public-contact a:hover {
  text-decoration: underline;
}

.public-divider {
  margin: 0 6px;
  color: var(--neutral-200);
}

.submission-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.answer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--neutral-200);
  color: var(--neutral-700);
}

.answer:last-child {
  border-bottom: none;
}

.hint {
  font-size: 12px;
  color: var(--neutral-500);
}

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

  .hero {
    grid-template-columns: 1fr;
  }
}
