/**
 * Nova Desk — estilos de la plataforma.
 *
 * Usa las variables de base.css (heredadas del tema de marketing), así que el
 * modo claro/oscuro funciona sin nada extra.
 */

/* ---------- estructura ---------- */

.t0-desk-main { min-height: 70vh; padding: 40px 24px 96px; }
.t0-desk-wrap { max-width: 1100px; margin: 0 auto; }

.t0-desk-head { margin-bottom: 28px; }
.t0-desk-title { font-family: var(--t0-display); font-size: clamp(22px, 3vw, 30px); letter-spacing: .02em; margin: 0 0 6px; }
.t0-desk-lead { color: var(--t0-text-3); margin: 0; }

.t0-desk-toolbar {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}

.t0-desk-empty {
	border: 1px dashed var(--t0-line); border-radius: 2px;
	padding: 48px 24px; text-align: center; color: var(--t0-text-3);
}

/* ---------- navegación ---------- */

.t0-desk-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.t0-desk-nav a { color: var(--t0-text-2); text-decoration: none; font-size: 14px; }
.t0-desk-nav a:hover { color: var(--t0-text); }

.t0-nav__tools { display: flex; align-items: center; gap: 18px; }
.t0-lang a { color: var(--t0-muted); text-decoration: none; font-size: 12px; letter-spacing: .08em; }
.t0-lang a.is-active { color: var(--t0-blue); }
.t0-lang__sep { color: var(--t0-line); margin: 0 4px; }

/* ---------- selector de tema claro/oscuro ---------- */

.t0-theme {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 3px;
	border: 1px solid var(--t0-line);
	border-radius: 2px;
	background: var(--t0-panel);
}

.t0-theme__btn {
	appearance: none;
	background: transparent;
	border: 0;
	color: var(--t0-text-3);
	padding: 6px 9px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	border-radius: 2px;
}

.t0-theme__btn:hover { color: var(--t0-blue); }

.t0-theme__btn.is-active {
	color: #04120c;
	background: var(--t0-blue);
}

.t0-theme__btn .t0-theme__ico { width: 14px; height: 14px; display: block; }

.t0-usermenu { position: relative; }
.t0-usermenu > summary {
	list-style: none; cursor: pointer; font-size: 14px; color: var(--t0-text-2);
	border: 1px solid var(--t0-line); padding: 7px 12px; border-radius: 2px;
}
.t0-usermenu > summary::-webkit-details-marker { display: none; }
.t0-usermenu__panel {
	position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
	min-width: 220px; display: flex; flex-direction: column; gap: 2px;
	background: var(--t0-panel); border: 1px solid var(--t0-line); padding: 12px;
}
.t0-usermenu__panel a { color: var(--t0-text-2); text-decoration: none; font-size: 14px; padding: 6px 0; }
.t0-usermenu__panel a:hover { color: var(--t0-blue); }
.t0-usermenu__role { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--t0-blue); }
.t0-usermenu__org { font-size: 12px; color: var(--t0-muted); margin-bottom: 8px; }

/* ---------- pestañas ---------- */

.t0-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.t0-tabs a {
	color: var(--t0-text-3); text-decoration: none; font-size: 13px;
	padding: 8px 14px; border: 1px solid transparent; border-radius: 2px;
}
.t0-tabs a.is-active { color: var(--t0-text); border-color: var(--t0-line); background: var(--t0-panel); }

/* ---------- botones ---------- */

.t0-btn {
	display: inline-flex; align-items: center; gap: 8px;
	background: var(--t0-blue); color: #04120c; border: 1px solid var(--t0-blue);
	padding: 10px 18px; border-radius: 2px; font-size: 14px; font-weight: 600;
	text-decoration: none; cursor: pointer; transition: opacity .2s;
}
.t0-btn:hover { opacity: .88; }
.t0-btn--ghost { background: transparent; color: var(--t0-text-2); border-color: var(--t0-line); }
.t0-btn--sm { padding: 7px 13px; font-size: 13px; }
.t0-btn.is-busy { opacity: .5; pointer-events: none; }

/* ---------- avisos ---------- */

.t0-alert { border-left: 3px solid; padding: 14px 18px; margin-bottom: 22px; font-size: 14px; background: var(--t0-panel); }
.t0-alert--ok    { border-color: var(--t0-blue); }
.t0-alert--error { border-color: #e5484d; }
.t0-alert--warn  { border-color: #f5a524; }

/* ---------- tabla de tickets ---------- */

.t0-tickets { width: 100%; border-collapse: collapse; font-size: 14px; }
.t0-tickets th {
	text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
	color: var(--t0-muted); font-weight: 500; padding: 10px 12px;
	border-bottom: 1px solid var(--t0-line);
}
.t0-tickets td { padding: 14px 12px; border-bottom: 1px solid var(--t0-line-soft); vertical-align: top; }
.t0-tickets tr:hover td { background: var(--t0-panel); }
.t0-ticket__ref a { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--t0-muted); text-decoration: none; }
.t0-ticket__subject a { color: var(--t0-text); text-decoration: none; font-weight: 500; }
.t0-ticket__subject a:hover { color: var(--t0-blue); }
.t0-ticket__date { color: var(--t0-muted); font-size: 13px; white-space: nowrap; }

/* ---------- píldoras ---------- */

.t0-pill {
	display: inline-block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
	padding: 3px 9px; border-radius: 2px; border: 1px solid var(--t0-line); color: var(--t0-text-3);
	white-space: nowrap;
}
.t0-pill--p1 { border-color: #e5484d; color: #e5484d; }
.t0-pill--p2 { border-color: #f5a524; color: #f5a524; }
.t0-pill--p3 { border-color: var(--t0-line); color: var(--t0-text-3); }
.t0-pill--p4 { border-color: var(--t0-line-soft); color: var(--t0-muted); }

.t0-pill--new         { border-color: var(--t0-blue); color: var(--t0-blue); }
.t0-pill--escalated   { border-color: #f5a524; color: #f5a524; }
.t0-pill--need-info   { border-color: #8b5cf6; color: #8b5cf6; }
.t0-pill--resolved,
.t0-pill--closed      { border-color: var(--t0-line-soft); color: var(--t0-muted); }
.t0-pill--breach      { border-color: #e5484d; color: #e5484d; margin-left: 8px; }
.t0-pill--risk        { border-color: #f5a524; color: #f5a524; margin-left: 8px; }
.t0-pill--internal    { border-color: #f5a524; color: #f5a524; }

/* ---------- formularios ---------- */

.t0-form { max-width: 780px; }
.t0-field { margin-bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
.t0-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.t0-field label,
.t0-actions__box label { font-size: 13px; color: var(--t0-text-2); }
.t0-req { color: #e5484d; }

.t0-field input[type="text"],
.t0-field input[type="url"],
.t0-field input[type="password"],
.t0-field input[type="email"],
.t0-field select,
.t0-field textarea,
.t0-actions__box select,
.t0-escalate textarea,
.t0-reply textarea,
.t0-chat__form input {
	background: var(--t0-panel); border: 1px solid var(--t0-line); color: var(--t0-text);
	padding: 11px 13px; border-radius: 2px; font: inherit; font-size: 14px; width: 100%;
}
.t0-field textarea, .t0-reply textarea, .t0-escalate textarea { resize: vertical; line-height: 1.6; }
.t0-field input:focus, .t0-field select:focus, .t0-field textarea:focus,
.t0-reply textarea:focus, .t0-chat__form input:focus {
	outline: 2px solid var(--t0-blue); outline-offset: 1px;
}
.t0-hint { font-size: 12px; color: var(--t0-muted); margin: 0; }
.t0-hint.is-error { color: #e5484d; }
.t0-form__actions { display: flex; gap: 12px; margin-top: 28px; }
.t0-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--t0-text-3); }

/* ---------- detalle del incidente ---------- */

.t0-incident__ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--t0-muted); margin: 0 0 4px; }
.t0-incident__meta { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; padding: 0; margin: 14px 0 0; font-size: 13px; color: var(--t0-text-3); }
.t0-incident__body {
	background: var(--t0-panel); border: 1px solid var(--t0-line-soft);
	padding: 22px 24px; margin: 28px 0; white-space: pre-wrap; word-break: break-word;
}

.t0-attachments { margin: 28px 0; }
.t0-attachments h2, .t0-thread h2, .t0-actions h2 {
	font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
	color: var(--t0-muted); font-weight: 500; margin: 0 0 12px;
}
.t0-attachments ul { list-style: none; padding: 0; margin: 0 0 8px; }
.t0-attachments li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--t0-line-soft); }
.t0-attachments a { color: var(--t0-blue); text-decoration: none; }
.t0-attachments__size { font-size: 12px; color: var(--t0-muted); }

/* ---------- hilo ---------- */

.t0-thread { margin-top: 40px; }
.t0-msg { border: 1px solid var(--t0-line-soft); border-left-width: 3px; padding: 16px 18px; margin-bottom: 14px; background: var(--t0-panel); }
.t0-msg--client   { border-left-color: var(--t0-line); }
.t0-msg--staff    { border-left-color: var(--t0-blue); }
.t0-msg--internal { border-left-color: #f5a524; background: transparent; border-style: dashed; }
.t0-msg__head { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.t0-msg__head time { color: var(--t0-muted); font-size: 12px; margin-left: auto; }
.t0-msg__body { font-size: 14px; color: var(--t0-text-2); }
.t0-msg__body p { margin: 0 0 10px; }

.t0-reply { margin-top: 24px; }
.t0-reply__actions { display: flex; align-items: center; gap: 16px; margin-top: 12px; }

/* ---------- panel de gestión ---------- */

.t0-actions { border: 1px solid var(--t0-line); padding: 20px 22px; margin: 32px 0; }
.t0-actions__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.t0-actions__box { display: flex; flex-direction: column; gap: 8px; }
.t0-escalate { margin-top: 22px; border-top: 1px solid var(--t0-line-soft); padding-top: 18px; }
.t0-escalate summary { cursor: pointer; font-size: 13px; color: #f5a524; }
.t0-escalate form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-width: 520px; }
.t0-escalate label { font-size: 13px; color: var(--t0-text-2); }

/* ---------- acceso ---------- */

.t0-login { max-width: 420px; margin: 8vh auto; text-align: center; }
.t0-login__title { font-family: var(--t0-display); font-size: 24px; margin: 0 0 8px; }
.t0-login__sub { color: var(--t0-text-3); margin: 0 0 32px; }
.t0-login__form { text-align: left; }
.t0-login__form .t0-btn { width: 100%; justify-content: center; }
.t0-login__forgot { margin-top: 18px; font-size: 13px; text-align: center; }
.t0-login__forgot a { color: var(--t0-text-3); }
.t0-login__or { font-size: 12px; color: var(--t0-muted); text-transform: uppercase; letter-spacing: .1em; margin: 28px 0 14px; }
.t0-login__providers { display: flex; flex-direction: column; gap: 12px; }
.t0-login__btn {
	display: flex; align-items: center; justify-content: center; gap: 12px;
	border: 1px solid var(--t0-line); background: var(--t0-panel); color: var(--t0-text);
	padding: 14px 18px; border-radius: 2px; text-decoration: none; font-size: 15px;
}
.t0-login__btn:hover { border-color: var(--t0-blue); }
.t0-login__icon { display: inline-flex; }
.t0-login__note { font-size: 13px; color: var(--t0-muted); margin-top: 28px; }
.t0-login__legal { font-size: 12px; margin-top: 12px; }
.t0-login__legal a { color: var(--t0-muted); }

/* ---------- perfil ---------- */

.t0-profile { display: grid; grid-template-columns: 200px 1fr; gap: 12px 20px; max-width: 620px; font-size: 14px; }
.t0-profile dt { color: var(--t0-muted); font-size: 13px; }
.t0-profile dd { margin: 0; color: var(--t0-text-2); }

/* ---------- paginación ---------- */

.t0-pagination { display: flex; gap: 8px; margin-top: 28px; justify-content: center; }
.t0-pagination .page-numbers {
	padding: 7px 12px; border: 1px solid var(--t0-line); color: var(--t0-text-3);
	text-decoration: none; font-size: 13px;
}
.t0-pagination .current { border-color: var(--t0-blue); color: var(--t0-blue); }

/* ---------- asistente ---------- */

.t0-chat__launcher {
	position: fixed; right: 24px; bottom: 24px; z-index: 200;
	width: 52px; height: 52px; border-radius: 50%;
	background: var(--t0-blue); color: #04120c; border: none; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.t0-chat { position: fixed; right: 24px; bottom: 88px; z-index: 210; width: min(380px, calc(100vw - 32px)); }
.t0-chat__panel {
	display: flex; flex-direction: column; max-height: min(560px, 70vh);
	background: var(--t0-panel); border: 1px solid var(--t0-line);
	box-shadow: 0 18px 48px rgba(0,0,0,.4);
}
.t0-chat__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--t0-line-soft); }
.t0-chat__title { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--t0-text-2); }
.t0-chat__close { background: none; border: none; color: var(--t0-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.t0-chat__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.t0-chat__msg { font-size: 14px; padding: 10px 13px; border-radius: 2px; max-width: 90%; word-break: break-word; }
.t0-chat__msg--bot  { background: rgba(var(--t0-blue-rgb), .08); border: 1px solid rgba(var(--t0-blue-rgb), .25); align-self: flex-start; }
.t0-chat__msg--user { background: var(--t0-bg); border: 1px solid var(--t0-line); align-self: flex-end; }
.t0-chat__msg p { margin: 0 0 8px; }
.t0-chat__msg p:last-child { margin: 0; }
.t0-chat__sources { list-style: none; padding: 8px 0 0; margin: 8px 0 0; border-top: 1px solid var(--t0-line-soft); font-size: 12px; }
.t0-chat__sources a { color: var(--t0-blue); }
.t0-chat__offer { border: 1px dashed var(--t0-line); padding: 12px; font-size: 13px; }
.t0-chat__offer p { margin: 0 0 10px; }
.t0-chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--t0-line-soft); }
.t0-chat__note { font-size: 11px; color: var(--t0-muted); padding: 0 12px 12px; margin: 0; }
.t0-chat__dots i {
	display: inline-block; width: 5px; height: 5px; margin-right: 3px; border-radius: 50%;
	background: var(--t0-blue); animation: t0blink 1.2s infinite;
}
.t0-chat__dots i:nth-child(2) { animation-delay: .2s; }
.t0-chat__dots i:nth-child(3) { animation-delay: .4s; }
@keyframes t0blink { 0%, 60%, 100% { opacity: .25 } 30% { opacity: 1 } }

@media (prefers-reduced-motion: reduce) {
	.t0-chat__dots i { animation: none; }
}

/* ---------- pie ---------- */

.t0-desk-footer { border-top: 1px solid var(--t0-line-soft); margin-top: 72px; padding: 22px 24px; }
.t0-desk-footer__inner {
	max-width: 1100px; margin: 0 auto;
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; flex-wrap: wrap;
}
.t0-desk-footer__copy { margin: 0; font-size: 12px; color: var(--t0-muted); }
.t0-desk-footer__links { list-style: none; display: flex; gap: 18px; flex-wrap: wrap; padding: 0; margin: 0; }
.t0-desk-footer__links a { color: var(--t0-muted); font-size: 12px; text-decoration: none; }
.t0-desk-footer__links a:hover { color: var(--t0-blue); }

/* ---------- panel de administración ---------- */

.t0-desk-sub { font-size: 16px; margin: 0 0 16px; }
.t0-admin__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.t0-admin__link { width: 100%; max-width: 640px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--t0-panel); border: 1px solid var(--t0-line); color: var(--t0-text); padding: 8px 10px; border-radius: 2px; }
.t0-admin__ctx { font-size: 12px; word-break: break-all; }

.t0-table-wrap { overflow-x: auto; }
.t0-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.t0-table th {
	text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
	color: var(--t0-muted); font-weight: 500; padding: 10px 12px;
	border-bottom: 1px solid var(--t0-line); white-space: nowrap;
}
.t0-table td { padding: 12px; border-bottom: 1px solid var(--t0-line-soft); vertical-align: top; }
.t0-table tr:hover td { background: var(--t0-panel); }
.t0-table input[type="text"],
.t0-table input[type="email"],
.t0-table input[type="url"],
.t0-table select,
.t0-table textarea {
	background: var(--t0-panel); border: 1px solid var(--t0-line); color: var(--t0-text);
	padding: 8px 10px; border-radius: 2px; font: inherit; font-size: 13px; width: 100%;
}
.t0-table textarea { resize: vertical; line-height: 1.5; }
.t0-nowrap { white-space: nowrap; }
.t0-admin__grid .t0-field { min-width: 0; }

/* ---------- accesibilidad ---------- */

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}

/* ---------- móvil ---------- */

@media (max-width: 860px) {
	.t0-nav__inner { flex-wrap: wrap; gap: 12px; }
	.t0-desk-nav { order: 3; width: 100%; }
	.t0-tickets thead { display: none; }
	.t0-tickets, .t0-tickets tbody, .t0-tickets tr, .t0-tickets td { display: block; width: 100%; }
	.t0-tickets tr { border: 1px solid var(--t0-line-soft); margin-bottom: 12px; padding: 8px 4px; }
	.t0-tickets td { border: none; padding: 6px 12px; }
	.t0-profile { grid-template-columns: 1fr; gap: 2px 0; }
	.t0-profile dd { margin-bottom: 12px; }
}
