@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');
/* Logo empresa (sem quadrado RPC) */
.rpc-header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    flex-shrink: 0;
}

.rpc-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    padding: 14px 24px;
    margin-left: 260px;
    margin-top: auto;
}

@media (max-width: 768px) {
    .rpc-footer {
        margin-left: 0;
    }
}

.rpc-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.rpc-footer-inner i {
    color: var(--primary);
    margin-right: 6px;
}

.rpc-footer-sep {
    opacity: 0.45;
    padding: 0 4px;
}

/* ---------- Tema escuro (padrão do HTML inline :root) ---------- */
html[data-rpc-theme="dark"] {
    /* usa --primary / --accent já definidos em cada página */
}

/* ---------- Tema claro (painéis suaves, sem branco puro “estourado”) ---------- */
html[data-rpc-theme="light"] {
    --bg-dark: #c8d0e0;
    --bg-card: #eef1f8;
    --bg-light: #e0e5f0;
    --text: #0f172a;
    --text-muted: #5c6578;
    --border: #c2c9d8;
    --shadow: 0 6px 28px rgba(15, 23, 42, 0.08);
    --primary: #00995c;
    --secondary: #007a4a;
    --accent: #2563eb;
    --warning: #c2410c;
    --danger: #dc2626;
    --success: #15803d;
}

html[data-rpc-theme="light"] body {
    color: var(--text);
    background: linear-gradient(165deg, #d2dae8 0%, #c5cedf 40%, #bcc7db 100%) fixed;
}

html[data-rpc-theme="light"] .header {
    background: linear-gradient(135deg, #fbfcff 0%, #f0f3fa 55%, #e6eaf5 100%) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

html[data-rpc-theme="light"] .sidebar {
    background: linear-gradient(180deg, #f4f6fb 0%, #e9edf6 100%) !important;
    border-right: 1px solid rgba(15, 23, 42, 0.1) !important;
}

html[data-rpc-theme="light"] .main-content {
    background: transparent;
}

/* Remove o gradiente escuro (#1a1a25) dos cards do layout demo */
html[data-rpc-theme="light"] .card,
html[data-rpc-theme="light"] .kpi-card,
html[data-rpc-theme="light"] .stat-card,
html[data-rpc-theme="light"] .settings-card,
html[data-rpc-theme="light"] .orders-table-container,
html[data-rpc-theme="light"] .production-calendar,
html[data-rpc-theme="light"] .settings-layout,
html[data-rpc-theme="light"] .settings-sidebar,
html[data-rpc-theme="light"] .settings-content {
    background: linear-gradient(160deg, #ffffff 0%, #f6f8fd 38%, #eef2fa 100%) !important;
    border: 1px solid rgba(15, 23, 42, 0.09) !important;
    box-shadow:
        0 4px 22px rgba(15, 23, 42, 0.07),
        0 1px 3px rgba(15, 23, 42, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

html[data-rpc-theme="light"] .machine-card,
html[data-rpc-theme="light"] .chart-panel,
html[data-rpc-theme="light"] .detail-panel {
    background: linear-gradient(160deg, #ffffff 0%, #f6f8fd 38%, #eef2fa 100%) !important;
    border: 1px solid rgba(15, 23, 42, 0.09) !important;
    box-shadow:
        0 4px 22px rgba(15, 23, 42, 0.07),
        0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

html[data-rpc-theme="light"] .machine-card:hover {
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.11) !important;
}

html[data-rpc-theme="light"] .card:hover,
html[data-rpc-theme="light"] .stat-card:hover,
html[data-rpc-theme="light"] .kpi-card:hover {
    box-shadow:
        0 14px 40px rgba(15, 23, 42, 0.11),
        0 2px 6px rgba(15, 23, 42, 0.05) !important;
}

html[data-rpc-theme="light"] .dashboard-title h2 {
    background: linear-gradient(90deg, #0f172a 0%, #0f172a 55%, var(--primary) 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
}

html[data-rpc-theme="light"] .nav-item:hover {
    background: rgba(15, 23, 42, 0.06) !important;
    color: var(--text) !important;
}

html[data-rpc-theme="light"] .nav-item.active {
    background: rgba(0, 153, 92, 0.12) !important;
}

html[data-rpc-theme="light"] .demo-alert {
    background: linear-gradient(90deg, rgba(255, 237, 213, 0.95), rgba(254, 243, 199, 0.75)) !important;
    border: 1px solid rgba(217, 119, 6, 0.28) !important;
    border-left: 4px solid var(--warning) !important;
}

html[data-rpc-theme="light"] .action-btn:not(.primary) {
    background: linear-gradient(180deg, #ffffff, #f4f6fb) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    color: var(--text) !important;
}

html[data-rpc-theme="light"] .action-btn:not(.primary):hover {
    background: var(--bg-light) !important;
}

html[data-rpc-theme="light"] .tab {
    background: rgba(255, 255, 255, 0.65) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    color: var(--text-muted) !important;
}

html[data-rpc-theme="light"] .tab.active {
    background: rgba(0, 153, 92, 0.14) !important;
    color: var(--primary) !important;
    border-color: rgba(0, 153, 92, 0.35) !important;
}

html[data-rpc-theme="light"] .orders-table th,
html[data-rpc-theme="light"] .orders-table thead {
    background: linear-gradient(180deg, #e8ecf6, #dfe5f0) !important;
    color: var(--text) !important;
}

html[data-rpc-theme="light"] .orders-table td {
    border-color: rgba(15, 23, 42, 0.06) !important;
}

html[data-rpc-theme="light"] .orders-table tr:hover {
    background: rgba(37, 99, 235, 0.05) !important;
}

html[data-rpc-theme="light"] .modal-content {
    background: linear-gradient(180deg, #ffffff 0%, #f3f5fb 100%) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18) !important;
}

html[data-rpc-theme="light"] .form-control {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
    color: var(--text) !important;
}

html[data-rpc-theme="light"] .rpc-footer {
    background: linear-gradient(180deg, #e9edf6, #e2e7f2) !important;
    border-top-color: rgba(15, 23, 42, 0.1) !important;
}

html[data-rpc-theme="light"] .rpc-theme-pick:hover {
    background: rgba(15, 23, 42, 0.05);
}

html[data-rpc-theme="light"] .rpc-theme-pick.active {
    background: rgba(0, 153, 92, 0.1);
}

/* Monitoramento — planta do galpão no tema claro */
html[data-rpc-theme="light"] .plant-map-viewport {
    background: #e8ecf4 !important;
}

html[data-rpc-theme="light"] .plant-floor {
    background-color: #dde2ec !important;
    border-color: #b8c0d4 !important;
    box-shadow: inset 0 0 60px rgba(15, 23, 42, 0.06) !important;
}

html[data-rpc-theme="light"] .floor-zone-label {
    color: rgba(15, 23, 42, 0.28) !important;
}

html[data-rpc-theme="light"] .galpao-door::after {
    color: rgba(15, 23, 42, 0.35) !important;
}

/* ---------- Terceira paleta (azul / industrial) ---------- */
html[data-rpc-theme="ocean"] {
    --bg-dark: #0a0f18;
    --bg-card: #111b2e;
    --bg-light: #162540;
    --text: #e8f0ff;
    --text-muted: #8ba3c4;
    --border: #243044;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --primary: #38bdf8;
    --secondary: #0ea5e9;
    --accent: #818cf8;
    --warning: #fbbf24;
    --danger: #f87171;
    --success: #34d399;
}

/* Seletor de tema na página Configurações */
.rpc-theme-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.rpc-theme-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.rpc-theme-pick:hover {
    background: rgba(255, 255, 255, 0.04);
}

.rpc-theme-pick.active {
    border-color: var(--primary);
    background: rgba(0, 230, 138, 0.08);
}

.rpc-theme-swatch {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

.rpc-theme-pick span {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    max-width: 100px;
}

.rpc-theme-pick.active span {
    color: var(--primary);
    font-weight: 600;
}

/* === RPC polish v2: identidade visual alinhada ao site (aplica nas 12 telas da demo) === */
html[data-rpc-theme="dark"] {
    --bg-dark: #0b0d0f;
    --bg-card: #101316;
    --bg-light: #171b1f;
    --border: rgba(255, 255, 255, 0.09);
    --primary: #00e676;
    --secondary: #00c853;
    --accent: #2196f3;
    --text: #e8f1f2;
    --text-muted: #8a9ca0;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
html[data-rpc-theme="dark"] body {
    background: radial-gradient(900px 520px at 100% -8%, rgba(0,230,118,.07), transparent), radial-gradient(700px 420px at 0% 110%, rgba(0,184,148,.05), transparent), #0b0d0f;
    font-feature-settings: 'tnum' 1, 'cv11' 1;
}
.nav-badge, .demo-badge, .notification-badge { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace !important; }

/* Cabeçalho */
html[data-rpc-theme="dark"] .header {
    background: rgba(9, 11, 13, 0.92);
    backdrop-filter: saturate(150%) blur(16px);
    border-bottom: 1px solid var(--border);
}
html[data-rpc-theme="dark"] .header::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, transparent 0%, transparent 30%, var(--primary) 50%, transparent 70%, transparent 100%);
    background-size: 200% 100%; opacity: .75; animation: rpcSweep 6s linear infinite;
}
@keyframes rpcSweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }
html[data-rpc-theme="dark"] .logo h1 {
    background: none; -webkit-text-fill-color: #fff; color: #fff;
    font-size: 17px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; margin-bottom: 3px;
}
html[data-rpc-theme="dark"] .demo-badge {
    display: inline-block; border-radius: 3px; padding: 1px 8px; font-size: 10px; letter-spacing: .14em;
    background: rgba(0,230,118,.12); border: 1px solid rgba(0,230,118,.4); color: var(--primary);
}
html[data-rpc-theme="dark"] .avatar { background: linear-gradient(135deg, #00e676, #00b894); color: #04130a; }
html[data-rpc-theme="dark"] .logout-btn {
    background: rgba(255,255,255,.06); border: 0; color: #fff; border-radius: 0;
    padding: 10px 24px; font: 600 12px 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
html[data-rpc-theme="dark"] .logout-btn:hover { background: rgba(0,230,118,.14); color: var(--primary); }

/* Menu lateral */
html[data-rpc-theme="dark"] .sidebar { background: #090b0d; border-right: 1px solid var(--border); }
html[data-rpc-theme="dark"] .nav-section-title {
    font: 600 10px 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .16em; color: #5f7378; border-bottom: 1px solid var(--border);
}
html[data-rpc-theme="dark"] .nav-item { font-size: 14px; font-weight: 500; color: #9aaeb2; margin: 2px 10px; padding: 11px 14px; border-radius: 8px; border-left: 0; }
html[data-rpc-theme="dark"] .nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
html[data-rpc-theme="dark"] .nav-item.active {
    background: linear-gradient(90deg, rgba(0,230,118,.16), rgba(0,230,118,.03)); color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}
html[data-rpc-theme="dark"] .nav-item i { width: 18px; text-align: center; }
html[data-rpc-theme="dark"] .nav-badge { background: rgba(0,230,118,.14); color: var(--primary); border: 1px solid rgba(0,230,118,.3); border-radius: 4px; font-size: 10px; padding: 1px 7px; }

/* Aviso de demonstração */
html[data-rpc-theme="dark"] .demo-alert {
    background: linear-gradient(90deg, rgba(255,176,32,.10), rgba(255,176,32,.02)); border: 1px solid rgba(255,176,32,.22);
    border-left: 3px solid var(--warning); border-radius: 8px; padding: 12px 18px; font-size: 13.5px;
}

/* Cartões e KPIs */
html[data-rpc-theme="dark"] .card,
html[data-rpc-theme="dark"] .kpi-card {
    background: linear-gradient(180deg, #12161a 0%, #0e1114 100%); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
html[data-rpc-theme="dark"] .card:hover { border-color: rgba(0,230,118,.35); }
html[data-rpc-theme="dark"] .kpi-card::before {
    content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--primary), transparent 80%);
}
html[data-rpc-theme="dark"] .kpi-icon { border-radius: 10px; background: rgba(0,230,118,.10); border: 1px solid rgba(0,230,118,.25); width: 52px; height: 52px; font-size: 20px; }
html[data-rpc-theme="dark"] .kpi-value { font-family: 'Inter', 'Segoe UI', sans-serif; font-size: 34px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
html[data-rpc-theme="dark"] .kpi-label { font-weight: 600; color: #cfdcdf; }
html[data-rpc-theme="dark"] .card-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }

/* Botões de ação */
html[data-rpc-theme="dark"] .action-btn { border-radius: 6px; background: rgba(255,255,255,.04); font-weight: 500; }
html[data-rpc-theme="dark"] .action-btn:hover { border-color: var(--primary); color: var(--primary); }
html[data-rpc-theme="dark"] .action-btn.primary, html[data-rpc-theme="dark"] .action-btn.btn-primary { background: var(--primary); color: #04130a; border-color: var(--primary); font-weight: 700; }

/* Barras de rolagem */
html[data-rpc-theme="dark"] ::-webkit-scrollbar { width: 9px; height: 9px; }
html[data-rpc-theme="dark"] ::-webkit-scrollbar-track { background: #0b0d0f; }
html[data-rpc-theme="dark"] ::-webkit-scrollbar-thumb { background: #26323a; border-radius: 6px; }
html[data-rpc-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #00c853; }
@media (prefers-reduced-motion: reduce) { html[data-rpc-theme="dark"] .header::after { animation: none; } }

/* === RPC mobile: menu lateral recolhível e conteúdo fluido (todas as telas da demo) === */
.rpc-nav-toggle { display: none; }
@media (max-width: 900px) {
    .rpc-nav-toggle {
        display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; margin-right: 10px; flex-shrink: 0;
        background: rgba(255,255,255,.06); border: 1px solid var(--border); color: #fff; border-radius: 8px; cursor: pointer; font-size: 18px;
    }
    .header { padding: 0 12px !important; }
    .header .logo { min-width: 0; }
    .header .logo h1 { font-size: 15px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header .user-info { gap: 10px !important; }
    .header .user-profile > div:not(.avatar) { display: none; }
    .header .notifications { display: none; }
    .header .logout-btn { padding: 8px 12px !important; font-size: 0 !important; letter-spacing: 0 !important; }
    .header .logout-btn i { font-size: 14px; margin: 0; }
    .header .logout-btn span { display: none; }
    .sidebar { transform: translateX(-100%); transition: transform .28s ease; z-index: 1001; width: 280px !important; box-shadow: 0 0 40px rgba(0,0,0,.6); }
    body.rpc-nav-open .sidebar { transform: none; }
    .rpc-nav-overlay { position: fixed; inset: 70px 0 0 0; background: rgba(0,0,0,.6); z-index: 1000; display: none; }
    body.rpc-nav-open .rpc-nav-overlay { display: block; }
    .main-content { margin-left: 0 !important; padding: 14px !important; max-width: 100vw; overflow-x: hidden; }
    .rpc-footer { margin-left: 0 !important; }
    .main-content [class*="grid-4"], .main-content .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .main-content .grid-3, .main-content .grid-2, .main-content [class*="-grid"] { grid-template-columns: minmax(0, 1fr) !important; }
    .main-content .card, .main-content .kpi-card { min-width: 0; padding: 18px !important; }
    .main-content table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .main-content .tabs, .main-content [class*="tabs"] { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; max-width: 100%; }
    .main-content .action-btn { white-space: nowrap; }
    .main-content h1, .main-content h2 { font-size: 22px !important; }
    .main-content canvas, .main-content img, .main-content svg { max-width: 100%; }
}
@media (max-width: 560px) {
    .main-content .grid-4, .main-content [class*="grid-4"] { grid-template-columns: minmax(0, 1fr) !important; }
}
