:root {
    --bg: #fff4de;
    --surface: #ffffff;
    --surface-soft: #ffe2ac;
    --primary: #f4a300;
    --primary-dark: #b5477a;
    --accent: #f4a300;
    --accent-dark: #d98f00;
    --highlight: #d54d8b;
    --text: #40231e;
    --muted: #7a5a52;
    --border: rgba(64, 35, 30, 0.1);
}

body {
    font-family: 'Outfit', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(244, 163, 0, 0.28), transparent 28%),
        radial-gradient(circle at right 12% top 10%, rgba(213, 77, 139, 0.18), transparent 24%),
        linear-gradient(180deg, #fffaf0 0%, var(--bg) 100%);
    color: var(--text);
    min-height: 100vh;
}

.app-navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    box-shadow: 0 8px 30px rgba(181, 71, 122, 0.24);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding-inline: 0.9rem;
    font-weight: 600;
    color: var(--primary-dark);
    box-shadow: 0 8px 20px rgba(181, 71, 122, 0.2);
}

.logout-btn svg {
    flex: 0 0 auto;
}

.hero-panel,
.auth-card {
    background:
        linear-gradient(135deg, rgba(181, 71, 122, 0.95), rgba(244, 163, 0, 0.92)),
        linear-gradient(120deg, rgba(255, 243, 224, 0.2), transparent 45%);
    border-radius: 24px;
    color: #fff;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.login-logo {
    width: min(100%, 280px);
    height: auto;
    display: block;
    filter: drop-shadow(0 16px 30px rgba(64, 35, 30, 0.22));
}

/* Login: experiência imersiva sem alterar os componentes das áreas autenticadas. */
.login-page {
    background: linear-gradient(160deg, #c93c82 0%, #d95d67 46%, #f59c24 100%);
}

.login-main {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1.25rem, 4vw, 3rem);
    place-items: center;
}

.login-main > .alert {
    position: fixed;
    z-index: 10;
    top: 1rem;
    left: 50%;
    width: min(calc(100% - 2rem), 420px);
    margin: 0;
    border: 0;
    border-radius: 14px;
    transform: translateX(-50%);
}

.login-shell {
    width: 100%;
    max-width: 420px;
}

.login-card {
    width: 100%;
    padding: clamp(2rem, 5vw, 2.5rem);
    overflow: hidden;
    color: var(--text);
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(92, 24, 52, 0.24);
    animation: loginFadeIn 0.55s ease both;
}

.login-card .login-logo-wrap {
    margin-bottom: 1.5rem;
}

.login-card .login-logo {
    width: 168px;
    max-width: 52%;
    border-radius: 18px;
    filter: none;
}

.login-heading {
    margin-bottom: 1.75rem;
    text-align: center;
}

.login-heading h1 {
    margin: 0 0 0.55rem;
    color: #3f2421;
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.18;
}

.login-heading p {
    margin: 0 auto;
    max-width: 320px;
    color: #756765;
    font-size: 1rem;
    line-height: 1.5;
}

.login-field {
    margin-bottom: 1.1rem;
}

.login-field .form-label {
    margin-bottom: 0.45rem;
    color: #4e3c39;
    font-size: 0.9rem;
    font-weight: 600;
}

.login-input-group {
    position: relative;
}

.login-input-group .form-control {
    height: 56px;
    padding: 0 3rem 0 3rem;
    color: #3f2421;
    background: #fffaf7;
    border: 1px solid #ded4d0;
    border-radius: 15px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.login-input-group .form-control:not(.has-password-toggle) {
    padding-right: 1rem;
}

.login-input-group .form-control::placeholder {
    color: #9a8c88;
}

.login-input-group .form-control:focus {
    background: #fff;
    border-color: #e29019;
    box-shadow: 0 0 0 4px rgba(245, 156, 36, 0.17);
}

.login-input-icon {
    position: absolute;
    z-index: 2;
    top: 18px;
    left: 1rem;
    color: #9a6d59;
    pointer-events: none;
    transition: color 0.2s ease;
}

.login-input-group:focus-within .login-input-icon {
    color: #d88716;
}

.password-toggle {
    position: absolute;
    z-index: 3;
    top: 6px;
    right: 6px;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    color: #7b6965;
    background: transparent;
    border: 0;
    border-radius: 11px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.password-toggle:hover {
    color: #a5336d;
    background: rgba(201, 60, 130, 0.08);
}

.password-toggle:focus-visible,
.login-register a:focus-visible {
    outline: 3px solid rgba(201, 60, 130, 0.3);
    outline-offset: 2px;
}

.password-toggle .eye-closed,
.password-toggle.is-visible .eye-open {
    display: none;
}

.password-toggle.is-visible .eye-closed {
    display: block;
}

.forgot-password-wrap {
    margin-top: -0.4rem;
    margin-bottom: 1.35rem;
    text-align: right;
}

.forgot-password {
    color: #7c6d69;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: default;
}

.login-submit {
    height: 56px;
    color: #fff;
    background: linear-gradient(135deg, #f59c24, #e7860b);
    border: 0;
    border-radius: 15px;
    box-shadow: 0 10px 24px rgba(229, 132, 10, 0.27);
    font-size: 1.125rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.login-submit:hover {
    color: #fff;
    box-shadow: 0 14px 30px rgba(229, 132, 10, 0.34);
    filter: brightness(1.035);
    transform: translateY(-2px);
}

.login-submit:active {
    color: #fff;
    transform: translateY(0);
}

.login-submit:focus-visible {
    color: #fff;
    outline: 3px solid rgba(201, 60, 130, 0.38);
    outline-offset: 3px;
}

.login-register {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 1.6rem;
    color: #756765;
    text-align: center;
}

.login-register a {
    width: fit-content;
    margin: 0 auto;
    color: #a52f69;
    border-radius: 4px;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-register a:hover {
    color: #7d204d;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.login-form .invalid-feedback {
    margin-top: 0.35rem;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 575.98px) {
    .login-main {
        padding: 1rem;
    }

    .login-card {
        padding: 1.75rem 1.35rem;
        border-radius: 22px;
    }

    .login-card .login-logo-wrap {
        margin-bottom: 1.25rem;
    }

    .login-card .login-logo {
        width: 145px;
    }

    .login-heading {
        margin-bottom: 1.5rem;
    }

    .login-heading h1 {
        font-size: 1.7rem;
    }
}

/* Design system das áreas internas: extensão visual da experiência de login. */
body:not(.login-page) {
    background:
        radial-gradient(circle at 8% 0%, rgba(201, 60, 130, 0.09), transparent 28rem),
        radial-gradient(circle at 96% 8%, rgba(245, 156, 36, 0.13), transparent 26rem),
        #fbf8f6;
}

body:not(.login-page) main.container {
    max-width: 1240px;
    padding-top: clamp(1.5rem, 3vw, 2.5rem) !important;
    padding-bottom: 3.5rem !important;
}

.app-navbar {
    min-height: 72px;
    background: linear-gradient(110deg, #9f2e69 0%, #c93c82 48%, #e58c18 130%);
    box-shadow: 0 8px 30px rgba(95, 28, 58, 0.17);
}

.app-navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    color: #9f2e69;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(73, 18, 45, 0.18);
    font-weight: 700;
}

.app-navbar .nav-link {
    position: relative;
    color: rgba(255, 255, 255, 0.82);
    border-radius: 10px;
    font-weight: 500;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.app-navbar .navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
}

.app-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.23);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #a72f6c 0%, #c93c82 48%, #ef9824 115%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 26px;
    box-shadow: 0 22px 54px rgba(124, 37, 76, 0.2);
}

.hero-panel::after {
    position: absolute;
    top: -90px;
    right: -70px;
    width: 250px;
    height: 250px;
    content: '';
    background: rgba(255, 255, 255, 0.09);
    border-radius: 50%;
    pointer-events: none;
}

.hero-panel > * {
    position: relative;
    z-index: 1;
}

.hero-panel .eyebrow {
    color: rgba(255, 255, 255, 0.78);
}

.hero-panel .btn-light {
    color: #9f2e69;
    border: 0;
    box-shadow: 0 10px 24px rgba(78, 20, 49, 0.18);
    font-weight: 700;
}

.auth-card {
    color: var(--text);
    background: #fff;
    border: 1px solid rgba(90, 52, 46, 0.07) !important;
    border-radius: 24px;
    box-shadow: 0 22px 60px rgba(77, 39, 48, 0.12) !important;
}

.eyebrow {
    color: #a33069;
    font-weight: 700;
}

.page-heading h1,
main h1,
main h2,
main h3 {
    color: #402823;
    letter-spacing: -0.02em;
}

.card,
.record-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(93, 52, 45, 0.08) !important;
    border-radius: 20px;
    box-shadow: 0 12px 36px rgba(67, 36, 42, 0.07) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pet-card:hover {
    border-color: rgba(201, 60, 130, 0.2) !important;
    box-shadow: 0 18px 44px rgba(91, 40, 57, 0.13) !important;
    transform: translateY(-4px);
}

.pet-name-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.pet-age {
    display: inline-flex;
    min-height: 26px;
    padding: 0.25rem 0.6rem;
    align-items: center;
    color: #9f2e69;
    background: rgba(201, 60, 130, 0.09);
    border: 1px solid rgba(201, 60, 130, 0.12);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.card-body {
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

.pet-cover {
    height: 238px;
    min-height: 238px;
    border-radius: 20px 20px 0 0;
}

.pet-profile-cover {
    min-height: 330px;
}

.pet-placeholder {
    color: #9f2e69;
    background: linear-gradient(135deg, #fff0f6, #ffe0ad);
}

.form-label {
    color: #55413d;
    font-size: 0.9rem;
    font-weight: 600;
}

.form-control,
.form-select {
    min-height: 50px;
    color: #402823;
    background-color: #fffcfa;
    border: 1px solid #ded4d0;
    border-radius: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

textarea.form-control {
    min-height: auto;
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
    border-color: #e29019;
    box-shadow: 0 0 0 4px rgba(245, 156, 36, 0.16);
}

.form-control-plaintext.border,
.bg-light-subtle {
    background-color: #fff8f4 !important;
    border-color: rgba(146, 85, 69, 0.14) !important;
    border-radius: 14px !important;
}

.btn {
    min-height: 44px;
    padding: 0.62rem 1.05rem;
    border-radius: 12px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn-sm {
    min-height: 36px;
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #f59c24, #e4860d);
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(226, 132, 14, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #fff;
    background: linear-gradient(135deg, #ee941b, #d97c05);
    border-color: transparent;
    box-shadow: 0 11px 24px rgba(226, 132, 14, 0.28);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: #a33069;
    border-color: rgba(163, 48, 105, 0.5);
}

.btn-outline-primary:hover {
    background: #a33069;
    border-color: #a33069;
}

.btn-outline-secondary {
    color: #685651;
    border-color: #c9bbb6;
}

.btn-outline-secondary:hover {
    color: #fff;
    background: #69534e;
    border-color: #69534e;
}

.btn-link,
a:not(.btn):not(.navbar-brand):not(.nav-link):not(.admin-access-link) {
    color: #a33069;
    text-underline-offset: 3px;
}

.badge {
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    font-weight: 600;
}

.pet-tabs {
    scrollbar-width: thin;
}

.pet-tabs .nav-link {
    padding: 0.68rem 1rem;
    color: #9f2e69;
    background: #fff;
    border: 1px solid rgba(159, 46, 105, 0.13);
    box-shadow: 0 5px 14px rgba(67, 36, 42, 0.04);
    font-weight: 600;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.pet-tabs .nav-link:hover {
    transform: translateY(-1px);
}

.pet-tabs .nav-link.active {
    background: linear-gradient(135deg, #a72f6c, #d04a83);
    box-shadow: 0 8px 18px rgba(163, 48, 105, 0.2);
}

.record-card {
    padding: 1.25rem;
}

.record-card:last-child {
    margin-bottom: 0;
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table thead th {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    color: #74615c;
    background: #fff8f4;
    border-bottom: 1px solid rgba(94, 55, 48, 0.1);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody td {
    border-color: rgba(94, 55, 48, 0.08);
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: rgba(245, 156, 36, 0.055);
}

.admin-stat {
    border-left: 0 !important;
    border-top: 4px solid #ef961e !important;
}

.admin-stat strong {
    color: #9f2e69;
}

.admin-icon {
    background: linear-gradient(135deg, #a72f6c, #ef9824);
    box-shadow: 0 10px 24px rgba(163, 48, 105, 0.22);
}

.empty-state {
    padding-block: 3rem !important;
    text-align: center;
}

.empty-state-icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    place-items: center;
    background: linear-gradient(135deg, #fff0f6, #ffe5bb);
    border-radius: 20px;
    font-size: 1.75rem;
}

.alert {
    border: 0;
    border-radius: 14px;
}

.modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(49, 25, 30, 0.24);
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        padding: 0.8rem 0 0.4rem;
    }

    .app-navbar .nav-link {
        padding: 0.7rem 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .app-navbar {
        min-height: 64px;
    }

    .hero-panel {
        padding: 1.5rem !important;
        border-radius: 22px;
    }

    .hero-panel .btn {
        width: 100%;
    }

    .page-section .auth-card .card-body {
        padding: 1.4rem !important;
    }

    .card-body {
        padding: 1.2rem;
    }

    .pet-cover {
        height: 220px;
    }

    main > section.d-flex.justify-content-between {
        align-items: flex-start !important;
        gap: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    body:not(.login-page) *,
    body:not(.login-page) *::before,
    body:not(.login-page) *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-height: 700px) {
    .login-main {
        align-items: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card {
        animation: none;
    }

    .login-page *,
    .login-page *::before,
    .login-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.76);
}

.card,
.record-card {
    border-radius: 20px;
}

.pet-card,
.record-card,
.hero-panel,
.auth-card,
.card {
    animation: fadeUp 0.45s ease;
}

.pet-cover,
.pet-profile-cover {
    object-fit: cover;
    min-height: 220px;
}

.pet-thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
}

.pet-placeholder {
    min-height: 260px;
    background: linear-gradient(135deg, var(--surface-soft), #ffd18a);
    color: var(--muted);
    font-weight: 600;
}

.pet-tabs .nav-link {
    white-space: nowrap;
    border-radius: 999px;
    color: var(--primary-dark);
    background: rgba(244, 163, 0, 0.14);
}

.pet-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
}

.record-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    margin-bottom: 1rem;
}

.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
}

.form-control,
.form-select {
    border-radius: 14px;
    border-color: rgba(64, 35, 30, 0.12);
    padding: 0.8rem 0.95rem;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(244, 163, 0, 0.55);
    box-shadow: 0 0 0 0.25rem rgba(244, 163, 0, 0.18);
}

.table > :not(caption) > * > * {
    padding: 0.9rem 0.75rem;
}

.admin-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; font-size: 1.8rem; color: #fff; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.admin-stat { border-left: 4px solid var(--primary) !important; }
.admin-stat strong { color: var(--primary-dark); }
.device-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-access-link {
    position: fixed;
    right: 12px;
    bottom: 10px;
    z-index: 1020;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    color: rgba(64, 35, 30, 0.28);
    border-radius: 50%;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.admin-access-link:hover,
.admin-access-link:focus-visible {
    color: var(--primary-dark);
    background: rgba(255, 255, 255, 0.72);
}

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

@media (max-width: 575.98px) {
    main.container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .logout-btn {
        width: 100%;
        justify-content: center;
        margin-top: 0.4rem;
    }
}

/* Consolidação final dos componentes que existiam no tema anterior. */
body:not(.login-page) .eyebrow {
    color: #a33069;
    font-weight: 700;
}

body:not(.login-page) .hero-panel .eyebrow {
    color: rgba(255, 255, 255, 0.78);
}

body:not(.login-page) .pet-placeholder {
    color: #9f2e69;
    background: linear-gradient(135deg, #fff0f6, #ffe0ad);
}

body:not(.login-page) .pet-tabs .nav-link {
    color: #9f2e69;
    background: #fff;
    border: 1px solid rgba(159, 46, 105, 0.13);
}

body:not(.login-page) .pet-tabs .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, #a72f6c, #d04a83);
}

body:not(.login-page) .record-card {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(93, 52, 45, 0.08);
}

body:not(.login-page) .btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #f59c24, #e4860d);
    border-color: transparent;
}

body:not(.login-page) .btn-primary:hover,
body:not(.login-page) .btn-primary:focus {
    color: #fff;
    background: linear-gradient(135deg, #ee941b, #d97c05);
    border-color: transparent;
}

body:not(.login-page) .form-control,
body:not(.login-page) .form-select {
    min-height: 50px;
    color: #402823;
    background-color: #fffcfa;
    border-color: #ded4d0;
}

body:not(.login-page) .form-control:focus,
body:not(.login-page) .form-select:focus {
    background-color: #fff;
    border-color: #e29019;
    box-shadow: 0 0 0 4px rgba(245, 156, 36, 0.16);
}

body:not(.login-page) .admin-icon {
    background: linear-gradient(135deg, #a72f6c, #ef9824);
}

body:not(.login-page) .admin-stat {
    border-top: 4px solid #ef961e !important;
    border-left: 1px solid rgba(93, 52, 45, 0.08) !important;
}

body:not(.login-page) .admin-stat strong {
    color: #9f2e69;
}
