/* register-app / style.css — Mobile-first */

:root {
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-light: #ccfbf1;
  --danger: #dc2626;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}
html[data-font-scale="sm"] { font-size: 18px; }
html[data-font-scale="md"] { font-size: 20px; }
html[data-font-scale="lg"] { font-size: 24px; }

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  line-height: 1.5;
}
body.picker-open { overflow: hidden; }

/* Header */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 24px 16px 20px;
}
.header-inner { max-width: 640px; margin: 0 auto; }
.eyebrow {
  margin: 0 0 2px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}
.app-header h1 { margin: 0; font-size: 1.5rem; font-weight: 700; }
.subtitle { margin: 4px 0 0; font-size: 0.875rem; opacity: 0.85; }
.display-toolbar {
  margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.display-toolbar-label { font-size: 0.8125rem; font-weight: 600; opacity: 0.92; }
.font-scale-controls {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px;
  border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
}
.font-scale-btn {
  min-width: 40px; min-height: 34px; padding: 0 12px;
  border: none; border-radius: 999px; background: transparent;
  color: #fff; font-size: 0.8125rem; font-weight: 700; cursor: pointer;
}
.font-scale-btn:hover, .font-scale-btn:focus-visible { background: rgba(255,255,255,.18); outline: none; }
.font-scale-btn.is-active { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* App shells */
.app-shell {
  max-width: 640px; margin: 0 auto;
  padding: 16px 12px calc(80px + var(--safe-bottom));
}
.login-shell {
  padding-top: 32px;
  display: flex; align-items: center; justify-content: center;
  min-height: 50dvh;
}

/* Cards */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 1.125rem; font-weight: 600; }
.card .hint { margin: 0 0 12px; font-size: 0.8125rem; color: var(--gray-500); }

/* Login */
.login-card { text-align: center; padding: 32px 24px; }
.login-badge {
  display: inline-block; background: var(--primary-light); color: var(--primary);
  font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 4px 12px; margin-bottom: 12px;
}

/* Profile */
.profile-card { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.profile-card .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; background: var(--gray-200);
}
.profile-card .profile-info { display: flex; flex-direction: column; }
.profile-card .profile-name { font-weight: 600; font-size: 0.9375rem; }
.profile-card .profile-sub { font-size: 0.75rem; color: var(--gray-500); }

/* Form fields */
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 0.8125rem; font-weight: 500; color: var(--gray-700); }
.required { color: var(--danger); }
.field-hint { font-size: 0.75rem; color: var(--gray-500); }
.field-hint.error { color: var(--danger); }
.field-hint.success { color: var(--success); }

.text-input, .select-input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: var(--font); color: var(--gray-800);
  background: #fff; transition: border-color 0.15s;
  -webkit-appearance: none; appearance: none;
}
.text-input.textarea { min-height: 96px; padding-top: 10px; padding-bottom: 10px; resize: vertical; }
.text-input:focus, .select-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.text-input.error, .select-input.error { border-color: var(--danger); }

.vendor-type-field { border: none; padding: 0; margin: 0; }
.vendor-type-field .field-label { display: block; margin-bottom: 6px; padding: 0; }
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill {
  flex: 1; min-width: 120px; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; font-size: 0.9375rem; font-weight: 500;
}
.radio-pill input[type="radio"] { accent-color: var(--primary); }
.radio-pill:has(input:checked) {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600;
}

/* Category picker (custom) */
.native-select-hidden { display: none; }
.picker-trigger {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: var(--font); color: var(--gray-800);
  background: #fff; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; cursor: pointer; text-align: left;
}
.picker-trigger::after { content: "▾"; color: var(--gray-500); flex-shrink: 0; }
.picker-trigger:focus, .picker-trigger:focus-visible {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.picker-trigger.is-placeholder { color: var(--gray-500); }

.picker-backdrop {
  position: fixed; inset: 0; z-index: 240;
  background: rgba(17, 24, 39, 0.48);
  display: flex; align-items: flex-end; justify-content: center; padding-top: 32px;
}
.picker-sheet {
  width: min(640px, 100%); max-height: min(72vh, 560px);
  background: #fff; border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.18);
  padding: 18px 16px calc(16px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.picker-sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.picker-sheet-title { margin: 0; font-size: 1.125rem; font-weight: 700; }
.picker-sheet-close {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: var(--gray-100); color: var(--gray-600); font-size: 1.125rem; cursor: pointer;
}
.picker-option-list { display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.picker-option {
  width: 100%; min-height: 50px; padding: 14px 16px;
  border: 1px solid var(--gray-300); border-radius: 14px;
  background: #fff; color: var(--gray-800);
  font-size: 0.9375rem; font-weight: 600; cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.picker-option.is-selected {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary);
}

/* File upload */
.upload-field { gap: 8px; }
.upload-box {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; border: 1px dashed var(--gray-300);
  border-radius: var(--radius-sm); background: var(--gray-50);
}
.upload-box.has-file { border-style: solid; border-color: var(--primary); background: #fff; }
.upload-box.error { border-color: var(--danger); }
.upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-pick-btn {
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); background: #fff;
  color: var(--gray-700); font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.upload-pick-btn:hover { border-color: var(--primary); color: var(--primary); }
.upload-clear-btn {
  background: none; border: none; color: var(--danger);
  font-size: 0.8125rem; cursor: pointer; padding: 4px 0;
}
.upload-file-name {
  font-size: 0.875rem; color: var(--gray-700); word-break: break-all; flex: 1; min-width: 0;
}
.upload-file-list {
  margin: 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.upload-file-item {
  display: flex; flex-direction: column; gap: 2px;
  color: var(--gray-700);
}
.upload-file-item-name {
  font-size: 0.8125rem; line-height: 1.5; word-break: break-all;
}
.upload-file-item-meta {
  font-size: 0.75rem; color: var(--gray-500);
}
.upload-progress {
  width: 100%; height: 6px; background: var(--gray-200); border-radius: 999px; overflow: hidden;
}
.upload-progress-bar { height: 100%; background: var(--primary); width: 0; transition: width 0.2s ease; }
.upload-status { font-size: 0.75rem; color: var(--gray-500); }
.upload-status.error { color: var(--danger); }
.upload-status.success { color: var(--success); }
.upload-input { display: none; }

/* Notice acknowledgement */
.notice-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); background: var(--gray-50);
}
.notice-copy {
  margin: 0; font-size: 0.875rem; color: var(--gray-700);
}
.notice-details {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
}
.notice-summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none;
  font-size: 0.875rem; font-weight: 700; color: var(--gray-800);
}
.notice-summary::-webkit-details-marker { display: none; }
.notice-summary::after {
  content: "▾"; color: var(--gray-500); flex-shrink: 0;
  transition: transform 0.15s ease;
}
.notice-details[open] .notice-summary::after { transform: rotate(180deg); }
.notice-body {
  padding: 14px; border-top: 1px solid var(--gray-200);
  display: flex; flex-direction: column; gap: 14px;
}
.notice-body p {
  margin: 0; font-size: 0.8125rem; color: var(--gray-700); line-height: 1.7;
}
.notice-loading { color: var(--gray-500); }
.notice-error { color: var(--danger); }
.notice-source-title {
  font-size: 0.9375rem !important; font-weight: 700; color: var(--gray-800) !important;
}
.notice-section {
  display: flex; flex-direction: column; gap: 10px;
}
.notice-section + .notice-section {
  padding-top: 14px; border-top: 1px solid var(--gray-100);
}
.notice-section-title {
  margin: 0; font-size: 0.875rem; font-weight: 700; color: var(--primary);
}
.notice-section-body {
  display: flex; flex-direction: column; gap: 10px;
}
.notice-body ul {
  margin: 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 0.8125rem; color: var(--gray-700);
}
.notice-body li { line-height: 1.7; }
.notice-body li > ul { margin-top: 8px; }
.notice-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.notice-link {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 1 1 160px;
  min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--primary); background: #fff; color: var(--primary);
  font-size: 0.875rem; font-weight: 700; text-decoration: none;
}
.notice-link:hover, .notice-link:focus-visible {
  background: var(--primary-light); outline: none;
}
.notice-link-secondary {
  border-color: var(--gray-300); color: var(--gray-700);
}
.notice-link-secondary:hover, .notice-link-secondary:focus-visible {
  background: var(--gray-100); color: var(--gray-800);
}
.notice-status {
  margin: 0; font-size: 0.75rem; color: var(--gray-500);
}
.notice-status.is-ready { color: var(--primary); }
.notice-check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); background: #fff;
  font-size: 0.875rem; color: var(--gray-700);
}
.notice-check input {
  width: 18px; height: 18px; margin-top: 2px;
  accent-color: var(--primary); flex-shrink: 0;
}
.notice-check.is-disabled { opacity: 0.72; }

/* Sticky action */
.sticky-action {
  position: sticky; bottom: 0;
  background: linear-gradient(180deg, rgba(243,244,246,0) 0%, rgba(243,244,246,0.95) 30%, rgba(243,244,246,1) 100%);
  padding: 16px 0 calc(16px + var(--safe-bottom));
  margin-top: 8px;
}
.primary-button {
  width: 100%; min-height: 52px; padding: 14px 16px;
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s;
}
.primary-button:hover, .primary-button:focus-visible { background: var(--primary-hover); outline: none; }
.primary-button:disabled { background: var(--gray-400); cursor: not-allowed; }

.ghost-button {
  width: 100%; min-height: 48px; padding: 12px 16px;
  background: #fff; color: var(--gray-700);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 0.9375rem; font-weight: 600; cursor: pointer;
}
.ghost-button:hover { border-color: var(--primary); color: var(--primary); }

/* Messages */
.inline-message {
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 0.875rem; margin: 8px 0; line-height: 1.5;
}
.inline-message.info { background: var(--primary-light); color: var(--primary); }
.inline-message.error { background: #fee2e2; color: #b91c1c; }
.inline-message.success { background: var(--success-light); color: #166534; }
.inline-message.warning { background: #fef3c7; color: #92400e; }

/* Success card */
.success-card { text-align: center; padding: 36px 20px; }
.success-icon { font-size: 3rem; margin-bottom: 8px; }
