/* ══════════════════════════════════════════════════════════════
   SYNERGIA O&M — Partes de Guardia de Retén
   Industrial / Utility-grade Design System
   ══════════════════════════════════════════════════════════════ */

:root {
    --navy:      #1a3a5c;
    --navy-dark: #0f2440;
    --blue:      #2980b9;
    --blue-light:#e8f0f8;
    --green:     #27ae60;
    --red:       #e74c3c;
    --orange:    #f39c12;
    --gray-50:   #f8f9fa;
    --gray-100:  #f0f2f5;
    --gray-200:  #e2e5e9;
    --gray-300:  #bdc3c7;
    --gray-500:  #7f8c8d;
    --gray-700:  #4a5568;
    --gray-900:  #1a202c;
    --radius:    8px;
    --radius-lg: 12px;
    --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
    --font:      'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:      'JetBrains Mono', monospace;
}

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

html { font-size: 15px; }

body {
    font-family: var(--font);
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── NAVBAR ─────────────────────────────────────────────────── */

.navbar {
    background: var(--navy-dark);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover { color: white; }

.btn-nav {
    background: var(--blue) !important;
    color: white !important;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-weight: 600 !important;
}

.nav-user {
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.15);
}

.nav-logout { color: rgba(255,255,255,0.4) !important; font-size: 0.8rem !important; }

/* ── CONTAINER ──────────────────────────────────────────────── */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 20px;
    flex: 1;
}

/* ── FLASH ──────────────────────────────────────────────────── */

.flash-container { max-width: 1000px; margin: 12px auto 0; padding: 0 20px; }

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    border-left: 4px solid;
}

.flash-success { background: #f0fdf4; color: #166534; border-color: var(--green); }
.flash-danger  { background: #fef2f2; color: #991b1b; border-color: var(--red); }
.flash-warning { background: #fffbeb; color: #92400e; border-color: var(--orange); }
.flash-info    { background: var(--blue-light); color: var(--navy); border-color: var(--blue); }

/* ── BUTTONS ────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    gap: 6px;
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn:hover { background: var(--gray-200); }

.btn-primary {
    background: var(--navy);
    color: white;
    border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); }

.btn-outline {
    background: transparent;
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }

.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-full { width: 100%; }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── LOGIN ──────────────────────────────────────────────────── */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header svg { margin-bottom: 12px; }
.login-header h1 { font-size: 1.3rem; color: var(--navy); margin-bottom: 4px; }
.login-header p { color: var(--gray-500); font-size: 0.85rem; }

/* ── FORMS ──────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--gray-900);
    background: white;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

.form-group textarea { resize: vertical; min-height: 60px; }

.input-disabled {
    background: var(--gray-100) !important;
    color: var(--gray-500) !important;
    cursor: not-allowed;
}

.required-mark { color: var(--red); font-weight: 700; }

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

.time-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-range input { flex: 1; }
.time-sep { color: var(--gray-300); font-weight: 600; }

/* ── FORM SECTIONS ──────────────────────────────────────────── */

.form-page { max-width: 900px; margin: 0 auto; }

.form-header {
    margin-bottom: 24px;
}
.form-header h1 { font-size: 1.5rem; color: var(--navy); }
.form-header p { color: var(--gray-500); font-size: 0.85rem; margin-top: 4px; }

.form-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.form-section--accent {
    border: 2px solid var(--blue);
    border-top: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.form-section--accent .section-header {
    background: rgba(41,128,185,0.05);
}

.section-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--navy);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 1rem;
    color: var(--navy);
    font-weight: 700;
}

.section-note {
    padding: 8px 20px;
    font-size: 0.8rem;
    color: var(--gray-500);
    font-style: italic;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.section-body { padding: 20px; }

/* ── SCADA TABLE ────────────────────────────────────────────── */

.table-responsive { overflow-x: auto; }

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

.scada-table th {
    background: var(--navy);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 10px 8px;
    text-align: center;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.scada-table td {
    padding: 6px 4px;
    border-bottom: 1px solid var(--gray-200);
    text-align: center;
}

.scada-table tr:nth-child(even) { background: var(--gray-50); }

.input-sm {
    padding: 6px 8px !important;
    font-size: 0.82rem !important;
    text-align: center;
}

.input-center { text-align: center; }

/* ── CHECKLIST ──────────────────────────────────────────────── */

.checklist { display: flex; flex-direction: column; gap: 10px; }

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.check-item:hover { border-color: var(--blue); background: rgba(41,128,185,0.02); }

.check-item input[type="checkbox"] { display: none; }

.check-box {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-top: 2px;
}

.check-item input:checked + .check-box {
    background: var(--green);
    border-color: var(--green);
}

.check-item input:checked + .check-box::after {
    content: "✓";
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.check-content strong {
    display: block;
    font-size: 0.9rem;
    color: var(--navy);
    margin-bottom: 2px;
}

.check-content span {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ── INCIDENCIAS ────────────────────────────────────────────── */

.incidencia-block {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: white;
}

.inc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.inc-badge {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--blue);
    background: var(--blue-light);
    padding: 3px 10px;
    border-radius: 4px;
}

.btn-remove-inc {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-remove-inc:hover { background: #fef2f2; color: var(--red); }

/* ── FIRMA ──────────────────────────────────────────────────── */

.firma-section { margin-top: 16px; }
.firma-section > label { font-weight: 600; margin-bottom: 8px; display: block; }

.firma-wrapper {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 4px;
    background: white;
    display: inline-block;
}

.firma-wrapper canvas {
    display: block;
    cursor: crosshair;
    border-radius: 4px;
    max-width: 100%;
}

.firma-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.firma-note { font-size: 0.75rem; color: var(--gray-500); }

/* ── FORM ACTIONS ───────────────────────────────────────────── */

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px 0;
}

/* ── DASHBOARD ──────────────────────────────────────────────── */

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dash-header h1 { font-size: 1.4rem; color: var(--navy); }
.dash-header p { color: var(--gray-500); font-size: 0.85rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th {
    background: var(--navy);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 12px 14px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.85rem;
}

.data-table tr:hover td { background: var(--gray-50); }

.ref-badge {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--blue);
    font-weight: 600;
}

.status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-ok { background: #f0fdf4; color: #166534; }
.status-warn { background: #fffbeb; color: #92400e; }

/* ── EMPTY STATE ────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.empty-state h3 { margin-top: 16px; color: var(--navy); }
.empty-state p { color: var(--gray-500); margin: 8px 0 20px; }

/* ── SUCCESS ────────────────────────────────────────────────── */

.success-page {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.success-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.success-icon { margin-bottom: 16px; }
.success-card h1 { font-size: 1.3rem; color: var(--navy); margin-bottom: 8px; }
.success-ref { color: var(--gray-500); font-size: 0.9rem; }

.success-details {
    margin: 24px 0;
    text-align: left;
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.85rem;
}

.detail-row:last-child { border-bottom: none; }
.detail-row span { color: var(--gray-500); }

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── FOOTER ─────────────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 16px;
    font-size: 0.75rem;
    color: var(--gray-500);
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    .nav-links { gap: 8px; }
    .nav-user { display: none; }
    .dash-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .form-actions { flex-direction: column; }
    .success-actions { flex-direction: column; }
    .firma-wrapper canvas { width: 100%; height: auto; }
}
