:root {
    --primary: #014ab0;
    --primary-strong: #0064d3;
    --primary-soft: #81b7f4;
    --primary-pale: #e8f0ff;
    --detail-top-blue: #2459bd;
    --surface: #ffffff;
    --surface-muted: #f5f7fb;
    --line: #dbe3f2;
    --text: #1f2a3d;
    --muted: #5f6f8c;
    --success: #05a648;
    --warning: #ee8d00;
    --danger: #f70404;
    --disabled: #c2c2c2;
    --shadow: 0 12px 28px rgba(1, 74, 176, 0.08);
    --radius: 18px;
    --radius-sm: 12px;
    --topbar-height: 64px;
    --drawer-width: 328px;
    --font-ui: "Segoe UI", Roboto, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    overscroll-behavior-y: none;
}

body {
    font-family: var(--font-ui);
    color: var(--text);
    background: var(--surface-muted);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
    color: var(--text);
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

input, textarea, select, button {
    font: inherit;
}

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

input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 0.85rem 0.15rem 0.7rem;
    background: transparent;
    color: var(--text);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    resize: vertical;
    min-height: 96px;
}

label {
    display: grid;
    gap: 0.45rem;
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    padding: 0.95rem 1.15rem;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(1, 74, 176, 0.22);
}

.btn-secondary {
    background: var(--primary-strong);
    color: #fff;
}

.btn-ghost {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--line);
}

.btn-accent {
    background: #dc6600;
    color: #fff;
    box-shadow: 0 8px 18px rgba(220, 102, 0, 0.24);
}

.btn-full {
    width: 100%;
}

.toast-stack {
    position: fixed;
    top: 0.9rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: min(420px, calc(100vw - 1.5rem));
    display: grid;
    gap: 0.7rem;
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    box-shadow: 0 16px 34px rgba(10, 24, 48, 0.18);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.toast-success {
    border-left: 4px solid var(--success);
    color: var(--success);
}

.toast-error {
    border-left: 4px solid #b93232;
    color: #b93232;
}

.toast-copy {
    color: #1d2430;
    line-height: 1.45;
}

.toast-close {
    border: none;
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.plain-list {
    margin: 1rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted);
    display: grid;
    gap: 0.55rem;
}

.surface-card,
.android-card,
.result-card,
.module-card,
.profile-card,
.brand-card,
.diagnostic-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.surface-card,
.android-card,
.diagnostic-card {
    padding: 1.2rem;
}

.android-kicker,
.eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.guest-shell {
    min-height: 100vh;
    margin: 0;
    background: var(--surface-muted);
}

.guest-page {
    min-height: 100vh;
    display: grid;
    align-content: start;
    gap: 1rem;
}

.login-screen {
    width: min(540px, 100%);
    display: grid;
    gap: 1rem;
}

.login-toolbar {
    min-height: 64px;
    border-radius: var(--radius);
    background: var(--surface);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow);
    padding: 0.8rem 1rem;
}

.login-toolbar img {
    width: 156px;
}

.login-card,
.login-notes {
    padding: 1.35rem;
}

.login-copy {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.login-card .android-form {
    grid-template-columns: 1fr;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: minmax(180px, 30vh) 1fr;
}

.login-topband {
    background: var(--primary);
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 1.5rem 1rem 1rem;
}

.login-topband-inner {
    display: grid;
    place-items: center;
}

.login-topband-inner img {
    width: min(240px, 70vw);
    max-width: 260px;
}

.login-form-area {
    width: min(520px, 100%);
    margin: 0 auto;
    padding: 1.1rem 1rem 2rem;
    display: grid;
    gap: 1rem;
}

.login-form {
    display: grid;
    gap: 1.2rem;
}

.login-fields {
    display: grid;
    gap: 0.5rem;
}

.login-label {
    font-size: 1.05rem;
    color: #161616;
    gap: 0;
}

.login-field-shell {
    background: #fff;
    border: 2px solid rgba(188, 187, 188, 1);
    border-radius: 10px;
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 0 0.95rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.login-field-shell:focus-within {
    border-color: rgba(1, 125, 246, 1);
    box-shadow: 0 0 0 2px rgba(1, 125, 246, 0.08);
}

.login-field-shell input {
    width: 100%;
    min-height: 44px;
    border: none;
    background: transparent;
    color: #151515;
    font-size: 1.125rem;
    padding: 0;
    box-shadow: none;
}

.login-field-shell input:focus {
    outline: none;
}

.login-field-shell input::placeholder {
    color: #a40bfe;
}

.login-field-shell input[data-transform="upper"] {
    text-transform: uppercase;
}

.login-field-shell input[data-transform="lower"] {
    text-transform: lowercase;
}

.login-submit {
    display: grid;
}

.login-submit-btn {
    min-height: 54px;
    padding: 0 1.15rem;
    border-radius: 18px;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    text-transform: uppercase;
    box-shadow: none;
    justify-content: center;
}

.login-copy-block {
    display: grid;
    gap: 0.8rem;
}

.login-note-paragraph {
    margin: 0;
    color: #1f1f1f;
    font-size: 1.04rem;
    line-height: 1.45;
}

.login-note-paragraph a {
    color: #161616;
    font-weight: 700;
    text-decoration: none;
}

.login-note-paragraph a:hover {
    text-decoration: underline;
}

.login-utility-form {
    display: grid;
    justify-content: start;
}

.login-utility-link {
    border: none;
    background: transparent;
    padding: 0;
    color: var(--primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.login-utility-link:hover {
    text-decoration: underline;
}

.login-spinner {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
}

.login-spinner[hidden] {
    display: none;
}

.login-spinner-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(245, 245, 246, 0.7);
}

.login-spinner-indicator {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 5px solid rgba(0, 0, 104, 0.14);
    border-top-color: #000068;
    animation: login-spin 0.8s linear infinite;
}

@keyframes login-spin {
    to {
        transform: rotate(360deg);
    }
}

.android-form,
.grid-form,
.detail-grid,
.filter-bar,
.line-fields,
.info-grid,
.detail-split,
.stack-form,
.inline-form {
    display: grid;
    gap: 1rem;
}

.android-form,
.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.android-field {
    gap: 0.35rem;
}

.login-actions,
.form-actions,
.actions,
.summary-chip-group,
.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.login-actions .btn {
    flex: 1 1 220px;
}

.android-body {
    min-height: 100vh;
    background: var(--surface-muted);
}

.android-shell {
    min-height: 100vh;
    overscroll-behavior-y: none;
}

.main-shell {
    will-change: transform, opacity;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

body.page-enter-from-right .main-shell {
    animation: page-enter-from-right 0.56s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.page-enter-from-bottom .main-shell {
    animation: page-enter-from-bottom 0.4s cubic-bezier(0.2, 0.9, 0.24, 1) both;
}

@keyframes page-enter-from-right {
    from {
        transform: translate3d(16px, 0, 0);
        opacity: 0.92;
    }

    to {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}

@keyframes page-enter-from-bottom {
    from {
        transform: translate3d(0, 34px, 0);
        opacity: 0.96;
    }
    to {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    height: var(--topbar-height);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.topbar-home {
    background: var(--primary);
    border-bottom: none;
    box-shadow: none;
}

.topbar-anagrafiche {
    grid-template-columns: 42px 1fr auto;
    position: sticky;
}

.topbar-anagrafiche .topbar-menu,
.topbar-anagrafiche-action {
    position: relative;
    z-index: 1;
}

.topbar-menu {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: transparent;
    display: grid;
    align-content: center;
    gap: 5px;
    cursor: pointer;
}

.topbar-back {
    width: 32px;
    height: 42px;
    justify-items: start;
    align-content: center;
    margin-left: -0.2rem;
    color: inherit;
    text-decoration: none;
}

.topbar-back svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topbar-menu span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
}

.topbar-home .topbar-menu span {
    background: #fff;
}

.topbar-home .topbar-back {
    color: #fff;
}

.topbar-titles {
    display: grid;
    gap: 0.1rem;
}

.topbar-titles strong {
    font-size: 1.08rem;
    color: var(--text);
}

.topbar-titles span {
    font-size: 0.98rem;
    color: var(--muted);
}

.topbar-meta {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
}

.topbar-titles-light strong,
.topbar-titles-light span,
.topbar-meta-light {
    color: #fff;
}

.topbar-titles-single {
    justify-self: center;
    text-align: center;
}

.topbar-titles-single strong {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.topbar-titles-single span {
    display: block;
    margin-top: 0.14rem;
    font-size: 0.88rem;
    font-weight: 500;
    opacity: 0.88;
}

.topbar-anagrafiche-title {
    position: static;
    transform: none;
    width: 100%;
    justify-self: start;
    align-self: center;
    text-align: left;
    pointer-events: none;
    z-index: 0;
    padding-left: 0.15rem;
}

.topbar-anagrafiche-action {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    color: #fff;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    padding: 0.3rem 0;
    min-width: 0;
    width: auto;
    text-align: right;
    margin-left: auto;
    margin-right: 0.72rem;
}

.detail-topbar-mode .topbar {
    padding-right: 0;
    flex: 0 0 var(--topbar-height);
}

.detail-topbar-mode {
    height: 100dvh;
    overflow: hidden;
}

.detail-topbar-mode .android-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    background: var(--detail-top-blue);
}

.detail-topbar-mode .main-shell-anagrafiche {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
    background: linear-gradient(
        180deg,
        var(--detail-top-blue) 0,
        var(--detail-top-blue) 250px,
        var(--surface-muted) 250px
    );
}

.detail-topbar-mode .topbar-anagrafiche-action {
    margin-right: max(0.72rem, calc((100vw - 780px) / 2 + 0.72rem));
}

.detail-topbar-mode .topbar.topbar-home {
    background: var(--detail-top-blue);
    box-shadow: none;
}

.topbar-center-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    width: 60px;
    height: 60px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.14rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
    pointer-events: none;
}

.topbar-home-filler {
    min-height: 1px;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(19, 35, 65, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 40;
}

.drawer-panel {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--drawer-width), calc(100vw - 28px));
    background: #fff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 45;
    overflow-y: auto;
}

body.drawer-open .drawer-overlay {
    opacity: 1;
    pointer-events: auto;
}

body.drawer-open .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    position: relative;
}

.drawer-header-image {
    height: 188px;
    background: url("../images/header.jpg") center/cover no-repeat;
}

.drawer-header-content {
    position: absolute;
    inset: 0;
    display: grid;
    justify-items: center;
    align-content: center;
    padding: 0 1rem;
    gap: 0.8rem;
}

.drawer-avatar {
    width: 100px;
    height: 100px;
    background: transparent;
}

.drawer-header-content strong {
    color: #fff;
    font-weight: 500;
    text-align: center;
}

.drawer-nav {
    display: grid;
    gap: 0.15rem;
    padding: 0.4rem 0 1rem;
}

.drawer-section-label {
    padding: 1rem 1rem 0.3rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.drawer-link,
.drawer-link-button {
    width: 100%;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: start;
    gap: 0.8rem;
    padding: 0.82rem 1rem;
    color: var(--primary);
    background: transparent;
    border: none;
    text-align: left;
    text-decoration: none;
}

.drawer-link.active {
    background: #efefef;
    color: var(--primary);
}

.drawer-link.active .drawer-link-icon {
    color: var(--primary);
}

.drawer-link.disabled {
    color: var(--disabled);
    cursor: default;
}

.drawer-link.disabled .drawer-link-icon {
    color: var(--disabled);
}

.drawer-link-title {
    font-weight: 500;
}

.drawer-link small {
    font-size: 0.88rem;
    color: var(--muted);
}

.drawer-link-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--primary);
    margin-top: 0.05rem;
}

.drawer-link-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.drawer-link-copy {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.drawer-link.tone-dark,
.drawer-link-button.tone-dark {
    color: #000;
}

.drawer-link.tone-dark .drawer-link-icon,
.drawer-link-button.tone-dark .drawer-link-icon {
    color: #3d3d3d;
}

.drawer-link-button.tone-exit {
    color: #ff5a00;
}

.drawer-link-button.tone-exit .drawer-link-icon {
    color: #ff5a00;
}

.drawer-company {
    color: var(--text);
}

.drawer-logout {
    margin: 0;
}

.main-shell {
    padding: 1rem;
}

.no-app-topbar .main-shell {
    padding-top: 1rem;
}

.main-shell-anagrafiche {
    padding: 0;
    overflow: visible;
    min-height: calc(100vh - var(--topbar-height));
}

.main-shell-prodotti {
    padding: 0;
    overflow: visible;
    min-height: calc(100vh - var(--topbar-height));
}

.no-app-topbar .main-shell-anagrafiche {
    min-height: 100vh;
}

.home-screen {
    display: grid;
    gap: 0;
    margin: -1rem;
    background: var(--surface-muted);
    min-height: calc(100vh - var(--topbar-height));
}

.home-hero {
    min-height: 280px;
    background: var(--primary);
    display: grid;
    grid-template-rows: 1fr auto auto;
    align-items: center;
    justify-items: center;
    padding: 0.85rem 1rem 0;
}

.home-hero-top {
    align-self: center;
    justify-self: center;
    padding-top: 0.75rem;
}

.home-hero-top img {
    width: min(240px, 64vw);
    max-width: 260px;
}

.home-hero-middle {
    align-self: center;
    justify-self: center;
}

.home-hero-middle p {
    margin: 0;
    color: #fff;
    font-size: 1.45rem;
    font-weight: 500;
    text-align: center;
}

.home-hero-tab {
    align-self: end;
    margin-bottom: -1px;
}

.home-hero-tab img {
    height: 30px;
    width: auto;
    display: block;
}

.home-module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 0.35rem 0 0.9rem;
    background: var(--surface-muted);
}

.home-module-form {
    margin: 0;
    display: block;
}

.home-module,
button.home-module {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 0.35rem;
    text-align: center;
    min-height: 130px;
    padding: 1rem 0.35rem 0.7rem;
    background: transparent;
    border: none;
    text-decoration: none;
    color: var(--primary);
    cursor: pointer;
    width: 100%;
}

.home-module:hover {
    background: rgba(1, 74, 176, 0.04);
}

.home-module.is-disabled {
    color: rgb(194, 194, 194);
    cursor: default;
}

.home-module.is-disabled:hover {
    background: transparent;
}

.home-module.is-logout {
    color: rgb(255, 90, 0);
}

.home-module-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
}

.home-module-icon svg {
    width: 58px;
    height: 58px;
    transform-origin: center;
}

.home-icon-filled {
    fill: currentColor;
    stroke: none;
}

.home-icon-stroke {
    fill: none;
    stroke: currentColor;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-module-icon.icon-anagrafiche svg,
.home-module-icon.icon-magazzino svg,
.home-module-icon.icon-interventi svg,
.home-module-icon.icon-scadenzario svg {
    width: 60px;
    height: 60px;
}

.home-module-icon.icon-prodotti svg,
.home-module-icon.icon-documenti svg {
    width: 56px;
    height: 56px;
}

.home-module-icon.icon-provvigioni svg,
.home-module-icon.icon-statistiche svg {
    width: 58px;
    height: 58px;
}

.home-module-icon.icon-esci svg {
    width: 60px;
    height: 60px;
    transform: none;
}

.home-module-label {
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.2;
}

.drawer-page {
    display: grid;
    gap: 1rem;
}

.info-card {
    display: grid;
    justify-items: center;
    gap: 1rem;
    text-align: center;
}

.info-card-logo {
    width: 170px;
}

.info-card-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.info-card-address {
    display: grid;
    gap: 0.3rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.android-list-header,
.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.android-list-header h1,
.page-header h2 {
    margin-top: 0.2rem;
}

.segmented-control {
    display: inline-flex;
    background: #fff;
    border-radius: 10px;
    padding: 0.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.segment {
    padding: 0.68rem 1rem;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
}

.segment.active {
    background: var(--primary);
    color: #fff;
}

.android-searchbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
    padding: 1rem 1.1rem;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.android-list,
.list-grid,
.action-panel-grid,
.info-grid,
.dashboard-grid,
.gallery-grid {
    display: grid;
    gap: 1rem;
}

.android-list-screen {
    display: grid;
    gap: 1rem;
}

.android-list-screen-anagrafiche,
.android-list-screen-prodotti {
    gap: 0;
    min-height: calc(100vh - var(--topbar-height));
    height: calc(100vh - var(--topbar-height));
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: #fff;
}

.android-list-screen-with-footer {
    padding-bottom: 5.7rem;
}

.android-list-row,
.result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-height: 86px;
}

.android-list-row.is-clickable {
    cursor: pointer;
}

.android-list-screen-anagrafiche.android-list-screen-with-footer,
.android-list-screen-prodotti.android-list-screen-with-footer {
    padding-bottom: 0;
}

.android-list-top-anagrafiche,
.android-list-top-prodotti {
    background: var(--primary);
    padding: 0 0 0.55rem;
}

.android-searchbar-anagrafiche,
.android-searchbar-prodotti {
    background: var(--primary);
    border-radius: 0;
    box-shadow: none;
    padding: 0 0.45rem;
    margin: 0;
    grid-template-columns: 1fr;
}

.android-searchbar-anagrafiche input,
.android-searchbar-prodotti input {
    background: #fff;
    border: none;
    border-radius: 16px;
    padding: 0.9rem 1rem 0.9rem 2.85rem;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08) inset, 0 2px 10px rgba(0, 0, 0, 0.06);
}

.android-searchfield-anagrafiche {
    position: relative;
    display: block;
}

.android-searchfield-anagrafiche input::placeholder {
    color: #8c97ab;
}

.android-searchfield-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #8c97ab;
    pointer-events: none;
}

.android-searchfield-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.android-list-anagrafiche,
.android-list-prodotti {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: linear-gradient(180deg, #f7f9fd 0%, #ffffff 100%);
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.95rem 0.9rem 0.4rem;
    position: relative;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.android-pull-refresh-content {
    display: grid;
    gap: 0.8rem;
    will-change: transform;
    transition: transform 0.18s ease;
    position: relative;
    z-index: 1;
}

.android-pull-refresh {
    position: absolute;
    top: 0.2rem;
    left: 0.9rem;
    right: 0.9rem;
    min-height: 82px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem 0.75rem;
    color: #7c8eac;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: opacity 0.18s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.android-pull-refresh.is-visible {
    opacity: 1;
}

.android-pull-refresh.is-active .android-pull-refresh-label {
    color: var(--primary);
}

.android-pull-refresh-spinner {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 2.5px solid rgba(1, 74, 176, 0.14);
    border-top-color: var(--primary);
    border-right-color: rgba(1, 74, 176, 0.32);
    transform: rotate(0deg);
    opacity: 0.95;
}

.android-pull-refresh.is-visible .android-pull-refresh-spinner {
    animation: pull-refresh-spin 0.9s linear infinite;
}

.android-pull-refresh.is-active .android-pull-refresh-spinner {
    animation: pull-refresh-spin 0.8s linear infinite;
}

@keyframes pull-refresh-spin {
    to {
        transform: rotate(360deg);
    }
}

.android-list-row-anagrafiche,
.android-list-row-prodotti {
    display: flex;
    justify-content: flex-start;
    gap: 0.85rem;
    min-height: 0;
    padding: 0.95rem 0.95rem 0.95rem 0.85rem;
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(15, 44, 91, 0.08);
    background: #fff;
    border: 1px solid rgba(1, 74, 176, 0.08);
    align-items: start;
    height: auto;
    flex: 0 0 auto;
}

.android-list-row-anagrafiche:last-child {
    border-bottom: 1px solid rgba(1, 74, 176, 0.08);
}

.android-list-copy {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.android-list-copy-anagrafiche {
    flex: 1 1 auto;
    gap: 0.38rem;
    padding-top: 0.08rem;
    min-width: 0;
}

.android-list-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(1, 74, 176, 0.12), rgba(1, 100, 211, 0.22));
    color: var(--primary);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.android-list-avatar-product svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.android-list-code-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0.18rem 0.52rem;
    border-radius: 999px;
    background: rgba(1, 74, 176, 0.08);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.android-list-support-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.38rem 0.55rem;
    min-width: 0;
}

.android-list-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.45rem;
    color: #7486a5;
    font-size: 0.84rem;
    line-height: 1.35;
    min-width: 0;
}

.android-list-meta-item {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.android-list-arrow-badge {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(1, 74, 176, 0.08);
    align-self: center;
    margin-top: 0;
}

.android-list-arrow-badge .android-list-arrow {
    margin: 0;
    opacity: 1;
}

.android-list-title,
.result-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
}

.android-list-subtitle,
.result-subtitle {
    color: var(--text);
    font-size: 0.93rem;
}

.android-list-row-anagrafiche .android-list-title {
    font-size: 1.03rem;
    line-height: 1.18;
    text-transform: none;
    word-break: break-word;
    overflow-wrap: anywhere;
    padding-right: 0.15rem;
}

.android-list-row-prodotti .android-list-title {
    font-size: 1.03rem;
    line-height: 1.18;
    word-break: break-word;
    overflow-wrap: anywhere;
    padding-right: 0.15rem;
}

.android-list-row-anagrafiche .android-list-subtitle {
    color: #5a6f90;
    font-size: 0.92rem;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.android-list-row-prodotti .android-list-subtitle {
    color: #6a7c9a;
    font-size: 0.9rem;
    line-height: 1.32;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.android-list-meta,
.result-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.android-list-arrow {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    opacity: 0.7;
}

.android-bottom-bar {
    background: #f5f5f6;
    border-top: none;
    box-shadow: 0 -8px 24px rgba(10, 24, 48, 0.08);
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.android-bottom-bar-inner {
    min-height: 84px;
    display: grid;
    grid-template-columns: 64px 1fr 64px;
    align-items: center;
    gap: 0.75rem;
    width: min(100%, 860px);
    margin: 0 auto;
    padding: 0 1rem;
}

.android-bottom-bar-side {
    display: flex;
}

.android-bottom-bar-side.align-start {
    justify-content: flex-start;
    padding-left: 0.5rem;
}

.android-bottom-bar-side.align-end {
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.android-bottom-bar-side.align-center {
    justify-content: center;
}

.android-bottom-bar-center {
    text-align: center;
    color: #000;
    font-size: 0.94rem;
    font-weight: 500;
    white-space: nowrap;
}

.android-bottom-bar-action {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    color: var(--primary);
}

.android-bottom-bar-action-button {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.android-bottom-bar-action svg {
    width: 40px;
    height: 40px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.android-bottom-bar-action.is-hidden {
    visibility: hidden;
}

.android-bottom-bar-products {
    display: grid;
    gap: 0;
    padding-bottom: 0;
    padding-top: 0.18rem;
}

.android-bottom-bar-products-meta {
    min-height: 22px;
    display: grid;
    place-items: center;
    color: #6b7486;
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: -0.04rem;
    transform: translateY(1px);
}

.android-bottom-bar-inner-products {
    grid-template-columns: 64px 1fr 64px;
    margin-top: -0.22rem;
}

.detail-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.anagrafica-detail-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 0;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
}

.anagrafica-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: -0.08rem;
    padding: 0 0.2rem;
}

.toolbar-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.toolbar-link:hover {
    text-decoration: underline;
}

.anagrafica-hero {
    flex: 0 0 auto;
    z-index: 18;
    width: 100%;
    background: var(--detail-top-blue);
    color: #fff;
    border-radius: 0;
    padding: 1.02rem 1.22rem 1.22rem;
    margin-top: -1px;
    box-shadow: none;
    display: block;
}

.anagrafica-detail-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
}

.anagrafica-detail-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0.9rem 1rem 0.85rem;
}

.anagrafica-detail-actions-wrap {
    flex: 0 0 auto;
    background: var(--surface-muted);
    padding: 0.15rem 1rem calc(1.2rem + env(safe-area-inset-bottom, 0px));
}

.anagrafica-hero-copy {
    display: grid;
    gap: 0.58rem;
    min-width: 0;
}

.anagrafica-hero-topline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.anagrafica-hero-kind,
.anagrafica-hero-code {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.18rem 0.72rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.anagrafica-hero-kind {
    background: rgba(255, 255, 255, 0.17);
    color: rgba(255, 255, 255, 0.96);
}

.anagrafica-hero-code {
    background: rgba(255, 255, 255, 0.96);
    color: #1e56b7;
    box-shadow: 0 1px 0 rgba(16, 49, 105, 0.06);
}

.anagrafica-hero h2 {
    margin: 0;
    font-size: 1.42rem;
    line-height: 1.22;
    font-weight: 700;
    color: #ffffff;
}

.anagrafica-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.5;
}

.anagrafica-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.anagrafica-hero-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    max-width: 100%;
    padding: 0.22rem 0.72rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.98);
    font-size: 0.84rem;
}

.anagrafica-hero-chip-action {
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.anagrafica-hero-chip-button {
    font: inherit;
}

.anagrafica-detail-list {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.anagrafica-detail-row {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 0.75rem;
    align-items: start;
    padding: 0.95rem 1rem;
}

.anagrafica-detail-row + .anagrafica-detail-row {
    border-top: 1px solid var(--line);
}

.anagrafica-detail-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: #3e5f92;
}

.anagrafica-detail-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.anagrafica-detail-copy {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.anagrafica-detail-value {
    color: #283a57;
    white-space: pre-line;
    word-break: break-word;
    font-weight: 600;
    font-size: 1.04rem;
    line-height: 1.48;
}

.anagrafica-detail-actions {
    display: flex;
    gap: 0.75rem;
    padding: 0;
}

.anagrafica-detail-actions > * {
    flex: 0 0 calc(50% - 0.375rem);
    width: calc(50% - 0.375rem);
    min-width: 0;
}

.anagrafica-detail-actions form {
    display: flex;
    width: calc(50% - 0.375rem);
    min-width: 0;
}

.detail-action-btn {
    width: 100%;
    justify-content: center;
    min-height: 54px;
    border-radius: 18px;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    box-shadow: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.detail-action-btn:hover {
    transform: none;
}

.detail-action-btn.btn-accent {
    background: #dc6600;
    box-shadow: none;
}

.detail-action-btn.btn-primary {
    background: #1f51b2;
    box-shadow: none;
}

.detail-action-cart-btn {
    background: #067f08 !important;
    border-color: #067f08 !important;
}

.anagrafica-detail-actions .detail-action-btn {
    font-size: 0.91rem;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anagrafica-detail-card-action {
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.anagrafica-detail-card-action:hover,
.anagrafica-detail-card-action:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(30, 86, 183, 0.18);
}

.anagrafica-detail-card-button {
    width: 100%;
    border: 1px solid rgba(30, 86, 183, 0.09);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.contact-sheet[hidden] {
    display: none;
}

.contact-sheet {
    position: fixed;
    inset: 0;
    z-index: 65;
}

.contact-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 24, 48, 0.28);
}

.contact-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.8rem 0.9rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    background: #f5f5f6;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 30px rgba(10, 24, 48, 0.16);
}

.contact-sheet-handle {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: rgba(40, 58, 87, 0.18);
    margin: 0 auto 0.7rem;
}

.contact-sheet-title {
    display: block;
    text-align: center;
    color: #283a57;
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.contact-sheet-actions {
    display: grid;
    gap: 0.6rem;
}

.contact-sheet-action,
.contact-sheet-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border-radius: 16px;
    background: #fff;
    color: #1f51b2;
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 700;
    border: 1px solid rgba(30, 86, 183, 0.08);
}

.contact-sheet-cancel {
    width: 100%;
    margin-top: 0.7rem;
    color: #5c6f8f;
}

body.contact-sheet-open {
    overflow: hidden;
}

.anagrafica-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.82rem;
}

.anagrafica-detail-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0.82rem;
    align-items: start;
    padding: 1rem 1.05rem;
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 10px 24px rgba(15, 44, 91, 0.08);
    border: 1px solid rgba(30, 86, 183, 0.09);
}

.anagrafica-detail-card .anagrafica-detail-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(30, 86, 183, 0.1), rgba(30, 86, 183, 0.14));
    color: #2f5fb1;
}

.anagrafica-detail-card .anagrafica-detail-label {
    color: #6d7f9d;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.anagrafica-edit-screen {
    max-width: 820px;
    margin: 0 auto;
    padding: 0;
    height: 100dvh;
    min-height: 100dvh;
}

.anagrafica-edit-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.anagrafica-save-spinner {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
}

.anagrafica-save-spinner[hidden] {
    display: none;
}

.anagrafica-save-spinner-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(245, 245, 246, 0.72);
}

.anagrafica-save-spinner-indicator {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 5px solid rgba(0, 0, 104, 0.14);
    border-top-color: #000068;
    animation: login-spin 0.8s linear infinite;
}

.anagrafica-edit-card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.anagrafica-edit-header {
    flex: 0 0 auto;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 0.35rem 1rem;
    padding: 0.2rem 1.1rem 0.7rem;
    background: var(--surface-muted);
}

.anagrafica-edit-close {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    margin-top: 0;
    line-height: 1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.anagrafica-edit-close:hover,
.anagrafica-edit-close:focus,
.anagrafica-edit-close:active,
.anagrafica-edit-close:visited {
    text-decoration: none;
}

.anagrafica-edit-title {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: -0.05rem;
}

.anagrafica-edit-header h2 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.08;
    font-weight: 700;
    color: var(--text);
}

.anagrafica-edit-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

.anagrafica-edit-body {
    display: grid;
    gap: 0.95rem;
    padding: 0 1.1rem calc(1.35rem + env(safe-area-inset-bottom, 0px));
}

.anagrafica-field {
    display: grid;
    gap: 0.35rem;
}

.anagrafica-field span {
    font-size: 1.04rem;
    color: var(--text);
}

.anagrafica-field-required span {
    color: var(--primary);
    font-weight: 700;
}

.anagrafica-field input {
    width: 100%;
    border: 1px solid #cfd8e6;
    border-radius: 12px;
    background: #fff;
    min-height: 48px;
    padding: 0.78rem 0.9rem;
    color: var(--text);
    font: inherit;
}

.anagrafica-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(1, 74, 176, 0.12);
}

.anagrafica-field-hint {
    margin: -0.35rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.anagrafica-inline-fields {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 90px;
    gap: 0.75rem;
    align-items: end;
}

.anagrafica-inline-fields.customer-extra {
    grid-template-columns: 110px minmax(0, 1fr);
}

.anagrafica-field.compact input {
    text-align: center;
}

.anagrafica-inline-fields .grow {
    grid-column: auto;
}

.anagrafica-section-title {
    text-align: center;
    color: #b6bcc7;
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 0.7rem;
}

.anagrafica-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 0 0.9rem;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

.anagrafica-switch-row span:first-child {
    flex: 1 1 auto;
}

.anagrafica-switch {
    position: relative;
    width: 52px;
    height: 30px;
    flex: 0 0 auto;
}

.anagrafica-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}

.anagrafica-switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #d8dfeb;
    transition: background 0.2s ease;
}

.anagrafica-edit-footer {
    flex: 0 0 auto;
    z-index: 3;
    background: var(--surface-muted);
    padding: 0.45rem 1.1rem calc(1.8rem + env(safe-area-inset-bottom, 0px));
}

.anagrafica-edit-footer-note {
    margin: 0 0 0.45rem;
    text-align: center;
    color: var(--primary);
    font-size: 0.96rem;
    font-weight: 600;
}

.anagrafica-edit-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.anagrafica-edit-actions .detail-action-btn {
    min-height: 54px;
    border-radius: 18px;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    box-shadow: none;
}

.edit-action-cancel {
    background: #a60000;
    color: #fff;
    border: 1px solid #a60000;
}

.edit-action-confirm {
    background: #067f08;
    color: #fff;
    border: 1px solid #067f08;
}

.anagrafica-switch-slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(13, 27, 49, 0.18);
    transition: transform 0.2s ease;
}

.anagrafica-switch input:checked + .anagrafica-switch-slider {
    background: #4e8ee7;
}

.anagrafica-switch input:checked + .anagrafica-switch-slider::after {
    transform: translateX(22px);
}

.no-app-topbar {
    background: #f5f5f6;
}

.no-app-topbar .android-shell,
.no-app-topbar .main-shell,
.no-app-topbar .main-shell-anagrafiche {
    background: #f5f5f6;
}

.no-app-topbar .main-shell-anagrafiche {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}


.span-2,
.grow {
    grid-column: span 2;
}

.toggle-row {
    align-items: center;
}

.checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
}

.checkbox-field input {
    width: auto;
}

.spec-grid {
    display: grid;
    gap: 0.9rem;
}

.spec-grid div {
    display: grid;
    gap: 0.2rem;
}

.gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.gallery-grid img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 12px;
    background: #eef2f9;
}

.line-stack {
    display: grid;
    gap: 0.9rem;
}

.line-card {
    display: grid;
    gap: 0.55rem;
    padding: 1rem;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
}

.line-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.totals-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.totals-bar div {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.3rem;
}

.chart-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.85rem 0.7rem;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--primary);
}

.diagnostics-shell {
    width: min(1120px, 100%);
    display: grid;
    gap: 1rem;
}

.diagnostics-header {
    display: grid;
    gap: 1rem;
}

.diagnostics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.diagnostic-card {
    display: grid;
    gap: 1rem;
}

.diagnostic-title {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.diagnostic-box {
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    display: grid;
    gap: 0.7rem;
}

.diagnostic-kv {
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.diagnostic-kv div {
    display: grid;
    gap: 0.14rem;
}

.diagnostic-kv dt {
    color: var(--muted);
    font-size: 0.86rem;
}

.diagnostic-kv dd {
    margin: 0;
    word-break: break-word;
}

.diagnostic-kv-wide {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.diagnostic-log {
    margin: 0;
    padding: 0.85rem;
    border-radius: 12px;
    background: #10233f;
    color: #d5e4ff;
    white-space: pre-wrap;
    word-break: break-word;
}

.status-ok {
    color: var(--success);
}

.status-error {
    color: var(--danger);
}

@media (max-width: 900px) {
    .android-form,
    .detail-grid,
    .detail-split,
    .anagrafica-inline-fields,
    .line-fields,
    .totals-bar,
    .anagrafica-detail-grid {
        grid-template-columns: 1fr;
    }

    .span-2,
    .grow {
        grid-column: auto;
    }

    .android-list-header,
    .page-header,
    .diagnostic-title,
    .anagrafica-edit-header,
    .anagrafica-edit-actions,
    .login-actions,
    .form-actions,
    .actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 760px) {
    .anagrafica-detail-actions {
        flex-direction: row;
        align-items: stretch;
        gap: 0.75rem;
    }
}

@media (max-width: 640px) {
    .main-shell {
        padding: 0.85rem;
    }

    .main-shell-anagrafiche {
        padding: 0;
    }

    .main-shell-prodotti {
        padding: 0;
    }

    .topbar {
        padding: 0 0.85rem;
    }

    .home-screen {
        margin: -0.85rem;
    }

    .home-hero {
        min-height: 250px;
        grid-template-rows: 1fr auto auto;
    }

    .home-hero-top img {
        width: min(210px, 66vw);
    }

    .home-hero-middle p {
        font-size: 1.25rem;
    }

    .home-module-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-module {
        min-height: 132px;
        padding: 0.85rem 0.2rem 0.65rem;
    }

    .home-module-icon {
        width: 64px;
        height: 64px;
    }

    .home-module-icon svg {
        width: 48px;
        height: 48px;
    }

    .home-module-label {
        font-size: 0.84rem;
    }

    .android-searchbar {
        grid-template-columns: 1fr;
    }

    .android-searchbar-anagrafiche,
    .android-searchbar-prodotti {
        padding: 0 0.45rem;
    }

    .android-list-row,
    .result-card {
        padding: 0.9rem 1rem;
    }

    .anagrafica-hero {
        grid-template-columns: 1fr;
        padding: 1rem 1rem 1.05rem;
    }

    .anagrafica-hero-badge {
        width: 54px;
        height: 54px;
    }

    .anagrafica-detail-screen {
        padding: 0;
    }

    .anagrafica-detail-body {
        max-width: none;
    }

    .anagrafica-detail-scroll {
        padding: 0.78rem 0.78rem 0.7rem;
    }

    .anagrafica-detail-actions-wrap {
        padding: 0.12rem 0.78rem calc(1.05rem + env(safe-area-inset-bottom, 0px));
    }

    .android-list-row-anagrafiche,
    .android-list-row-prodotti {
        padding: 0.9rem 0.82rem;
        min-height: 0;
    }

    .android-list-anagrafiche,
    .android-list-prodotti {
        padding: 0.85rem 0.72rem 0.35rem;
    }

    .android-list-avatar {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        border-radius: 999px;
        font-size: 0.88rem;
    }

    .android-list-code-badge {
        font-size: 0.7rem;
    }

    .android-list-support-row {
        gap: 0.34rem 0.45rem;
    }

    .android-list-meta-line {
        font-size: 0.74rem;
    }

    .android-bottom-bar-inner {
        min-height: 80px;
        grid-template-columns: 60px 1fr 60px;
        padding: 0 0.95rem;
    }

    .android-bottom-bar-center {
        font-size: 0.92rem;
    }

    .android-bottom-bar-products-actions {
        min-height: 64px;
        padding: 0 0.95rem;
    }

    .android-bottom-bar-products-meta {
        font-size: 0.88rem;
        min-height: 20px;
        margin-bottom: -0.02rem;
        transform: translateY(1px);
    }

    .android-bottom-bar-side.align-start {
        padding-left: 0.4rem;
    }

    .android-bottom-bar-side.align-end {
        padding-right: 0.4rem;
    }

    .android-bottom-bar-action {
        width: 56px;
        height: 56px;
    }

    .android-bottom-bar-action svg {
        width: 37px;
        height: 37px;
    }
}
