:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-card: #1c1c1f;
    --bg-elevated: #222225;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-gold: #d4a574;
    --accent-gold-light: #e8c9a8;
    --accent-gold-dark: #b8956a;
    --accent-emerald: #34d399;
    --accent-red: #f87171;
    --accent-amber: #fbbf24;
    --accent-blue: #60a5fa;
    --border-subtle: rgba(255,255,255,0.06);
    --border-medium: rgba(255,255,255,0.1);
    --glass: rgba(255,255,255,0.03);
    --shadow-glow: 0 0 80px rgba(212,165,116,0.08);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-2xl: 48px;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

.font-display { font-family: 'Playfair Display', serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-gold-dark); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.6s ease-out forwards; }
.animate-fade-in-up { animation: fadeInUp 0.7s ease-out forwards; }
.animate-slide-in { animation: slideInRight 0.5s ease-out forwards; }

.stagger-1 { animation-delay: 0.1s; opacity: 0; }
.stagger-2 { animation-delay: 0.2s; opacity: 0; }
.stagger-3 { animation-delay: 0.3s; opacity: 0; }
.stagger-4 { animation-delay: 0.4s; opacity: 0; }
.stagger-5 { animation-delay: 0.5s; opacity: 0; }

.bg-noise {
    position: fixed;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.bg-gradient-radial {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(212,165,116,0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10,10,11,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.logo-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.logo-text h1 span {
    color: var(--accent-gold);
}

.logo-text p {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Navigation */
nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.375rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.nav-btn:hover { color: var(--text-primary); }
.nav-btn.active { color: var(--bg-primary); }
.nav-btn.active::before { opacity: 1; }
.nav-btn span { position: relative; z-index: 1; }

/* Main Content */
main {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Section Headers */
.section-header { margin-bottom: 2.5rem; }
.section-header .overline {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-bottom: 0.75rem;
}
.section-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}
.section-header h2 span { color: var(--accent-gold); }
.section-header .description {
    max-width: 700px;
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Manual Section Cards */
.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.manual-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.manual-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), transparent);
}

.manual-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-medium);
}

.manual-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.manual-card-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(212,165,116,0.2), rgba(212,165,116,0.05));
    border: 1px solid rgba(212,165,116,0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold);
}

.manual-card-icon i { width: 20px; height: 20px; }

.manual-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.manual-card-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.manual-card-content ul {
    list-style: none;
    margin-top: 1rem;
}

.manual-card-content li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    border-bottom: 1px solid var(--border-subtle);
}

.manual-card-content li:last-child { border-bottom: none; }

.manual-card-content li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-gold);
    font-weight: 600;
}

/* Roles Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.role-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.role-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.role-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Impact Cards */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.impact-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.impact-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.impact-card.n1::after { background: var(--accent-red); }
.impact-card.n2::after { background: var(--accent-amber); }
.impact-card.desvio::after { background: var(--text-muted); }

.impact-card:hover {
    transform: translateX(8px);
    border-color: var(--border-medium);
}

.impact-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.impact-card.n1 .impact-icon { background: rgba(248,113,113,0.1); color: var(--accent-red); }
.impact-card.n2 .impact-icon { background: rgba(251,191,36,0.1); color: var(--accent-amber); }
.impact-card.desvio .impact-icon { background: var(--glass); color: var(--text-muted); }
.impact-icon i { width: 24px; height: 24px; }

.impact-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.impact-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Definición de Incidente */
.incident-definition {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: 3rem;
    margin: 3rem 0;
}

.incident-definition h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.incident-definition h3 span { color: var(--accent-gold); }

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

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

.definition-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.definition-box.incident { border-left: 4px solid var(--accent-red); }
.definition-box.desvio { border-left: 4px solid var(--accent-emerald); }

.definition-box h4 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.definition-box.incident h4 { color: var(--accent-red); }
.definition-box.desvio h4 { color: var(--accent-emerald); }

.definition-box p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.definition-box ul {
    list-style: none;
}

.definition-box li {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.4rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.definition-box li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-gold);
}

/* MATRIZ DE RIESGO */
.risk-matrix-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.matrix-header {
    padding: 2.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.matrix-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.matrix-header p {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

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

.matrix-table thead { background: var(--bg-tertiary); }

.matrix-table th {
    padding: 1.25rem 1.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.matrix-table th.center { text-align: center; }
.matrix-table tbody tr { transition: background 0.3s ease; }
.matrix-table tbody tr:hover { background: var(--glass); }

.matrix-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.matrix-table td.center { text-align: center; }

.risk-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.risk-mitigation {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.prob-imp {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.risk-badge {
    display: inline-flex;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.risk-badge.critical { background: rgba(127,29,29,0.3); color: #fca5a5; border: 1px solid rgba(248,113,113,0.3); }
.risk-badge.high { background: rgba(185,28,28,0.2); color: #fca5a5; border: 1px solid rgba(248,113,113,0.2); }
.risk-badge.medium { background: rgba(217,119,6,0.2); color: #fcd34d; border: 1px solid rgba(251,191,36,0.2); }
.risk-badge.low { background: rgba(21,128,61,0.2); color: #86efac; border: 1px solid rgba(52,211,153,0.2); }

.risk-legend {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.legend-item {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border-subtle);
}

.legend-item.critical { background: rgba(127,29,29,0.15); border-color: rgba(248,113,113,0.2); }
.legend-item.high { background: rgba(185,28,28,0.1); border-color: rgba(248,113,113,0.15); }
.legend-item.medium { background: rgba(217,119,6,0.1); border-color: rgba(251,191,36,0.15); }
.legend-item.low { background: rgba(21,128,61,0.1); border-color: rgba(52,211,153,0.15); }

.legend-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.legend-item.critical .legend-label { color: #fca5a5; }
.legend-item.high .legend-label { color: #fca5a5; }
.legend-item.medium .legend-label { color: #fcd34d; }
.legend-item.low .legend-label { color: #86efac; }
.legend-text { font-size: 0.65rem; color: var(--text-muted); }

/* PROTOCOLOS */
.protocols-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.protocols-header {
    padding: 2rem 2.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: var(--bg-secondary);
}

.protocols-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.protocols-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-search {
    position: relative;
}

.filter-search input {
    width: 280px;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

.filter-search input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212,165,116,0.1);
}

.filter-search input::placeholder { color: var(--text-muted); }

.filter-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.filter-select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: all 0.3s ease;
}

.filter-select:focus { border-color: var(--accent-gold); }

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

.protocols-table thead { background: var(--bg-tertiary); }

.protocols-table th {
    padding: 1.25rem 1.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.protocols-table tbody tr { transition: all 0.3s ease; }
.protocols-table tbody tr:hover { background: var(--glass); }

.protocols-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.protocol-stage {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    background: var(--glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.protocol-event {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.protocol-games {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.protocol-impact {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.level-badge {
    display: inline-flex;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.level-badge.n1 { background: rgba(248,113,113,0.15); color: #fca5a5; border: 1px solid rgba(248,113,113,0.2); }
.level-badge.n2 { background: rgba(251,191,36,0.15); color: #fcd34d; border: 1px solid rgba(251,191,36,0.2); }
.level-badge.desvio { background: var(--glass); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.level-badge.normal { background: rgba(52,211,153,0.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.2); }

.protocol-action { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.protocol-comm { font-size: 0.8rem; font-weight: 600; color: var(--accent-gold); }
.protocol-time { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-muted); }

/* RACI Section */
.raci-section { margin-top: 3rem; }

.raci-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.raci-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.raci-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), transparent);
}

.raci-level {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.raci-card.n1 .raci-level { color: var(--accent-red); }
.raci-card.n2 .raci-level { color: var(--accent-amber); }
.raci-card.desvio .raci-level { color: var(--text-muted); }

.raci-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.raci-item:last-child { border-bottom: none; }
.raci-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.raci-value { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); text-align: right; }

/* LOGGER */
.logger-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

@media (max-width: 1200px) {
    .logger-grid { grid-template-columns: 1fr; }
}

.logger-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
}

.form-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.form-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
}

.form-icon i { width: 28px; height: 28px; }

.form-title h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.form-title p {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full { grid-column: 1 / -1; }

.form-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(212,165,116,0.1);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

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

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn i { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
    color: var(--bg-primary);
    box-shadow: 0 4px 20px rgba(212,165,116,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212,165,116,0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-medium);
}

/* Live Feed */
.live-feed-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    max-height: 700px;
}

.feed-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.feed-header i { color: var(--accent-gold); width: 18px; height: 18px; }

.feed-header span {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.feed-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem;
}

.feed-empty p {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.5;
}

.feed-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border-left: 3px solid var(--accent-gold);
    animation: slideInRight 0.4s ease-out;
}

.feed-item.n1 { border-left-color: var(--accent-red); }
.feed-item.n2 { border-left-color: var(--accent-amber); }

.feed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.feed-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.feed-level {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--glass);
    border: 1px solid var(--border-subtle);
}

.feed-item.n1 .feed-level { color: var(--accent-red); border-color: rgba(248,113,113,0.2); }
.feed-item.n2 .feed-level { color: var(--accent-amber); border-color: rgba(251,191,36,0.2); }

.feed-game {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.feed-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.feed-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.feed-meta {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.feed-audit {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.feed-audit.ok { color: var(--accent-emerald); }
.feed-audit.pending { color: var(--accent-amber); }
.feed-audit.error { color: var(--accent-red); }

/* CONSULTA INCIDENTES */
.consulta-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.consulta-filters {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 140px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.filter-group.filter-actions {
    flex-direction: row;
    align-items: flex-end;
    gap: 0.5rem;
}

.consulta-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    text-align: center;
    min-width: 120px;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-card.abierto .stat-value { color: var(--accent-red); }
.stat-card.en-proceso .stat-value { color: var(--accent-amber); }
.stat-card.cerrado .stat-value { color: var(--accent-emerald); }

.consulta-table-container {
    overflow-x: auto;
}

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

.consulta-table thead {
    background: var(--bg-tertiary);
}

.consulta-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-medium);
}

.consulta-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.consulta-table tbody tr:hover {
    background: var(--glass);
}

.consulta-table .empty-table {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    font-style: italic;
}

.consulta-table .nivel-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.consulta-table .nivel-badge.n1 {
    background: rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
}

.consulta-table .nivel-badge.n2 {
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-amber);
}

.consulta-table .nivel-badge.desvio {
    background: rgba(161, 161, 170, 0.2);
    color: var(--text-secondary);
}

.estado-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}

.estado-badge.abierto {
    background: rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
}

.estado-badge.en_proceso {
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-amber);
}

.estado-badge.cerrado {
    background: rgba(52, 211, 153, 0.2);
    color: var(--accent-emerald);
}

.estado-select {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-medium);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
}

.estado-select:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.estado-select.abierto { border-color: var(--accent-red); }
.estado-select.en_proceso { border-color: var(--accent-amber); }
.estado-select.cerrado { border-color: var(--accent-emerald); }

.btn-ver-detalle {
    padding: 0.4rem 0.8rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ver-detalle:hover {
    background: var(--accent-gold);
    color: var(--bg-primary);
    border-color: var(--accent-gold);
}

.descripcion-truncada {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-container {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-header h3 span {
    color: var(--accent-gold);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 1.5rem;
}

.modal-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
}

.modal-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.modal-row:last-child {
    margin-bottom: 0;
}

.modal-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 100px;
}

.modal-row span:last-child,
.modal-row p {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.modal-divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 1.5rem 0;
}

.modal-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.modal-form .form-group.full {
    grid-column: span 2;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}

/* Fila clickeable */
.consulta-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.consulta-table tbody tr:hover {
    background: rgba(212, 165, 116, 0.1);
}

/* Footer */
footer {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    padding: 3rem 2rem;
    text-align: center;
}

.footer-text {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        padding: 1rem;
    }
    nav {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }
    .nav-btn {
        padding: 0.625rem 1rem;
        white-space: nowrap;
    }
    main { padding: 1.5rem 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .risk-legend { grid-template-columns: repeat(2, 1fr); }
    .manual-grid { grid-template-columns: 1fr; }
}
