:root {
    --bg: #f4f7f9;
    --ink: #14222b;
    --muted: #657681;
    --panel: #ffffff;
    --line: #dbe4e9;
    --blue: #0d7fb3;
    --teal: #159f8f;
    --green: #1f9f63;
    --red: #d94b4b;
    --amber: #d49b22;
    --shadow: 0 22px 60px rgba(20, 34, 43, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        linear-gradient(145deg, rgba(13, 127, 179, 0.14), transparent 42%),
        linear-gradient(25deg, rgba(21, 159, 143, 0.16), transparent 48%),
        var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

a {
    color: inherit;
}

.survey-shell,
.admin-shell {
    width: min(1120px, calc(100% - 32px));
    max-width: 100%;
    margin: 0 auto;
    padding: 28px 0 48px;
}

.hero,
.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 0 22px;
}

.hero h1,
.admin-header h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(2rem, 6vw, 4.4rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.hero p:not(.eyebrow) {
    max-width: 680px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.65;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brand-line {
    display: inline-grid;
    grid-template-columns: minmax(0, auto) 42px;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.35;
    text-transform: uppercase;
}

.brand-line span {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.brand-line img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    object-fit: contain;
}

.admin-link,
.admin-header nav a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    backdrop-filter: blur(14px);
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-header nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.panel,
.notice,
.stat-card {
    border: 1px solid rgba(219, 228, 233, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.notice {
    margin: 0 0 18px;
    padding: 16px 18px;
    border-color: rgba(31, 159, 99, 0.28);
    color: #12643c;
    font-weight: 800;
}

.error-notice {
    border-color: rgba(217, 75, 75, 0.34);
    color: #9d2e2e;
}

.login-shell {
    width: min(560px, calc(100% - 32px));
}

.login-hero {
    padding-bottom: 18px;
}

.login-form {
    display: grid;
    gap: 16px;
}

.password-field {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-top: 9px;
}

.password-field input {
    margin-top: 0;
}

.password-toggle {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
}

.survey-form {
    padding: 24px;
    max-width: 100%;
    min-width: 0;
}

.survey-shell > *,
.survey-form > *,
.form-grid > *,
.ratings > * {
    max-width: 100%;
    min-width: 0;
}

.scale-help {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
    padding: 16px 18px;
}

.thanks-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.thanks-panel {
    width: min(560px, 100%);
    padding: 28px;
    text-align: left;
}

.thanks-panel h1 {
    margin: 8px 0 12px;
    font-size: clamp(2rem, 8vw, 3.2rem);
    line-height: 1;
}

.thanks-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.55;
}

.thanks-panel .muted-copy {
    margin-top: 14px;
    font-weight: 800;
}

.scale-help strong {
    font-size: 1rem;
}

.scale-help span {
    color: var(--muted);
    line-height: 1.55;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

label,
.rating-row legend {
    color: var(--ink);
    font-size: 0.93rem;
    font-weight: 800;
}

.rating-row legend small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
}

input,
textarea,
select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 14px;
    background: #fbfdfe;
    color: var(--ink);
    font: inherit;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="date"] {
    display: block;
    min-height: 48px;
    text-align: left;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(13, 127, 179, 0.14);
}

textarea {
    resize: vertical;
}

.ratings {
    display: grid;
    gap: 14px;
    margin: 22px 0;
}

.rating-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fbfdfe;
    min-width: 0;
}

.rating-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 42px));
    gap: 8px;
    min-width: 0;
}

.rating-options label {
    display: block;
    min-width: 0;
}

.rating-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.rating-options span {
    display: grid;
    width: 100%;
    min-width: 0;
    max-width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.rating-options input:checked + span {
    border-color: var(--teal);
    background: var(--teal);
    color: #fff;
}

.rating-options span:hover {
    transform: translateY(-1px);
}

.primary-btn {
    width: 100%;
    min-height: 54px;
    margin-top: 20px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    box-shadow: 0 18px 32px rgba(13, 127, 179, 0.26);
}

.primary-small-btn,
.secondary-btn,
.danger-btn {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
}

.primary-small-btn {
    border: 0;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    color: #fff;
}

.secondary-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.danger-btn {
    border: 0;
    background: var(--red);
    color: #fff;
}

.positive-text {
    color: var(--green);
    font-weight: 900;
}

.negative-text {
    color: var(--red);
    font-weight: 900;
}

.season-panel {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
    padding: 20px;
}

.season-panel h2,
.report-title h2 {
    margin: 0;
}

.season-panel p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form label {
    min-width: min(220px, 100%);
}

.season-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
}

.delete-season-form {
    display: grid;
    grid-template-columns: 1fr minmax(180px, 240px) auto;
    gap: 12px;
    align-items: end;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.delete-season-form h3 {
    margin: 0;
    font-size: 1rem;
}

.delete-season-form p {
    margin: 6px 0 0;
}

.report-title {
    margin: 20px 0 14px;
}

.print-header {
    display: none;
}

.source-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.source-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
}

.source-card span {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    color: #fff;
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.source-card strong {
    display: block;
    margin-top: 12px;
    font-size: 1.2rem;
}

.survey-source span {
    background: var(--blue);
}

.guestbook-source span {
    background: var(--teal);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    padding: 18px 20px 20px;
}

.data-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 8px 0 18px;
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2.35rem;
    line-height: 1;
}

.stat-card.positive strong {
    color: var(--green);
}

.stat-card.negative strong {
    color: var(--red);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 20px 0;
}

.section-title h2 {
    margin: 0;
    font-size: 1.2rem;
}

.section-title span {
    color: var(--muted);
    font-weight: 800;
}

.bar-chart {
    display: flex;
    height: 22px;
    overflow: hidden;
    margin: 18px 20px 22px;
    border-radius: 8px;
    background: #eef4f6;
}

.bar-chart span {
    min-width: 0;
}

.bar-chart .positive {
    background: var(--green);
}

.bar-chart .neutral {
    background: var(--amber);
}

.bar-chart .negative {
    background: var(--red);
}

.percent-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 0 20px 22px;
}

.percent-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfdfe;
}

.percent-grid span,
.percent-grid small {
    display: block;
    color: var(--muted);
    font-weight: 800;
}

.percent-grid strong {
    display: block;
    margin: 6px 0 2px;
    font-size: 1.6rem;
    line-height: 1;
}

.chart-list {
    display: grid;
    gap: 14px;
    padding: 18px 20px 22px;
}

.chart-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 2fr) 48px;
    gap: 14px;
    align-items: center;
}

.chart-label {
    display: grid;
    gap: 4px;
}

.chart-label strong {
    line-height: 1.3;
}

.chart-label span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.chart-track {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef4f6;
}

.chart-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--teal));
}

.feedback-list {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.feedback-card,
.survey-result-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fbfdfe;
}

.feedback-card div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.feedback-card span,
.empty-state {
    color: var(--muted);
}

.feedback-card p {
    margin: 8px 0 0;
    line-height: 1.55;
}

.survey-result-card {
    border-color: rgba(13, 127, 179, 0.28);
    background: linear-gradient(180deg, rgba(13, 127, 179, 0.06), #fbfdfe 42%);
}

.survey-result-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}

.survey-result-head h3 {
    margin: 8px 0 4px;
    font-size: 1.15rem;
}

.survey-result-head p {
    margin: 0;
    color: var(--muted);
    font-weight: 800;
}

.overall-score {
    min-width: 116px;
    border: 1px solid rgba(21, 159, 143, 0.24);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    text-align: center;
}

.overall-score span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.overall-score strong {
    display: block;
    margin-top: 4px;
    color: var(--teal);
    font-size: 2rem;
    line-height: 1;
}

.entry-type {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    border-radius: 999px;
    padding: 0 11px;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
}

.entry-type.survey {
    background: var(--blue);
}

.entry-type.guestbook {
    background: var(--teal);
}

.score-pills {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.score-pills div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
}

.score-pills dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.25;
}

.score-pills dd {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    margin: 0;
    border-radius: 8px;
    background: #e9f6f4;
    color: var(--teal);
    font-weight: 900;
}

.qr-layout,
.qr-card {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: center;
    padding: 28px;
}

.qr-grid {
    display: grid;
    gap: 18px;
}

.qr-layout h2,
.qr-card h2 {
    margin: 0 0 12px;
    font-size: 2rem;
}

.qr-layout p,
.qr-card p {
    max-width: 520px;
    color: var(--muted);
    line-height: 1.6;
}

.qr-layout code,
.qr-card code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #f7fafb;
}

.qr-image {
    width: 100%;
    max-width: 420px;
    justify-self: end;
    border: 12px solid #fff;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(20, 34, 43, 0.16);
}

.poster-body {
    background:
        linear-gradient(145deg, rgba(13, 127, 179, 0.14), transparent 42%),
        linear-gradient(25deg, rgba(21, 159, 143, 0.16), transparent 48%),
        var(--bg);
}

.poster-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 14px 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 26px rgba(20, 34, 43, 0.08);
    backdrop-filter: blur(16px);
}

.poster-toolbar strong,
.poster-toolbar span {
    display: block;
}

.poster-toolbar span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.poster-toolbar button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    padding: 0 22px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
}

.poster-board {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.poster-board-title {
    margin-bottom: 20px;
}

.poster-board-title h1 {
    margin: 0;
    font-size: clamp(2.4rem, 7vw, 5rem);
    line-height: 0.95;
}

.poster-card-grid {
    display: grid;
    gap: 20px;
}

.print-card {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 34px;
    align-items: center;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 28px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.print-card.is-selected {
    border-color: var(--blue);
    box-shadow: 0 0 0 5px rgba(13, 127, 179, 0.14), var(--shadow);
}

.guestbook-card.is-selected {
    border-color: var(--teal);
    box-shadow: 0 0 0 5px rgba(21, 159, 143, 0.15), var(--shadow);
}

.print-card h2 {
    margin: 8px 0 14px;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.05;
}

.print-card p:not(.eyebrow) {
    max-width: 620px;
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.print-card code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #f7fafb;
}

.print-card img {
    width: 100%;
    max-width: 320px;
    justify-self: end;
    border: 12px solid #fff;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(20, 34, 43, 0.16);
}

@media (max-width: 760px) {
    .survey-shell,
    .admin-shell {
        width: min(100% - 22px, 1120px);
        padding-top: 14px;
    }

    .survey-shell {
        width: 100%;
        padding: 16px 10px 36px;
    }

    .hero,
    .admin-header,
    .feedback-card div,
    .survey-result-head {
        display: grid;
    }

    .overall-score {
        width: 100%;
        text-align: left;
    }

    .hero-actions {
        justify-content: start;
    }

    .brand-line {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 36px;
        width: 100%;
        align-items: center;
        font-size: 0.72rem;
        letter-spacing: 0.04em;
    }

    .brand-line img {
        width: 36px;
        height: 36px;
    }

    .qr-image {
        justify-self: center;
    }

    .hero h1,
    .admin-header h1 {
        font-size: clamp(1.85rem, 9vw, 2.65rem);
        line-height: 1.05;
        overflow-wrap: anywhere;
    }

    .hero p:not(.eyebrow) {
        font-size: 1rem;
        line-height: 1.55;
    }

    .admin-header nav {
        justify-content: start;
    }

    .form-grid,
    .rating-row,
    .stats-grid,
    .source-grid,
    .percent-grid,
    .chart-row,
    .qr-layout,
    .qr-card,
    .print-card {
        grid-template-columns: 1fr;
    }

    .poster-board {
        width: min(100% - 18px, 1120px);
    }

    .print-card img {
        justify-self: center;
    }

    .poster-toolbar {
        display: grid;
    }

    .survey-form,
    .qr-layout,
    .qr-card {
        padding: 16px;
    }

    .panel,
    .notice,
    .stat-card {
        max-width: 100%;
    }

    .rating-options {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: 100%;
    }

    .rating-options span {
        max-width: none;
        width: 100%;
    }

    .stats-grid {
        gap: 10px;
    }
}

@media (max-width: 420px) {
    .survey-shell,
    .admin-shell {
        width: min(100% - 16px, 1120px);
    }

    .survey-shell {
        width: 100%;
        padding-right: 8px;
        padding-left: 8px;
    }

    .hero h1,
    .admin-header h1 {
        font-size: 1.9rem;
        line-height: 1.04;
    }

    .brand-line {
        font-size: 0.68rem;
        gap: 8px;
    }

    .admin-link,
    .admin-header nav a,
    .primary-small-btn,
    .secondary-btn,
    .danger-btn {
        width: 100%;
    }

    .hero-actions,
    .admin-header nav,
    .season-actions,
    .inline-form,
    .delete-season-form {
        width: 100%;
    }

    .delete-season-form {
        grid-template-columns: 1fr;
    }

    .rating-row {
        padding: 10px;
    }

    .rating-options {
        gap: 5px;
    }

    .rating-options span {
        height: 38px;
    }

    .section-title {
        display: grid;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
    }

    .admin-shell {
        width: 100%;
        padding: 0;
    }

    .no-print,
    .admin-header,
    .season-panel {
        display: none !important;
    }

    .print-header {
        display: block;
        margin-bottom: 18px;
        border-bottom: 1px solid #999;
        padding-bottom: 12px;
    }

    .print-header h1 {
        margin: 10px 0 4px;
        font-size: 24px;
    }

    .print-header p {
        margin: 0;
    }

    .panel,
    .stat-card {
        box-shadow: none;
        break-inside: avoid;
    }

    .feedback-card {
        break-inside: avoid;
    }

    .poster-body {
        background: #fff;
    }

    .poster-board {
        width: 100%;
        padding: 0;
    }

    .poster-board-title,
    .print-card {
        display: none;
    }

    body[data-print-target="survey"] .survey-card,
    body[data-print-target="guestbook"] .guestbook-card {
        display: grid;
    }

    .print-card {
        min-height: auto;
        grid-template-columns: 1fr 260px;
        gap: 24px;
        border: 2px solid #111;
        border-radius: 8px;
        padding: 24px;
        box-shadow: none;
        break-inside: avoid;
    }

    .print-card img {
        max-width: 260px;
        border: 8px solid #fff;
        box-shadow: none;
    }
}
