/* ==========================================================================
   Condiciones Subestándar — Design System
   ========================================================================== */

:root {
    --primary: #1B3A5C;
    --primary-light: #2A5580;
    --primary-dark: #122A42;
    --accent: #3B82F6;
    --accent-soft: #EFF6FF;
    --secondary: #10B981;
    --secondary-soft: #ECFDF5;
    --danger: #EF4444;
    --danger-soft: #FEF2F2;
    --warning: #F59E0B;
    --warning-soft: #FFFBEB;
    --info: #6366F1;
    --info-soft: #EEF2FF;

    --bg: #EEF2F7;
    --bg-pattern:
        radial-gradient(ellipse 80% 60% at 10% -10%, rgba(59, 130, 246, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, #F8FAFC 0%, #EEF2F7 100%);
    --surface: #FFFFFF;
    --surface-raised: #FFFFFF;
    --surface-muted: #F8FAFC;
    --surface-hover: #F1F5F9;

    --text-main: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border: rgba(148, 163, 184, 0.25);
    --border-strong: rgba(148, 163, 184, 0.45);

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.09), 0 4px 12px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.1);

    --header-height: 68px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body,
.app-body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    background-image: var(--bg-pattern);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 55%, #3B82F6 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(27, 58, 92, 0.28);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.03em;
}

.brand-tagline {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.main-nav {
    display: flex;
    align-items: center;
}

.nav-pills {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.85);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 4px 12px rgba(27, 58, 92, 0.22);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 3rem;
    animation: fadeInUp 0.45s ease-out;
}

/* Page Hero */
.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 2rem 2.25rem;
    margin-bottom: 1.75rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 45%, var(--primary-light) 100%);
    color: #fff;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(59,130,246,0.25) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero-content {
    position: relative;
    z-index: 1;
    max-width: 640px;
}

.page-hero-eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
}

.page-hero-title {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.page-hero-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.55;
    max-width: 520px;
}

.page-hero-cta {
    position: relative;
    z-index: 1;
    background: #fff !important;
    color: var(--primary) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    flex-shrink: 0;
}

.page-hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2) !important;
}

.container { max-width: 760px; }
.container-lg { max-width: 1200px; }

.page-header {
    margin-bottom: 1.75rem;
    padding: 1.5rem 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { opacity: 0.5; }

/* ==========================================================================
   Cards & Panels
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card--table {
    border-radius: var(--radius-xl);
}

.card + .card { margin-top: 1.5rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.card-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header-title h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.card-icon--primary { background: var(--accent-soft); color: var(--accent); }
.card-icon--success { background: var(--secondary-soft); color: var(--secondary); }
.card-icon--warning { background: var(--warning-soft); color: var(--warning); }
.card-icon--info { background: var(--info-soft); color: var(--info); }
.card-icon--danger { background: var(--danger-soft); color: var(--danger); }

.card-body { padding: 1.5rem; }

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--surface-muted);
    border-top: 1px solid var(--border);
}

/* Legacy alias */
.glass-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card-top {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex-shrink: 0;
}

.stat-icon--total { background: var(--accent-soft); color: var(--primary); }
.stat-icon--open { background: var(--danger-soft); color: var(--danger); }
.stat-icon--progress { background: var(--warning-soft); color: var(--warning); }
.stat-icon--closed { background: var(--secondary-soft); color: var(--secondary); }

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card--total::before { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card--open::before { background: linear-gradient(90deg, #F87171, var(--danger)); }
.stat-card--progress::before { background: linear-gradient(90deg, #FBBF24, var(--warning)); }
.stat-card--closed::before { background: linear-gradient(90deg, #34D399, var(--secondary)); }

.stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.04em;
    line-height: 1;
}

.stat-card--total .stat-value { color: var(--primary); }
.stat-card--open .stat-value { color: var(--danger); }
.stat-card--progress .stat-value { color: var(--warning); }
.stat-card--closed .stat-value { color: var(--secondary); }

/* ==========================================================================
   Table
   ========================================================================== */

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.table-toolbar h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.table-toolbar-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    background: var(--accent-soft);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

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

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

.data-table thead {
    background: transparent;
}

.data-table th {
    padding: 0.9rem 1.5rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table-row {
    transition: background var(--transition), transform var(--transition);
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

.data-table .nc-area-assigned {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary-light);
    background: var(--accent-soft);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.cell-date {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--text-main);
}

.cell-tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

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

.data-table .nc-id {
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.data-table .nc-title {
    font-weight: 500;
    color: var(--text-main);
    max-width: 280px;
}

.data-table .nc-title-text {
    display: block;
    font-weight: 600;
    color: var(--text-main);
}


/* Legacy table */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #F8FAFC; }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-open { background: var(--danger-soft); color: #B91C1C; border-color: rgba(239, 68, 68, 0.2); }
.badge-open::before { background: #EF4444; }

.badge-analysis { background: var(--warning-soft); color: #B45309; border-color: rgba(245, 158, 11, 0.25); }
.badge-analysis::before { background: #F59E0B; }

.badge-action { background: var(--accent-soft); color: #1D4ED8; border-color: rgba(59, 130, 246, 0.2); }
.badge-action::before { background: #3B82F6; }

.badge-verification { background: var(--info-soft); color: #4338CA; border-color: rgba(99, 102, 241, 0.2); }
.badge-verification::before { background: #6366F1; }

.badge-closed { background: var(--secondary-soft); color: #047857; border-color: rgba(16, 185, 129, 0.2); }
.badge-closed::before { background: #10B981; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border-radius: 11px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(27, 58, 92, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 8px 20px rgba(27, 58, 92, 0.32);
    transform: translateY(-2px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.btn-secondary:hover {
    background: #047857;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--surface-muted);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.55rem;
}

.btn-link-danger {
    display: inline-flex;
    align-items: center;
    border: 0;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.btn-link-danger:hover {
    text-decoration: underline;
}

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.action-link:hover {
    background: var(--accent-soft);
    color: var(--primary);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-end;
}

.table-actions form {
    margin: 0;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.form-section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.45rem;
    color: var(--text-main);
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    padding: 0.75rem 1rem;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    width: 100%;
}

.form-control:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background: #FDFEFE;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
    background: #fff;
}

textarea.form-control {
    resize: vertical;
    min-height: 110px;
    line-height: 1.6;
}

select.form-control {
    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='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.row {
    display: flex;
    gap: 1.25rem;
}

.col { flex: 1; min-width: 0; }

/* ==========================================================================
   Alerts
   ========================================================================== */

.form-control::placeholder { color: var(--text-muted); }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid;
    animation: slideDown 0.35s ease-out;
    line-height: 1.55;
}

.alert svg { flex-shrink: 0; margin-top: 2px; }

.alert p { margin: 0.5rem 0 0; }

.alert-success {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    color: #065F46;
    border-color: rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    color: #991B1B;
    border-color: rgba(239, 68, 68, 0.25);
}

.alert-steps {
    margin: 0.75rem 0 0 1.25rem;
    font-size: 0.88rem;
}

.alert-steps li { margin-bottom: 0.3rem; }
.alert-steps li.is-done { color: var(--secondary); font-weight: 600; }

.callout {
    text-align: left;
    padding: 1.35rem 1.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent-soft) 0%, #F0F9FF 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius);
}

.callout h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.history-block {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.history-item {
    margin-top: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.history-cycle {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.alert-warning {
    background: var(--warning-soft);
    color: #92400E;
    border-color: #FCD34D;
}

.alert a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

/* Success state card */
.success-state {
    text-align: center;
    padding: 3rem 2rem;
}

.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--secondary-soft);
    color: var(--secondary);
    border-radius: 50%;
    margin-bottom: 1.25rem;
}

.success-state h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.success-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.success-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface-muted) 100%);
    border: 1px solid var(--border);
    border-radius: 50%;
    margin-bottom: 1.25rem;
    color: var(--primary);
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ==========================================================================
   NC Detail Page
   ========================================================================== */

.nc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-actions form {
    margin: 0;
}

.nc-header-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.nc-header-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nc-code {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--accent-soft);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Workflow Stepper */
.workflow-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem 1.5rem;
    background: linear-gradient(180deg, var(--surface-muted) 0%, #fff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    gap: 0.5rem;
}

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 80px;
    position: relative;
}

.workflow-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 2px;
    background: var(--border);
}

.workflow-step.done:not(:last-child)::after {
    background: var(--secondary);
}

.workflow-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-muted);
    position: relative;
    z-index: 1;
    transition: all var(--transition);
}

.workflow-step.done .workflow-step-circle {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

.workflow-step.active .workflow-step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.15);
}

.workflow-step-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

.workflow-step.active .workflow-step-label {
    color: var(--primary);
    font-weight: 600;
}

.workflow-step.done .workflow-step-label {
    color: var(--secondary);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    background: var(--surface);
    padding: 1.1rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.detail-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.detail-value {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
}

.detail-block {
    margin-bottom: 1.25rem;
}

.detail-block:last-child { margin-bottom: 0; }

.detail-content {
    background: var(--surface-muted);
    padding: 1rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.detail-content--warning {
    background: var(--warning-soft);
    border-color: #FDE68A;
    color: #92400E;
}

.detail-content--highlight {
    background: var(--accent-soft);
    border-color: #BAE6FD;
}

.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.evidence-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.evidence-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.evidence-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: var(--surface-muted);
}

.evidence-card span {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.evidence-card small {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.evidence-upload-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: end;
    margin-top: 1rem;
}

.audit-timeline {
    list-style: none;
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.audit-event {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.85rem;
    align-items: start;
}

.audit-dot {
    width: 12px;
    height: 12px;
    margin-top: 0.45rem;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 0 5px var(--warning-soft);
}

.audit-content {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.audit-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-main);
}

.audit-header span,
.audit-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.audit-meta {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

/* 5 Whys */
.why-group {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.why-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 4px;
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.2);
}

.why-input { flex-grow: 1; }

.why-result {
    background: var(--surface-muted);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.why-result-item {
    display: flex;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.why-result-item:last-child { border-bottom: none; }

.why-result-text {
    padding-top: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.root-cause-summary {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 2px dashed var(--border);
}

.root-cause-summary .detail-label {
    color: var(--primary);
    font-size: 0.8rem;
}

.root-cause-summary .detail-value {
    font-size: 1.05rem;
    margin-top: 0.35rem;
}

/* Task List */
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.task-item:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--shadow-sm);
}

.task-item.completed {
    background: var(--surface-muted);
    opacity: 0.85;
}

.task-item.completed .task-desc {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-desc {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.task-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-meta strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.task-form-panel {
    background: linear-gradient(180deg, var(--surface-muted) 0%, #fff 100%);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(59, 130, 246, 0.35);
    margin-top: 1.25rem;
}

.task-form-panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}

/* Verification */
.verification-card {
    background: var(--surface-muted);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.verification-card:last-child { margin-bottom: 0; }

.verification-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.verification-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.verification-form {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--border);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.footer-logo {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
}

.footer-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Legacy / Utility
   ========================================================================== */

.header { text-align: center; margin-bottom: 2rem; }
.header h1 { font-size: 2rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.header p { color: var(--text-secondary); }

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .page-hero {
        padding: 1.5rem 1.35rem;
        border-radius: var(--radius-lg);
    }

    .page-hero-title { font-size: 1.45rem; }

    .page-hero-cta {
        width: 100%;
        justify-content: center;
    }

    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 1rem 1.25rem;
        gap: 1rem;
    }

    .main-nav {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        padding: 1.25rem 1rem 2rem;
    }

    .page-title { font-size: 1.4rem; }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-value { font-size: 1.5rem; }

    .row { flex-direction: column; gap: 0; }

    .detail-grid { grid-template-columns: 1fr; }

    .workflow-stepper {
        padding: 1rem 0.75rem;
    }

    .workflow-step-label { font-size: 0.6rem; }

    .task-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .nc-header {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .evidence-upload-form {
        grid-template-columns: 1fr;
    }

    .evidence-upload-form .btn {
        width: 100%;
    }

    .brand-tagline { display: none; }
}

/* ==========================================================================
   Authentication
   ========================================================================== */

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-user-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-container {
    max-width: 520px;
}

.auth-container--wide {
    max-width: 980px;
    width: 100%;
}

.auth-shell {
    min-height: calc(100vh - var(--header-height) - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
}

.auth-intro {
    margin-bottom: 1.5rem;
}

.auth-intro h1 {
    margin: 0.35rem 0 0.45rem;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.1;
    color: var(--primary);
    letter-spacing: -0.04em;
}

.auth-intro p {
    color: var(--text-secondary);
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-submit {
    width: 100%;
    justify-content: center;
}

.auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}

.auth-links--left {
    justify-content: flex-start;
}

.auth-links a {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.auth-links a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.users-layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 980px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .users-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header-user {
        width: 100%;
        justify-content: space-between;
    }

    .auth-card {
        padding: 1.4rem;
    }
}

/* Mejoras visuales profesionales */
.brand-icon i {
    font-size: 1.15rem;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem 0.35rem 0.35rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.user-chip__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--primary);
    font-size: 1.5rem;
}

.empty-state h3 {
    color: var(--text-main);
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.empty-state--inline {
    padding: 1.25rem;
    background: var(--surface-muted);
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
}

.root-cause-box {
    padding: 1rem 1.1rem;
    background: var(--info-soft);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.card--close {
    border-color: rgba(99, 102, 241, 0.25);
}

.card--verification {
    border-color: rgba(99, 102, 241, 0.3);
}

.verification-timeline {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.callout--info {
    background: var(--info-soft);
    border-color: rgba(99, 102, 241, 0.25);
}

.alert-steps {
    margin: 0.75rem 0 0;
    padding-left: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.alert-steps li.is-done {
    color: var(--secondary);
}

.cell-assignee {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
}

.cell-assignee--me {
    color: var(--secondary);
}

.cell-muted {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-style: italic;
}

.stats-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
    .stats-grid--four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.workflow-stepper--compact {
    margin: 1.25rem 0 1.75rem;
}

.cell-tag--you {
    background: var(--accent-soft);
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stack-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.mb-3 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.w-100 { width: 100%; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }

/* Login split profesional */
.auth-shell--split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - var(--header-height) - 4rem);
    gap: 0;
    max-width: 980px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-panel--brand {
    background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: #fff;
    padding: 2.5rem;
    display: flex;
    align-items: center;
}

.auth-brand-block h2 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 1rem 0 0.75rem;
    letter-spacing: -0.03em;
}

.auth-brand-block p {
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.auth-brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    font-size: 1.6rem;
}

.auth-features {
    list-style: none;
    display: grid;
    gap: 0.65rem;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.9);
}

.auth-features i {
    color: #6EE7B7;
}

.auth-panel--form {
    background: var(--surface);
    padding: 2rem;
    display: flex;
    align-items: center;
}

.auth-card--flat {
    box-shadow: none;
    border: none;
    padding: 0;
    width: 100%;
    background: transparent;
}

.auth-eyebrow {
    color: var(--primary) !important;
}

.auth-footer-link {
    margin-top: 1.25rem;
    text-align: center;
}

.auth-footer-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}

.auth-footer-link a:hover {
    color: var(--primary);
}

@media (max-width: 860px) {
    .auth-shell--split {
        grid-template-columns: 1fr;
    }

    .auth-panel--brand {
        padding: 1.75rem;
    }

    .auth-features {
        display: none;
    }
}
