/**
 * OmniPresence — stile allineato alle schermate di riferimento
 */

:root {
    --sidebar-bg: #0a0b14;
    --sidebar-text: #e2e8f0;
    --sidebar-muted: #64748b;
    --accent: #3b82f6;
    --accent-soft: #60a5fa;
    --page-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --font: "Inter", system-ui, -apple-system, sans-serif;
}

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

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    color: var(--text);
    background: var(--page-bg);
    overflow-x: hidden;
}

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

[hidden] {
    display: none !important;
}

/* Shell */
.shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem 1rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    padding: 0 0.25rem;
}

.sidebar-close,
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: inherit;
    background: transparent;
}

.sidebar-backdrop {
    display: none;
}

.main-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}

.main-topbar .btn {
    flex-shrink: 0;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-title {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
}

.sidebar-sub {
    font-size: 0.68rem;
    color: var(--accent-soft);
    margin-top: 0.15rem;
    letter-spacing: 0.02em;
}

.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-muted);
    margin: 1rem 0 0.5rem 0.5rem;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sidebar-text);
    opacity: 0.88;
    transition: background 0.15s, opacity 0.15s;
}

a.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    opacity: 1;
}

.nav-item.is-active {
    background: var(--accent);
    opacity: 1;
    color: #fff;
}

.nav-ico {
    display: flex;
    opacity: 0.9;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user-ico {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user--kiosk .sidebar-user-ico--blue {
    background: rgba(59, 130, 246, 0.25);
    color: var(--accent-soft);
}

.sidebar-user-txt {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    background: var(--card-bg);
    border-bottom: 1px solid #e2e8f0;
    gap: 0.75rem;
}

.main--kiosk .main-topbar {
    background: transparent;
    border-bottom: none;
    padding-bottom: 0.5rem;
}

.main-topbar-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
    min-width: 0;
}

.main-inner {
    padding: 1.5rem 2rem 2rem;
    flex: 1;
}

.main-inner--kiosk {
    padding-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-logout {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-logout:hover {
    background: #fee2e2;
}

.btn-admin-lock {
    background: var(--sidebar-bg);
    color: #fff;
}

.btn-admin-lock:hover {
    filter: brightness(1.1);
}

.btn-primary {
    background: var(--sidebar-bg);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
}

.btn-add {
    background: #0f172a;
    color: #fff;
    padding: 0.6rem 1.1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-add:hover {
    background: #1e293b;
}

/* Page section header (RISORSE UMANE row) */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* Cards grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1.25rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 1.25rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-card-ico {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-ico--blue {
    background: #dbeafe;
    color: #2563eb;
}

.stat-card-ico--green {
    background: #dcfce7;
    color: #16a34a;
}

.stat-card-ico--orange {
    background: #ffedd5;
    color: #ea580c;
}

.stat-card-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.25rem;
    line-height: 1;
}

.panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel:has(> .panel-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.panel-table {
    width: 100%;
    min-width: 36rem;
    border-collapse: collapse;
}

.panel-table--fit {
    min-width: 0;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
}

.panel-table th {
    text-align: left;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.panel-table td {
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #f8fafc;
    word-break: break-word;
}

.panel-table tr:last-child td {
    border-bottom: none;
}

.panel-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* HR / Location cards */
.info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem 1.3rem 1.35rem;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.info-card-actions {
    position: absolute;
    top: 0.95rem;
    right: 0.95rem;
    display: flex;
    gap: 0.3rem;
    z-index: 2;
}

.info-card-top {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.35rem;
    min-width: 0;
    padding-right: 7.5rem;
}

.info-card-text {
    flex: 1 1 auto;
    min-width: 0;
}

.emp-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.emp-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    overflow: hidden;
    background: #eff6ff;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.emp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.emp-avatar-wrap .med-dot {
    position: absolute;
    right: 1px;
    bottom: 1px;
    box-shadow: 0 0 0 2px #fff;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: #e2e8f0;
    color: var(--accent);
}

.info-card-name {
    margin: 0 0 0.2rem;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.015em;
    text-transform: uppercase;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

.tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #2563eb;
}

.info-card-meta {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.pin-box {
    margin-top: 0.85rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.pin-box > span:first-child {
    display: block;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    margin-bottom: 0.25rem;
}

.role-line {
    font-size: 0.74rem;
    color: var(--accent);
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.info-card .loc-line {
    margin: 0.2rem 0 0;
    line-height: 1.3;
}

/* Locations: keep actions in the top row flow */
.info-card:has(> .info-card-top > .info-card-actions) .info-card-actions {
    position: static;
}

.info-card:has(> .info-card-top > .info-card-actions) .info-card-top {
    justify-content: space-between;
    padding-right: 0;
}

/* Settings form */
.settings-card {
    max-width: 520px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row > .form-group {
    flex: 1 1 200px;
    min-width: 0;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
}

.settings-card h2 {
    margin: 0 0 1.25rem;
    font-size: 1rem;
}

/* Login */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-card p {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.login-error {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Kiosk terminal */
.kiosk-terminal {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    min-height: min(70vh, 620px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--card-bg);
    width: 100%;
}

.kiosk-qr-reader video,
.kiosk-qr-reader canvas,
.kiosk-qr-reader img {
    max-width: 100% !important;
}

.kiosk-left {
    background: linear-gradient(180deg, #0f172a 0%, #0a0b14 100%);
    color: #fff;
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kiosk-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    width: fit-content;
}

.kiosk-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
}

.kiosk-hero-line1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    line-height: 1.1;
}

.kiosk-hero-line2 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.kiosk-gps {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    overflow-wrap: anywhere;
}

.kiosk-gps > svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.kiosk-gps-copy {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.kiosk-gps-site {
    font-size: 0.88rem;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.25;
}

.kiosk-gps-site[hidden] {
    display: none !important;
}

.kiosk-cam-warn {
    margin: 0.75rem 0 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #fcd34d;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-sm);
}

.kiosk-cam-warn code {
    font-size: 0.68rem;
    color: #fde68a;
}

.kiosk-right {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8fafc;
    min-width: 0;
}

.kiosk-camera {
    flex: 1;
    min-height: 280px;
    background: #e2e8f0;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 0.5rem;
}

.kiosk-camera-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    min-height: 240px;
}

.kiosk-qr-reader {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    max-height: min(52vh, 440px);
    max-width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

#qr-reader,
#qr-reader__scan_region,
#qr-reader__dashboard {
    width: 100% !important;
    max-width: 100%;
}

#qr-reader video,
#qr-reader canvas,
#qr-reader img,
#qr-reader__scan_region,
#qr-reader__scan_region * {
    pointer-events: none !important;
}

#qr-reader video {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 200px;
    background: #0f172a;
    object-fit: contain;
    display: block;
}

#qr-reader canvas,
#qr-reader img {
    max-width: 100% !important;
}

#qr-reader__dashboard,
#qr-reader__dashboard_section,
#qr-reader__header_message {
    display: none !important;
}

.kiosk-qr-reader[hidden] {
    display: none !important;
}

.kiosk-cam-actions {
    position: relative;
    z-index: 40;
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin: 0.45rem 0 0;
    padding: 0.15rem 0.1rem calc(0.15rem + env(safe-area-inset-bottom, 0px));
    pointer-events: auto;
}

.kiosk-cam-actions[hidden] {
    display: none !important;
}

.kiosk-cam-actions .btn {
    pointer-events: auto;
    touch-action: manipulation;
    min-height: 44px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.28);
}

.kiosk-btn-switchcam {
    background: #0f172a;
    color: #fff;
    gap: 0.35rem;
}

.kiosk-btn-stopcam {
    margin-left: auto;
}

.kiosk-punch-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.kiosk-punch-btn {
    padding: 1.1rem 0.6rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    color: #fff;
    white-space: normal;
    line-height: 1.25;
    min-height: 3.25rem;
}

.kiosk-punch-btn--in {
    background: linear-gradient(145deg, #334155, #1e293b);
}

.kiosk-punch-btn--out {
    background: linear-gradient(145deg, #475569, #334155);
}

.kiosk-punch-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.kiosk-msg {
    font-size: 0.85rem;
    min-height: 1.25rem;
    color: #64748b;
}

.kiosk-msg--ok {
    color: #16a34a;
}

.kiosk-msg--err {
    color: var(--danger);
}

/* Pagina QR sede (admin/location_qr.php) */
.qr-page-body {
    margin: 0;
    min-height: 100vh;
    background: var(--page-bg);
    font-family: var(--font);
}

.qr-page {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.qr-page-back {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
}

.qr-page-back a {
    color: var(--accent);
    font-weight: 600;
}

.qr-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem 1.5rem 2rem;
    text-align: center;
}

.qr-page-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.qr-page-sub {
    margin: 0.35rem 0 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
}

.qr-frame {
    display: inline-block;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    line-height: 0;
}

.qr-frame img {
    display: block;
    width: 320px;
    height: 320px;
    max-width: 100%;
    height: auto;
}

.qr-hint {
    margin: 1.25rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
    text-align: left;
}

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.qr-payload-details {
    margin-top: 1.75rem;
    text-align: left;
    font-size: 0.8rem;
    color: #64748b;
}

.qr-payload-pre {
    margin: 0.5rem 0 0;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    overflow-x: auto;
    word-break: break-all;
}

@media print {
    .qr-page-back,
    .qr-actions,
    .qr-payload-details {
        display: none !important;
    }
    .qr-page {
        padding: 1rem;
    }
}

/* --- v3.1 Definitiva --- */
.kiosk-punch-row--4 { grid-template-columns: 1fr 1fr; }
.kiosk-punch-btn--break { background: linear-gradient(145deg, #f59e0b, #d97706); }
.kiosk-punch-btn--break-end { background: linear-gradient(145deg, #3b82f6, #2563eb); }
.kiosk-badge--active { color: #34d399; }
.kiosk-timer { font-family: ui-monospace, monospace; font-size: 1.25rem; color: #34d399; margin: 1rem 0; }
.kiosk-timer-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; margin-left: 0.5rem; color: #6ee7b7; }
.kiosk-facility { font-size: 0.75rem; font-weight: 700; color: #a5b4fc; margin-bottom: 0.75rem; }
.kiosk-pin-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,0.85); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.kiosk-pin-overlay[hidden] { display: none !important; }
.kiosk-pin-modal { background: #fff; border-radius: 1.25rem; padding: 2rem; width: 100%; max-width: 22rem; }
.kiosk-pin-modal h3 { margin: 0 0 1rem; text-align: center; text-transform: uppercase; font-size: 0.85rem; }
.kiosk-pin-modal input { width: 100%; text-align: center; font-size: 1.5rem; letter-spacing: 0.35em; padding: 0.75rem; border-radius: 0.75rem; border: 2px solid #e2e8f0; }
.kiosk-pin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.manual-page { max-width: 48rem; }
.manual-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.manual-version { color: var(--text-muted); font-size: 0.85rem; }
.manual-section { background: var(--card-bg); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.manual-section h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.trace-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; align-items: center; }
.trace-filters input,
.trace-filters select {
    min-width: 0;
    flex: 1 1 10rem;
    max-width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    background: #fff;
}
.trace-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; overflow: hidden; }
.trace-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; background: #312e81; color: #fff; }
.trace-card-head h3 { margin: 0; flex: 1; font-size: 0.95rem; text-transform: uppercase; }
.trace-count { font-size: 0.8rem; font-weight: 700; }
.trace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1rem; }
@media (max-width: 800px) { .trace-grid { grid-template-columns: 1fr; } }
.trace-present-list { list-style: none; margin: 0; padding: 0; }
.trace-present-list li { padding: 0.5rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; }
.employee-map { height: min(70vh, 560px); min-height: 420px; border-radius: var(--radius); border: 1px solid #e2e8f0; z-index: 1; }
.map-page { display: flex; flex-direction: column; gap: 1rem; min-height: min(75vh, 680px); }
.map-page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; background: var(--card-bg); padding: 1.25rem 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #e2e8f0; }
.map-page-title { margin: 0; font-size: 1.1rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.map-page-sub { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--text-muted); font-weight: 600; max-width: 36rem; }
.map-page-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.map-filter-field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1 1 10rem; min-width: 0; }
.map-filter-field label { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; }
.map-filter-field input, .map-filter-field select { padding: 0.55rem 0.75rem; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.85rem; font-weight: 600; min-width: 0; width: 100%; background: #f8fafc; }
.map-stats { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; color: #475569; }
.map-stat strong { color: #0f172a; }
.map-stat--info { color: var(--accent); font-weight: 700; }
.map-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; }
.map-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.omni-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-shell { position: relative; flex: 1; background: var(--card-bg); border-radius: var(--radius); border: 1px solid #e2e8f0; box-shadow: var(--shadow); overflow: hidden; min-height: 420px; }
.map-loading, .map-empty { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(248,250,252,0.92); text-align: center; padding: 2rem; }
.map-loading[hidden], .map-empty[hidden] { display: none !important; }
.map-loading p, .map-empty p { margin: 0.75rem 0 0; font-weight: 700; color: #475569; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.08em; }
.map-empty small { display: block; margin-top: 0.5rem; max-width: 28rem; color: var(--text-muted); font-size: 0.8rem; line-height: 1.45; text-transform: none; font-weight: 500; }
.map-loading-spinner { width: 2.5rem; height: 2.5rem; border: 3px solid #e2e8f0; border-top-color: var(--accent); border-radius: 50%; animation: omni-spin 0.8s linear infinite; }
@keyframes omni-spin { to { transform: rotate(360deg); } }
.omni-map-marker-wrap { background: transparent; border: none; }
.omni-map-marker { display: block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(15,23,42,0.35); }
.omni-map-facility { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: #4338ca; color: #fff; font-size: 14px; font-weight: 800; border: 3px solid #fff; box-shadow: 0 2px 10px rgba(67,56,202,0.45); }
.omni-legend-facility { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: #4338ca; vertical-align: middle; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.info-card-geo { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.info-card-geo small { color: var(--text-muted); font-size: 0.7rem; }
.tag--ok { background: #dcfce7; color: #166534; }
.tag--warn { background: #fef3c7; color: #92400e; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.72rem; }
.leaflet-container { font-family: var(--font); border-radius: var(--radius); }
.report-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.report-tab { padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; background: #e2e8f0; color: #475569; }
.report-tab.is-active { background: #fff; color: var(--accent); box-shadow: var(--shadow); }
.med-alert-panel { background: #fff; border: 1px solid #fecaca; border-radius: var(--radius); padding: 1.25rem; margin-top: 1.5rem; box-shadow: var(--shadow); }
.med-alert-panel h2 { margin: 0 0 0.25rem; font-size: 1rem; }
.med-alert-sub { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 1rem; }
.med-alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.med-alert-card { padding: 0.75rem 1rem; border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 0.35rem; }
.med-alert-card--danger { background: #fef2f2; border: 1px solid #fecaca; }
.med-alert-card--warn { background: #fffbeb; border: 1px solid #fde68a; }
.med-badge { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; padding: 0.2rem 0.5rem; border-radius: 6px; display: inline-block; width: fit-content; }
.med-expired { background: #fee2e2; color: #b91c1c; }
.med-expiring { background: #fef3c7; color: #b45309; }
.med-valid { background: #d1fae5; color: #047857; }
.med-missing { background: #f1f5f9; color: #64748b; }

/* Forms admin v3.1 */
.flash { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.875rem; font-weight: 600; }
.flash--success { background: #dcfce7; color: #166534; }
.flash--error { background: #fee2e2; color: #b91c1c; }
.form-panel { padding: 1.5rem; margin-bottom: 1.5rem; overflow: visible; }
.panel.form-panel { overflow: visible; }
.hr-form { min-width: 0; max-width: 100%; }
.form-panel h3 { margin: 0 0 1rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; }
.hr-form fieldset, .form-panel fieldset { border: 1px solid #e2e8f0; border-radius: var(--radius-sm); padding: 1rem; margin: 0 0 1rem; min-width: 0; max-width: 100%; overflow: visible; }
.hr-form legend, .form-panel legend { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted); padding: 0 0.25rem; }
.form-panel input, .form-panel select, .form-panel textarea { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.9rem; }
.form-panel input[type="checkbox"],
.form-panel input[type="radio"] { width: auto; padding: 0; }
.form-panel select { background: #fff; }
.staff-anag-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem 1.5rem;
    align-items: start;
}
.staff-photo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    max-width: 220px;
}
.staff-photo-preview {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    overflow: hidden;
    background: #eff6ff;
    color: #2563eb;
    border: 3px solid #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 800;
}
.staff-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.staff-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.staff-photo-actions .btn {
    background: #f1f5f9;
    color: #334155;
    font-size: 0.78rem;
    padding: 0.45rem 0.7rem;
}
.staff-photo-actions .btn-primary {
    background: var(--sidebar-bg);
    color: #fff;
}
.staff-photo-remove {
    color: var(--danger) !important;
    background: var(--danger-bg) !important;
}
.staff-photo-hint {
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.staff-photo-hidden-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0 !important;
}
.staff-cam-overlay {
    position: fixed;
    inset: 0;
    z-index: 240;
    background: rgba(15, 23, 42, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.staff-cam-overlay[hidden] { display: none !important; }
.staff-cam-modal {
    background: #fff;
    border-radius: 1.15rem;
    padding: 1.25rem;
    width: min(420px, 100%);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
}
.staff-cam-modal h4 {
    margin: 0 0 0.85rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.staff-cam-frame {
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}
.staff-cam-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.staff-cam-frame video.is-mirrored {
    transform: scaleX(-1);
}
.staff-cam-error {
    margin: 0.7rem 0 0;
    color: #b91c1c;
    font-size: 0.8rem;
    font-weight: 600;
}
.staff-cam-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}
.staff-cam-actions .btn {
    background: #f1f5f9;
    color: #334155;
}
.staff-cam-actions .btn-primary {
    background: var(--sidebar-bg);
    color: #fff;
    margin-left: auto;
}
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.page-head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.inline-form { display: inline; }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; font-size: 0.8rem; padding: 0 0.25rem; }
.link-btn--danger { color: var(--danger); }
.row-actions { white-space: nowrap; }
.text-in { color: #16a34a; font-weight: 700; }
.text-out { color: #dc2626; font-weight: 700; }
.status-pill { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; padding: 0.2rem 0.5rem; border-radius: 6px; background: #f1f5f9; }
.status-pill--pending { background: #fef3c7; color: #b45309; }
.status-pill--approved { background: #dcfce7; color: #166534; }
.status-pill--rejected { background: #fee2e2; color: #b91c1c; }
.modal-banner { padding: 1rem 1.25rem; border-radius: var(--radius-sm); margin-bottom: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.modal-banner--ok { background: #dcfce7; color: #166534; }
.loc-line { font-size: 0.75rem; color: #64748b; margin: 0.25rem 0; }
.med-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-red { background: #ef4444; }
.dot-amber { background: #f59e0b; }
.dot-green { background: #22c55e; }
.dot-slate { background: #94a3b8; }
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.45rem 0.12rem 0.28rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: fit-content;
    line-height: 1.2;
}
.status-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    line-height: 1.4;
}
.checkbox-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0.15rem 0 0;
}
.checkbox-label span {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.report-hours-note {
    margin: 0 0 1.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.settings-stack { display: flex; flex-direction: column; gap: 1.25rem; }
.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .backup-grid { grid-template-columns: 1fr; } }
.causali-add { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.causali-add input { flex: 1; }
.causali-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.causale-chip { display: flex; align-items: center; gap: 0.35rem; background: #f1f5f9; padding: 0.35rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.chip-del { background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 1rem; line-height: 1; }
.panel--warn { border: 2px solid #fed7aa; background: #fffbeb; }
.confirm-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.75rem; }

/* Assistente AI */
.assistant-wrap { display: flex; flex-direction: column; gap: 1rem; max-width: 820px; }
.assistant-intro p { margin: 0 0 0.75rem; color: #475569; font-size: 0.95rem; line-height: 1.5; }
.assistant-hints { margin: 0; padding-left: 1.25rem; color: #64748b; font-size: 0.875rem; line-height: 1.6; }
.assistant-mode-note { margin: 0.75rem 0 0; font-size: 0.8rem; color: #94a3b8; }
.assistant-mode-note--ok { color: #166534; }
.assistant-mode-note--warn { color: #b45309; }
.assistant-mode-note a { color: inherit; text-decoration: underline; }
.assistant-chat {
    min-height: 320px;
    max-height: 52vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}
.assistant-msg { max-width: 92%; }
.assistant-msg--user { align-self: flex-end; }
.assistant-msg--bot { align-self: flex-start; }
.assistant-msg-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.assistant-msg--user .assistant-msg-label { text-align: right; }
.assistant-msg-body {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
}
.assistant-msg--user .assistant-msg-body {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.assistant-msg--bot .assistant-msg-body {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.assistant-compose { margin-top: 0.25rem; }
.assistant-input-row { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.assistant-input {
    flex: 1 1 12rem;
    min-width: 0;
    min-height: 48px;
    resize: vertical;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-family: var(--font);
    font-size: 0.95rem;
}
.assistant-input:focus { outline: 2px solid rgba(59, 130, 246, 0.35); border-color: var(--accent); }
.assistant-mic {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.assistant-mic:hover { border-color: var(--accent); color: var(--accent); }
.assistant-mic.is-listening {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
    animation: assistant-pulse 1.2s ease-in-out infinite;
}
.assistant-mic:disabled { opacity: 0.45; cursor: not-allowed; }
.assistant-send { min-height: 48px; flex-shrink: 0; }
.assistant-status { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--text-muted); }
@keyframes assistant-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* Dashboard — assistente vocale */
.dashboard-assistant { margin-top: 1.25rem; }
.dashboard-assistant-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.dashboard-assistant-title {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
}
.dashboard-assistant-sub {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
}
.dashboard-assistant-mic {
    width: auto;
    min-height: 52px;
    padding: 0 1.1rem;
    gap: 0.5rem;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}
.dashboard-assistant-mic:hover {
    color: #fff;
    filter: brightness(1.05);
}
.dashboard-assistant-mic.is-listening {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #ef4444;
}
.dashboard-assistant-mic-label { line-height: 1; }
.dashboard-assistant-chat {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
}

body.nav-open {
    overflow: hidden;
}

.sidebar-brand > div:nth-child(2) {
    min-width: 0;
    flex: 1;
}

/* Tablet (10/11") e mobile — cassetto, padding, form e tabelle */
@media (max-width: 1279px) {
    .nav-toggle,
    .sidebar-close {
        display: inline-flex;
    }

    .nav-toggle {
        background: #f1f5f9;
        color: #0f172a;
        border: 1px solid #e2e8f0;
    }

    .sidebar-close {
        background: rgba(255, 255, 255, 0.08);
        color: #e2e8f0;
        margin-left: auto;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 88vw);
        z-index: 120;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-top: max(1.25rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        box-shadow: none;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(15, 23, 42, 0.28);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 110;
        background: rgba(15, 23, 42, 0.5);
        border: none;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }

    .sidebar-backdrop[hidden] {
        display: none !important;
    }

    .sidebar-footer {
        margin-top: auto;
        width: auto;
    }

    .main-topbar {
        padding: 0.75rem 1rem;
        padding-top: max(0.75rem, env(safe-area-inset-top));
        padding-right: max(1rem, env(safe-area-inset-right));
        position: sticky;
        top: 0;
        z-index: 40;
    }

    .main-topbar-title {
        font-size: 1.05rem;
        letter-spacing: 0.03em;
    }

    .main-inner {
        padding: 1rem 1rem 1.5rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .form-row > .form-group {
        flex-basis: calc(50% - 0.5rem);
    }

    .form-row > .form-group:last-child:nth-child(odd) {
        flex-basis: 100%;
    }

    .map-page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .map-page-filters {
        width: 100%;
    }

    .backup-grid,
    .trace-grid {
        grid-template-columns: 1fr;
    }

    .employee-map {
        height: min(62vh, 520px);
        min-height: 320px;
    }

    .map-shell {
        min-height: 320px;
    }

    .panel-table th,
    .panel-table td {
        padding: 0.85rem 1rem;
    }

    .info-card-top {
        gap: 0.75rem;
    }

    .page-head {
        align-items: flex-start;
    }
}

@media (max-width: 900px) {
    .kiosk-terminal {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .kiosk-left {
        padding: 1.25rem 1.35rem;
    }

    .kiosk-hero {
        flex: 0 0 auto;
        padding: 0.85rem 0;
    }

    .kiosk-camera {
        min-height: 240px;
    }

    .kiosk-qr-reader {
        max-height: min(42vh, 320px);
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .kiosk-qr-reader {
        max-height: min(48vh, 220px);
    }

    .kiosk-cam-actions .btn {
        min-height: 40px;
        padding: 0.45rem 0.75rem;
    }
}

@media (max-width: 767px) {
    .form-row > .form-group,
    .form-row > .form-group:last-child:nth-child(odd) {
        flex-basis: 100%;
    }

    .staff-anag-grid {
        grid-template-columns: 1fr;
    }

    .staff-photo {
        max-width: none;
        align-items: center;
        text-align: center;
    }

    .staff-photo-actions {
        justify-content: center;
    }

    .staff-photo-hint {
        text-align: center;
    }

    .kiosk-punch-row,
    .kiosk-punch-row--4 {
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
    }

    .kiosk-punch-btn {
        font-size: 0.72rem;
        letter-spacing: 0.04em;
        padding: 0.9rem 0.4rem;
    }

    .stat-card {
        padding: 1.1rem 1.15rem;
    }

    .stat-card-value {
        font-size: 1.65rem;
    }

    .login-wrap {
        padding: 1.25rem;
        align-items: flex-start;
        padding-top: 2.5rem;
    }

    .login-card {
        padding: 1.5rem 1.25rem;
    }

    .qr-page {
        padding: 1.25rem 1rem 2rem;
    }

    .qr-frame img {
        width: min(320px, 100%);
    }

    .assistant-wrap {
        max-width: none;
    }

    .dashboard-assistant-mic {
        width: 100%;
        justify-content: center;
    }

    .causali-add input {
        flex: 1 1 100%;
    }

    .trace-filters .btn,
    .map-page-filters .btn {
        width: 100%;
        justify-content: center;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-panel input,
    .form-panel select,
    .form-panel textarea,
    .assistant-input,
    .map-filter-field input,
    .map-filter-field select,
    .trace-filters input,
    .trace-filters select,
    .login-card input {
        font-size: 16px;
    }

    .panel-table--fit th,
    .panel-table--fit td {
        padding: 0.65rem 0.5rem;
        font-size: 0.8rem;
    }

    .table-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
}

@media (max-width: 479px) {
    .btn-text {
        display: none;
    }

    .main-topbar-title {
        font-size: 0.95rem;
    }

    .kiosk-hero-line1,
    .kiosk-hero-line2 {
        font-size: 1.75rem;
    }

    .panel-table {
        min-width: 32rem;
    }

    .panel-table--fit {
        min-width: 0;
    }

    .table-col-optional {
        display: none;
    }
}

@media (hover: none) and (pointer: coarse) {
    .nav-item,
    .btn,
    .icon-btn,
    .kiosk-punch-btn,
    .report-tab {
        min-height: 44px;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
    }
}
