/* Ippocrate Area Pazienti — Login */

:root {
    --ip-cyan: #29ABE2;
    --ip-dark: #1B2080;
    --ip-mid:  #1565B8;
    --ip-deep: #0f1654;
    --ip-surface: rgba(255, 255, 255, 0.1);
    --ip-border: rgba(255, 255, 255, 0.16);
    --ip-text-muted: rgba(255, 255, 255, 0.65);
    --touch-min: 44px;
    --app-sidebar-w: 248px;
    --app-bottom-nav-h: 68px;
    --app-header-h: 56px;
    --app-radius: 18px;
    --app-radius-sm: 14px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    background: linear-gradient(135deg, var(--ip-dark) 0%, var(--ip-mid) 50%, var(--ip-cyan) 100%);
}

body::before {
    content: '';
    position: fixed;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(41, 171, 226, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(27, 32, 128, 0.4) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    padding: 44px 40px;
    box-shadow: 0 32px 64px rgba(27, 32, 128, 0.35);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-section {
    text-align: center;
    margin-bottom: 28px;
}

.brand-logo {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(41, 171, 226, 0.35);
    padding: 8px;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.brand-logo--small {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    padding: 6px;
}

.brand-section--compact {
    margin-bottom: 20px;
}

.brand-section h1 {
    font-size: 1.55rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.brand-section .subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 8px;
}

.brand-section p {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    font-weight: 500;
}

.alert-flash {
    background: rgba(41, 171, 226, 0.18);
    border: 1px solid rgba(41, 171, 226, 0.45);
    color: #e0f7ff;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.45;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.input-wrap {
    position: relative;
}

.input-wrap i.icon-left {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    min-height: var(--touch-min);
    padding: 12px 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    color: #fff;
    font-size: 0.95rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    transition: all 0.2s;
    outline: none;
}

.input-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.input-wrap input:focus {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--ip-cyan);
    box-shadow: 0 0 0 3px rgba(41, 171, 226, 0.25);
}

.btn-toggle-pw {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.85rem;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-toggle-pw:hover {
    color: rgba(255, 255, 255, 0.8);
}

.btn-login {
    width: 100%;
    min-height: var(--touch-min);
    padding: 12px 14px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--ip-cyan) 0%, var(--ip-dark) 100%);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 8px 24px rgba(41, 171, 226, 0.35);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(41, 171, 226, 0.5);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-faceid {
    width: 100%;
    min-height: var(--touch-min);
    padding: 12px;
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
}

.badge-soon {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.help-note {
    margin-top: 18px;
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
    line-height: 1.5;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 0;
}

.divider span {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.divider p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    white-space: nowrap;
}

.card-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.card-footer a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    transition: color 0.2s;
}

.card-footer a:hover {
    color: var(--ip-cyan);
}

.page-footer {
    position: relative;
    z-index: 2;
    margin-top: 28px;
    text-align: center;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
}

.page-footer a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}

.page-footer a:hover {
    color: var(--ip-cyan);
}

/* Privacy page */
.privacy-card {
    max-width: 720px;
    padding: 36px 32px;
}

.privacy-card h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.privacy-card .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    margin-bottom: 24px;
    transition: color 0.2s;
}

.privacy-card .back-link:hover {
    color: var(--ip-cyan);
}

.privacy-content {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.88rem;
    line-height: 1.65;
}

.privacy-content h2 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    margin: 1.5rem 0 0.5rem;
}

.privacy-content p {
    margin-bottom: 0.75rem;
}

.privacy-content ul {
    margin: 0 0 0.75rem 1.25rem;
    padding: 0;
}

.privacy-content li {
    margin-bottom: 0.35rem;
}

.privacy-content a {
    color: var(--ip-cyan);
    font-weight: 700;
    text-decoration: none;
}

.privacy-content a:hover {
    text-decoration: underline;
}

.privacy-highlight {
    background: rgba(41, 171, 226, 0.12);
    border: 1px solid rgba(41, 171, 226, 0.35);
    border-radius: 16px;
    padding: 16px 18px;
    margin: 1rem 0 1.25rem;
}

.privacy-highlight h2 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-highlight h2 i {
    color: var(--ip-cyan);
}

.privacy-highlight p {
    margin-bottom: 0;
}

.privacy-updated {
    margin-top: 1.25rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
}

.alert-flash-error {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.alert-flash-error i {
    color: #f87171;
}

/* ── App shell (Area Pazienti autenticata) ───────────────── */

.app-shell-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: block;
    padding: 0;
    padding-top: env(safe-area-inset-top, 0px);
    justify-content: flex-start;
    align-items: stretch;
    background: linear-gradient(160deg, var(--ip-dark) 0%, var(--ip-deep) 42%, var(--ip-mid) 100%);
    color: #fff;
}

.app-shell-body::before,
.app-shell-body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

.app-shell-body::before {
    top: -15%;
    right: -8%;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(41, 171, 226, 0.18) 0%, transparent 70%);
}

.app-shell-body::after {
    bottom: -10%;
    left: -8%;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(27, 32, 128, 0.35) 0%, transparent 70%);
}

.app-layout {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Sidebar — desktop */
.app-sidebar {
    display: none;
    width: var(--app-sidebar-w);
    flex-shrink: 0;
    flex-direction: column;
    padding: 20px 14px;
    background: rgba(8, 12, 48, 0.72);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 18px;
    color: #fff;
}

.app-sidebar-brand img {
    border-radius: 12px;
}

.app-sidebar-brand strong {
    display: block;
    font-size: 0.92rem;
}

.app-sidebar-brand span {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.app-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--touch-min);
    padding: 0 14px;
    border-radius: var(--app-radius-sm);
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    transition: background 0.2s, color 0.2s;
}

.app-nav-link i {
    width: 1.15rem;
    text-align: center;
    font-size: 0.95rem;
}

.app-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.app-nav-link.is-active {
    background: linear-gradient(135deg, rgba(41, 171, 226, 0.28), rgba(27, 32, 128, 0.35));
    color: #fff;
    border: 1px solid rgba(41, 171, 226, 0.35);
    box-shadow: 0 8px 20px rgba(41, 171, 226, 0.12);
}

.app-sidebar-studio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 12px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar-studio i {
    color: var(--ip-cyan);
}

/* Content column */
.app-content-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--app-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: var(--app-header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(15, 22, 84, 0.92) 0%, rgba(15, 22, 84, 0.78) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-header-brand img {
    border-radius: 10px;
    flex-shrink: 0;
}

.app-header-titles {
    min-width: 0;
}

.app-header-titles strong {
    display: block;
    font-size: 0.88rem;
    line-height: 1.2;
}

.app-header-studio {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 52vw;
}

.app-logout-btn {
    flex-shrink: 0;
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}

.app-logout-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.app-logout-btn span {
    display: none;
}

.app-main {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 24px;
}

.app-footer {
    text-align: center;
    padding: 12px 16px 16px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.42);
    font-weight: 600;
}

.app-footer a {
    color: var(--ip-cyan);
    text-decoration: none;
    font-weight: 700;
}

/* Bottom tab bar — mobile / tablet */
.app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    align-items: stretch;
    min-height: var(--app-bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(8, 12, 48, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
}

.app-bottom-nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: var(--touch-min);
    padding: 8px 4px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.62rem;
    font-weight: 700;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.app-bottom-nav-link i {
    font-size: 1.05rem;
}

.app-bottom-nav-link.is-active {
    color: var(--ip-cyan);
}

.app-bottom-nav-link.is-active i {
    transform: scale(1.05);
}

/* Inner page sections */
.app-page-header {
    margin-bottom: 18px;
    color: #fff;
}

.app-page-header h1 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.app-page-header p {
    font-size: 0.82rem;
    color: var(--ip-text-muted);
    line-height: 1.45;
}

.app-card {
    background: var(--ip-surface);
    border: 1px solid var(--ip-border);
    border-radius: var(--app-radius);
    padding: 16px 18px;
    margin-bottom: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.app-page-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.app-card-unified {
    padding: 0;
    overflow: hidden;
}

.app-card-section {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-card-section:last-child {
    border-bottom: none;
}

.app-card-section--footer {
    background: rgba(239, 68, 68, 0.06);
    padding-top: 14px;
    padding-bottom: 14px;
}

.app-card-sub {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--app-radius-sm);
    padding: 14px 16px;
}

.app-card-sub-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.65);
    margin: 0 0 10px;
}

.app-card-sub-title i {
    color: var(--ip-cyan);
}

.app-card--accent {
    background: rgba(41, 171, 226, 0.12);
    border-color: rgba(41, 171, 226, 0.28);
}

.app-card--danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.28);
}

.app-card--warn {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
}

.app-placeholder-card {
    padding: 0;
    overflow: hidden;
}

.app-placeholder-card .app-placeholder {
    border: none;
    background: transparent;
    border-radius: 0;
}

.app-link-row--inset {
    min-height: var(--touch-min);
    margin: 0 -18px -16px;
    width: calc(100% + 36px);
}

.app-card-section .app-link-row--inset {
    margin: 0;
    width: 100%;
    border-radius: var(--app-radius-sm);
}

.app-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: #fff;
}

.app-card-title i {
    color: var(--ip-cyan);
    font-size: 0.95rem;
}

.app-card-text {
    font-size: 0.82rem;
    color: var(--ip-text-muted);
    line-height: 1.55;
    margin-bottom: 12px;
}

.app-card-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-card-links {
    padding: 0;
    overflow: hidden;
}

.app-card-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.22);
}

/* Salute connessa */
.health-sync-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.health-sync-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: var(--app-radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.health-sync-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.health-sync-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.health-sync-icon--apple {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.health-sync-icon--google {
    background: rgba(66, 133, 244, 0.2);
    color: #93c5fd;
}

.health-sync-copy strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.health-sync-copy small {
    display: block;
    font-size: 0.76rem;
    color: var(--ip-text-muted);
    line-height: 1.45;
    font-weight: 500;
}

.health-sync-meta {
    display: block;
    margin-top: 6px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
}

.health-sync-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-left: 52px;
}

.health-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.health-badge--active {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #a7f3d0;
}

.health-badge--app {
    background: rgba(41, 171, 226, 0.15);
    border: 1px solid rgba(41, 171, 226, 0.35);
    color: #bae6fd;
}

.health-link-btn {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(66, 133, 244, 0.22);
    border: 1px solid rgba(96, 165, 250, 0.4);
    color: #dbeafe;
    font-size: 0.72rem;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.health-link-btn:hover {
    background: rgba(66, 133, 244, 0.32);
}

@media (min-width: 520px) {
    .health-sync-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .health-sync-actions {
        padding-left: 0;
        flex-shrink: 0;
    }
}

.app-settings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.app-settings-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-settings-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.app-settings-row:first-child {
    padding-top: 0;
}

.app-settings-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
}

.app-settings-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    word-break: break-word;
}

.app-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--touch-min);
    padding: 0 18px;
    text-decoration: none;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    transition: background 0.2s;
}

.app-link-row span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.app-link-row i.fa-chevron-right {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
}

.app-link-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.app-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    line-height: 1.45;
}

.app-hint i {
    color: var(--ip-cyan);
}

/* Toggle notifiche */
.app-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: var(--touch-min);
    cursor: pointer;
    user-select: none;
}

.app-toggle-copy strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.app-toggle-copy small {
    display: block;
    font-size: 0.74rem;
    color: var(--ip-text-muted);
    font-weight: 500;
}

.app-toggle-wrap {
    position: relative;
    flex-shrink: 0;
}

.app-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.app-toggle-track {
    display: block;
    width: 52px;
    height: 30px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background 0.2s;
    position: relative;
}

.app-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.app-toggle-input:checked + .app-toggle-track {
    background: linear-gradient(135deg, var(--ip-cyan), var(--ip-mid));
}

.app-toggle-input:checked + .app-toggle-track::after {
    transform: translateX(22px);
}

.app-toggle-input:focus-visible + .app-toggle-track {
    box-shadow: 0 0 0 3px rgba(41, 171, 226, 0.35);
}

/* App buttons */
.btn-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--touch-min);
    padding: 0 18px;
    border-radius: var(--app-radius-sm);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-app-block {
    width: 100%;
}

.btn-app-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
}

.btn-app-disabled {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-app-danger {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.btn-app-danger:hover {
    background: rgba(239, 68, 68, 0.28);
}

.app-placeholder {
    text-align: center;
    padding: 36px 20px;
    background: var(--ip-surface);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: var(--app-radius);
    color: #fff;
}

.app-placeholder--compact {
    padding: 24px 18px;
}

.app-placeholder > i {
    font-size: 2rem;
    color: var(--ip-cyan);
    margin-bottom: 12px;
    opacity: 0.85;
}

.app-placeholder h2 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.app-placeholder p {
    font-size: 0.82rem;
    color: var(--ip-text-muted);
    line-height: 1.5;
    max-width: 280px;
    margin: 0 auto;
}

/* Dashboard home */
.dash-welcome-card {
    color: #fff;
}

.dash-welcome-card .dash-greeting {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.25rem;
}

.dash-welcome-name {
    font-size: 1.65rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.dash-welcome {
    margin-bottom: 22px;
    color: #fff;
}

.dash-greeting {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.25rem;
}

.dash-welcome h1 {
    font-size: 1.65rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.dash-studio {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.78);
    background: rgba(41, 171, 226, 0.15);
    border: 1px solid rgba(41, 171, 226, 0.35);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
}

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

.dash-card {
    background: var(--ip-surface);
    border: 1px solid var(--ip-border);
    border-radius: var(--app-radius);
    padding: 16px;
    color: #fff;
    min-height: 148px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.dash-card-link:hover {
    transform: translateY(-2px);
    border-color: rgba(41, 171, 226, 0.35);
    background: rgba(255, 255, 255, 0.14);
}

.dash-card-link:active {
    transform: translateY(0);
}

.dash-card > i {
    font-size: 1.3rem;
    color: var(--ip-cyan);
    margin-bottom: 0.6rem;
}

.dash-card h2 {
    font-size: 0.92rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.dash-card p {
    font-size: 0.76rem;
    color: var(--ip-text-muted);
    line-height: 1.45;
    flex: 1;
}

.dash-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--ip-cyan);
}

.dash-card-active {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(16, 185, 129, 0.12);
}

/* Legacy dashboard classes (compat) */
.dashboard-body {
    justify-content: flex-start;
    padding: 0;
    background: linear-gradient(160deg, var(--ip-dark) 0%, var(--ip-deep) 40%, var(--ip-mid) 100%);
}

.dash-header,
.dash-main,
.dash-footer,
.dash-logout-btn,
.dash-header-inner,
.dash-brand {
    /* mantenuti per eventuali pagine legacy */
}

.dash-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(15, 22, 84, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.dash-brand img {
    border-radius: 10px;
}

.dash-brand strong {
    display: block;
    font-size: 0.95rem;
}

.dash-brand span {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
}

.dash-logout-btn {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    min-height: var(--touch-min);
    padding: 0 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.dash-main {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px 48px;
    position: relative;
    z-index: 2;
}

.dash-footer {
    width: 100%;
    text-align: center;
    padding: 16px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    position: relative;
    z-index: 2;
}

.dash-footer a {
    color: var(--ip-cyan);
    text-decoration: none;
    font-weight: 700;
}

@media (min-width: 640px) {
    .app-main {
        padding: 24px 24px 28px;
    }

    .dash-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .app-logout-btn span {
        display: inline;
    }
}

@media (min-width: 1024px) {
    .app-sidebar {
        display: flex;
    }

    .app-bottom-nav {
        display: none;
    }

    .app-content-wrap {
        padding-bottom: 0;
    }

    .app-header {
        display: none;
    }

    .app-main {
        max-width: 840px;
        padding: 32px 32px 40px;
    }

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

    .dash-welcome h1 {
        font-size: 1.85rem;
    }
}

/* ── Toast + ippConfirm ─────────────────────────────────── */

.ipp-toast-root {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.ipp-toast {
    background: #fff;
    color: #1e293b;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
    min-width: 240px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: auto;
}

.ipp-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.ipp-toast strong {
    display: block;
    font-size: 0.82rem;
    margin-bottom: 2px;
}

.ipp-toast span {
    font-size: 0.76rem;
    color: #64748b;
}

.ipp-toast-info {
    border-left: 4px solid var(--ip-cyan);
}

.ipp-toast-success {
    border-left: 4px solid #10b981;
}

.ipp-toast-error {
    border-left: 4px solid #ef4444;
}

.ipp-confirm-root {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ipp-confirm-root.hidden {
    display: none;
}

.ipp-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    transition: opacity 0.2s;
}

.ipp-confirm-backdrop.show {
    opacity: 1;
}

.ipp-confirm-panel {
    position: relative;
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s, transform 0.2s;
    text-align: center;
}

.ipp-confirm-panel.show {
    opacity: 1;
    transform: scale(1);
}

.ipp-confirm-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(41, 171, 226, 0.15), rgba(27, 32, 128, 0.08));
}

.ipp-confirm-title {
    font-size: 1rem;
    color: #0f172a;
    margin-bottom: 8px;
}

.ipp-confirm-message {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 18px;
}

.ipp-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ipp-confirm-btn {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 10px;
    min-height: var(--touch-min);
    padding: 0 1rem;
    cursor: pointer;
    border: none;
}

.ipp-confirm-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.ipp-confirm-btn-ok {
    background: linear-gradient(135deg, #29ABE2, #1B2080);
    color: #fff;
}

/* ── Layout nav ──────────────────────────────────────────── */

.dash-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.2s;
}

.dash-back-link:hover {
    background: rgba(255, 255, 255, 0.16);
}

.dash-brand {
    gap: 12px;
}

.dash-card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.dash-card-link:hover {
    transform: translateY(-2px);
    border-color: rgba(41, 171, 226, 0.55);
    background: rgba(41, 171, 226, 0.14);
}

.dash-card-link .dash-card-cta {
    margin-top: 0.65rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--ip-cyan);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* ── Agenda paziente ─────────────────────────────────────── */

.agenda-page {
    color: #fff;
}

.agenda-page-header {
    margin-bottom: 1.5rem;
}

.agenda-page-header h1 {
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.agenda-page-header p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
}

.agenda-section {
    margin-bottom: 1.25rem;
}

.agenda-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 0.85rem;
}

.agenda-count {
    margin-left: auto;
    font-size: 0.68rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.agenda-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.agenda-card {
    display: flex;
    gap: 0.85rem;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 0.85rem;
    transition: border-color 0.2s, background 0.2s;
}

.agenda-card--today {
    border-color: rgba(41, 171, 226, 0.55);
    background: rgba(41, 171, 226, 0.12);
}

.agenda-card--past {
    opacity: 0.82;
}

.agenda-card-badge {
    flex-shrink: 0;
    width: 58px;
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(41, 171, 226, 0.35), rgba(27, 32, 128, 0.45));
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.35rem;
    text-align: center;
}

.agenda-card--past .agenda-card-badge {
    background: rgba(255, 255, 255, 0.08);
}

.agenda-card-badge-day {
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.7);
}

.agenda-card-badge-num {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
}

.agenda-card-badge-month {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
}

.agenda-card-body {
    flex: 1;
    min-width: 0;
}

.agenda-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-bottom: 0.35rem;
}

.agenda-chip--today {
    background: rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
    border: 1px solid rgba(147, 197, 253, 0.35);
}

.agenda-card-time {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ip-cyan);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.agenda-card-title {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 0.35rem;
}

.agenda-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
}

.agenda-meta-item {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.68);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.agenda-meta-item i {
    color: rgba(41, 171, 226, 0.85);
    font-size: 0.68rem;
}

.agenda-empty {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 18px;
}

.agenda-empty--compact {
    padding: 1.35rem 1rem;
    margin-bottom: 1rem;
}

.agenda-empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.85rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(41, 171, 226, 0.25), rgba(27, 32, 128, 0.35));
    color: var(--ip-cyan);
    font-size: 1.35rem;
}

.agenda-empty-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.agenda-empty-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.5;
    max-width: 28rem;
    margin: 0 auto;
}

.agenda-section-card .agenda-section-title,
.agenda-section-card .app-card-title {
    margin-bottom: 14px;
}

.agenda-section-card .agenda-count {
    margin-left: auto;
}

.agenda-past-card {
    padding: 0;
    overflow: hidden;
}

.agenda-past-card .agenda-past-details {
    margin-top: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.agenda-past-card .agenda-past-summary {
    padding: 16px 18px;
}

.agenda-past-card .agenda-list {
    padding: 0 18px 18px;
}

.agenda-alert {
    padding: 0;
    border-radius: 0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.agenda-alert--in-card {
    margin: 0;
    border: none;
    background: transparent;
}

.agenda-alert--warn {
    color: #fde68a;
}

.agenda-past-details {
    margin-top: 0.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.agenda-past-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    font-size: 0.82rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.82);
    user-select: none;
}

.agenda-past-summary::-webkit-details-marker {
    display: none;
}

.agenda-past-summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    margin-left: auto;
    color: rgba(255, 255, 255, 0.45);
    transition: transform 0.2s;
}

.agenda-past-details[open] .agenda-past-summary::after {
    transform: rotate(180deg);
}

.agenda-past-details .agenda-list {
    padding: 0 0.85rem 0.85rem;
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
        border-radius: 22px;
    }

    .brand-section h1 {
        font-size: 1.35rem;
    }

    .dash-welcome h1 {
        font-size: 1.35rem;
    }

    .app-page-header h1 {
        font-size: 1.2rem;
    }

    .app-bottom-nav-link span {
        font-size: 0.58rem;
    }

    .agenda-card {
        padding: 0.75rem;
    }

    .agenda-card-badge {
        width: 52px;
    }
}

/* ── Documenti paziente ──────────────────────────────────── */

.doc-page {
    color: #fff;
}

.doc-page-header {
    margin-bottom: 1.25rem;
}

.doc-page-header h1 {
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.doc-page-header p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
}

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-list-card {
    padding: 14px;
}

.doc-list-card .doc-card {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.doc-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    color: #fff;
}

.doc-card-icon {
    grid-row: 1 / span 2;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--doc-color) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--doc-color) 35%, transparent);
    align-self: start;
}

.doc-card-icon i {
    font-size: 1.1rem;
    color: var(--doc-color);
}

.doc-card-body {
    min-width: 0;
}

.doc-card-type {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 0.2rem;
}

.doc-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.35rem;
    word-break: break-word;
}

.doc-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
}

.doc-card-meta i {
    margin-right: 0.25rem;
    opacity: 0.85;
}

.doc-card-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.doc-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    min-height: var(--touch-min, 44px);
}

.doc-btn-view {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.doc-btn-download {
    background: linear-gradient(135deg, var(--ip-cyan), var(--ip-mid));
    color: #fff;
}

.doc-empty-state {
    text-align: center;
    padding: 36px 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    color: #fff;
}

.doc-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(41, 171, 226, 0.15);
    border: 1px solid rgba(41, 171, 226, 0.3);
}

.doc-empty-icon i {
    font-size: 1.5rem;
    color: var(--ip-cyan);
}

.doc-empty-state h2 {
    font-size: 1rem;
    margin-bottom: 0.45rem;
}

.doc-empty-state p {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.5;
    max-width: 22rem;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .doc-card {
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto;
        align-items: center;
    }

    .doc-card-icon {
        grid-row: auto;
    }

    .doc-card-actions {
        grid-column: auto;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        flex: 0 0 auto;
    }

    .doc-btn {
        flex: 0 0 auto;
        min-width: 96px;
    }
}

@media (max-width: 480px) {
    .doc-page-header h1 {
        font-size: 1.35rem;
    }
}

/* ── Pagamenti (piani di trattamento) ───────────────────── */

.pag-list-card {
    padding: 14px;
}

.pag-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pag-list-card .pag-card {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.pag-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    color: #fff;
}

.pag-card-body {
    min-width: 0;
    flex: 1;
}

.pag-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
    word-break: break-word;
}

.pag-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.pag-badge i {
    font-size: 0.72rem;
}

.pag-badge--success {
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: #bbf7d0;
}

.pag-badge--info {
    background: rgba(41, 171, 226, 0.18);
    border: 1px solid rgba(41, 171, 226, 0.4);
    color: #bae6fd;
}

.pag-badge--warn {
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(251, 191, 36, 0.45);
    color: #fde68a;
}

.pag-badge--muted {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.62);
}

@media (max-width: 480px) {
    .pag-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .pag-badge {
        align-self: flex-start;
    }
}

/* ── Fatture aperte ─────────────────────────────────────── */

/* Banner totale dovuto */
.pag-totale-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(251, 191, 36, 0.12) 100%);
    border: 1px solid rgba(251, 191, 36, 0.38);
    padding: 22px 20px;
    text-align: center;
}

.pag-totale-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pag-totale-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fde68a;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.pag-totale-amount {
    font-size: 2.4rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.pag-totale-sub {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}

/* Lista fatture */
.fat-list-card {
    padding: 16px;
}

.fat-list-card .app-card-title {
    margin-bottom: 12px;
}

.fat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fat-card {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fat-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.fat-card-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.fat-card-icon {
    font-size: 1.05rem;
    color: rgba(41, 171, 226, 0.85);
    flex-shrink: 0;
}

.fat-numero {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.fat-data {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.52);
    margin-top: 2px;
}

.fat-data i {
    font-size: 0.68rem;
}

.fat-card-amounts {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}

.fat-amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
}

.fat-amount-lbl {
    color: rgba(255, 255, 255, 0.58);
    font-weight: 500;
}

.fat-amount-val {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
}

.fat-amount-val--paid {
    color: rgba(52, 211, 153, 0.85);
}

.fat-amount-row--due {
    margin-top: 2px;
    padding-top: 5px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.fat-amount-val--due {
    font-size: 0.92rem;
    color: #fde68a;
}

/* Istruzioni di pagamento */
.pag-istruzioni-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pag-istruzioni-card .app-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

.pag-istruzioni-card .app-card-title i {
    color: rgba(41, 171, 226, 0.85);
    font-size: 0.95rem;
}

.pag-istruzioni-intro {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.55;
    margin: 0;
}

/* Metodi di pagamento */
.pag-metodi-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pag-metodo-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pag-metodo-card--default {
    border-color: rgba(41, 171, 226, 0.3);
    background: rgba(41, 171, 226, 0.07);
}

.pag-metodo-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pag-metodo-head i {
    font-size: 0.88rem;
    color: rgba(41, 171, 226, 0.85);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.pag-metodo-nome {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    flex: 1;
}

.pag-metodo-badge-default {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(41, 171, 226, 0.2);
    border: 1px solid rgba(41, 171, 226, 0.4);
    color: #bae6fd;
    padding: 2px 7px;
    border-radius: 999px;
}

.pag-metodo-note {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.58);
    margin: 0;
    padding-left: 26px;
    word-break: break-word;
}

/* Box causale */
.pag-causale-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pag-causale-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.pag-causale-label i {
    font-size: 0.66rem;
}

.pag-causale-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
    line-height: 1.45;
    user-select: all;
}

.pag-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    align-self: flex-start;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pag-copy-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.pag-copy-btn--done {
    background: rgba(52, 211, 153, 0.18);
    border-color: rgba(52, 211, 153, 0.4);
    color: #d1fae5;
}

.pag-copy-btn i {
    font-size: 0.72rem;
}

/* Footer nota segreteria */
.pag-istruzioni-footer {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin: 0;
    line-height: 1.5;
}

.pag-istruzioni-footer i {
    font-size: 0.68rem;
    flex-shrink: 0;
    margin-top: 2px;
    color: rgba(245, 158, 11, 0.7);
}

/* Responsivo fatture */
@media (max-width: 480px) {
    .pag-totale-amount {
        font-size: 2rem;
    }

    .fat-card-head {
        flex-wrap: wrap;
    }
}

/* ── Anamnesi (mobile-first accordion form) ─────────────── */

.anam-status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0;
    border-radius: 0;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0;
}

.anam-status--in-card {
    padding: 0;
    border: none;
    background: transparent;
}

.anam-status--info {
    color: #e0f7ff;
}

.anam-status--ok {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #d1fae5;
}

.anam-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0;
    border-radius: 0;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0;
    line-height: 1.45;
}

.anam-alert--in-card {
    padding: 0;
    border: none;
    background: transparent;
}

.anam-alert--error {
    color: #fecaca;
}

.anam-alert--invite {
    color: #e0f7ff;
}

.anam-alert--invite i {
    color: var(--ip-cyan);
    margin-top: 2px;
}

.anam-alert--invite strong {
    display: block;
    margin-bottom: 0.25rem;
}

.anam-alert--invite p {
    margin: 0;
    font-weight: 500;
}

.anam-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.anam-accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.anam-acc-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--app-radius-sm);
    overflow: hidden;
}

.anam-acc-head {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 1rem 1.05rem;
    min-height: 56px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.anam-acc-head::-webkit-details-marker {
    display: none;
}

.anam-acc-head span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.anam-acc-head i:first-child {
    color: var(--ip-cyan);
    width: 18px;
    text-align: center;
}

.anam-acc-chevron {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    transition: transform 0.2s;
}

.anam-acc-item.is-open .anam-acc-chevron,
.anam-acc-item[open] .anam-acc-chevron {
    transform: rotate(180deg);
}

.anam-acc-body {
    padding: 0 1.05rem 1.05rem;
}

.anam-field-hint,
.anam-ro-hint {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.anam-ro-hint i {
    color: rgba(255, 255, 255, 0.45);
    margin-right: 0.25rem;
}

.anam-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.anam-tag {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
    font-size: 0.76rem;
    font-weight: 700;
}

.anam-text {
    font-size: 0.88rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.9);
    white-space: pre-wrap;
}

.anam-empty {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
}

.anam-check-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.anam-check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.anam-check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.anam-check-box {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.anam-check-box i {
    font-size: 0.7rem;
    color: #fff;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s, transform 0.15s;
}

.anam-check input:checked + .anam-check-box {
    background: var(--ip-cyan);
    border-color: var(--ip-cyan);
}

.anam-check input:checked + .anam-check-box i {
    opacity: 1;
    transform: scale(1);
}

.anam-check-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.3;
}

.anam-check-label i {
    color: var(--ip-cyan);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.anam-field {
    display: block;
    margin-top: 12px;
}

.anam-field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 0.45rem;
}

.anam-input,
.anam-textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    min-height: 48px;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.anam-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.anam-input::placeholder,
.anam-textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.anam-input:focus,
.anam-textarea:focus {
    border-color: var(--ip-cyan);
    box-shadow: 0 0 0 3px rgba(41, 171, 226, 0.25);
}

.anam-form-actions {
    margin-top: 20px;
    padding-bottom: 8px;
}

.btn-anam-submit {
    width: 100%;
    min-height: 52px;
    padding: 0.85rem 1.25rem;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ip-cyan) 0%, var(--ip-dark) 100%);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    box-shadow: 0 8px 24px rgba(41, 171, 226, 0.35);
    -webkit-tap-highlight-color: transparent;
}

.btn-anam-submit:disabled {
    opacity: 0.75;
    cursor: wait;
}

.btn-anam-submit:active:not(:disabled) {
    transform: scale(0.99);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 640px) {
    .anam-check-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .anam-check-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .btn-anam-submit {
        width: auto;
        min-width: 240px;
    }
}
