* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Tahoma, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: #0f172a;
    color: white;
    padding: 25px 18px;
}

.sidebar h2 {
    margin-top: 0;
    text-align: center;
    color: #38bdf8;
}

.sidebar a {
    display: block;
    color: #cbd5e1;
    text-decoration: none;
    padding: 13px;
    border-radius: 8px;
    margin: 8px 0;
}

.sidebar a:hover {
    background: #1e293b;
    color: white;
}

.main {
    margin-left: 240px;
    padding: 30px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.topbar h1 {
    margin: 0;
}

.btn {
    border: 0;
    padding: 10px 16px;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
}

.btn-primary {
    background: #0284c7;
    color: white;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 25px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px #0000000d;
}

.card small {
    color: #64748b;
}

.card strong {
    display: block;
    font-size: 28px;
    margin-top: 8px;
}

.panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px #0000000d;
}

.search {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
}

textarea {
    min-height: 80px;
}

.search input {
    max-width: 400px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
}

th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

th {
    background: #f8fafc;
}

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

.status {
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 12px;
    color: white;
}

.ใช้งาน {
    background: #16a34a;
}

.สำรอง {
    background: #2563eb;
}

.ซ่อม {
    background: #f59e0b;
}

.จำหน่าย {
    background: #64748b;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 14px;
}

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

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

@media (max-width: 1000px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 700px) {
    .sidebar {
        position: static;
        width: 100%;
    }

    .main {
        margin-left: 0;
        padding: 15px;
    }

    .cards,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        display: block;
    }

    .topbar .btn {
        margin-top: 15px;
    }
}
