:root {
    --primary: #1bb134;
    --primary-dark: #059669;
    --secondary: #6388c2;
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --surface-soft: #F9FAFB;
    --surface-hover: #F3F4F6;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-on-primary: #F9FAFB;
    --border: #E5E7EB;
    --delete: #941010;
}

body {
    font-family: system-ui, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

.btn {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

.btn-voltar {
    background: var(--delete);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    background: var(--secondary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn.outline {
    background: transparent;
    border: 1px solid #aaa;
    color: #333;
}

.card {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom:20px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-bottom: 4px solid var(--primary);
}

.kpi-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary);
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: bold;
    text-transform: uppercase;
}

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

.data-table th {
    text-align: left;
    padding: 10px;
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    color: white;
}

.badge.montagem {
    background: #8B5CF6;
}

.badge.instalacao {
    background: #3B82F6;
}

.badge.testes {
    background: #F59E0B;
}

.badge.ok {
    background: #D1FAE5;
    color: #065F46;
}

.badge.no {
    background: #FEE2E2;
    color: #991B1B;
}

/* Form Styles */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field label {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-secondary);
}

.field input,
.field select,
.field textarea {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
}

.checklist-section {
    margin-top: 30px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.checklist-section h2 {
    font-size: 16px;
    color: var(--secondary);
    margin-bottom: 15px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.photo-uploader {
    aspect-ratio: 4/3;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px dashed var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.photo-uploader img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-label {
    font-size: 11px;
    text-align: center;
    margin-top: 5px;
    font-weight: bold;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px dashed var(--border);
}


/* ================================
   PAINÉIS / GESTÃO DE PAINÉIS
   ================================ */

/* Header da página (título + descrição) */
.page-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header-bar h2 {
    margin: 0;
    font-size: 18px;
}

.page-header-bar p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

/* Grid do formulário de novo painel */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px 18px;
    align-items: flex-end;
}

/* Campos do formulário (já existe .field, aqui só refinamos um pouco) */
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    font-weight: 600;
}

.badge.concluido {
    background: var(--primary);
    color: var(--text-on-primary);
}


/* Deixa o serial com "cara" de ID */
input[name="serial"] {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Botão principal da tela de painéis */
.btn-primary {
    background: var(--primary);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-delete {
    background: var(--delete);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-secondary {
    background: var(--secondary);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-primary .material-icons-round {
    font-size: 16px;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Serial em forma de "pill" na tabela */
.pill-serial {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.04em;
}

/* Estado atual do painel (pill) – versão específica para painéis */
.badge-stage {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: #ffffff;
}

/* Cores por estágio, reaproveitando a lógica das badges já existentes */
.badge-stage.montagem {
    background: #8B5CF6;
}

.badge-stage.testes {
    background: #F59E0B;
}

.badge-stage.instalacao {
    background: #3B82F6;
}

.badge-stage.criado {
    background: #9CA3AF;
}

/* Linha de "nenhum registro" nas tabelas */
.table-empty-state {
    text-align: center;
    padding: 18px;
    color: #9ca3af;
    font-style: italic;
    font-size: 13px;
}

/* Ação pequena (botão de abrir painel) – compatível com .btn-sm existente */
.btn-sm {
    padding: 5px 5px;
    font-size: 11px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-sm .material-icons-round {
    font-size: 14px;
}

.card-panel {
    background: var(--bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* Header Verde */
.header-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-card h1 {
    margin: 0;
    font-size: 28px;
}

.header-card small {
    opacity: 0.9;
    font-size: 14px;
}

.status-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
}

.btn-inline {
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    font-size: 14px;
}

.btn-inline:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-inline.warn {
    background: #F59E0B;
}

.btn-inline.info {
    background: var(--secondary);
}

.btn-inline.outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 14px;
    font-size: 13px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.panel-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* Timeline Items */
.timeline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
    border-bottom: none;
}

.tag {
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 10px;
    color: white;
    text-transform: uppercase;
}

.tag.montagem {
    background: #8B5CF6;
}

.tag.testes {
    background: #F59E0B;
}

.tag.instalacao {
    background: #3B82F6;
}

/* Galeria */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.photo-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.photo-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.photo-label {
    font-size: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px;
    text-align: center;
    position: absolute;
    bottom: 0;
    width: 100%;
}

@media (max-width: 768px) {
    .panel-split {
        grid-template-columns: 1fr;
    }
}

.panel-container {
    max-width: 1000px;
    margin: 0 auto;
}
