:root {
    color-scheme: light;
    --bg: #d6e0ea;
    --panel: rgba(244, 248, 252, 0.9);
    --panel-strong: #edf3f8;
    --text: #1c1d37;
    --muted: #445a79;
    --accent: #344e95;
    --accent-soft: #84a2c9;
    --line: rgba(68, 90, 121, 0.2);
    --border: rgba(68, 90, 121, 0.28);
    --shadow: 0 22px 54px rgba(28, 29, 55, 0.16);
    --success-bg: rgba(132, 162, 201, 0.18);
    --success-text: #2e4671;
    --error-bg: rgba(137, 137, 147, 0.2);
    --error-text: #394866;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(132, 162, 201, 0.35), transparent 34%),
        radial-gradient(circle at top right, rgba(52, 78, 149, 0.18), transparent 28%),
        linear-gradient(145deg, #edf3f8 0%, #d6e0ea 48%, #c4d4e4 100%);
    min-height: 100vh;
}

.wrap {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: 56px 0 72px;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-search-label {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 700;
}

.header-search-input {
    width: 150px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    color: var(--text);
}

.header-search-input:focus,
.field input:focus,
.field textarea:focus {
    outline: 2px solid rgba(52, 78, 149, 0.18);
    outline-offset: 1px;
    border-color: var(--accent);
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-logo img {
    width: auto;
    height: 114px;
    max-width: 286px;
    display: block;
    filter: drop-shadow(0 12px 22px rgba(28, 29, 55, 0.22));
}

.nav {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.nav a,
.nav-user {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.nav a:hover,
.api-link:hover,
.brand:hover {
    color: var(--accent);
}

.nav-form {
    margin: 0;
}

.nav-button,
.primary-button,
.danger-button {
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.nav-button,
.primary-button {
    background: linear-gradient(135deg, #344e95, #445a79);
    color: #edf3f8;
    box-shadow: 0 12px 28px rgba(52, 78, 149, 0.22);
}

.secondary-button {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 11px 18px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.danger-button {
    background: linear-gradient(135deg, #b63b4d, #8f2438);
    color: #fff4f5;
    box-shadow: 0 12px 28px rgba(143, 36, 56, 0.24);
}

.nav-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
    transform: translateY(-1px);
}

.hero,
.panel {
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero {
    padding: 40px;
    margin-bottom: 28px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(214, 224, 234, 0.82)),
        var(--panel);
}

h1,
h2 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.03em;
}

h1 {
    font-size: clamp(2.4rem, 5vw, 4.5rem);
    margin-bottom: 16px;
}

p {
    margin: 0;
    line-height: 1.6;
}

.subtitle {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 90ch;
}

.welcome-banner {
    margin-top: 16px;
    color: var(--accent);
}

.profile-share-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.share-button {
    flex-shrink: 0;
}

.share-status {
    margin-top: 12px;
    min-height: 1.4em;
}

.status-pill {
    display: inline-block;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.95rem;
}

.status-pill-validated {
    background: rgba(132, 162, 201, 0.2);
    color: #2e4671;
}

.status-pill-unvalidated {
    background: rgba(137, 137, 147, 0.2);
    color: #394866;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 28px;
}

.panel {
    padding: 24px;
}

.panel-spaced {
    margin-top: 28px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.notes {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.note {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.note h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.api-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 180px);
}

.auth-panel {
    width: min(520px, 100%);
    padding: 32px;
    background: rgba(244, 248, 252, 0.94);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.auth-title {
    margin: 0 0 14px;
    font-size: clamp(2rem, 4vw, 3rem);
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

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

.field input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    color: var(--text);
}

.field input:disabled,
.field textarea:disabled,
.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.field textarea {
    width: 100%;
    min-height: 160px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    color: var(--text);
    resize: vertical;
}

.panel-form {
    margin-top: 20px;
}

.inline-form {
    margin-top: 16px;
}

.readonly-question {
    margin-top: 18px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    white-space: pre-wrap;
    line-height: 1.7;
}

.form-message {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 14px;
}

.form-message-error {
    background: var(--error-bg);
    color: var(--error-text);
}

.form-message-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.header-message {
    margin-top: -10px;
    margin-bottom: 20px;
}

.field-hint {
    color: var(--muted);
    font-size: 0.95rem;
}

.responses-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.response-card {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--line);
}

.auth-meta {
    margin-top: 18px;
    color: var(--muted);
}

.admin-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.admin-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.site-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.footer-nav a:hover {
    color: var(--accent);
}

.danger-panel {
    border-color: rgba(182, 59, 77, 0.48);
    background:
        linear-gradient(135deg, rgba(255, 232, 236, 0.95), rgba(246, 214, 220, 0.96)),
        var(--panel);
    box-shadow: 0 22px 54px rgba(143, 36, 56, 0.18);
}

.danger-panel .eyebrow,
.danger-panel h2 {
    color: #7e2031;
}

.danger-copy {
    margin-top: 10px;
    color: #8f2438;
    font-weight: 700;
}

.danger-panel > .danger-button {
    display: block;
    margin: 18px auto 0;
}

.danger-dialog {
    width: min(560px, calc(100% - 32px));
    border: 1px solid rgba(182, 59, 77, 0.45);
    border-radius: 24px;
    padding: 0;
    background:
        linear-gradient(135deg, rgba(255, 244, 245, 0.98), rgba(248, 229, 233, 0.98)),
        #fff7f8;
    box-shadow: 0 28px 70px rgba(143, 36, 56, 0.28);
}

.danger-dialog::backdrop {
    background: rgba(28, 29, 55, 0.42);
    backdrop-filter: blur(4px);
}

.danger-dialog-form {
    margin: 0;
    padding: 28px;
}

.danger-dialog-form h3 {
    margin: 10px 0 12px;
    font-size: 1.45rem;
    color: #7e2031;
}

.danger-dialog-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.admin-mail-panel {
    max-width: 760px;
}

.trace-log {
    margin: 0;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(28, 29, 55, 0.92);
    color: #edf3f8;
    font: 0.9rem/1.6 "Courier New", Courier, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.legal-panel {
    overflow: hidden;
}

.legal-document {
    color: var(--text);
    font-size: 1rem;
}

.legal-document .WordSection1 {
    background: transparent !important;
}

.legal-document p,
.legal-document div,
.legal-document li {
    font-family: Georgia, "Times New Roman", serif !important;
    color: var(--text) !important;
    line-height: 1.7 !important;
    background: transparent !important;
}

.legal-document span,
.legal-document b,
.legal-document i {
    font-family: inherit !important;
    color: inherit !important;
    background: transparent !important;
}

.legal-document p {
    margin: 0 0 14px !important;
}

.legal-document p[style*="mso-outline-level:1"] {
    font-size: 2rem !important;
    line-height: 1.2 !important;
    margin-bottom: 18px !important;
}

.legal-document p[style*="mso-outline-level:2"] {
    font-size: 1.35rem !important;
    line-height: 1.3 !important;
    margin-top: 28px !important;
    margin-bottom: 12px !important;
}

.legal-document p[style*="mso-outline-level:3"] {
    font-size: 1.08rem !important;
    line-height: 1.4 !important;
    margin-top: 20px !important;
    margin-bottom: 10px !important;
}

.legal-document a,
.legal-document a span {
    color: var(--accent) !important;
}

.legal-document a:hover,
.legal-document a:hover span {
    color: var(--muted) !important;
}

@media (max-width: 640px) {
    .wrap {
        width: min(100% - 24px, 960px);
        padding-top: 28px;
    }

    .site-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-main,
    .header-tools {
        width: 100%;
        gap: 12px;
    }

    .header-tools {
        justify-content: space-between;
        align-items: center;
    }

    .header-main {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .header-search {
        width: 100%;
    }

    .header-search-input {
        width: 100%;
    }

    .brand-logo img {
        height: 83px;
        max-width: 221px;
    }

    .profile-share-row {
        align-items: stretch;
    }

    .hero,
    .panel,
    .auth-panel {
        padding: 24px;
    }
}
