:root{
    --bg:#0f1722;
    --bg-soft:#162131;
    --panel:#ffffff;
    --panel-soft:#f4f6f8;
    --line:#d8dee5;
    --text:#13202c;
    --muted:#64748b;
    --accent:#c89b4b;
    --accent-dark:#9e7532;
    --danger:#b42318;
    --warning:#b7791f;
    --success:#18794e;
    --shadow:0 18px 40px rgba(7,16,27,.12);
    --radius:18px;
}

/* RESET */
*{box-sizing:border-box}
html,body{
    margin:0;
    padding:0;
    font-family:Inter,Segoe UI,Arial,sans-serif;
    background:#eef2f5;
    color:var(--text)
}

a{color:inherit;text-decoration:none}
body{min-height:100vh}

/* LAYOUT */
.layout{
    display:grid;
    grid-template-columns:280px 1fr;
    min-height:100vh
}

.content{
    padding:32px
}

/* SIDEBAR */
.sidebar{
    background:linear-gradient(180deg,var(--bg),#182332 70%,#1f2c3d);
    color:#fff;
    padding:28px 22px;
    display:flex;
    flex-direction:column;
    gap:24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand{
    display:flex;
    align-items:center;
    gap:14px;
    padding-bottom:10px;
    border-bottom:1px solid rgba(255,255,255,.08)
}

.brand-mark{
    width:52px;
    height:52px;
    border-radius:14px;
    background:linear-gradient(135deg,var(--accent),#e3c17e);
    color:#1a1d22;
    display:grid;
    place-items:center;
    font-weight:800;
}

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

.nav a{
    padding:14px 16px;
    border-radius:14px;
    color:rgba(255,255,255,.88);
    transition:.2s;
}

.nav a:hover,
.nav a.active{
    background:rgba(255,255,255,.08);
    transform:translateX(2px)
}

.sidebar-footer{
    margin-top:auto;
    color:rgba(255,255,255,.7);
    font-size:.95rem
}

/* HEADERS */
.topbar{
    display:flex;
    justify-content:space-between;
    margin-bottom:24px
}

h1,h2,h3{margin:0 0 10px}
.muted{color:var(--muted)}

/* CARDS */
.card{
    background:var(--panel);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    padding:24px;
    margin-bottom:24px;
}

.card-soft{background:var(--panel-soft)}
.compact-card{padding:18px}

/* BUTTONS */
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:12px 18px;
    border-radius:14px;
    border:none;
    font-weight:700;
    cursor:pointer;
    line-height:1.2;
}

.btn-primary{
    background:linear-gradient(135deg,var(--accent),#dfbf7b);
    color:#221d15
}

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

.btn-danger{
    background:var(--danger);
    color:#fff
}

/* TABLE */
.table-wrap{overflow:auto}

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

th,td{
    padding:14px 12px;
    border-bottom:1px solid var(--line)
}

th{
    background:#f8fafc
}

/* BADGES */
.badge{
    display:inline-block;
    padding:6px 10px;
    border-radius:999px;
    font-size:.85rem;
    font-weight:700
}

.badge-success{background:#dcfce7;color:#166534}
.badge-warning{background:#fef3c7;color:#92400e}
.badge-danger{background:#fee2e2;color:#991b1b}

/* FORMS */
input,select,textarea{
    width:100%;
    padding:12px;
    border-radius:14px;
    border:1px solid #cad5e2;
    font:inherit;
}

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

/* FILTER */
.filter-grid{
    display:grid;
    grid-template-columns:2fr 1fr 1fr 1fr auto;
    gap:14px;
}

.filter-actions{
    display:flex;
    gap:10px;
    align-items:end;
    flex-wrap:wrap;
}

/* GRID LAYOUT */
.grid-2{
    display:grid;
    grid-template-columns:1.2fr 1fr;
    gap:24px;
    align-items:start;
}

.info-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px;
}

.info-grid > div{
    padding:14px;
    border-radius:16px;
    background:#f8fafc;
    border:1px solid #e7edf3;
}

.form-row-full{
    grid-column:1 / -1;
}

.report-block strong{
    display:block;
    margin-bottom:10px;
}

.report-actions{
    margin-top:4px;
    margin-bottom:8px;
}

/* MACHINE FOTO */
.machine-photo{
    width:100%;
    max-width:100%;
    height:auto;
    max-height:400px;
    border-radius:20px;
    border:1px solid var(--line);
    display:block;
    object-fit:contain;
    background:#f5f7fa;
    box-shadow:var(--shadow);
    margin:0 auto;
}

/* QR */
.qr-block{
    display:grid;
    place-items:center;
    background:#f8fafc;
    border:1px solid #e7edf3;
    border-radius:18px;
    padding:16px;
    min-height:100%;
}

.qr-image{
    width:220px;
    max-width:100%;
    height:auto;
    border-radius:14px;
    background:#fff;
    border:1px solid var(--line);
    padding:10px;
}

/* HELP */
.help{
    font-size:.92rem;
    color:var(--muted);
    margin-top:6px;
}

/* ACTIONS */
.actions,
.table-actions{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    align-items:center;
    margin-top:18px;
}

.section-head{
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:center;
    flex-wrap:wrap;
    margin-bottom:18px;
}

/* MOBILE */
.mobile-search{
    display:grid;
    grid-template-columns:1fr auto;
    gap:10px;
}

.mobile-result{
    background:#fff;
    border-radius:22px;
    padding:18px;
    box-shadow:var(--shadow);
}

.mobile-data{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
}

/* REPAIR FOTO */
.repair-photo-thumb{
    max-width:180px;
    border-radius:14px;
    border:1px solid var(--line);
    display:block;
}

/* ALERTS */
.alert{
    padding:14px 18px;
    border-radius:14px;
    margin-bottom:18px;
    font-weight:600;
}

.alert-success{
    background:#ecfdf3;
    color:#166534;
    border:1px solid #bbf7d0;
}

.alert-error{
    background:#fef2f2;
    color:#991b1b;
    border:1px solid #fecaca;
}

/* RESPONSIVE */
@media (max-width:1100px){
    .layout{
        grid-template-columns:1fr;
    }

    .sidebar{
        padding:20px;
    }

    .content{
        padding:20px;
    }

    .filter-grid{
        grid-template-columns:1fr;
    }

    .grid-2{
        grid-template-columns:1fr;
    }

    .info-grid{
        grid-template-columns:1fr;
    }

    .machine-photo{
        max-height:300px;
    }
}

@media (max-width:720px){
    .mobile-search{
        grid-template-columns:1fr;
    }

    .mobile-data{
        grid-template-columns:1fr;
    }

    .content{
        padding:14px;
    }

    .btn{
        width:100%;
    }

    .actions,
    .table-actions,
    .filter-actions{
        flex-direction:column;
        align-items:stretch;
    }
}
.machine-select-grid{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:12px;
    max-height:320px;
    overflow:auto;
    padding:12px;
    border:1px solid var(--line);
    border-radius:16px;
    background:#f8fafc;
}

.machine-select-item{
    display:flex;
    align-items:flex-start;
    gap:10px;
    padding:12px 14px;
    border:1px solid #dbe3ea;
    border-radius:14px;
    background:#fff;
    cursor:pointer;
    transition:.15s ease;
}

.machine-select-item:hover{
    border-color:#bfcbd8;
    box-shadow:0 4px 10px rgba(7,16,27,.06);
}

.machine-select-item input{
    width:auto;
    margin-top:3px;
    flex:0 0 auto;
}

.machine-select-text{
    line-height:1.35;
}

.machine-select-text strong{
    display:block;
    font-size:.98rem;
}

.machine-select-text span{
    color:var(--muted);
    font-size:.92rem;
}

@media (max-width: 900px){
    .machine-select-grid{
        grid-template-columns:1fr;
    }
}
.linked-machines-list{
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
    gap:12px;
    margin-top:10px;
}

.linked-machine-card{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border:1px solid var(--line);
    border-radius:16px;
    background:#f8fafc;
    text-decoration:none;
    transition:.15s ease;
}

.linked-machine-card:hover{
    transform:translateY(-1px);
    box-shadow:0 6px 14px rgba(7,16,27,.08);
    border-color:#c8d2dc;
}

.linked-machine-number{
    min-width:58px;
    height:44px;
    padding:0 12px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:12px;
    background:#ffffff;
    border:1px solid var(--line);
    font-weight:800;
}

.linked-machine-info{
    line-height:1.3;
}