:root {
    --bg: #447ac1;
    --bg-deep: #0c5c95;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: #ffffff;
    --text: #18211e;
    --muted: #5d6964;
    --line: rgba(24, 33, 30, 0.1);
    --primary: #0d699e;
    --primary-dark: #136296;
    --accent: #4d91ff;
    --danger: #c63f3f;
    --success: #207a57;
    --shadow: 0 24px 70px rgba(18, 39, 34, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Outfit", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 184, 77, 0.35), transparent 28%),
        radial-gradient(circle at bottom right, rgba(12, 122, 92, 0.24), transparent 24%),
        linear-gradient(135deg, #f7f2e9 0%, #e7efe7 100%);
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.home-view,
.login-view,
.survey-view,
.user-view,
.admin-view {
    animation: fadeUp 0.5s ease;
}

.login-panel,
.hero-card,
.panel {
    background: var(--panel);
    backdrop-filter: blur(14px);
    border: 1px solid rgb(31, 107, 174);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.login-panel {
    min-height: calc(100vh - 88px);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    overflow: hidden;
}

.admin-login-panel {
    min-height: auto;
}

.login-copy {
    padding: 56px;
    color: #f5f7f1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    background:
        linear-gradient(rgba(59, 132, 184, 0.72), rgba(135, 181, 219, 0.72)),
        url("assets/images/doctorimage.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-copy h1,
.access-option h2,
.admin-header h2,
.panel-head h3,
.panel-head h2,
.hero-card h3 {
    margin: 0;
}

.eyebrow {
    margin: 0;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.76rem;
    font-weight: 700;
}

.login-copy .eyebrow {
    color: rgba(255, 255, 255, 0.72);
}

.login-copy p,
.access-option p {
    margin: 0;
    line-height: 1.6;
}

.login-copy p {
    max-width: 520px;
    color: rgba(245, 247, 241, 0.84);
}

.login-hint {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.login-hint span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.access-card,
.login-form {
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
}

.access-card {
    gap: 20px;
}

.access-option {
    padding: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(24, 33, 30, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
}

.field-full {
    grid-column: 1 / -1;
}

.field span {
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(12, 122, 92, 0.5);
    box-shadow: 0 0 0 4px rgba(12, 122, 92, 0.12);
}

.primary-button,
.ghost-button {
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.ghost-button {
    background: rgba(12, 122, 92, 0.08);
    color: var(--primary-dark);
}

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

.form-message {
    min-height: 24px;
    margin: 0;
    color: var(--danger);
    font-weight: 600;
}

.success-message {
    color: var(--success);
}

.survey-panel,
.admin-view,
.user-view {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.survey-form,
.upload-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.admin-header,
.panel-head,
.persona-top,
.hero-card,
.header-actions,
.file-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

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

.hero-text,
.result-note {
    margin: 8px 0 0;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 14px;
    width: min(560px, 100%);
}

.stat-box {
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(24, 33, 30, 0.06);
}

.stat-box.accent {
    background: linear-gradient(135deg, #8996c8 0%, #b1bacea2 100%);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.stat-label,
.card-label {
    color: var(--muted);
}

.filtros,
.people-grid,
.file-grid,
.registry-grid {
    display: grid;
    gap: 16px;
}

.filtros {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 20px;
}

.people-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 20px;
}

.file-grid,
.registry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
}

.persona,
.file-card,
.registry-card {
    padding: 20px;
    border-radius: 24px;
    background: var(--panel-strong);
    border: 1px solid rgba(24, 33, 30, 0.08);
    box-shadow: 0 12px 30px rgba(18, 39, 34, 0.08);
}

.persona h4,
.persona p,
.file-card h4,
.file-card p,
.registry-card h4,
.registry-card p {
    margin: 0;
}

.persona h4,
.file-card h4,
.registry-card h4 {
    font-size: 1.12rem;
}

.persona p + p,
.file-card p + p,
.registry-card p + p {
    margin-top: 10px;
    color: var(--muted);
}

.registry-reason {
    margin-top: 12px !important;
    color: var(--text) !important;
}

.blood-pill,
.file-tag {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(12, 122, 92, 0.12);
    color: var(--primary-dark);
    font-weight: 700;
    width: fit-content;
}

.file-actions {
    justify-content: flex-start;
    margin-top: 16px;
    flex-wrap: wrap;
}

.xml-preview {
    margin: 16px 0 0;
    padding: 16px;
    border-radius: 18px;
    background: #13212c;
    color: #dce6ef;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
}

.empty-state {
    margin: 0;
    padding: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--muted);
}

.oculto {
    display: none !important;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .login-panel,
    .hero-card,
    .admin-header,
    .panel-head {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid,
    .filtros,
    .people-grid,
    .file-grid,
    .registry-grid,
    .survey-form,
    .upload-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100% - 20px, 1180px);
        padding: 20px 0 40px;
    }

    .login-copy,
    .access-card,
    .login-form,
    .hero-card,
    .panel {
        padding: 20px;
    }

    .stats-grid,
    .filtros,
    .people-grid,
    .file-grid,
    .registry-grid,
    .survey-form,
    .upload-form {
        grid-template-columns: 1fr;
    }

    .header-actions,
    .file-actions {
        width: 100%;
    }
}
