:root {
    --bg: #edf7f1;
    --panel: rgba(255, 255, 255, 0.9);
    --panel-strong: #ffffff;
    --ink: #183047;
    --muted: #647487;
    --line: rgba(29, 46, 64, 0.11);
    --brand: #1f8a5b;
    --brand-dark: #17643f;
    --accent: #5c9f84;
    --warning: #a86a16;
    --danger: #b14934;
    --shadow: 0 24px 60px rgba(27, 43, 61, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Verdana, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(113, 180, 148, 0.19), transparent 24%),
        radial-gradient(circle at 84% 10%, rgba(31, 138, 91, 0.14), transparent 24%),
        linear-gradient(180deg, #f8fcfa 0%, var(--bg) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(31, 138, 91, 0.032) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 138, 91, 0.032) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, black 0%, rgba(0, 0, 0, 0.16) 68%, transparent 100%);
}

.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    width: min(1280px, calc(100% - 28px));
    min-height: calc(100vh - 28px);
    margin: 14px auto;
}

.sidebar,
.topbar,
.panel {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.sidebar {
    position: sticky;
    top: 14px;
    align-self: start;
    min-height: calc(100vh - 28px);
    padding: 18px;
    border-radius: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 22px;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
}

.brand span,
.status,
.hint,
.notice p,
.site-footer,
.qr-output {
    color: var(--muted);
}

.menu {
    display: grid;
    gap: 10px;
}

.menu__button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--ink);
    background: transparent;
    font: inherit;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.menu__button:hover,
.menu__button.is-active {
    border-color: rgba(31, 138, 91, 0.2);
    color: var(--brand-dark);
    background: rgba(31, 138, 91, 0.09);
}

.main-content {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 24px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 28px;
    border-radius: 24px;
}

.eyebrow,
.panel-label {
    margin: 0 0 8px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.76rem;
    font-weight: 800;
}

h1,
h2,
p {
    margin-top: 0;
}

h1,
h2 {
    font-family: Georgia, "Times New Roman", serif;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3.3rem);
}

h2 {
    margin-bottom: 12px;
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
}

.status {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(31, 138, 91, 0.1);
    font-size: 0.92rem;
    font-weight: 700;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
}

.panel {
    border-radius: 24px;
    padding: 28px;
}

.panel--form {
    min-height: 560px;
}

.panel--result {
    position: sticky;
    top: 14px;
    display: grid;
    gap: 16px;
}

.tool-section {
    display: none;
}

.tool-section.is-active {
    display: block;
}

.section-heading {
    margin-bottom: 22px;
}

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

.field {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(23, 38, 59, 0.12);
    border-radius: 16px;
    background: var(--panel-strong);
    color: var(--ink);
    font: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.field textarea {
    min-height: 112px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    transform: translateY(-1px);
    border-color: rgba(31, 138, 91, 0.36);
    box-shadow: 0 0 0 4px rgba(31, 138, 91, 0.08);
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-weight: 700;
}

.hint {
    margin-bottom: 0;
    line-height: 1.6;
}

.terms-check {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.55;
}

.terms-check input {
    margin-top: 4px;
}

.decline-link {
    justify-self: start;
    color: var(--brand-dark);
    font-size: 0.9rem;
    font-weight: 800;
}

.notice {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid rgba(31, 138, 91, 0.18);
    border-radius: 18px;
    background: rgba(31, 138, 91, 0.08);
}

.notice p {
    margin-bottom: 0;
    line-height: 1.6;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 14px 20px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand) 0%, #63ad83 100%);
    color: #f7fafc;
    text-decoration: none;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: saturate(1.05);
    box-shadow: 0 12px 24px rgba(31, 138, 91, 0.2);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button--ghost {
    border: 1px solid rgba(31, 138, 91, 0.16);
    background: rgba(31, 138, 91, 0.1);
    color: var(--brand-dark);
    box-shadow: none;
}

.qr-box {
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 20px;
    border: 1px dashed rgba(31, 138, 91, 0.25);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
}

.qr-output {
    display: grid;
    place-items: center;
    width: 256px;
    min-height: 256px;
    text-align: center;
    line-height: 1.5;
}

.qr-output img,
.qr-output canvas {
    width: 256px;
    height: 256px;
}

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

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 4px 18px;
    font-size: 0.92rem;
}

.site-footer p {
    margin-bottom: 0;
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.site-footer a {
    color: var(--brand-dark);
    font-weight: 700;
    text-decoration: none;
}

.site-footer .footer-home-link {
    color: inherit;
    font-weight: inherit;
}

.help-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--brand-dark);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.45;
    text-align: left;
    text-decoration: underline;
    cursor: pointer;
}

.help-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.help-modal.is-open {
    display: flex;
}

.help-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 48, 71, 0.34);
    backdrop-filter: blur(4px);
}

.help-modal__panel {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(86vh, 820px);
    overflow: auto;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
}

.help-modal__panel h2 {
    margin-bottom: 16px;
}

.help-modal__panel p,
.help-steps {
    line-height: 1.65;
}

.help-steps {
    display: grid;
    gap: 12px;
    margin: 0 0 18px;
    padding-left: 22px;
}

.help-steps a {
    color: var(--brand-dark);
    font-weight: 800;
}

.help-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(31, 138, 91, 0.16);
    border-radius: 50%;
    background: rgba(31, 138, 91, 0.1);
    color: var(--brand-dark);
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
}

.qr-reader-page {
    grid-column: 1 / -1;
    width: min(760px, 100%);
    margin: 0 auto;
}

.reader-result {
    margin: 18px 0;
}

.reader-result a {
    color: var(--brand-dark);
    font-weight: 800;
}

.secure-file-viewer {
    display: grid;
    gap: 16px;
}

.secure-file-viewer img,
.secure-file-viewer video {
    display: block;
    width: 100%;
    max-height: 70vh;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    object-fit: contain;
}

.pdcc-open-modal {
    cursor: pointer;
}

#pdcc-modal,
#pdcc-notice {
    font-family: Verdana, "Segoe UI", sans-serif;
}

@media (max-width: 980px) {
    .app-shell,
    .workspace {
        grid-template-columns: 1fr;
    }

    .sidebar,
    .panel--result {
        position: static;
    }

    .sidebar {
        min-height: auto;
    }

    .menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .app-shell {
        width: min(100% - 18px, 1280px);
        margin: 9px auto;
    }

    .menu,
    .result-actions {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .sidebar,
    .topbar,
    .panel {
        border-radius: 18px;
    }

    .panel {
        padding: 20px;
    }

    .help-modal {
        padding: 10px;
    }

    .help-modal__panel {
        padding: 22px;
        border-radius: 18px;
    }
}
