:root {
    /* ADR Eixos Corporate Palette - Light Theme */
    --bg-main: #f3f4f6; /* Light gray background */
    --panel-bg: #ffffff; /* White panels */
    --panel-border: #e5e7eb;
    
    --text-main: #1f2937; /* Dark gray */
    --text-muted: #6b7280;
    
    --brand-primary: #1e3a8a; /* Deep Corporate Blue */
    --brand-secondary: #2563eb;
    --brand-accent: #0284c7;
    
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Corporate Panels */
.corporate-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.card-inner {
    background: #f9fafb;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 1rem;
}

/* Header */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
}

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

.brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--brand-primary);
}

.subtitle {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ecfdf5;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border: 1px solid #d1fae5;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pulse-green {
    background-color: var(--success);
}

.status-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--success);
}

.btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    background: var(--brand-primary);
    color: white;
}

.primary-btn:hover {
    background: var(--brand-secondary);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--panel-border);
}

.secondary-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Global KPIs */
.global-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    padding: 1.5rem;
    border-top-width: 4px;
}

.border-blue { border-top-color: var(--brand-primary); }
.border-gray { border-top-color: var(--text-muted); }

.kpi-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.kpi-value-container {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.kpi-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.kpi-blue { color: var(--brand-primary); }

.unit {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Machine Focus List */
.machine-focus {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.machine-card {
    padding: 0;
    overflow: hidden;
}

.machine-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--panel-border);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.machine-ident {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.machine-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-primary);
}

.machine-id {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #e2e8f0;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-family: monospace;
}

.machine-status-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-bg-online {
    background: #ecfdf5;
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* Machine Body Layout */
.machine-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.metrics-headers-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.metrics-content-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.metrics-actions-row {
    display: flex;
    justify-content: flex-end;
}

.section-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
    margin-bottom: 0;
}

.section-heading-global {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--panel-border);
}

.metrics-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.production-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.metric-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.25rem;
}

.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.color-primary { color: var(--brand-primary); }

/* Progress */
.performance-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1; /* Take remaining space */
}

.bar-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.progress-track {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--brand-primary);
    border-radius: 5px;
    transition: width 1s ease-out;
}

/* Production Stats right side */
.production-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-grow: 1; /* Stretch to safely align with left column */
}

.production-count-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.production-real {
    font-size: 2.25rem;
}

.radial-progress {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: conic-gradient(var(--success) 0%, #e5e7eb 0%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.radial-progress::after {
    content: '';
    position: absolute;
    width: 52px;
    height: 52px;
    background: #f9fafb; /* match .card-inner */
    border-radius: 50%;
}

.oee-machine-label, .oee-machine-value {
    position: relative;
    z-index: 1;
}

.oee-machine-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
}

.oee-machine-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--success);
}



/* Global Sections Layout */
.machine-summaries-section,
.global-logs-section {
    margin-top: 2.5rem;
    padding: 1.5rem;
}

/* Raw Data Table Section */
.log-container {
    max-height: 400px; /* Slightly taller for global view */
}

.sensor-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f3f4f6;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-family: monospace;
}

.table-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
}

.corporate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.corporate-table th, .corporate-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.corporate-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 1;
}

.corporate-table tbody tr:hover {
    background-color: #f9fafb;
}

.corporate-table tbody tr:last-child td {
    border-bottom: none;
}

.log-event-operacao { color: var(--success); font-weight: 500; }
.log-event-standby { color: var(--warning); font-weight: 500; }
.log-event-desligado { color: var(--danger); font-weight: 500; }

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