body {
    margin:0;
    background:#0b0b0b;
    color:white;
    font-family:Arial;
}.header {
    position: relative;
    padding: 15px;
    background: #111;
    text-align: center;
}

.header::before,
.header::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: #00e5ff;
    border-style: solid;
}

/* angolo top-left */
.header::before {
    top: 6px;
    left: 6px;
    border-width: 2px 0 0 2px;
}

/* angolo top-right */
.header::after {
    top: 6px;
    right: 6px;
    border-width: 2px 2px 0 0;
}

.corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: #00e5ff;
    border-style: solid;
}

.bottom-left {
    bottom: 6px;
    left: 6px;
    border-width: 0 0 2px 2px;
}

.bottom-right {
    bottom: 6px;
    right: 6px;
    border-width: 0 2px 2px 0;
}

.container {
    padding:10px;
}

.card {
    background:#111;
    padding:15px;
    margin:0px;
    border-radius:10px;
}

.open-btn {
    background:#f1c40f;
    color:black;
    padding:15px 15px;
    text-decoration:none;
}

.new-btn {
    position:fixed;
    bottom:20px;
    left:50%;
    transform:translateX(-50%);
    background:#f1c40f;
    padding:15px;
    border:none;
}

.modal {
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.8);
    justify-content:center;
    align-items:center;
}

.modal-box {
    background:#111;
    padding:20px;
}

.actions {
    display:flex;
    flex-direction: row;
    gap: 10px;
    padding: 15px;
    flex-wrap: wrap;
}

.actions-row {

    right: 10px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    flex-wrap: nowrap; /* 🔥 FIX */
    justify-content: center;
    margin-top: 15px;
}

.action {
    background: #111;
    flex: 1;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    border: 1px solid #222;
    cursor: pointer;
}

.action .material-icons {
    font-size: 32px; /* era 25px, aumentato */
    color: #aaa;
}

.action:hover .material-icons {
    color: #00e5ff;
}

.action span:last-child {
    font-size: 15px;
    color: #888;
    margin-top: 4px;
}

.row {
    display:flex;
    justify-content:space-between;
}

.info {
    color:#f1c40f;
}

.dist {
    color:#00e5ff;
}

.back-btn {
    background:#f1c40f;
    padding:10px;
}

.modal-box.modern {
    width: 90%;
    max-width: 400px;
    background: #111;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field label {
    font-size: 12px;
    color: #888;
}

.field input,
.field select {
    width: 100%;
    padding: 10px;
    background: #0b0b0b;
    border: 1px solid #222;
    border-radius: 8px;
    color: white;
}

.field input:focus {
    border-color: #00e5ff;
    outline: none;
}


.btn-primary {
    background: #f1c40f;
    border: none;
    padding: 10px 20px;
    font-weight: bold;
    border-radius: 8px;
}

.btn-secondary {
    background: #222;
    border: none;
    padding: 10px 20px;
    color: #aaa;
    border-radius: 8px;
}
.modal-box h3 {
    margin-bottom: 15px;
    border-bottom: 1px solid #222;
    padding-bottom: 10px;
}

.icons {
    display: flex;
    gap: 10px;
}

.icon-btn {
    cursor: pointer;
    color: #aaa;
}

.icon-btn:hover {
    color: #00e5ff;
}

.kpi {
    text-align: center;
}

.kpi h2 {
    color: #00e5ff;
    margin: 5px 0;
}

.kpi-box {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.kpi-box span {
    color: #888;
    font-size: 12px;
}

canvas {
    background: #111;
    border-radius: 10px;
    margin: 20px 0;
}

.hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    color: #00e5ff;
    font-size: 14px;
    font-family: monospace;
    z-index: 10;
}

.hud b {
    color: #fff;
}

#hud_ai {
    color: red;
}
.loading {
    display: none;
    text-align: center;
    color: #f1c40f;
    margin-top: 10px;
    font-weight: bold;
}

.grid-row {
    display: grid;

    /* 🔥 CARD IN RIGA */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));

    gap: 10px;
}

.card.compact {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;

    padding: 10px;
    font-size: 15px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


.card.compact .nome {
    font-weight: bold;
    color: #00e5ff;
    margin-bottom: 5px;
}

.nome {
    font-size: 16px;
}
.card.compact .meta {
    color: #aaa;
    font-size: 14px;
}

.card.compact .actions {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.card.compact button {
    background: #222;
    border: none;
    padding: 4px 6px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}
.icon-btn.edit-btn:hover {
    background: #3498db;
    transform: scale(1.1);
}

.icon-btn.delete-btn:hover {
    background: #db3434;
    transform: scale(1.1);
}

.camera-box {
    width: 100%;
    max-width: 400px;
    margin: auto;
    position: relative;
    overflow: hidden;
}

.qr-wrapper {
    width: 100%;
    max-width: 400px;
    height: 300px;   /* 🔥 altezza fissa fondamentale */
    margin: auto;
    position: relative;
    overflow: hidden;
    background: black;
}

/* reader prende tutta l'area */#reader {
    position: relative;
    width: 100%;
    height: calc(100vh - 150px); /* 🔥 spazio per header + bottoni */
    overflow: hidden;
    background: black;
}

#reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain; /* 🔥 IMPORTANTISSIMO per QR */
    position: absolute !important;
    top: 0;
    left: 0;
}

#reader canvas {
    position: absolute !important;
    top: 0;
    left: 0;
}

#reader.scanned video {
    filter: brightness(1.2) contrast(1.2);
}

#reader.scanned::after {
    content: "✔ QR LETTO";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #00ff88;
    font-size: 24px;
    font-weight: bold;
    z-index: 20;
}
