/* ============================================================================
   RetíficaPRO – Design System v3.0 (Mobile-First Responsive)
   Tema claro, legível, para público 40+ em ambiente de retífica
   ============================================================================ */

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

:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fb;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: rgba(59,130,246,0.15);
    --bg-input: #ffffff;
    --bg-section: #f7f8fa;
    --bg-topbar: #ffffff;
    --border-color: #e2e5ea;
    --border-light: #eef0f3;
    --border-strong: #d1d5db;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-light: #6b7280;
    --text-sidebar: #cbd5e1;
    --text-sidebar-muted: #64748b;
    --status-recebido: #3b82f6;
    --status-em-analise: #eab308;
    --status-em-execucao: #f97316;
    --status-aguardando-peca: #ef4444;
    --status-finalizado: #22c55e;
    --status-entregue: #6b7280;
    --status-cancelado: #9ca3af;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --accent-dim: rgba(37,99,235,0.08);
    --success: #16a34a;
    --success-light: #dcfce7;
    --success-dim: rgba(22,163,74,0.08);
    --warning: #d97706;
    --warning-light: #fef3c7;
    --warning-dim: rgba(217,119,6,0.08);
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --danger-dim: rgba(220,38,38,0.08);
    --info: #7c3aed;
    --info-light: #ede9fe;
    --info-dim: rgba(124,58,237,0.08);
    --orange: #ea580c;
    --orange-light: #fff7ed;
    --orange-dim: rgba(234,88,12,0.08);
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --transition: all 0.15s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* ===================================================================
   LAYOUT (Mobile-First)
   =================================================================== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar – hidden on mobile, visible on desktop */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--bg-sidebar);
    display: flex; flex-direction: column;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}
.sidebar.open { transform: translateX(0); }

.sidebar-brand {
    height: var(--topbar-height);
    display: flex; align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 12px;
}
.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand .brand-name { font-size: 16px; font-weight: 700; color: #ffffff; letter-spacing: -0.3px; }
.sidebar-brand .brand-sub { font-size: 10px; color: var(--text-sidebar-muted); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 500; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-section-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-sidebar-muted); padding: 0 12px; margin-bottom: 8px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px; border-radius: var(--radius-sm);
    color: var(--text-sidebar); font-size: 14px; font-weight: 500;
    transition: var(--transition); margin-bottom: 2px; cursor: pointer;
    min-height: 44px;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #ffffff; }
.nav-item.active { background: var(--bg-sidebar-active); color: #60a5fa; }
.nav-item .nav-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }

.nav-item .nav-badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; padding: 2px 8px;
    border-radius: 10px; min-width: 22px; text-align: center;
}

.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent); display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: var(--text-sidebar-muted); }

/* Main Content – full width on mobile */
.main-content {
    flex: 1; margin-left: 0;
    min-height: 100vh; display: flex; flex-direction: column;
}

/* Top Bar – compact on mobile */
.main-header {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-sm);
}
.main-header h1 { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* Global Search – hidden on mobile */
.global-search { display: none; position: relative; }
.global-search input {
    width: 200px; padding: 8px 12px 8px 36px;
    background: var(--bg-section); border: 1px solid var(--border-color);
    border-radius: var(--radius); font-size: 13px; color: var(--text-primary);
    font-family: var(--font); outline: none; transition: var(--transition);
}
.global-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); background: #fff; }
.global-search input::placeholder { color: var(--text-muted); }
.global-search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

.notification-btn {
    position: relative; background: none; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); padding: 7px 10px; cursor: pointer;
    color: var(--text-secondary); transition: var(--transition);
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.notification-btn:hover { background: var(--bg-section); border-color: var(--border-strong); }
.notification-btn .notif-count {
    position: absolute; top: -6px; right: -6px;
    background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-topbar);
}

.quick-os-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: var(--transition); font-family: var(--font); text-decoration: none;
    min-height: 44px; white-space: nowrap;
}
.quick-os-btn:hover { background: var(--accent-hover); color: #fff; }
.quick-os-btn svg { flex-shrink: 0; }

/* Hide text on mobile, keep icon */
.quick-os-btn span.btn-text-hide { display: none; }

.header-date { display: none; font-size: 12px; color: var(--text-muted); font-weight: 500; }
.page-content { padding: 16px; flex: 1; }

/* Mobile Toggle – visible on mobile */
.mobile-toggle {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--text-primary);
    cursor: pointer; padding: 8px;
    min-width: 44px; min-height: 44px;
    border-radius: var(--radius-sm);
}
.mobile-toggle:active { background: var(--bg-section); }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 99; }
.sidebar-overlay.active { display: block; }

/* ===================================================================
   CARDS
   =================================================================== */
.card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
    padding: 14px 16px; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0;
    gap: 10px; flex-wrap: wrap;
}
.card-header h2, .card-header h3 { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.card-body { padding: 16px; }
.card-footer {
    padding: 12px 16px; border-top: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    background: var(--bg-section); border-radius: 0 0 var(--radius) var(--radius);
}

/* ===================================================================
   DAY SUMMARY
   =================================================================== */
.day-summary {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}
.day-summary-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 12px;
}
.day-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ds-item { text-align: center; padding: 8px 4px; background: var(--bg-section); border-radius: var(--radius-sm); }
.ds-value { display: block; font-size: 18px; font-weight: 800; line-height: 1; margin-bottom: 4px; letter-spacing: -0.3px; }
.ds-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ds-blue { color: var(--accent); }
.ds-green { color: var(--success); }
.ds-emerald { color: #059669; }
.ds-orange { color: var(--orange); }

/* ===================================================================
   STAT CARDS
   =================================================================== */
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
.stats-grid-8 { grid-template-columns: repeat(2, 1fr); }

.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 14px 16px;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: var(--shadow-sm); transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat-card-featured { border-left: 3px solid var(--accent); background: linear-gradient(135deg, #fff 0%, #f8faff 100%); }
.stat-card-danger { border-color: var(--danger); background: var(--danger-light); animation: subtle-pulse 2s infinite; }
@keyframes subtle-pulse { 0%, 100% { box-shadow: var(--shadow-sm); } 50% { box-shadow: 0 0 0 3px rgba(220,38,38,0.08); } }

.stat-icon {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--info-light); color: var(--info); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 3px; letter-spacing: -0.5px; }
.stat-value-sm { font-size: 18px; }
.stat-label { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 600; }

/* ===================================================================
   BUTTONS (44px min touch target)
   =================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; border: 1px solid transparent;
    cursor: pointer; transition: var(--transition);
    font-family: var(--font); white-space: nowrap; text-decoration: none;
    min-height: 44px; justify-content: center;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: #fff; color: var(--text-secondary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-section); color: var(--text-primary); border-color: var(--text-muted); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-light); color: var(--danger); }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 40px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-icon { padding: 8px; width: 44px; height: 44px; justify-content: center; }

/* Responsive button group */
.btn-group-responsive {
    display: flex; flex-wrap: wrap; gap: 8px;
}

/* ===================================================================
   FORMS (16px font prevents iOS zoom, 44px touch targets)
   =================================================================== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.2px; }

.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 16px; font-family: var(--font);
    transition: var(--transition); outline: none;
    min-height: 44px;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

/* Small form controls for inline table editing */
.form-control-sm {
    padding: 4px 8px !important; font-size: 13px !important;
    min-height: 32px !important; height: 32px; line-height: 1.4;
    border-radius: 4px;
}
select.form-control-sm { padding-right: 28px !important; background-position: right 6px center; }
.form-control-sm.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px !important; }

/* Table small variant */
.table-sm thead th { padding: 6px 8px; font-size: 10px; }
.table-sm tbody td { padding: 4px 8px; font-size: 13px; }
.table-sm .btn-sm { padding: 2px 8px; font-size: 11px; min-height: auto; height: 28px; }

.form-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 44px; }
.form-check input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* ===================================================================
   TABLES
   =================================================================== */
.table-container { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }

table thead th {
    background: var(--bg-section); padding: 10px 12px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--text-light); text-align: left;
    border-bottom: 2px solid var(--border-color); white-space: nowrap;
}

table tbody tr { border-bottom: 1px solid var(--border-light); transition: var(--transition); }
table tbody tr:hover { background: #f9fafb; }
table tbody td { padding: 10px 12px; font-size: 14px; color: var(--text-primary); vertical-align: middle; }
table tbody td .text-muted { color: var(--text-muted); font-size: 13px; }

/* ===================================================================
   BADGES
   =================================================================== */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-purple { background: var(--info-light); color: var(--info); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-gray { background: #f3f4f6; color: #6b7280; }

.badge-status-recebido { background: #dbeafe; color: #2563eb; }
.badge-status-em_analise { background: #fef9c3; color: #a16207; }
.badge-status-em_execucao { background: #fff7ed; color: #c2410c; }
.badge-status-aguardando_peca { background: #fee2e2; color: #dc2626; }
.badge-status-finalizado { background: #dcfce7; color: #16a34a; }
.badge-status-entregue { background: #f3f4f6; color: #4b5563; }
.badge-status-cancelado { background: #f3f4f6; color: #9ca3af; }

/* ===================================================================
   ALERTS
   =================================================================== */
.alert { padding: 14px 16px; border-radius: var(--radius-sm); font-size: 14px; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; border: 1px solid; }
.alert-success { background: var(--success-light); border-color: #bbf7d0; color: var(--success); }
.alert-danger { background: var(--danger-light); border-color: #fecaca; color: var(--danger); }
.alert-warning { background: var(--warning-light); border-color: #fde68a; color: var(--warning); }
.alert-info { background: var(--accent-light); border-color: #bfdbfe; color: var(--accent); }

.alert-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius-sm);
    margin-bottom: 8px; font-size: 13px; font-weight: 500;
    transition: var(--transition); border: 1px solid transparent; color: var(--text-primary);
    min-height: 44px;
}
.alert-item:hover { transform: translateX(3px); }
.alert-item.type-warning { background: var(--warning-light); border-color: #fde68a; color: #92400e; }
.alert-item.type-danger { background: var(--danger-light); border-color: #fecaca; color: #991b1b; }

/* Alert Rows (Dashboard v3) */
.alert-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--border-light);
    text-decoration: none; color: var(--text-primary); transition: var(--transition);
    border-left: 3px solid transparent; min-height: 48px;
}
.alert-row:hover { background: #f8fafc; }
.alert-row.severity-critical { border-left-color: var(--danger); }
.alert-row.severity-warning { border-left-color: var(--warning); }
.alert-row.severity-info { border-left-color: var(--info); }
.alert-row-icon {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.severity-critical .alert-row-icon { background: var(--danger-light); color: var(--danger); }
.severity-warning .alert-row-icon { background: var(--warning-light); color: var(--warning); }
.severity-info .alert-row-icon { background: var(--info-light); color: var(--info); }
.alert-row-body { flex: 1; min-width: 0; }
.alert-row-cat { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.alert-row-msg { display: block; font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===================================================================
   PRODUCTION ROWS
   =================================================================== */
.production-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--border-light);
    text-decoration: none; color: var(--text-primary); transition: var(--transition);
    min-height: 48px; flex-wrap: wrap;
}
.production-row:hover { background: #f8fafc; }
.prod-main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.prod-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.prod-tech { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.prod-days {
    font-size: 12px; font-weight: 800; color: var(--text-secondary);
    background: var(--bg-section); padding: 2px 8px; border-radius: 10px;
}
.prod-days-warn { color: var(--danger); background: var(--danger-light); }

/* Recent Order Rows */
.recent-order-row {
    display: flex; align-items: center; padding: 12px 16px;
    border-bottom: 1px solid var(--border-light); gap: 12px;
    text-decoration: none; color: var(--text-primary); transition: var(--transition);
    min-height: 48px;
}
.recent-order-row:hover { background: #f8fafc; }

/* ===================================================================
   CHART
   =================================================================== */
.chart-toggle-group { display: flex; background: var(--bg-section); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-color); }
.chart-toggle {
    padding: 6px 12px; font-size: 12px; font-weight: 600;
    border: none; background: none; cursor: pointer;
    color: var(--text-muted); font-family: var(--font); transition: var(--transition);
    min-height: 36px;
}
.chart-toggle.active { background: var(--accent); color: #fff; }
.chart-toggle:hover:not(.active) { color: var(--text-primary); }

.status-stacked-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 1px; }
.ssb-segment { min-width: 4px; transition: width 0.4s ease; }
.sbl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Measurements */
.measure-ok { color: var(--success); font-weight: 700; }
.measure-warn { color: var(--warning); font-weight: 700; }
.measure-danger { color: var(--danger); font-weight: 700; }

/* Empty State */
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto 20px; color: var(--text-muted); }

/* ===================================================================
   GRID UTILITIES (Mobile-First: 1 column default)
   =================================================================== */
.grid-2, .grid-3, .grid-4 { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* Spacing */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 32px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }

/* Flex */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* ===================================================================
   DETAIL GRID (Mobile-First: 1 column)
   =================================================================== */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.detail-item { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.detail-item .detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 4px; }
.detail-item .detail-value { font-size: 15px; font-weight: 600; color: var(--text-primary); word-break: break-word; }
.detail-item .detail-value.mono { font-family: var(--font-mono); font-size: 15px; }

/* ===================================================================
   TABS (touch-friendly)
   =================================================================== */
.tab-nav { display: flex; border-bottom: 2px solid var(--border-color); margin-bottom: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; }
.tab-btn {
    padding: 12px 16px; font-size: 13px; font-weight: 600;
    color: var(--text-muted); border: none; background: none;
    cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: var(--transition);
    white-space: nowrap; font-family: var(--font);
    min-height: 44px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===================================================================
   TIMELINE
   =================================================================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border-color); }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -22px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid var(--border-color); background: #fff;
}
.timeline-dot.active { border-color: var(--accent); background: var(--accent); }
.timeline-dot.done { border-color: var(--success); background: var(--success); }
.timeline-date { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.timeline-text { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* Overdue Indicator */
.overdue-indicator { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-weight: 700; font-size: 12px; }
.overdue-indicator::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: pulse-dot 1.5s infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Status Bars */
.status-bar-row { margin-bottom: 12px; }
.status-bar-label { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.status-bar-label .sbl-name { font-size: 12px; font-weight: 600; color: var(--text-secondary); flex: 1; }
.status-bar-label .sbl-count { font-size: 13px; font-weight: 800; color: var(--text-primary); }
.status-bar-track { height: 6px; background: var(--bg-section); border-radius: 3px; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

/* Chart Area */
.chart-area { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 12px; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 20px; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.chart-bar-value { font-size: 10px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }
.chart-bar { width: 100%; min-height: 4px; border-radius: 4px 4px 0 0; transition: height 0.5s ease; }
.chart-bar-label { font-size: 9px; color: var(--text-muted); font-weight: 600; }
.chart-legend { display: flex; gap: 12px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.chart-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); font-weight: 500; }
.chart-legend-color { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Progress Bar */
.progress-bar { height: 8px; background: var(--bg-section); border-radius: 4px; overflow: hidden; border: 1px solid var(--border-light); }
.progress-bar .progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================================================================
   LOGIN PAGE
   =================================================================== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); padding: 16px;
}
.login-container { width: 100%; max-width: 420px; }
.login-card { background: #fff; border-radius: var(--radius-lg); padding: 28px 24px; box-shadow: var(--shadow-lg); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .login-icon { width: 56px; height: 56px; margin: 0 auto 16px; background: var(--accent); border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.login-brand h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.login-brand p { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.login-card .form-control { padding: 12px 16px; font-size: 16px; background: #f9fafb; border-color: var(--border-color); }
.login-card .form-control:focus { background: #fff; }
.login-card .btn { width: 100%; padding: 12px; font-size: 15px; justify-content: center; }
.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: #64748b; }

/* ===================================================================
   SEARCH & FILTERS
   =================================================================== */
.search-box { position: relative; }
.search-box .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-box .form-control { padding-left: 40px; }

.filter-bar {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 10px; margin-bottom: 20px;
}
.filter-bar .form-control { max-width: 100%; }
.filter-bar .search-box .form-control { max-width: 100%; }

/* ===================================================================
   CHECKLIST
   =================================================================== */
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-light); min-height: 48px; }
.checklist-item:last-child { border-bottom: none; }
.checklist-item.checked .checklist-text { text-decoration: line-through; color: var(--text-muted); }
.checklist-text { flex: 1; font-size: 14px; color: var(--text-primary); }
.checklist-meta { font-size: 12px; color: var(--text-muted); }

/* ===================================================================
   MISC
   =================================================================== */
.divider { height: 1px; background: var(--border-color); margin: 20px 0; }
.info-box { background: var(--bg-section); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 14px 16px; }
.procedure-text { white-space: pre-line; font-size: 14px; line-height: 1.8; color: var(--text-primary); background: var(--bg-section); padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-light); }

.quick-action-card {
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 16px; text-align: center; text-decoration: none;
    border-radius: var(--radius); background: var(--bg-card);
    border: 1px dashed var(--border-strong); transition: var(--transition); cursor: pointer;
    min-height: 120px; justify-content: center;
}
.quick-action-card:hover { border-color: var(--accent); border-style: solid; background: var(--accent-dim); }
.quick-action-card .qa-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.quick-action-card .qa-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.quick-action-card .qa-desc { font-size: 12px; color: var(--text-muted); }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
    content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%); background: var(--bg-sidebar); color: #fff;
    padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12px;
    white-space: nowrap; z-index: 50; margin-bottom: 6px;
}

/* ===================================================================
   RESPONSIVE TABLE → CARDS (Mobile)
   Tables with .table-cards class convert to card layout on mobile
   =================================================================== */
.table-cards { width: 100%; border-collapse: collapse; }
.table-cards thead { display: none; }
.table-cards tbody { display: flex; flex-direction: column; gap: 10px; }
.table-cards tbody tr {
    display: flex; flex-direction: column;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.table-cards tbody tr:hover { box-shadow: var(--shadow); }
.table-cards tbody td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; border: none; font-size: 14px;
}
.table-cards tbody td::before {
    content: attr(data-label);
    font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-muted); margin-right: 12px;
    flex-shrink: 0;
}
.table-cards tbody td:first-child { padding-top: 0; }
.table-cards tbody td:last-child { padding-bottom: 0; }
.table-cards tbody td[data-label=""] ::before,
.table-cards tbody td:not([data-label])::before { display: none; }

/* Card row with action button emphasis */
.table-cards tbody td.card-actions {
    justify-content: flex-end;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid var(--border-light);
}
.table-cards tbody td.card-actions::before { display: none; }

/* ===================================================================
   RESPONSIVE MEASUREMENT FORM (Mobile)
   =================================================================== */
.measurement-row-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-section);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}
.measurement-row-responsive .mf-cyl-label {
    grid-column: 1 / -1;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 14px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}
.measurement-row-responsive .mf-field { display: flex; flex-direction: column; gap: 4px; }
.measurement-row-responsive .mf-field label {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-muted);
}
.measurement-row-responsive .mf-field.mf-notes { grid-column: 1 / -1; }

/* ===================================================================
   RESPONSIVE PARTS FORM (Mobile)
   =================================================================== */
.part-row-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-section);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    align-items: end;
}
.part-row-responsive .pf-field { display: flex; flex-direction: column; gap: 4px; }
.part-row-responsive .pf-field label {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-muted);
}
.part-row-responsive .pf-name { grid-column: 1 / -1; }
.part-row-responsive .pf-actions { display: flex; align-items: flex-end; justify-content: flex-end; }

/* ===================================================================
   PRINT
   =================================================================== */
@media print {
    .sidebar, .main-header, .btn, .filter-bar, .quick-os-btn, .notification-btn, .global-search { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .badge { border: 1px solid currentColor; }
}

/* ===================================================================
   RESPONSIVE: SMALL MOBILE (480px+)
   =================================================================== */
@media (min-width: 480px) {
    .day-summary-grid { grid-template-columns: repeat(4, 1fr); }
    .ds-value { font-size: 20px; }
    .ds-item { padding: 4px; background: transparent; }
    .stats-grid-8 { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 24px; }
    .stat-value-sm { font-size: 20px; }
    .stat-icon { width: 40px; height: 40px; }
    .chart-bars { gap: 6px; }
    .chart-bar-value { font-size: 11px; }
    .chart-bar-label { font-size: 10px; }
    .login-card { padding: 36px 32px; }
    .quick-action-card { padding: 24px 20px; }
}

/* ===================================================================
   RESPONSIVE: TABLET (768px+)
   =================================================================== */
@media (min-width: 768px) {
    .main-header { padding: 0 20px; }
    .main-header h1 { font-size: 17px; }
    .page-content { padding: 24px; }

    /* Show search on tablet */
    .global-search { display: block; }
    .global-search input { width: 200px; }

    /* Grid expansions */
    .grid-2 { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid-8 { grid-template-columns: repeat(4, 1fr); }

    /* Form rows expand */
    .form-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
    .form-control { font-size: 14px; }

    /* Detail grid 2 columns */
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-item { border-right: 1px solid var(--border-light); }
    .detail-item:nth-child(2n) { border-right: none; }

    /* Card sizing */
    .card-header { padding: 16px 20px; }
    .card-header h2, .card-header h3 { font-size: 15px; }
    .card-body { padding: 20px; }
    .card-footer { padding: 14px 20px; }

    /* Filter bar horizontal */
    .filter-bar { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .filter-bar .form-control { max-width: 200px; }
    .filter-bar .search-box .form-control { max-width: 280px; min-width: 180px; }

    /* Chart area */
    .chart-area { padding: 16px; }
    .chart-bars { gap: 6px; height: 180px; }
    .chart-bar-value { font-size: 12px; }
    .chart-bar-label { font-size: 10px; }
    .chart-legend { gap: 16px; }

    /* Day summary */
    .day-summary { padding: 14px 20px; }

    /* Tables back to normal */
    .table-cards thead { display: table-header-group; }
    .table-cards tbody { display: table-row-group; }
    .table-cards tbody tr {
        display: table-row;
        padding: 0; background: transparent;
        border: none; border-radius: 0;
        box-shadow: none;
    }
    .table-cards tbody tr { border-bottom: 1px solid var(--border-light); }
    .table-cards tbody tr:hover { background: #f9fafb; box-shadow: none; }
    .table-cards tbody td {
        display: table-cell;
        padding: 12px 16px; border: none;
        font-size: 14px; vertical-align: middle;
    }
    .table-cards tbody td::before { display: none; }
    .table-cards tbody td.card-actions { border-top: none; margin-top: 0; padding-top: 12px; }

    /* Measurement form - wider grid */
    .measurement-row-responsive {
        grid-template-columns: auto 1fr 1fr 1fr 1fr;
        align-items: end;
        padding: 8px 12px;
        background: transparent;
        border: none;
        border-radius: 0;
        margin-bottom: 4px;
    }
    .measurement-row-responsive .mf-cyl-label {
        grid-column: auto;
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
        text-align: center;
    }
    .measurement-row-responsive .mf-field label { display: none; }
    .measurement-row-responsive .mf-field.mf-notes { grid-column: auto; }
    .measurement-form-header { display: grid !important; }

    /* Parts form - wider grid */
    .part-row-responsive {
        grid-template-columns: 2fr 1fr 60px 1fr auto;
        align-items: end;
        padding: 4px 0;
        background: transparent;
        border: none;
        border-radius: 0;
        margin-bottom: 4px;
    }
    .part-row-responsive .pf-field label { display: none; }
    .part-row-responsive .pf-name { grid-column: auto; }

    /* Tabs */
    .tab-btn { padding: 12px 20px; font-size: 14px; }

    /* Production meta */
    .production-row { flex-wrap: nowrap; }
    .prod-meta { flex-wrap: nowrap; }

    .mb-3 { margin-bottom: 24px; }
}

/* ===================================================================
   RESPONSIVE: DESKTOP (1024px+)
   =================================================================== */
@media (min-width: 1024px) {
    /* Show sidebar, offset content */
    .sidebar { transform: translateX(0); }
    .main-content { margin-left: var(--sidebar-width); }
    .mobile-toggle { display: none; }

    .main-header { padding: 0 28px; }
    .main-header h1 { font-size: 18px; }
    .page-content { padding: 28px; }
    .header-date { display: inline; }

    /* Wider search */
    .global-search input { width: 280px; }

    /* Grid full expansion */
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .stats-grid-8 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

    /* Detail grid fluid */
    .detail-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .detail-item { border-right: 1px solid var(--border-light); }
    .detail-item:last-child { border-right: none; }

    /* Card sizing */
    .card-header { padding: 18px 24px; }
    .card-body { padding: 24px; }
    .card-footer { padding: 14px 24px; }

    /* Chart */
    .chart-area { padding: 20px; }
    .chart-bars { gap: 8px; height: 200px; }
    .chart-legend { gap: 20px; }
    .chart-legend-item { font-size: 12px; }
    .chart-legend-color { width: 12px; height: 12px; }

    /* Stat cards full */
    .stat-value { font-size: 26px; }
    .stat-value-sm { font-size: 20px; }

    /* Quick actions */
    .quick-action-card { padding: 28px 20px; }
    .quick-action-card .qa-icon { width: 48px; height: 48px; }
    .quick-action-card .qa-title { font-size: 15px; }

    /* Filter bar */
    .filter-bar .search-box .form-control { max-width: 320px; min-width: 200px; }
}

/* ===================================================================
   RESPONSIVE: WIDE (1280px+)
   =================================================================== */
@media (min-width: 1280px) {
    .stats-grid-8 { grid-template-columns: repeat(8, 1fr); }
    .day-summary-grid { gap: 16px; }
    .ds-value { font-size: 22px; }
}

/* ===================================================================
   PDF PREVIEW
   =================================================================== */
.pdf-template-selector {
    display: flex; flex-direction: column;
    gap: 12px; margin-bottom: 4px;
}
.pdf-template-option {
    flex: 1; display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border: 2px solid var(--border-color);
    border-radius: var(--radius); background: var(--bg-card);
    cursor: pointer; transition: all 0.2s;
}
.pdf-template-option:hover { border-color: var(--accent); }
.pdf-template-option.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: var(--accent-light);
}
.pdf-template-option input[type="radio"] { display: none; }
.pto-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.pto-text strong { display: block; font-size: 14px; color: var(--text-primary); }
.pto-text small { font-size: 12px; color: var(--text-muted); }

.pdf-visibility-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.pdf-visibility-grid label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    cursor: pointer; transition: background 0.15s;
    min-height: 44px;
}
.pdf-visibility-grid label:hover { background: #eff6ff; }

@media (min-width: 640px) {
    .pdf-template-selector { flex-direction: row; }
    .pdf-visibility-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* ===================================================================
   ANIMATIONS
   =================================================================== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.25s ease-out; }

/* ============================================================================
   RetíficaPRO ERP v2.0 – Additional Styles
   ============================================================================ */

/* --- Grid utilities --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.gap-2 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.ml-2 { margin-left: 8px; }
.nowrap { white-space: nowrap; }
.font-bold { font-weight: 700; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .kpi-grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
}

/* --- KPI cards --- */
.kpi-card {
    background: #fff; border-radius: 10px; padding: 16px; text-align: center;
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.kpi-card.kpi-accent { border-left: 4px solid var(--accent, #2563eb); }
.kpi-card.kpi-financial { border-left: 4px solid #10b981; }
.kpi-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; margin-bottom: 4px; }
.kpi-value { font-size: 1.5rem; font-weight: 800; color: #1e293b; line-height: 1.2; }
.kpi-sub { font-size: 0.7rem; color: #94a3b8; margin-top: 2px; }
.text-success { color: #10b981 !important; }
.text-danger { color: #ef4444 !important; }
.text-warning { color: #f59e0b !important; }
.text-info { color: #3b82f6 !important; }

/* --- Stage Timeline --- */
.stage-timeline {
    display: flex; gap: 8px; overflow-x: auto; padding: 16px 0;
}
.stage-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px;
    border-radius: 10px; min-width: 140px; flex: 1;
    border: 2px solid #e2e8f0; background: #f8fafc; transition: all .2s;
}
.stage-item.stage-completed { border-color: #10b981; background: #ecfdf5; }
.stage-item.stage-current { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.stage-item.stage-pending { opacity: .5; }
.stage-dot {
    width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; color: #fff; background: #94a3b8; flex-shrink: 0;
}
.stage-completed .stage-dot { background: #10b981; }
.stage-current .stage-dot { background: #2563eb; animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); } 50% { box-shadow: 0 0 0 8px rgba(37,99,235,0); } }
.stage-name { font-weight: 600; font-size: .85rem; color: #1e293b; }
.stage-date { font-size: .7rem; color: #64748b; }
.stage-notes { font-size: .7rem; color: #94a3b8; font-style: italic; margin-top: 2px; }

@media (max-width: 768px) {
    .stage-timeline { flex-direction: column; }
    .stage-item { min-width: unset; }
}

/* --- Tabs --- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid #e2e8f0; overflow-x: auto; }
.tab-btn {
    padding: 10px 18px; font-size: .85rem; font-weight: 600; background: none; border: none;
    color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
    white-space: nowrap; transition: all .2s;
}
.tab-btn:hover { color: #1e293b; }
.tab-btn.active { color: var(--accent, #2563eb); border-bottom-color: var(--accent, #2563eb); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Photo gallery --- */
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-card {
    position: relative; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.photo-card img { width: 100%; height: 150px; object-fit: cover; display: block; }
.photo-info { padding: 8px; font-size: .75rem; }
.photo-info .badge { margin-right: 4px; }
.photo-delete { position: absolute; top: 6px; right: 6px; }
.photo-upload-form { padding: 12px; background: #f8fafc; border-radius: 8px; border: 1px dashed #cbd5e1; }

/* --- History list --- */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { padding: 10px; border-left: 3px solid #e2e8f0; padding-left: 14px; }
.history-meta { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: .8rem; }
.history-detail { font-size: .8rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* --- Badge variants --- */
.badge-admin { background: #7c3aed; color: #fff; }
.badge-socio { background: #2563eb; color: #fff; }
.badge-tecnico { background: #0891b2; color: #fff; }
.badge-financeiro { background: #059669; color: #fff; }
.badge-consulta { background: #94a3b8; color: #fff; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-audit { background: #f1f5f9; color: #475569; font-size: .7rem; }
.badge-urgente { background: #ef4444; color: #fff; }
.badge-alta { background: #f59e0b; color: #fff; }
.badge-normal { background: #64748b; color: #fff; }

/* Status badges */
.badge-recebido { background: #dbeafe; color: #1e40af; }
.badge-desmontagem { background: #fef3c7; color: #92400e; }
.badge-medicao { background: #e0e7ff; color: #3730a3; }
.badge-usinagem { background: #fce7f3; color: #9d174d; }
.badge-conferencia { background: #d1fae5; color: #065f46; }
.badge-aguardando_peca { background: #ffedd5; color: #9a3412; }
.badge-finalizado { background: #dcfce7; color: #166534; }
.badge-entregue { background: #f0fdf4; color: #14532d; }
.badge-cancelado { background: #fee2e2; color: #991b1b; }

/* Warranty status badges */
.badge-aberto { background: #fef3c7; color: #92400e; }
.badge-em_analise { background: #dbeafe; color: #1e40af; }
.badge-procedente { background: #fee2e2; color: #991b1b; }
.badge-improcedente { background: #f1f5f9; color: #475569; }
.badge-resolvido { background: #dcfce7; color: #166534; }

/* Part status */
.badge-pendente { background: #fef3c7; color: #92400e; }
.badge-encomendada { background: #dbeafe; color: #1e40af; }
.badge-recebida { background: #d1fae5; color: #065f46; }
.badge-aplicada { background: #dcfce7; color: #166534; }

/* --- Info list --- */
.info-list { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: .85rem; }

/* --- Filter bar --- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { padding: 7px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: .85rem; }
.filter-bar input { min-width: 180px; }
.checkbox-label { display: flex; align-items: center; gap: 4px; font-size: .85rem; cursor: pointer; }

/* --- Alert card (dashboard) --- */
.alert-card { border-left: 4px solid #f59e0b; }
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; font-size: .83rem; }
.alert-item.alert-danger { background: #fef2f2; }
.alert-item.alert-warning { background: #fffbeb; }
.alert-item.alert-info { background: #eff6ff; }
.alert-icon { flex-shrink: 0; }

/* --- Production list --- */
.production-list { display: flex; flex-direction: column; gap: 6px; }
.production-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: .85rem; flex-wrap: wrap; }

/* --- Audit feed --- */
.audit-feed { display: flex; flex-direction: column; gap: 6px; }
.audit-feed-item { display: flex; gap: 8px; font-size: .8rem; padding: 4px 0; border-bottom: 1px solid #f8fafc; align-items: center; }
.audit-feed-time { color: #94a3b8; font-family: 'JetBrains Mono', monospace; font-size: .7rem; }
.audit-feed-user { font-weight: 600; color: #1e293b; }
.audit-feed-action { color: #2563eb; }
.audit-details { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Status bars (dashboard) --- */
.status-bars { display: flex; flex-direction: column; gap: 6px; }
.status-bar-row { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.status-bar-label { width: 110px; text-align: right; color: #64748b; flex-shrink: 0; }
.status-bar-track { flex: 1; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 4px; transition: width .5s; }
.status-bar-count { width: 30px; text-align: right; font-weight: 600; }
.status-recebido { background: #3b82f6; }
.status-desmontagem { background: #f59e0b; }
.status-medicao { background: #6366f1; }
.status-usinagem { background: #ec4899; }
.status-conferencia { background: #10b981; }
.status-aguardando_peca { background: #f97316; }
.status-finalizado { background: #22c55e; }
.status-entregue { background: #06b6d4; }
.status-cancelado { background: #ef4444; }

/* --- Day summary --- */
.day-summary { background: linear-gradient(135deg, #1e293b, #334155); border-radius: 12px; padding: 16px 20px; color: #fff; }
.day-summary-title { font-size: .85rem; opacity: .8; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.day-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ds-item { text-align: center; }
.ds-value { font-size: 1.3rem; font-weight: 800; display: block; }
.ds-label { font-size: .7rem; opacity: .7; }
.ds-blue { color: #60a5fa; } .ds-green { color: #34d399; } .ds-emerald { color: #6ee7b7; } .ds-orange { color: #fb923c; }
@media (max-width: 768px) { .day-summary-grid { grid-template-columns: repeat(2, 1fr); } }

/* --- Form grid --- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

/* --- Table improvements --- */
.table-sm th, .table-sm td { padding: 6px 10px; font-size: .82rem; }
.row-warning { background: #fffbeb !important; }
.btn-group { display: flex; gap: 4px; }

/* --- Pagination --- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 16px 0; }
.pagination-info { font-size: .85rem; color: #64748b; }

/* --- Chart container --- */
.chart-container { position: relative; height: 220px; }

/* --- Checklist --- */
.checklist-list { display: flex; flex-direction: column; gap: 4px; }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; font-size: .85rem; }
.checklist-item input[type="checkbox"] { width: 18px; height: 18px; }

/* --- Card title --- */
.card-title { font-size: 1rem; font-weight: 700; color: #1e293b; margin-bottom: 12px; }

/* ===================================================================
   ERP v2.0 – COMPREHENSIVE CSS FIXES
   =================================================================== */

/* --- btn-outline (MISSING – used everywhere) --- */
.btn-outline {
    background: #fff; color: var(--text-secondary, #4b5563);
    border: 1px solid var(--border-strong, #d1d5db);
}
.btn-outline:hover {
    background: var(--bg-section, #f7f8fa);
    color: var(--text-primary, #111827);
    border-color: var(--text-muted, #9ca3af);
}

/* --- page-header (MISSING – used in all module views) --- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light, #eef0f3);
}
.page-header h2 {
    font-size: 1.35rem; font-weight: 800; color: var(--text-primary, #111827);
    letter-spacing: -0.3px; margin: 0;
}
.page-header p { margin: 0; }
.page-header .flex,
.page-header > div:last-child:not(:first-child) {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
@media (max-width: 480px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .btn { width: 100%; }
}

/* --- table-responsive (MISSING – used in all table views) --- */
.table-responsive {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm, 6px);
}

/* --- Card internal padding for direct child containers --- */
.card > .form-grid,
.card > form.form-grid {
    padding: 20px;
}
.card > .form-stack,
.card > form.form-stack {
    padding: 20px;
}
.card > .filter-bar,
.card > form.filter-bar {
    padding: 16px 20px;
}
.card > .info-list {
    padding: 16px 20px;
}
.card > .table-responsive {
    padding: 0;
}
.card > .table-responsive table {
    margin: 0;
}
.card > .card-title,
.card > h3.card-title,
.card > h4.card-title {
    padding: 18px 20px 0 20px;
}
.card > .card-title + .info-list,
.card > .card-title + .form-stack,
.card > .card-title + .form-grid,
.card > .card-title + .status-bars,
.card > .card-title + .production-list,
.card > .card-title + .audit-feed,
.card > .card-title + p {
    padding: 0 20px 20px;
}
.card > .card-title + .table-responsive {
    padding: 0;
}
.card > .card-title:first-child ~ .table-responsive:last-child {
    padding: 0;
}

/* --- Auto-style form elements inside .form-group (avoids adding classes to every input) --- */
.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text-secondary, #4b5563);
    margin-bottom: 6px; letter-spacing: 0.2px;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input, #ffffff);
    border: 1px solid var(--border-color, #e2e5ea);
    border-radius: var(--radius-sm, 6px);
    color: var(--text-primary, #111827);
    font-size: 15px; font-family: var(--font);
    transition: var(--transition); outline: none;
    min-height: 44px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted, #9ca3af);
}
.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.form-group textarea {
    resize: vertical; min-height: 80px;
}
.form-group small {
    display: block; font-size: 12px; color: var(--text-muted, #9ca3af); margin-top: 4px;
}

/* --- Improved form-grid inside cards (remove double margin-bottom) --- */
.form-grid .form-group,
.form-stack .form-group {
    margin-bottom: 0;
}

/* --- Improved filter-bar (for use inside cards) --- */
.filter-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.filter-bar input[type="text"],
.filter-bar input[type="search"],
.filter-bar select {
    padding: 9px 14px;
    border: 1px solid var(--border-color, #e2e5ea);
    border-radius: var(--radius-sm, 6px);
    font-size: 14px; font-family: var(--font);
    background: var(--bg-input, #fff);
    min-height: 40px; outline: none;
    transition: var(--transition);
}
.filter-bar input[type="text"]:focus,
.filter-bar input[type="search"]:focus,
.filter-bar select:focus {
    border-color: var(--accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.filter-bar input[type="text"] { min-width: 180px; flex: 1; max-width: 320px; }
.filter-bar select { min-width: 140px; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
@media (max-width: 640px) {
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar input[type="text"],
    .filter-bar select { max-width: 100%; min-width: 0; width: 100%; }
}

/* --- Improved checkbox-label --- */
.checkbox-label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; cursor: pointer;
    padding: 6px 0; white-space: nowrap;
}
.checkbox-label input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--accent, #2563eb);
}

/* --- Improved btn-group --- */
.btn-group {
    display: inline-flex; gap: 6px; align-items: center;
    flex-wrap: wrap;
}

/* --- Improved info-list & info-row --- */
.info-list {
    display: flex; flex-direction: column; gap: 0;
}
.info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light, #eef0f3);
    font-size: 14px; gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-row > span:first-child { color: var(--text-muted, #9ca3af); flex-shrink: 0; }
.info-row > span:last-child { font-weight: 600; text-align: right; }

/* --- Improved form-actions --- */
.form-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding-top: 16px; margin-top: 8px;
    border-top: 1px solid var(--border-light, #eef0f3);
}

/* --- Production list padding in card --- */
.card > .production-list {
    padding: 0 20px 16px;
}
.card > .status-bars {
    padding: 0 20px 16px;
}
.card > .audit-feed {
    padding: 0 20px 16px;
}

/* --- Card > direct p text --- */
.card > p {
    padding: 12px 20px;
}

/* --- Improved production-item & audit-feed-item --- */
.production-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border-light, #eef0f3);
    font-size: 14px; flex-wrap: wrap;
}
.production-item:last-child { border-bottom: none; }

.audit-feed-item {
    display: flex; gap: 10px; font-size: 13px;
    padding: 8px 0; border-bottom: 1px solid var(--border-light, #eef0f3);
    align-items: center;
}
.audit-feed-item:last-child { border-bottom: none; }

/* --- Card for alerts (dashboard) --- */
.alert-card {
    border-left: 4px solid var(--warning, #d97706);
}
.card.alert-card > .card-title {
    padding: 18px 20px 8px 20px;
}
.card.alert-card > .alert-list {
    padding: 0 20px 16px;
}

/* --- Status bars inside card --- */
.status-bars { display: flex; flex-direction: column; gap: 10px; }
.status-bar-row {
    display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.status-bar-label {
    width: 120px; text-align: right; color: var(--text-muted, #9ca3af);
    flex-shrink: 0; font-weight: 500;
}
.status-bar-track {
    flex: 1; height: 8px; background: var(--bg-section, #f7f8fa);
    border-radius: 4px; overflow: hidden;
}
.status-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.status-bar-count {
    width: 32px; text-align: right; font-weight: 700;
    color: var(--text-primary, #111827);
}
@media (max-width: 480px) {
    .status-bar-label { width: 80px; font-size: 11px; }
}

/* --- Chart container in card --- */
.card > .chart-container {
    padding: 0 20px 20px;
}

/* --- Pagination improvements --- */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 12px; padding: 16px 20px;
    border-top: 1px solid var(--border-light, #eef0f3);
}

/* --- Better hr inside forms --- */
.form-stack hr {
    border: none;
    border-top: 1px solid var(--border-light, #eef0f3);
    margin: 8px 0;
}
.form-stack h4 {
    font-size: 15px; font-weight: 700;
    color: var(--text-primary, #111827);
    margin-bottom: 4px;
}

/* --- Alert with margin --- */
.alert.mb-3 { margin-bottom: 20px; }

/* --- Responsive grid-2 at small screens for stock/show forms --- */
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    .status-bar-row { font-size: 12px; }
}

/* --- Better card hover for KPI cards inside grid --- */
.kpi-card { transition: var(--transition); }
.kpi-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

/* --- Ensure form-grid responsive at mobile --- */
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr !important; }
    .form-grid .form-group[style*="grid-column"] { grid-column: 1 !important; }
    .form-actions[style*="grid-column"] { grid-column: 1 !important; }
}
