* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F1F5F9;
  color: #1E293B;
  min-height: 100vh;
}
a { color: #2563EB; text-decoration: none; }
button { font-family: inherit; }

.top-header {
  background: linear-gradient(135deg, #1E3A8A 0%, #1E40AF 100%);
  color: white;
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-header h1 { font-size: 22px; font-weight: 600; }
.top-header .subtitle { font-size: 13px; opacity: 0.8; margin-top: 4px; }

.page-home { background: linear-gradient(180deg, #EFF6FF 0%, #F8FAFC 30%); padding: 20px 16px 32px; min-height: 100vh; }
.home-cover {
  width: 100%; height: 160px; border-radius: 16px;
  background: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: white; margin-bottom: 20px;
}
.home-cover .title { font-size: 20px; font-weight: 700; text-align: center; line-height: 1.4; padding: 0 16px; }
.home-cover .meta { font-size: 12px; opacity: 0.9; margin-top: 8px; }
.home-desc { font-size: 13px; color: #475569; line-height: 1.7; margin-bottom: 20px; padding: 0 4px; }
.form-card { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 500; color: #334155; margin-bottom: 6px; display: block; }
.form-input, select.form-input, textarea.form-input {
  width: 100%; height: 44px; border: 1.5px solid #E2E8F0; border-radius: 10px;
  padding: 0 14px; font-size: 14px; color: #1E293B; background: #F8FAFC; outline: none;
}
textarea.form-input { height: auto; padding: 12px 14px; }
.form-input:focus { border-color: #3B82F6; background: white; }
.code-row { display: flex; gap: 10px; }
.code-row .form-input { flex: 1; }
.code-btn {
  white-space: nowrap; padding: 0 16px; height: 44px; border: 1.5px solid #3B82F6;
  background: #EFF6FF; color: #2563EB; font-size: 13px; font-weight: 500; border-radius: 10px; cursor: pointer;
}
.code-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.checkbox-row { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0; font-size: 12px; color: #64748B; line-height: 1.5; }
.checkbox-row input { margin-top: 2px; accent-color: #2563EB; }
.primary-btn, .submit-btn {
  width: 100%; height: 48px; background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: white; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.primary-btn:disabled, .submit-btn:disabled { opacity: 0.6; }
.participant-count { text-align: center; font-size: 12px; color: #64748B; margin-top: 16px; }
.participant-count strong { color: #2563EB; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #0F172A; color: white; padding: 10px 16px; border-radius: 10px; font-size: 13px;
  z-index: 50; display: none;
}
.toast.show { display: block; }
.hint { font-size: 12px; color: #64748B; margin-top: 6px; }
.error { color: #DC2626; font-size: 12px; margin-top: 8px; }

.page-companies { background: #F8FAFC; padding: 16px; min-height: 100vh; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h2 { font-size: 18px; font-weight: 700; }
.count-badge { font-size: 12px; color: #64748B; background: #E2E8F0; padding: 4px 10px; border-radius: 20px; }
.company-card {
  background: white; border-radius: 14px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04); display: flex; gap: 14px; align-items: center; cursor: pointer;
}
.company-logo, .detail-logo {
  width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: white; flex-shrink: 0;
}
.detail-logo { width: 64px; height: 64px; font-size: 24px; border-radius: 14px; }
.logo-blue { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.logo-green { background: linear-gradient(135deg, #10B981, #059669); }
.logo-purple { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }
.logo-orange { background: linear-gradient(135deg, #F59E0B, #D97706); }
.company-info { flex: 1; min-width: 0; }
.company-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.tag-level1 { background: #DBEAFE; color: #1D4ED8; }
.tag-level2 { background: #D1FAE5; color: #059669; }
.tag-multi-house { background: #DBEAFE; color: #1D4ED8; }
.tag-multi-phone { background: #FCE7F3; color: #BE185D; }
.tag-ok { background: #D1FAE5; color: #065F46; }
.tag-bad { background: #FEE2E2; color: #991B1B; }
.tag-warn { background: #FEF3C7; color: #92400E; }
.rel-item { font-size: 13px; padding: 8px 0; border-bottom: 1px dashed #E2E8F0; }
.rel-item:last-child { border-bottom: none; }
.detail-link { font-size: 13px; color: #2563EB; font-weight: 500; white-space: nowrap; }
.bottom-action { position: sticky; bottom: 0; padding: 12px 0 20px; background: linear-gradient(180deg, transparent, #F8FAFC 30%); }

.page-detail { background: #F8FAFC; padding-bottom: 20px; min-height: 100vh; }
.detail-header { background: white; padding: 20px 16px; display: flex; gap: 14px; align-items: center; border-bottom: 1px solid #F1F5F9; }
.detail-company-name { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.detail-tags { display: flex; gap: 6px; }
.detail-section { background: white; margin: 10px 12px; border-radius: 12px; padding: 16px; }
.detail-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; padding-left: 10px; border-left: 3px solid #2563EB; }
.detail-section p { font-size: 13px; color: #475569; line-height: 1.7; }
.cert-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.cert-item { flex: 1; min-width: 80px; height: 70px; background: #F1F5F9; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #64748B; text-align: center; padding: 8px; }
.promise-list { list-style: none; }
.promise-list li { font-size: 13px; color: #475569; padding: 6px 0; display: flex; align-items: center; gap: 8px; }
.promise-list li::before { content: "✓"; color: #10B981; font-weight: 700; }
.case-item { font-size: 13px; color: #475569; padding: 6px 0; border-bottom: 1px dashed #E2E8F0; }
.case-item:last-child { border-bottom: none; }
.fee-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.fee-row .label { color: #64748B; }
.fee-row .value { font-weight: 600; }
.select-fab { position: sticky; bottom: 16px; margin: 0 12px; }
.back-mini { font-size: 13px; color: #2563EB; padding: 12px 16px; display: inline-block; }

.page-vote { background: #F8FAFC; padding: 16px 16px 32px; min-height: 100vh; }
.vote-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; text-align: center; }
.vote-option {
  background: white; border: 2px solid #E2E8F0; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.vote-option.selected { border-color: #2563EB; background: #EFF6FF; }
.radio-circle { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #CBD5E1; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.vote-option.selected .radio-circle { border-color: #2563EB; }
.vote-option.selected .radio-circle::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #2563EB; }
.vote-option-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.vote-option-desc { font-size: 12px; color: #64748B; }
.section-label { font-size: 14px; font-weight: 600; color: #334155; margin: 20px 0 10px; }
.tag-options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag-chip { padding: 8px 14px; border: 1.5px solid #E2E8F0; border-radius: 20px; font-size: 13px; color: #475569; background: white; cursor: pointer; }
.tag-chip.selected { border-color: #2563EB; background: #EFF6FF; color: #2563EB; font-weight: 500; }
.suggestion-box { width: 100%; min-height: 80px; border: 1.5px solid #E2E8F0; border-radius: 10px; padding: 12px; font-size: 13px; background: white; resize: none; outline: none; font-family: inherit; }

.page-success { background: #F8FAFC; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; min-height: 100vh; }
.success-icon { width: 80px; height: 80px; border-radius: 50%; background: #D1FAE5; display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.success-title { font-size: 22px; font-weight: 700; color: #059669; margin-bottom: 8px; }
.success-desc { font-size: 14px; color: #64748B; margin-bottom: 24px; }
.success-card { background: white; border-radius: 14px; padding: 20px; width: 100%; box-shadow: 0 2px 8px rgba(0,0,0,0.04); margin-bottom: 24px; }
.success-card .row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; }
.success-card .row .label { color: #64748B; }
.back-home-btn { width: 100%; height: 48px; background: white; color: #2563EB; border: 1.5px solid #2563EB; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }

.owner-view { display: none; }
.owner-view.active { display: block; }
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: none; align-items: center; justify-content: center; z-index: 40; padding: 24px; }
.modal-mask.show { display: flex; }
.modal { background: white; border-radius: 16px; padding: 20px; max-width: 420px; width: 100%; }
.modal h3 { margin-bottom: 10px; }
.modal p { font-size: 13px; color: #475569; line-height: 1.7; }

/* Admin */
.admin-body { display: flex; min-height: 100vh; }
.admin-sidebar { width: 232px; background: #0F172A; padding: 20px 0; flex-shrink: 0; overflow-y: auto; }
.sidebar-logo { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 16px; }
.sidebar-logo .name { font-size: 16px; font-weight: 700; color: white; }
.sidebar-logo .sub { font-size: 11px; color: #64748B; margin-top: 2px; }
.sidebar-menu { list-style: none; }
.menu-item {
  padding: 10px 16px 10px 17px; font-size: 13px; color: #94A3B8;
  display: flex; align-items: center; gap: 10px;
  border-left: 3px solid transparent; min-height: 40px; box-sizing: border-box;
}
.menu-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item:hover { color: #E2E8F0; background: rgba(255,255,255,0.05); }
.menu-item.active { color: white; background: rgba(37,99,235,0.2); border-left-color: #3B82F6; }
.menu-item.in { color: #E2E8F0; }
.menu-item.lv2 { padding-left: 43px; }
.menu-item.lv3 { padding-left: 59px; }
.menu-icon { width: 16px; height: 16px; flex-shrink: 0; }
.menu-children { list-style: none; }
.admin-main { flex: 1; background: #F8FAFC; padding: 24px; overflow: auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 12px; flex-wrap: wrap; }
.admin-topbar h2 { font-size: 20px; font-weight: 700; }
.status-badge { background: #D1FAE5; color: #059669; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; }
.status-draft { background: #E2E8F0; color: #475569; }
.status-ended { background: #FEE2E2; color: #B91C1C; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.stat-card .label { font-size: 12px; color: #64748B; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .change { font-size: 11px; margin-top: 6px; color: #10B981; }
.stat-card.blue .value { color: #2563EB; }
.stat-card.green .value { color: #059669; }
.stat-card.orange .value { color: #D97706; }
.rate-bar-wrap, .chart-card, .panel {
  background: white; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.rate-bar-header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.rate-bar-header .percent { font-size: 20px; font-weight: 700; color: #2563EB; }
.rate-bar { height: 12px; background: #E2E8F0; border-radius: 6px; overflow: hidden; }
.rate-bar .fill { height: 100%; background: linear-gradient(90deg, #3B82F6, #2563EB); border-radius: 6px; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-card h3, .panel h3 { font-size: 14px; font-weight: 600; color: #334155; margin-bottom: 16px; }
.vote-bar-item { margin-bottom: 14px; }
.vbi-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.vote-bar-track, .building-bar-track { height: 10px; background: #F1F5F9; border-radius: 5px; overflow: hidden; }
.vote-bar-fill, .building-bar-fill { height: 100%; background: linear-gradient(90deg, #60A5FA, #3B82F6); border-radius: 5px; }
.rank-order {
  width: 22px; height: 22px; border-radius: 6px; background: #2563EB; color: white;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fill-blue { background: linear-gradient(90deg, #60A5FA, #2563EB); }
.fill-green { background: linear-gradient(90deg, #34D399, #059669); }
.fill-purple { background: linear-gradient(90deg, #A78BFA, #7C3AED); }
.fill-orange { background: linear-gradient(90deg, #FBBF24, #D97706); }
.building-bar-item { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.b-label { width: 48px; font-size: 12px; color: #64748B; text-align: right; }
.b-percent { width: 48px; font-size: 12px; font-weight: 600; }
.rank-table, .data-table { width: 100%; border-collapse: collapse; }
.rank-table th, .data-table th { text-align: left; font-size: 12px; color: #64748B; font-weight: 500; padding: 8px; border-bottom: 1px solid #E2E8F0; }
.rank-table td, .data-table td { padding: 10px 8px; font-size: 13px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
.rank-num { display: inline-flex; width: 22px; height: 22px; border-radius: 6px; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.rank-1 { background: #FEF3C7; color: #D97706; }
.rank-2 { background: #E2E8F0; color: #475569; }
.rank-3 { background: #FED7AA; color: #C2410C; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px;
  border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 500;
}
.btn-primary { background: #2563EB; color: white; }
.btn-ghost { background: #EFF6FF; color: #1D4ED8; }
.btn-danger { background: #FEE2E2; color: #B91C1C; }
.btn-line { background: white; border: 1px solid #E2E8F0; color: #334155; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1E3A8A, #1E40AF); }
.login-card { width: 400px; background: white; border-radius: 16px; padding: 32px; }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card p { font-size: 13px; color: #64748B; margin-bottom: 24px; }
.flash { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.flash-ok { background: #D1FAE5; color: #065F46; }
.flash-err { background: #FEE2E2; color: #991B1B; }
.muted { color: #64748B; font-size: 12px; }
.community-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.community-pick-card {
  display: block; background: white; border-radius: 12px; padding: 20px; color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); border: 1px solid #E2E8F0; text-decoration: none;
}
.community-pick-card:hover { border-color: #3B82F6; box-shadow: 0 6px 16px rgba(37,99,235,0.08); }
.community-pick-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.community-pick-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; font-size: 12px; color: #64748B; }
.community-pick-go { margin-top: 14px; font-size: 13px; font-weight: 600; color: #2563EB; }
.community-index-name { display: inline-flex; align-items: center; gap: 10px; color: inherit; }
.letter-avatar {
  width: 28px; height: 28px; border-radius: 8px; background: #EFF6FF; color: #2563EB;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.subnav {
  display: flex; gap: 4px; margin: -8px 0 20px; padding: 4px; background: #E2E8F0; border-radius: 10px; width: fit-content; max-width: 100%; flex-wrap: wrap;
}
.subnav-item {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 8px; font-size: 13px; font-weight: 500; color: #475569;
}
.subnav-item:hover { color: #1E293B; background: rgba(255,255,255,0.6); }
.subnav-item.active { background: white; color: #1D4ED8; font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,0.06); }
.subnav-badge { background: #DBEAFE; color: #1D4ED8; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.crumb { font-size: 13px; color: #64748B; margin-bottom: 6px; }
.crumb a { color: #2563EB; }
.stat-card { text-decoration: none; color: inherit; display: block; }
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 13px;
}
.pager a { background: white; border: 1px solid #E2E8F0; color: #334155; }
.pager a:hover { border-color: #3B82F6; color: #2563EB; }
.pager .current { background: #2563EB; color: white; font-weight: 600; }
.batch-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 12px; padding: 10px 12px; background: #F8FAFC; border-radius: 8px;
}
.batch-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #475569; }
.batch-filter input { accent-color: #2563EB; }
.qr-box { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) {
  .stats-row, .charts-grid, .grid-2 { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-main { padding: 16px; }
}
