* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
}

/* Topbar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 42px;
    background: #16163a;
    color: #fff;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 1.2rem;
    z-index: 1000;
    border-bottom: 1px solid #2a2a4a;
}

/* Hamburger */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    margin-right: 0.7rem;
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: #b0b0c0;
    border-radius: 1px;
    transition: background 0.15s;
}

.hamburger:hover span {
    background: #fff;
}

.topbar-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #b0b0c0;
}

.layout {
    display: flex;
    min-height: 100vh;
    padding-top: 42px;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 1rem 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 42px;
    height: calc(100vh - 42px);
    overflow-y: auto;
    transition: margin-left 0.25s ease, opacity 0.25s ease;
}

.sidebar-closed .sidebar {
    margin-left: -220px;
    opacity: 0;
    pointer-events: none;
}

.sidebar-overlay {
    display: none;
}

.sidebar-header {
    padding: 0.5rem 1rem 1.5rem;
    border-bottom: 1px solid #2a2a4a;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    color: #fff;
}

.sidebar-spacer {
    flex: 1;
}

.sidebar-version {
    font-size: 0.7rem;
    color: #6a6a8a;
    padding: 0.5rem 1.2rem;
    border-top: 1px solid #2a2a3e;
}

.nav-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6a6a8a;
    padding: 1rem 1.2rem 0.3rem;
    letter-spacing: 0.05em;
}

.nav-menu {
    list-style: none;
    padding: 0 0 0.5rem;
}

.nav-menu li a {
    display: block;
    padding: 0.6rem 1.2rem;
    color: #b0b0c0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.nav-menu li a:hover,
.nav-menu li a.active {
    background: #2a2a4a;
    color: #fff;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-left: auto;
}

.topbar-user {
    font-size: 0.8rem;
    color: #b0b0c0;
}

.lang-switch {
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: #b0b0c0;
    background: #2a2a4a;
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.lang-switch:hover {
    background: #3a3a5a;
    color: #fff;
}

/* Content */
.content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 2px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.card-selected {
    border-color: #3498db;
}

.card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 0.4rem;
}

.card .value {
    font-size: 2rem;
    font-weight: 700;
}

.card .value.online { color: #2ecc71; }
.card .value.offline { color: #e74c3c; }
.card .value.pending { color: #f39c12; }
.card .value.total { color: #3498db; }

/* Table */
table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    border-collapse: collapse;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

th, td {
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.8rem;
    text-transform: uppercase;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: #3498db; }

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fa; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-online { background: #d4edda; color: #155724; }
.badge-offline { background: #f8d7da; color: #721c24; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-migrated { background: #6f42c1; color: #fff; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-approve { background: #2ecc71; color: #fff; }
.btn-reject { background: #e74c3c; color: #fff; }
.btn-primary { background: #3498db; color: #fff; }
.btn-secondary { background: #95a5a6; color: #fff; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.btn + .btn { margin-left: 0.4rem; }
.btn-stack .btn + .btn { margin-left: 0; }

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

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid #ddd;
}

.tab {
    padding: 0.6rem 1.2rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: #555; }

.tab-active {
    color: #3498db;
    border-bottom-color: #3498db;
}

/* Utility */
h1 { font-size: 1.4rem; margin-bottom: 1rem; }
.text-muted { color: #888; font-size: 0.85rem; }
.mt-1 { margin-top: 1rem; }

/* Pagination */
.pagination {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Alert */
.alert {
    padding: 0.7rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-danger { background: #f8d7da; color: #721c24; }

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f0f2f5;
}

.login-box {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    width: 360px;
}

.login-box h2 {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1a1a2e;
}

/* Tag chips */
.tag-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    font-size: 0.78rem;
    overflow: hidden;
    border: 1px solid #ddd;
}

.tag-key {
    background: #3498db;
    color: #fff;
    padding: 0.15rem 0.5rem;
    font-weight: 600;
}

.tag-value {
    background: #fff;
    color: #333;
    padding: 0.15rem 0.5rem;
}

.tag-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    font-size: 0.9rem;
    line-height: 1;
}

.tag-remove:hover { color: #e74c3c; }

.tag-chip-sm {
    display: inline-flex;
    align-items: center;
    border-radius: 3px;
    font-size: 0.7rem;
    overflow: hidden;
    border: 1px solid #ddd;
    margin: 1px;
}

.tag-chip-sm .tag-key {
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
}

.tag-chip-sm .tag-value {
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
}

/* Locker Layout Grid */
.locker-grid {
    display: grid;
    gap: 4px;
    grid-auto-rows: 48px;
    width: fit-content;
    background: #e8e8e8;
    padding: 6px;
    border-radius: 8px;
}

.locker-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: 2px solid #bbb;
    background: #fff;
    font-weight: 600;
    position: relative;
    min-width: 52px;
}

.locker-box-s { background: #e8f5e9; border-color: #81c784; }
.locker-box-m { background: #e3f2fd; border-color: #64b5f6; }
.locker-box-l { background: #fff3e0; border-color: #ffb74d; }

.locker-box-number {
    font-size: 0.95rem;
    color: #333;
}

.locker-box-size {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
}

.locker-box-error {
    background: #f8d7da;
    border-color: #dc3545;
}

.locker-box-error-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #dc3545;
}

.locker-grid-mini {
    gap: 1px;
    grid-auto-rows: 14px;
    padding: 3px;
}

.locker-grid-mini .locker-box {
    min-width: 22px;
    border-width: 1px;
}

/* Mobile sidebar overlay */
@media (max-width: 768px) {
    .sidebar-open .sidebar {
        position: fixed;
        top: 42px;
        left: 0;
        z-index: 900;
        margin-left: 0;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-closed .sidebar {
        position: fixed;
        top: 42px;
        left: -220px;
        margin-left: 0;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        top: 42px;
        background: rgba(0,0,0,0.4);
        z-index: 899;
    }

    .content {
        padding: 1rem;
    }
}
