/* ============================================================
   Ailura Automatización IA — Demo funcional
   Tema claro tipo SaaS con acentos de marca Ailura
   Paleta: azul noche #0D1B2A · oro #D9B36A · oliva #6C7F5A
   ============================================================ */

* {
	box-sizing: border-box;
}

/* El atributo hidden debe ganar a los display de clase (flex/grid, etc.) */
[hidden] {
	display: none !important;
}

:root {
	/* Marca Ailura */
	--night: #0D1B2A;
	--night-soft: #1c2f42;
	--gold: #D9B36A;
	--gold-strong: #c99a45;
	--olive: #6C7F5A;
	--olive-strong: #566748;

	/* Superficie clara */
	--bg-top: #eef2f7;
	--bg-bottom: #e3e9f1;
	--surface: #ffffff;
	--surface-soft: #f6f8fb;
	--border: #e2e8f0;
	--border-strong: #cfd8e3;

	/* Texto */
	--text: #0D1B2A;
	--muted: #566372;
	--subtle: #8a95a3;

	/* Prioridad / estado */
	--prio-baja: #6C7F5A;
	--prio-media: #c99a45;
	--prio-alta: #d97a45;
	--prio-critica: #c8503f;
	--danger: #c8503f;
	--success: #4f8a5b;

	--shadow-sm: 0 2px 10px rgba(13, 27, 42, 0.06);
	--shadow: 0 18px 44px rgba(13, 27, 42, 0.10);
	--radius: 18px;
	--radius-sm: 12px;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	min-height: 100vh;
	color: var(--text);
	font-family: "Inter", "Segoe UI", system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	background:
		radial-gradient(circle at 12% 8%, rgba(217, 179, 106, 0.14), transparent 32%),
		radial-gradient(circle at 88% 6%, rgba(108, 127, 90, 0.13), transparent 30%),
		linear-gradient(180deg, #eef2f7 0%, #e7edf4 46%, #eef2f7 100%);
	background-attachment: fixed;
}

button,
input,
select,
textarea {
	font: inherit;
}

button {
	cursor: pointer;
}

/* ---------- Layout ---------- */
.page-shell {
	width: min(1280px, calc(100vw - 36px));
	margin: 0 auto;
	padding: 28px 0 48px;
}

.panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}

.panel__head {
	margin-bottom: 18px;
}

.panel__head--row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

/* ---------- Cabecera ---------- */
.hero {
	position: relative;
	overflow: hidden;
	background: linear-gradient(135deg, #0D1B2A 0%, #14283c 60%, #1b3247 100%);
	border-radius: 22px;
	padding: 32px 34px 34px;
	color: #F6F7F4;
	box-shadow: var(--shadow);
	margin-bottom: 20px;
}

.hero::after {
	content: "";
	position: absolute;
	top: -40%;
	right: -10%;
	width: 380px;
	height: 380px;
	background: radial-gradient(circle, rgba(217, 179, 106, 0.22), transparent 68%);
	pointer-events: none;
}

.hero__brand {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 22px;
}

.brand-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	background: #F6F7F4;
	border-radius: 14px;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.brand-name {
	margin: 0;
	font-family: "Fraunces", Georgia, serif;
	font-weight: 600;
	font-size: 1.5rem;
	line-height: 1;
	color: #F6F7F4;
}

.brand-tag {
	margin: 2px 0 0;
	font-size: 0.78rem;
	letter-spacing: 0.02em;
	color: var(--gold);
}

.hero__copy {
	position: relative;
	z-index: 1;
	max-width: 900px;
}

.eyebrow,
.section-label {
	margin: 0 0 10px;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	font-size: 0.72rem;
	font-weight: 700;
}

.eyebrow {
	color: var(--gold);
}

.hero__copy h1 {
	margin: 0;
	font-family: "Fraunces", Georgia, serif;
	font-size: clamp(2rem, 4.4vw, 3.2rem);
	line-height: 1.02;
	letter-spacing: -0.02em;
	font-weight: 600;
}

.lede {
	margin: 14px 0 0;
	font-size: clamp(1.05rem, 1.6vw, 1.3rem);
	font-weight: 500;
	color: #e8ecf1;
}

.hero__commercial {
	margin: 14px 0 0;
	max-width: 74ch;
	color: #c3ccd6;
	font-size: 0.98rem;
	line-height: 1.55;
}

.hero__notes {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 20px;
}

.note-pill {
	padding: 6px 13px;
	border-radius: 999px;
	background: rgba(246, 247, 244, 0.09);
	border: 1px solid rgba(217, 179, 106, 0.35);
	color: #eef1f5;
	font-size: 0.8rem;
	font-weight: 500;
}

/* ---------- Métricas ---------- */
.metrics {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	margin-bottom: 20px;
}

.metric-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 16px 18px;
	box-shadow: var(--shadow-sm);
	position: relative;
	overflow: hidden;
}

.metric-card::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: var(--olive);
}

.metric-card--alert::before { background: var(--prio-critica); }
.metric-card--time::before { background: var(--gold); }

/* Tarjetas que actúan como filtro del panel de seguimiento */
.metric-card--filter {
	cursor: pointer;
	user-select: none;
	transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

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

.metric-card--filter:focus-visible {
	outline: 2px solid var(--gold);
	outline-offset: 2px;
}

.metric-card--filter.is-active {
	border-color: var(--night);
	box-shadow: 0 0 0 2px var(--night) inset, var(--shadow-sm);
}

.metric-card--filter.is-active::after {
	content: "Filtrando";
	position: absolute;
	top: 10px;
	right: 12px;
	font-size: 0.62rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--night);
	background: rgba(217, 179, 106, 0.35);
	padding: 2px 7px;
	border-radius: 999px;
}

/* La tarjeta "Total" activa no dice "Filtrando" (muestra todo) */
.metric-card--filter[data-filter="all"].is-active::after {
	content: "Todos";
	background: rgba(108, 127, 90, 0.22);
}

.metric-card__label {
	margin: 0;
	font-size: 0.76rem;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.metric-card__value {
	margin: 8px 0 2px;
	font-family: "Fraunces", Georgia, serif;
	font-size: 2rem;
	font-weight: 600;
	line-height: 1;
	color: var(--night);
}

.metric-card__hint {
	margin: 0;
	font-size: 0.78rem;
	color: var(--subtle);
}

/* ---------- Workspace (formulario + resultado) ---------- */
.workspace {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
	gap: 20px;
	margin-bottom: 20px;
	align-items: start;
}

.section-label {
	color: var(--olive-strong);
}

.panel__head h2 {
	margin: 0;
	font-family: "Fraunces", Georgia, serif;
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.section-note {
	margin: 6px 0 0;
	color: var(--muted);
	font-size: 0.9rem;
	line-height: 1.45;
}

.form-panel,
.result-panel,
.tracking-panel {
	padding: 24px 24px 26px;
}

/* ---------- Formulario ---------- */
.lead-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

.field label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--muted);
}

.field input,
.field select,
.field textarea {
	width: 100%;
	padding: 11px 13px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-soft);
	color: var(--text);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
	outline: none;
	border-color: var(--gold);
	box-shadow: 0 0 0 3px rgba(217, 179, 106, 0.22);
	background: var(--surface);
}

.field textarea {
	resize: vertical;
	min-height: 96px;
	line-height: 1.5;
}

.form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 6px;
}

/* ---------- Botones ---------- */
.button {
	border: 1px solid transparent;
	border-radius: 10px;
	padding: 11px 18px;
	font-weight: 600;
	font-size: 0.92rem;
	transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:active {
	transform: translateY(1px);
}

.button--primary {
	background: linear-gradient(135deg, var(--gold) 0%, var(--gold-strong) 100%);
	color: var(--night);
	box-shadow: 0 8px 18px rgba(201, 154, 69, 0.28);
}

.button--primary:hover {
	box-shadow: 0 10px 22px rgba(201, 154, 69, 0.38);
}

.button--ghost {
	background: var(--surface);
	border-color: var(--border-strong);
	color: var(--night);
}

.button--ghost:hover {
	border-color: var(--olive);
	color: var(--olive-strong);
}

.button--subtle {
	background: transparent;
	color: var(--muted);
	border-color: transparent;
}

.button--subtle:hover {
	background: var(--surface-soft);
	color: var(--text);
}

/* ---------- Aviso discreto del panel de resultado ---------- */
.result-notice {
	margin: 0 0 14px;
	padding: 9px 13px;
	border-radius: var(--radius-sm);
	background: rgba(217, 179, 106, 0.14);
	border: 1px solid rgba(217, 179, 106, 0.5);
	color: var(--night);
	font-size: 0.85rem;
	font-weight: 600;
}

/* ---------- Estado vacío del resultado ---------- */
.result-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 6px;
	padding: 40px 20px;
	border: 1.5px dashed var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-soft);
	color: var(--muted);
}

.result-empty p { margin: 0; font-size: 0.92rem; }
.result-empty strong { color: var(--text); }

.result-empty__icon {
	font-size: 2rem;
	color: var(--gold);
	margin-bottom: 4px;
}

/* ---------- Resultado ---------- */
.result-headline {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 14px 16px;
	background: var(--surface-soft);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	margin-bottom: 16px;
}

.result-headline__name {
	margin: 0;
	font-weight: 700;
	font-size: 1.05rem;
}

.result-headline__meta {
	margin: 2px 0 0;
	font-size: 0.85rem;
	color: var(--muted);
}

.analysis-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 16px;
}

.analysis-item {
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
}

.analysis-item__label {
	margin: 0 0 4px;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--subtle);
}

.analysis-item__value {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 600;
	color: var(--text);
	line-height: 1.35;
}

.analysis-item__value--accent {
	color: var(--olive-strong);
}

/* ---------- Badges de prioridad / interés / riesgo ---------- */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 13px;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 700;
	white-space: nowrap;
	letter-spacing: 0.01em;
}

.badge::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.badge--baja    { background: rgba(108, 127, 90, 0.15);  color: var(--prio-baja); }
.badge--media   { background: rgba(201, 154, 69, 0.16);  color: var(--prio-media); }
.badge--alta    { background: rgba(217, 122, 69, 0.16);  color: var(--prio-alta); }
.badge--critica { background: rgba(200, 80, 63, 0.15);   color: var(--prio-critica); }

.badge--sm {
	padding: 4px 10px;
	font-size: 0.76rem;
}

/* Texto de nivel con color inline */
.level-strong { font-weight: 700; }
.level-baja    { color: var(--prio-baja); }
.level-media   { color: var(--prio-media); }
.level-alta    { color: var(--prio-alta); }
.level-critica { color: var(--prio-critica); }

/* ---------- Próximo paso ---------- */
.next-step {
	border: 1px solid rgba(217, 179, 106, 0.5);
	background: linear-gradient(180deg, rgba(217, 179, 106, 0.10), rgba(217, 179, 106, 0.04));
	border-radius: var(--radius-sm);
	padding: 14px 16px;
	margin-bottom: 18px;
}

.next-step__label {
	margin: 0 0 4px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--gold-strong);
}

.next-step__text {
	margin: 0;
	font-weight: 600;
	font-size: 0.98rem;
}

/* ---------- Respuesta sugerida ---------- */
.response-block {
	border-top: 1px solid var(--border);
	padding-top: 16px;
}

.response-block__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}

.tone-switch {
	display: inline-flex;
	gap: 4px;
	background: var(--surface-soft);
	border: 1px solid var(--border);
	border-radius: 999px;
	padding: 3px;
}

.tone-button {
	border: none;
	background: transparent;
	color: var(--muted);
	padding: 6px 13px;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 600;
	transition: background 0.15s ease, color 0.15s ease;
}

.tone-button.is-active {
	background: var(--night);
	color: #F6F7F4;
}

.response-text {
	width: 100%;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-soft);
	padding: 14px 16px;
	line-height: 1.55;
	color: var(--text);
	resize: vertical;
	min-height: 120px;
}

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

.copy-hint {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--success);
}

/* ---------- Panel de seguimiento ---------- */
.tracking-panel__actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px 6px 13px;
	border-radius: 999px;
	background: rgba(217, 179, 106, 0.16);
	border: 1px solid rgba(217, 179, 106, 0.5);
	color: var(--night);
	font-size: 0.82rem;
	font-weight: 600;
}

.filter-chip__clear {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border: none;
	border-radius: 50%;
	background: rgba(13, 27, 42, 0.1);
	color: var(--night);
	font-size: 0.7rem;
	line-height: 1;
}

.filter-chip__clear:hover {
	background: var(--night);
	color: #F6F7F4;
}

.table-wrap {
	overflow-x: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}

.tracking-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 900px;
}

.tracking-table thead th {
	text-align: left;
	font-size: 0.74rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
	font-weight: 700;
	padding: 12px 14px;
	background: var(--surface-soft);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

.tracking-table tbody td {
	padding: 12px 14px;
	border-bottom: 1px solid var(--border);
	font-size: 0.9rem;
	vertical-align: middle;
}

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

.tracking-table tbody tr {
	animation: rowIn 0.35s ease;
}

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

.cell-strong {
	font-weight: 600;
	color: var(--text);
}

.cell-sub {
	display: block;
	font-size: 0.8rem;
	color: var(--subtle);
}

.status-select {
	padding: 6px 8px;
	border: 1px solid var(--border-strong);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	font-size: 0.84rem;
	font-weight: 600;
	max-width: 160px;
}

.table-empty {
	margin: 0;
	padding: 26px 18px;
	text-align: center;
	color: var(--subtle);
	font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.footer {
	text-align: center;
	color: var(--muted);
	font-size: 0.82rem;
	padding: 8px 12px;
	line-height: 1.5;
}

.footer__brand {
	margin-top: 4px;
	color: var(--olive-strong);
	font-weight: 600;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
	.metrics {
		grid-template-columns: repeat(2, 1fr);
	}
	.workspace {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 620px) {
	.page-shell {
		width: calc(100vw - 24px);
	}
	.field-row,
	.analysis-grid {
		grid-template-columns: 1fr;
	}
	.hero {
		padding: 26px 22px;
	}
	.form-actions .button {
		flex: 1 1 auto;
	}
}

/* Navegación superior dentro de la demo operativa */
.app-topnav {
        width: min(1180px, calc(100% - 28px));
        margin: 14px auto 0;
        padding: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        background: rgba(7, 17, 31, 0.97);
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 22px;
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
        backdrop-filter: blur(10px);
        position: relative;
        z-index: 20;
}

.app-topnav__brand {
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--text, #ffffff);
        text-decoration: none;
        min-width: 0;
}

.app-topnav__brand img {
        width: 38px;
        height: 38px;
        display: block;
        border-radius: 11px;
        background: rgba(255, 255, 255, 0.92);
        padding: 2px;
        flex: 0 0 auto;
}

.app-topnav__brand span {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
}

.app-topnav__brand strong {
        font-size: 0.92rem;
        letter-spacing: 0.02em;
        line-height: 1.1;
}

.app-topnav__brand small {
        color: var(--muted, #c8d8d1);
        font-size: 0.78rem;
        line-height: 1.1;
}

.app-topnav__links {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
        padding: 5px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.09);
        border: 1px solid rgba(255, 255, 255, 0.08);
}

.app-topnav__links a {
        color: var(--text, #ffffff);
        text-decoration: none;
        font-size: 0.86rem;
        font-weight: 800;
        padding: 8px 12px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.045);
}

.app-topnav__links a:hover {
        background: rgba(143, 184, 168, 0.16);
        border-color: rgba(143, 184, 168, 0.34);
        color: var(--accent, #9fc8b7);
}

@media (max-width: 760px) {
        .app-topnav {
                align-items: stretch;
                flex-direction: column;
        }

        .app-topnav__links {
                border-radius: 18px;
                justify-content: flex-start;
        }

        .app-topnav__links a {
                flex: 1 1 auto;
                text-align: center;
        }
}

/* Corrección final contraste menú interno */
.app-topnav,
.app-topnav * {
        color: #ffffff !important;
}

.app-topnav__brand strong {
        color: #ffffff !important;
        opacity: 1 !important;
}

.app-topnav__brand small {
        color: #d7e6df !important;
        opacity: 1 !important;
}

.app-topnav__links a {
        color: #ffffff !important;
        opacity: 1 !important;
        background: rgba(255, 255, 255, 0.12) !important;
        border-color: rgba(255, 255, 255, 0.22) !important;
}

.app-topnav__links a:hover {
        color: #d8f2e7 !important;
        background: rgba(143, 184, 168, 0.24) !important;
}
