:root {
  color-scheme: light;
  --ink: #144653;
  --muted: #627180;
  --line: #d8dce6;
  --paper: #ffffff;
  --canvas: #f5f6f9;
  --brand: #3a435e;
  --brand-dark: #2b334b;
  --brand-soft: #eef0f6;
  --accent: #fc6b37;
  --accent-soft: #fff1e9;
  --accent-border: #efb69f;
  --heading-accent: #e25828;
  --action: #c74f1a;
  --action-hover: #a94016;
  --focus: #ed8a60;
  --red: #b14c3b;
  --red-soft: #fff0ec;
  --amber: #95651c;
  --amber-soft: #fff4da;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-width: 320px; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: inherit; }
.app-shell { min-height: 100dvh; }
.loading-screen { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px max(24px, calc((100vw - 1160px) / 2)); background: var(--brand); color: #fff; border-bottom: 1px solid var(--brand-dark); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 35px; height: 35px; flex: 0 0 auto; }
.brand-name { font-size: 15px; line-height: 1.2; font-weight: 720; }
.brand-subtitle { font-size: 11px; color: #d2d8e4; margin-top: 3px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.top-user { color: #e4e8f0; font-size: 13px; padding: 0 7px; }
.button { min-height: 38px; border: 1px solid transparent; padding: 8px 13px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 650; cursor: pointer; text-decoration: none; transition: background .16s, border-color .16s, color .16s; }
.button:disabled { opacity: .52; cursor: not-allowed; }
.button-primary { color: #fff; background: var(--action); }
.button-primary:hover:not(:disabled) { background: var(--action-hover); }
.button-secondary { color: var(--brand); background: var(--brand-soft); border-color: #cbd1df; }
.button-secondary:hover:not(:disabled) { background: #e0e4ee; }
.button-quiet { color: var(--ink); background: transparent; border-color: var(--line); }
.button-quiet:hover:not(:disabled) { background: var(--brand-soft); }
.topbar .button-quiet { color: #fff; border-color: #747e99; }
.topbar .button-quiet:hover:not(:disabled) { background: #4a5470; }
.topbar .button-secondary { color: #fff; background: var(--action); border-color: var(--action); }
.topbar .button-secondary:hover:not(:disabled) { background: var(--action-hover); border-color: var(--action-hover); }
.button-danger { color: var(--red); background: var(--red-soft); border-color: #f0d0c7; }
.button-small { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.language-button { font-size: 12px; min-width: 60px; }
.compact-label { display: none; }
.sync-button { position: relative; }
.sync-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #fff; color: var(--action-hover); font-size: 11px; }
.network-status { display: inline-flex; align-items: center; gap: 6px; color: #e4e8f0; font-size: 12px; white-space: nowrap; }
.network-dot { width: 8px; height: 8px; border-radius: 50%; background: #388768; }
.network-status.offline .network-dot { background: #d2842d; }
.content { width: min(100% - 40px, 1080px); margin: 0 auto; padding: 34px 0 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-title { margin: 0; color: var(--heading-accent); font-size: 27px; line-height: 1.18; font-weight: 720; letter-spacing: 0; }
.page-description { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.eyebrow { margin: 0 0 9px; color: var(--brand); font-size: 10px; font-weight: 760; letter-spacing: 1px; }
.progress-wrap { width: min(250px, 34vw); flex: 0 0 auto; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.progress-copy strong { color: var(--ink); font-weight: 650; }
.progress-track { height: 6px; overflow: hidden; background: #e0e4ed; border-radius: 4px; }
.progress-fill { height: 100%; background: var(--accent); transition: width .18s ease; }
.questionnaire { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.question-row { display: grid; grid-template-columns: 44px minmax(220px, 1fr) minmax(260px, 370px); gap: 18px; align-items: center; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.question-row:last-child { border-bottom: 0; }
.question-number { align-self: start; padding-top: 2px; color: var(--brand); font-size: 12px; font-variant-numeric: tabular-nums; }
.question-text { margin: 0; font-size: 15px; line-height: 1.45; font-weight: 650; }
.question-text-en { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.choice-set { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 0; padding: 0; border: 0; }
.choice-option { min-width: 0; position: relative; }
.choice-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-option span { min-height: 39px; display: grid; place-items: center; padding: 6px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 630; cursor: pointer; text-align: center; transition: .15s; }
.choice-option span:hover { background: var(--brand-soft); border-color: #9ea8bf; }
.choice-option input:checked + span { color: var(--action-hover); background: var(--accent-soft); border-color: var(--accent); }
.choice-option.no-choice input:checked + span { color: #963e31; background: var(--red-soft); border-color: #d89d8d; }
.choice-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.answer-detail { grid-column: 2 / -1; display: flex; align-items: center; gap: 9px; margin-top: -7px; color: var(--muted); font-size: 12px; }
.answer-detail strong { color: #963e31; font-weight: 650; }
.thumb-strip { display: inline-flex; gap: 5px; }
.thumb-strip img { width: 32px; height: 32px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 18px; }
.footer-note { font-size: 12px; color: var(--muted); }
.form-footer .button { min-width: 150px; }
.notice { padding: 12px 14px; margin: 0 0 18px; border: 1px solid #eddcae; border-radius: 5px; background: var(--amber-soft); color: #76521a; font-size: 13px; line-height: 1.5; }
.notice.error { border-color: #efc8bf; background: var(--red-soft); color: #8c3c30; }
.notice.success { border-color: #cbd1df; background: var(--brand-soft); color: var(--brand-dark); }
.notice[hidden] { display: none; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab-button { min-height: 42px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 13px; font-weight: 650; cursor: pointer; }
.tab-button.active { border-bottom-color: var(--accent); color: var(--action-hover); }
.admin-section { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.section-toolbar h2 { margin: 0; font-size: 15px; font-weight: 700; }
.section-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 17px; color: #fff; background: var(--brand); font-size: 10px; font-weight: 730; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
td { padding: 13px 17px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
td.secondary-cell { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 7px; align-items: center; justify-content: flex-end; }
.role-label { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 3px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 650; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; padding: 17px 19px; background: #f8f9fc; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: 6px; }
.field-label { display: block; color: var(--ink); font-size: 12px; font-weight: 650; }
.field-hint { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.field input, .field textarea, textarea { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid #c5cddd; border-radius: 4px; background: #fff; color: var(--ink); font-size: 13px; }
textarea { resize: vertical; line-height: 1.5; }
.inline-error { padding: 0 19px 14px; color: var(--red); font-size: 12px; }
.empty-state { padding: 38px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.table-filter { width: min(230px, 38vw); min-height: 35px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.password-panel { width: min(100%, 440px); margin: 46px auto 0; padding: 26px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.password-panel h1 { margin: 0 0 8px; color: var(--heading-accent); font-size: 23px; }
.password-panel p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.password-panel form { display: grid; gap: 13px; }
.password-panel form .button { margin-top: 4px; }
.login-shell { min-height: 100dvh; display: grid; grid-template-rows: 66px 1fr; }
.login-main { width: min(100% - 40px, 900px); margin: auto; padding: 44px 0 70px; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: clamp(40px, 8vw, 96px); }
.login-intro h1 { margin: 0; color: var(--heading-accent); font-size: 36px; line-height: 1.12; font-weight: 730; }
.login-intro .en-title { margin: 10px 0 0; color: var(--brand); font-size: 20px; font-weight: 600; }
.login-intro .login-date { margin-top: 26px; color: var(--muted); font-size: 13px; }
.login-form { padding: 24px 0 8px; border-top: 3px solid var(--accent); }
.login-form h2 { margin: 0 0 18px; font-size: 17px; }
.login-form form { display: grid; gap: 13px; }
.login-form input { width: 100%; min-height: 43px; padding: 10px 11px; border: 1px solid #c5cddd; border-radius: 4px; color: var(--ink); font-size: 14px; }
.login-form .button { width: 100%; margin-top: 4px; min-height: 43px; }
.demo-account { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.demo-account button { border: 1px solid #c5cddd; background: #fff; border-radius: 4px; padding: 6px 9px; font-size: 11px; color: var(--brand); cursor: pointer; }
.login-footnote { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.dialog { width: min(540px, calc(100% - 24px)); max-height: min(86dvh, 790px); padding: 0; overflow: auto; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 7px; background: #fff; color: var(--ink); box-shadow: 0 16px 55px #2b334b38; }
.dialog::backdrop { background: #242c43b8; }
.dialog form { padding: 23px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.dialog-head .eyebrow { margin-bottom: 5px; }
.dialog-head h2 { margin: 0; font-size: 18px; line-height: 1.4; }
.icon-button { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); font-size: 21px; line-height: 1; cursor: pointer; }
#reason { margin-top: 7px; min-height: 94px; }
.photo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.photo-row > div { min-width: 0; }
.photo-row .field-hint { margin: 3px 0 0; }
.upload-button { position: relative; flex: 0 0 auto; }
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.photo-item { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--canvas); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 3px; color: #fff; background: #3a435edd; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.confirm-dialog { width: min(460px, calc(100% - 24px)); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog .dialog-head { margin-bottom: 10px; }
.confirm-message { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.confirm-dialog .dialog-actions { margin-top: 24px; }
.report-dialog { width: min(850px, calc(100% - 24px)); }
.report-frame { padding: 28px; }
.report-actions { display: flex; justify-content: flex-end; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.report-title { margin: 24px 0 4px; color: var(--heading-accent); font-size: 24px; }
.report-subtitle { margin: 0 0 19px; color: var(--muted); font-size: 13px; }
.report-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.report-meta span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.report-meta strong { font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.report-question { padding: 16px 0; border-bottom: 1px solid var(--line); }
.report-question h3 { margin: 0 0 8px; font-size: 14px; line-height: 1.45; }
.report-question h3 span { color: var(--muted); font-weight: 450; }
.report-answer { font-size: 13px; font-weight: 700; }
.report-reason { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.report-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.report-photos img { width: 112px; height: 90px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 28px); padding: 11px 15px; border-radius: 5px; color: #fff; background: var(--brand); box-shadow: 0 5px 20px #2b334b45; font-size: 13px; text-align: center; }
.toast[hidden] { display: none; }

@media (max-width: 760px) {
  .topbar { min-height: 60px; padding: 9px 15px; gap: 10px; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-name { font-size: 13px; }
  .brand-subtitle { display: none; }
  .top-actions { gap: 5px; }
  .top-user, .network-status { display: none; }
  .top-actions .button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
  .change-password-button .wide-label { display: none; }
  .change-password-button .compact-label { display: inline; }
  .content { width: min(100% - 28px, 600px); padding: 25px 0 45px; }
  .page-head { display: block; margin-bottom: 18px; }
  .page-title { font-size: 23px; }
  .page-description { font-size: 13px; }
  .progress-wrap { width: 100%; margin-top: 18px; }
  .question-row { grid-template-columns: 30px minmax(0, 1fr); gap: 7px 10px; padding: 17px 14px; }
  .question-number { grid-row: 1; }
  .question-copy { grid-column: 2; }
  .choice-set { grid-column: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-top: 6px; }
  .choice-option span { min-height: 38px; padding: 5px 3px; font-size: 11px; }
  .answer-detail { grid-column: 2; flex-wrap: wrap; margin-top: 1px; }
  .form-footer { align-items: stretch; flex-direction: column; padding-top: 15px; }
  .form-footer .button { width: 100%; }
  .footer-note { line-height: 1.5; }
  .section-toolbar { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .section-toolbar > div { flex: 1 1 100%; }
  .section-toolbar .table-filter { flex: 1 1 150px; width: auto; }
  .section-toolbar h2 { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; padding: 14px; }
  .form-grid .button { width: 100%; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 13px 14px; border-top: 1px solid var(--line); }
  tbody td { width: auto; padding: 0; border: 0; }
  tbody td:nth-child(1) { font-weight: 650; }
  tbody td:nth-child(2), tbody td:nth-child(3) { color: var(--muted); font-size: 11px; }
  tbody td:last-child { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .row-actions { flex-wrap: wrap; }
  .password-panel { margin-top: 25px; padding: 20px; }
  .login-shell { grid-template-rows: 60px 1fr; }
  .login-main { width: min(100% - 36px, 460px); grid-template-columns: 1fr; gap: 26px; padding: 31px 0 50px; }
  .login-intro h1 { font-size: 29px; }
  .login-intro .en-title { font-size: 16px; }
  .login-intro .login-date { margin-top: 13px; }
  .login-form { padding-top: 19px; }
  .dialog form { padding: 18px; }
  .confirm-dialog form { padding: 20px; }
  .report-frame { padding: 18px; }
  .report-meta { grid-template-columns: 1fr 1fr; }
  .report-meta > :last-child { grid-column: 1 / -1; }
}

@media print {
  body { background: #fff; }
  .report-actions { display: none !important; }
  .report-frame { padding: 0; }
  .report-title { margin-top: 0; }
  .report-question { break-inside: avoid; }
  .report-photos img { width: 95px; height: 78px; }
}
