:root {
  color-scheme: light;
  --ink: #1d2b32;
  --muted: #64757b;
  --paper: #f3f1ea;
  --card: #fffefa;
  --line: #e3e2db;
  --deep: #21414b;
  --deep-hover: #17343d;
  --accent: #c97943;
  --soft-accent: #f8ece2;
  --green: #317766;
  --red: #a44339;
  --shadow: 0 18px 55px rgba(28, 48, 54, .08);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(201, 121, 67, .55); outline-offset: 3px; }
[hidden] { display: none !important; }

.public-shell, .survey-shell { min-height: 100vh; background: radial-gradient(circle at 50% -8%, #fffefa 0, var(--paper) 54%); }
.landing-card { width: min(100% - 32px, 700px); margin: 8vh auto; padding: clamp(32px, 8vw, 72px); background: var(--card); border: 1px solid rgba(35, 62, 70, .07); border-radius: 20px; box-shadow: var(--shadow); }
.brand-logo { display: block; width: 52px; height: 52px; object-fit: contain; }
.brand-logo.small { width: 34px; height: 34px; }
.landing-logo { margin-bottom: 24px; }
.login-logo { margin: 0 auto 22px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font: 700 10px/1.4 Arial, sans-serif; letter-spacing: .16em; }
h1 { margin: 0; color: var(--deep); font-size: clamp(28px, 6vw, 44px); font-weight: 650; letter-spacing: -.045em; line-height: 1.35; }
.lead { max-width: 42em; margin: 22px 0 0; color: #52646a; font-size: 16px; line-height: 1.9; }
.small-note, .muted, .question-hint { color: var(--muted); font-size: 13px; line-height: 1.7; }
.small-note { margin: 34px 0 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 24px; border: 0; border-radius: 5px; text-decoration: none; font-weight: 650; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.button-primary { background: var(--deep); color: white; }
.button-primary:hover:not(:disabled) { background: var(--deep-hover); transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .58; }
.public-footer { display: flex; gap: 12px; align-items: center; margin-top: 52px; color: var(--deep); font: 700 12px Arial, sans-serif; letter-spacing: .08em; }
.public-footer span { color: #899398; font: 400 11px sans-serif; letter-spacing: 0; }

.public-header { display: flex; justify-content: space-between; align-items: center; width: min(100% - 32px, 800px); margin: 0 auto; padding: 20px 0; border-bottom: 1px solid rgba(35, 62, 70, .1); }
.brand-link { display: inline-flex; align-items: center; gap: 10px; color: var(--deep); font: 700 13px Arial, sans-serif; letter-spacing: .08em; text-decoration: none; }
.header-note { color: var(--muted); font-size: 12px; }
.survey-wrap { width: min(100% - 28px, 800px); margin: 28px auto 56px; }
.survey-card, .state-card { padding: clamp(24px, 5vw, 48px); background: var(--card); border: 1px solid rgba(35, 62, 70, .08); border-radius: 14px; box-shadow: var(--shadow); }
.state-card { min-height: 220px; }
.state-card h1 { font-size: clamp(24px, 5vw, 34px); }
.state-card .muted, .state-card .form-error { margin-top: 14px; }
.form-intro { padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.form-intro h1 { font-size: clamp(28px, 5vw, 38px); }
.form-intro > p:not(.eyebrow) { max-width: 62ch; color: #56666b; font-size: 14px; line-height: 1.8; }
.form-time { display: inline-block; margin: 12px 0 0; padding: 7px 11px; border-radius: 4px; background: var(--soft-accent); color: #92552f !important; font-size: 12px !important; }
.question { min-width: 0; margin: 0; padding: 30px 0; border: 0; border-bottom: 1px solid var(--line); }
.question legend { display: block; width: 100%; padding: 0; color: var(--ink); font-size: 16px; font-weight: 650; line-height: 1.65; }
.question-number { display: inline-block; min-width: 34px; margin-right: 8px; color: var(--accent); font: 700 11px Arial, sans-serif; letter-spacing: .06em; vertical-align: 2px; }
.required-label { display: inline-flex; margin-left: 9px; padding: 3px 7px; border-radius: 3px; background: #f8e9e4; color: #9c4d3f; font-size: 10px; font-weight: 600; vertical-align: 2px; }
.question-hint { margin: 6px 0 16px; }
.rating-row { display: grid; grid-template-columns: repeat(5, minmax(42px, 1fr)); gap: 9px; max-width: 500px; margin-top: 19px; }
.rating-row label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #64757b; text-align: center; cursor: pointer; }
.rating-row input { position: absolute; opacity: 0; }
.rating-row label > span { display: grid; place-items: center; width: 100%; min-height: 50px; border: 1px solid #d7deda; border-radius: 5px; background: #fff; color: var(--deep); font-size: 16px; font-weight: 650; transition: .14s ease; }
.rating-row input:checked + span { border-color: var(--deep); background: var(--deep); color: white; box-shadow: 0 4px 12px rgba(33, 65, 75, .14); }
.rating-row input:focus-visible + span { outline: 3px solid rgba(201, 121, 67, .55); outline-offset: 2px; }
.rating-row small { min-height: 14px; font-size: 10px; }
.compact-rating { max-width: 560px; }
.compact-rating label > span { min-height: 46px; }
.dimension-list { display: grid; gap: 14px; margin-top: 20px; }
.dimension-row { display: grid; grid-template-columns: minmax(155px, 1fr) minmax(0, 2.2fr); align-items: center; gap: 16px; padding: 13px 0; border-top: 1px solid #eeeee9; }
.dimension-title { font-size: 13px; font-weight: 600; }
.dimension-ratings { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dimension-ratings label { position: relative; display: grid; place-items: center; cursor: pointer; }
.dimension-ratings input { position: absolute; opacity: 0; }
.dimension-ratings label > span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #d7deda; border-radius: 5px; background: white; color: var(--deep); font-size: 13px; }
.dimension-ratings input:checked + span { border-color: var(--deep); background: var(--deep); color: #fff; }
.dimension-ratings input:focus-visible + span { outline: 3px solid rgba(201, 121, 67, .55); outline-offset: 2px; }
.dimension-ratings .na-option span { width: auto; min-width: 70px; padding: 0 7px; color: #65777c; font-size: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 18px 0 21px; }
.choice-card { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px; border: 1px solid #dfe4df; border-radius: 5px; background: #fff; color: #40545a; font-size: 13px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: #648078; background: #f0f5f1; color: #1e4c43; }
.choice-card input { width: 17px; height: 17px; margin: 0; accent-color: var(--green); flex: 0 0 auto; }
.field-label { display: block; margin: 16px 0 7px; color: #46585d; font-size: 12px; font-weight: 650; }
textarea, input[type="text"], input[type="password"], input[type="date"], select { width: 100%; min-height: 46px; padding: 11px 12px; border: 1px solid #d9dfda; border-radius: 5px; background: white; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; line-height: 1.7; }
textarea::placeholder, input::placeholder { color: #9aa4a4; }
.contact-wrap { margin-top: 18px; }
.turnstile-wrap { margin: 25px 0; }
.turnstile-status { margin: 12px 0; padding: 10px 12px; background: #f3f2ec; color: #59686b; font-size: 13px; line-height: 1.7; }
.turnstile-status[data-state="error"] { background: #fcf0ed; color: var(--red); }
.turnstile-retry { min-height: 42px; padding: 0 16px; border: 1px solid #d7deda; background: #fff; color: var(--deep); font-size: 13px; }
.turnstile-retry:hover { background: #f0f5f1; }
.form-error { padding: 12px 14px; border-left: 3px solid var(--red); background: #fcf0ed; color: var(--red); font-size: 13px; line-height: 1.6; }
.dev-note { padding: 10px 12px; background: #fff4d8; color: #725a22; font-size: 12px; }
.submit-button { width: 100%; margin-top: 27px; }
.privacy-copy { margin: 14px 0 0; color: #7c888a; font-size: 11px; line-height: 1.7; text-align: center; }
.page-footer { justify-content: center; margin: 0 auto; padding: 0 16px 28px; }
.thanks-shell { display: grid; place-items: center; padding: 24px; }
.thanks-card { width: min(100%, 620px); padding: clamp(32px, 7vw, 62px); text-align: center; }
.thanks-card h1 { font-size: clamp(26px, 5vw, 36px); }
.thanks-card .muted { margin: 16px 0 0; }
.success-mark { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 22px; border-radius: 50%; background: #e5f1e9; color: var(--green); font-size: 24px; }
.thanks-logo { width: 42px; height: 42px; margin: 38px auto 0; }

/* Admin application */
.admin-shell { background: #f4f5f3; color: var(--ink); }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 0 max(20px, calc((100% - 1280px) / 2)); background: #183640; color: #fff; }
.admin-brand { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.admin-user { display: flex; align-items: center; gap: 14px; color: #d5e0df; font-size: 12px; }
.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); width: min(100%, 1440px); min-height: calc(100vh - 66px); margin: auto; }
.admin-nav { padding: 26px 16px; border-right: 1px solid #e1e5e0; background: #f8f9f7; }
.admin-nav button { display: flex; align-items: center; width: 100%; min-height: 43px; margin: 3px 0; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: #52666b; text-align: left; cursor: pointer; }
.admin-nav button[aria-current="page"] { background: #e8eeea; color: #1d4e46; font-weight: 700; }
.admin-main { min-width: 0; padding: clamp(20px, 4vw, 42px); }
.admin-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 25px; }
.admin-page-head h1 { font-size: 28px; }
.admin-page-head p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.period-controls { display: flex; align-items: center; gap: 8px; }
.period-controls input { width: 145px; min-height: 38px; padding: 7px 9px; font-size: 12px; }
.small-button { min-height: 38px; padding: 0 13px; border: 1px solid #cfd9d3; border-radius: 4px; background: #fff; color: var(--deep); font-size: 12px; font-weight: 650; cursor: pointer; }
.small-button:hover { background: #eef3ef; }
.small-button.primary { border-color: var(--deep); background: var(--deep); color: #fff; }
.small-button.danger { color: var(--red); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card, .panel, .admin-section { border: 1px solid #e3e8e2; border-radius: 8px; background: #fff; box-shadow: 0 3px 12px rgba(31, 52, 55, .035); }
.metric-card { min-height: 130px; padding: 18px; }
.metric-label { color: #6b7b7e; font-size: 12px; }
.metric-value { margin-top: 12px; color: var(--deep); font-size: 30px; font-weight: 700; letter-spacing: -.04em; }
.metric-detail { margin-top: 4px; color: #829093; font-size: 11px; }
.admin-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-bottom: 16px; }
.panel { min-width: 0; padding: 20px; }
.panel h2, .admin-section h2 { margin: 0 0 16px; color: var(--deep); font-size: 15px; }
.dimension-stat { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(70px, 2fr) 50px; align-items: center; gap: 10px; margin: 13px 0; font-size: 12px; }
.dimension-stat .stat-label { color: #536569; }
.bar-track { height: 8px; overflow: hidden; border-radius: 10px; background: #edf0ed; }
.bar-fill { height: 100%; border-radius: inherit; background: #5c8a7a; }
.stat-score { color: var(--deep); font-weight: 700; text-align: right; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { padding: 7px 10px; border: 1px solid #e4e9e4; border-radius: 4px; color: #4c6064; font-size: 11px; }
.tag-chip strong { margin-left: 7px; color: var(--deep); }
.comment-list { display: grid; gap: 10px; }
.comment-card { padding: 12px; border: 1px solid #edf0ec; border-radius: 5px; background: #fcfcfa; }
.comment-meta { display: flex; flex-wrap: wrap; gap: 8px 13px; margin-bottom: 8px; color: #879294; font-size: 10px; }
.comment-card p { margin: 5px 0 0; color: #34474c; font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.response-panel { grid-column: 1 / -1; }
.response-card { padding: 16px; }
.response-card .comment-meta strong { color: var(--deep); font-size: 12px; }
.response-score-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 12px 0; }
.response-score { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; padding: 9px 10px; border-radius: 4px; background: #f2f5f1; color: #627174; font-size: 11px; }
.response-score strong { flex: 0 0 auto; color: var(--deep); }
.response-card .response-selections { color: #52666b; font-size: 11px; }
.response-card .response-comment { padding: 9px 10px; border-left: 2px solid #c97943; background: #fff; }
.response-comment strong { color: var(--deep); }
.response-actions { margin-top: 12px; }
.small-button.danger { border-color: #ecd8d3; color: var(--red); }
.small-button.danger:hover { border-color: #dcbab2; background: #fbf1ef; }
.response-editor { display: grid; gap: 14px; margin-top: 16px; padding: 16px; border: 1px solid #dce5de; border-radius: 6px; background: #fff; }
.response-editor h3 { margin: 0; color: var(--deep); font-size: 14px; }
.response-rating-editor { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.response-editor-field { display: grid; gap: 6px; min-width: 0; color: #536569; font-size: 11px; }
.response-editor-field select { min-height: 38px; }
.response-comment-field textarea { min-height: 82px; resize: vertical; }
.response-tag-editor { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 0; padding: 10px; border: 1px solid #e7ebe6; border-radius: 5px; }
.response-tag-editor legend { padding: 0 4px; color: #536569; font-size: 11px; }
.response-tag-choice { display: inline-flex; align-items: center; gap: 5px; color: #52666b; font-size: 11px; }
.response-editor .inline-actions { margin-top: 2px; }
.admin-section { margin: 0 0 18px; padding: clamp(18px, 3vw, 26px); }
.admin-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; align-items: end; }
.admin-form label, .login-card label { display: grid; gap: 6px; color: #536569; font-size: 11px; }
.admin-form input, .admin-form select { min-height: 40px; font-size: 12px; }
.admin-form .wide { grid-column: span 2; }
.invite-result { display: grid; gap: 10px; margin-top: 16px; padding: 14px; border: 1px solid #d9e6de; border-radius: 6px; background: #f4f8f5; }
.invite-result code { overflow-wrap: anywhere; color: #325f50; font-size: 12px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-table-wrap { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.admin-table th, .admin-table td { padding: 11px 9px; border-bottom: 1px solid #edf0ed; text-align: left; vertical-align: middle; }
.admin-table th { color: #7b898b; font-weight: 600; }
.admin-table td { color: #415257; }
.status-pill { display: inline-flex; padding: 4px 7px; border-radius: 20px; background: #edf1ee; color: #526760; font-size: 10px; }
.status-pill.sent, .status-pill.responded, .status-pill.done { background: #e6f2ea; color: #2e715c; }
.status-pill.draft, .status-pill.open { background: #f6f0e2; color: #88713b; }
.empty-state { padding: 22px 10px; color: #859194; font-size: 12px; text-align: center; }
.followup-card { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(180px, 1fr) minmax(180px, 1fr); gap: 12px; padding: 15px 0; border-bottom: 1px solid #edf0ed; font-size: 12px; }
.followup-card strong { color: var(--deep); overflow-wrap: anywhere; }
.action-card { display: grid; grid-template-columns: minmax(0, 1fr) 160px 140px; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid #edf0ed; }
.action-card .action-title { grid-column: 1 / -1; }
.action-card .action-note-input { grid-column: 1 / span 2; }
.action-card p { margin: 0; color: var(--deep); font-size: 12px; font-weight: 600; }
.action-card small { display: block; margin-top: 4px; color: #879294; font-size: 10px; }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 18px; background: radial-gradient(circle at 50% -8%, #fffefa 0, var(--paper) 54%); }
.login-card { width: min(100%, 410px); padding: 34px; border: 1px solid #e2e5df; border-radius: 10px; background: #fffefa; box-shadow: var(--shadow); }
.login-card h1 { font-size: 26px; }
.login-card p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-card input { margin-top: 7px; }
.login-card .button { width: 100%; margin-top: 16px; }
.login-error { margin-top: 12px; color: var(--red) !important; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: min(90vw, 400px); padding: 12px 16px; border-radius: 5px; background: #203e46; color: #fff; box-shadow: var(--shadow); font-size: 12px; }

@media (max-width: 760px) {
  .dimension-row { grid-template-columns: 1fr; gap: 9px; }
  .dimension-ratings { justify-content: flex-start; }
  .dimension-ratings label > span { width: 42px; height: 42px; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { display: block; }
  .admin-nav { position: sticky; top: 0; z-index: 3; display: flex; gap: 5px; overflow-x: auto; padding: 8px 12px; border: 0; border-bottom: 1px solid #dfe5df; }
  .admin-nav button { flex: 0 0 auto; width: auto; min-height: 38px; padding: 0 12px; font-size: 11px; }
  .admin-main { padding: 20px 14px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric-card { min-height: 112px; padding: 13px; }
  .metric-value { font-size: 25px; }
  .admin-columns { grid-template-columns: 1fr; }
  .response-score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .response-rating-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-page-head { display: block; }
  .period-controls { flex-wrap: wrap; margin-top: 15px; }
  .period-controls input { flex: 1 1 120px; width: 130px; }
  .admin-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form .wide { grid-column: span 2; }
  .followup-card { grid-template-columns: 1fr; gap: 7px; }
  .action-card { grid-template-columns: minmax(0, 1fr) minmax(110px, 150px); }
  .action-card .action-title, .action-card .action-note-input { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  .survey-wrap { width: min(100% - 18px, 800px); margin-top: 14px; }
  .survey-card, .state-card { padding: 20px 15px; border-radius: 10px; }
  .question { padding: 24px 0; }
  .question legend { font-size: 14px; }
  .rating-row { gap: 5px; }
  .rating-row label > span { min-height: 45px; }
  .dimension-ratings { gap: 5px; }
  .dimension-ratings label > span { width: 36px; height: 38px; }
  .dimension-ratings .na-option span { min-width: 62px; font-size: 9px; }
  .admin-topbar { min-height: 58px; padding: 0 12px; }
  .admin-user { gap: 6px; font-size: 10px; }
  .admin-user .small-button { min-height: 32px; padding: 0 8px; font-size: 10px; }
  .admin-form { grid-template-columns: 1fr; }
  .admin-form .wide { grid-column: auto; }
  .response-score-grid, .response-rating-editor { grid-template-columns: 1fr; }
}
