:root {
    --primary-color: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 12px;
    --box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    color: var(--dark-color);
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
}

header {
    background-color: white;
    padding: 10px 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
}

@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

.logo-container {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 32px;
    width: auto;
}

nav {
    display: flex;
    gap: 5px;
    width: 100%;
    justify-content: space-around;
}

@media (min-width: 768px) {
    nav {
        width: auto;
        gap: 15px;
    }
}

nav a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 20px;
    transition: background 0.2s;
}

nav a:hover, nav a.active {
    background: #eef2ff;
    color: var(--primary-color);
}

.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--box-shadow);
    margin-bottom: 16px;
    border: 1px solid #edf2f7;
}

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

@media (min-width: 992px) {
    .grid {
        grid-template-columns: 1.5fr 1fr;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 12px 8px;
    border-radius: var(--border-radius);
    background: white;
    border: 1px solid #edf2f7;
    cursor: pointer;
    transition: transform 0.1s;
}

.stat-item:active {
    transform: scale(0.95);
    background: #f8fafc;
}

.stat-item img {
    height: 24px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    display: block;
    color: var(--dark-color);
}

.stat-label {
    font-size: 10px;
    color: var(--secondary-color);
    font-weight: 700;
}

/* Mobile List Style (Cards instead of Table) */
.chip-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chip-card {
    background: white;
    padding: 14px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.chip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chip-ssn {
    font-family: monospace;
    font-weight: 700;
    font-size: 14px;
    color: #2d3748;
}

.chip-op-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #edf2f7;
    font-weight: 800;
    text-transform: uppercase;
}

.chip-details {
    font-size: 13px;
    color: #718096;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip-status-label {
    font-weight: 600;
    color: var(--dark-color);
}

/* Hide table on small screens, show cards */
.desktop-only { display: none; }
@media (min-width: 768px) {
    .desktop-only { display: table; }
    .mobile-only { display: none; }
}

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

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    color: #64748b;
    background: #f8fafc;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.status-disponivel { background: #dcfce7; color: #166534; }
.status-indisponivel { background: #fee2e2; color: #991b1b; }
.status-instalado { background: #fef3c7; color: #92400e; }
.status-em-maos, .status-em-mãos { background: #e0e7ff; color: #3730a3; }
.status-exportado { background: #e0f2fe; color: #075985; }

.btn {
    padding: 12px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    width: 100%;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .btn { width: auto; display: inline-flex; margin-bottom: 0; }
}

.btn-primary { background: var(--primary-color); color: white; }
.btn-success { background: var(--success-color); color: white; }
.btn-danger { background: var(--danger-color); color: white; }
.btn-secondary { background: #e2e8f0; color: #475569; }

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

input, select {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px; /* Prevents auto-zoom on iOS */
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: white;
    margin: 0;
    position: absolute;
    bottom: 0;
    padding: 24px;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-content {
        position: relative;
        margin: 50px auto;
        border-radius: 16px;
        width: 90%;
        max-width: 500px;
    }
}
