:root {
    color-scheme: dark;
    font-family: ui-sans-serif, system-ui, sans-serif;

    /* Page background */
    --bg-page-radial: radial-gradient(circle at top, rgba(18, 45, 80, 0.2), transparent 28%);
    --bg-page-linear: linear-gradient(180deg, #030815 0%, #081628 100%);
    --bg-page: #02070f;

    /* Text */
    --text-main: #f8fafc;
    --text-soft: #cbd5e1;
    --text-muted: #94a3b8;
    --text-dim: #e2e8f0;
    --text-error: #f87171;

    /* Brand */
    --brand-blue: #4c8de8;
    --brand-blue-strong: #1f63b8;
    --brand-blue-hover: #1954a1;

    --link-blue-bg: rgba(76, 141, 232, 0.12);
    --link-blue-bg-hover: rgba(76, 141, 232, 0.18);

    /* Buttons */
    --btn-bg: var(--brand-blue-strong);
    --btn-bg-hover: var(--brand-blue-hover);
}


* {
    box-sizing: border-box;
}
.error-message{
	color: #fda4af;
    background: rgba(248, 113, 113, 0.12);
    margin-top: 1.3rem;
    border-radius: .75rem;
    border: 2px solid var(--app-danger-border);
    padding: 1rem;
}
.error-message p{ margin: 0.5em 0; text-decoration: underline; font-weight: 600;}
.error-message ul{	padding-left: 1rem; }
.success-message{
    color: #86efac;
    background: var(--app-success-soft);
    margin-top: 1.3rem;
    border-radius: .75rem;
    border: 2px solid var(--app-success-border);
    padding: 1rem;
}
.success-message p{ margin: 0.5em 0; text-decoration: underline; font-weight: 600; }
.success-message ul{ padding-left: 1rem; }

body.auth-page {
    margin: 0;
    margin: 10vh 0;
    min-height: 100vh;
    background: var(--bg-page-radial),
        var(--bg-page-linear);
    color: var(--text-main);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.7rem;
    background-attachment: fixed;
}


body.auth-login-page {
    justify-content: center;
}

body.auth-login-page .auth-main {
    width: 100%;
}

body.auth-profile-page {
    justify-content: flex-start;
}

.auth-footer-text {
    width: 100%;
    text-align: center;
    color: var(--app-text-secondary);
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}


html {
    background: var(--bg-page);
}


.auth-container {
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
}

.auth-main {
    width: 100%;
    flex: 1;
    padding: 5vh 1rem;
}

.auth-card {
    width: 100%;
    border-radius: 1.5rem;
    overflow: hidden;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.45);
}

.auth-card-light {
    background: #081225;
    border: 1px solid rgba(86, 111, 168, 0.22);
}

.auth-card-body {
    padding: 1.5rem;
}

.auth-heading {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    color: #f8fafc;
}

.auth-form {
    display: grid;
    gap: 1.25rem;
}

.auth-label {
    display: block;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 500;
}

.auth-form-control {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: #0f172a;
    color: #f8fafc;
    padding: 1rem;
    margin-top: 0.75rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form-control::placeholder {
    color: rgba(241, 245, 249, 0.56);
}

.auth-form-control:focus {
    border-color: #4c8de8;
    box-shadow: 0 0 0 4px rgba(76, 141, 232, 0.18);
}

.auth-button {
    flex: 1;
    border: none;
    border-radius: 0.75rem;
    padding: 0.9rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease,
                transform 0.15s ease,
                box-shadow 0.2s ease;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.auth-error {
    margin: 0;
    color: #f87171;
    font-size: 0.92rem;
}

.text-sm {
    font-size: 0.95rem;
    line-height: 1.5rem;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-8 {
    padding: 2rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.rounded-2xl {
    border-radius: 1rem;
}

.rounded-3xl {
    border-radius: 1.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.w-full {
    width: 100%;
}

.max-w-3xl {
    max-width: 48rem;
}

.list-disc {
    list-style-type: disc;
}

.list-inside {
    list-style-position: inside;
}

.auth-alert-list {
    color: #f8fafc;
}


.auth-alert {
    margin-top: 1.5rem;
    border-radius: 1rem;
    background: #081826;
    border: 1px solid var(--app-border-strong);
    padding: 1rem;
    color: #f8fafc;
}

.auth-alert strong {
    display: block;
    margin-bottom: 0.5rem;
}



.auth-info-card {
    margin-top: 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(76, 141, 232, 0.16);
    background: #091b2f;
    padding: 1.5rem;
    color: #f8fafc;
    font-size: 0.95rem;
    line-height: 1.6;
}

.auth-info-card strong {
    color: #f8fafc;
}

.auth-banner {
    height: 70px;
    gap: 0px;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertical centering */
    align-items: flex-start; /* Keep text left-aligned */
}

.auth-banner-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    line-height: 1.2;
}

.auth-banner-description {
    color: #94a3b8;
    font-size: 0.9rem;
    margin: 2px 0 0;
    line-height: 1.2;
}

.auth-profile-card {
    margin-bottom: 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(76, 141, 232, 0.16);
    background: #061127;
    padding: 1.25rem;
}

.auth-profile-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    color: #e2e8f0;
}

.auth-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 0.75rem;
}

.auth-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 32rem;
}

.auth-table th,
.auth-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    vertical-align: middle;
}

.auth-table th {
    color: #f8fafc;
    font-weight: 700;
    background: rgba(8, 17, 37, 0.96);
}

.auth-table tbody tr:hover {
    background: rgba(76, 141, 232, 0.08);
}

.unitat-scroll {
    display: grid;
    gap: 0.75rem;
    max-height: calc(100vh - 12rem);
    overflow-y: auto;
    padding-right: 0.25rem;
    margin-top: 0.75rem;
}

.unitat-scroll::-webkit-scrollbar {
    width: 8px;
}

.unitat-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

.auth-unitat-list-section {
    min-height: calc(100vh - 16rem);
}

.auth-unitat-button {
    flex: 0 0 auto;
    min-width: 11rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(76, 141, 232, 0.24);
    background: rgba(76, 141, 232, 0.12);
    color: #f8fafc;
    border-radius: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.auth-unitat-button:hover {
    background: rgba(76, 141, 232, 0.2);
    transform: translateY(-1px);
}

.auth-section-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

.auth-function-list {
    display: grid;
    gap: 1rem;
}

.auth-function-card {
    border-radius: 1.25rem;
    border: 1px solid rgba(76, 141, 232, 0.14);
    background: rgba(10, 20, 42, 0.92);
    padding: 1.25rem;
    display: grid;
    gap: 0.75rem;
}

.auth-function-label {
    width: 100%;
    text-align: center;
    font-weight: 600;
    color: #e2e8f0;
}

.auth-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(76, 141, 232, 0.12);
}

.auth-footer .text-sm {
    color: #94a3b8;
}

.auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    padding: 1rem 1.25rem;
    color: #f8fafc;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease;
}

.auth-link:hover {
    background: rgba(76, 141, 232, 0.12);
}

.auth-page-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 20;
    padding: .75rem 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    height: 12vh;
    background: rgba(8, 17, 37, 0.98);
    border-bottom: 1px solid rgba(76, 141, 232, 0.14);
}

.auth-page-brand {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.auth-avatar {
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(76, 141, 232, 0.18);
    color: #f8fafc;
    font-weight: 700;
}

.auth-profile-container {
    padding-bottom: 5.5rem;
}

.auth-page.auth-login-page .auth-fixed-footer,
.auth-page.auth-profile-page .auth-fixed-footer {
    display: flex;
}

.auth-fixed-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    padding: 0.85rem 1rem;
    height: 12vh;
    background: rgba(8, 17, 37, 0.98);
    border-top: 1px solid rgba(76, 141, 232, 0.12);
    z-index: 10;
}



.auth-nav-link.active {
    background: rgba(76, 141, 232, 0.2);
}

.auth-history-details {
    border-radius: 1.5rem;
    border: 1px solid rgba(76, 141, 232, 0.14);
    background: rgba(10, 20, 42, 0.92);
    margin-top: 1.5rem;
    overflow: hidden;
}

.auth-history-summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #f8fafc;
    font-weight: 700;
    list-style: none;
    min-height: 3.5rem;
}

.auth-history-summary::marker {
    content: none;
}

.auth-history-content {
    padding: 1rem 1.25rem 1.25rem;
}

.auth-function-card-compact {
    padding: 1rem;
}

.auth-profile-actions {
    justify-content: space-between;
    align-items: center;
}



.auth-nav-link {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 3.25rem;
    height: 3.25rem;
    min-width: 3.25rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: #f8fafc;
    text-decoration: none;
    font-weight: 700;
    background: rgba(10, 20, 42, 0.92);
    transition: background 0.2s ease, transform 0.2s ease;
}

.auth-nav-login {
    color: #fff7cc;
    border-color: rgba(252, 211, 77, 0.3);
    background: rgba(245, 158, 11, 0.12);
}

.auth-nav-login:hover {
    background: rgba(245, 158, 11, 0.2);
}

.auth-nav-logout {
    color: #fda4af;
    border-color: var(--app-danger-border);
    background: rgba(248, 113, 113, 0.12);
}

.auth-nav-logout:hover {
    background: rgba(248, 113, 113, 0.18);
}

.auth-nav-link:hover {
    background: rgba(76, 141, 232, 0.18);
    transform: translateY(-1px);
}

.auth-nav-link.active {
    background: rgba(76, 141, 232, 0.24);
    border-color: rgba(76, 141, 232, 0.28);
}

@media (min-width: 640px) {
    body.auth-page {
        padding: 1rem;
    }

    .auth-container {
        max-width: 26rem;
    }
}
