/*
 * Tokify — "mercado de noche": ciruela oscura, texto crema cálido y caléndula.
 * Pensado para verse bien sobre webs oscuras y claras.
 * Tipografía: letras redondeadas del propio sistema (sin descargar fuentes: rápido en móviles y sin problemas de RGPD).
 */
.tokify,
.tokify-panel {
	--tk-night: #1b1422;
	--tk-raised: #2a2033;
	--tk-raised-2: #342840;
	--tk-line: #3b2f47;
	--tk-text: #f7eee3;
	--tk-muted: #b9aabb;
	--tk-gold: #f5b041;
	--tk-gold-deep: #e39a22;
	--tk-on-gold: #2b1a05;
	--tk-danger: #ff9b8a;
	--tk-danger-bg: #3a1f26;
	--tk-font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
	--tk-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tokify {
	font-family: var(--tk-font);
	font-size: 16px;
	color: var(--tk-text);
	background: var(--tk-night);
	border: 1px solid var(--tk-line);
	border-radius: 22px;
	box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
	max-width: 760px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	height: min(80vh, 740px);
	overflow: hidden;
	text-align: left;
}
.tokify *,
.tokify *::before,
.tokify *::after { box-sizing: border-box; }

/* ---------- Cabecera ---------- */
.tokify-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--tk-line);
}
.tokify-model {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	min-width: 0;
}
.tokify-model-label {
	color: var(--tk-muted);
	font-size: 0.85em;
}
.tokify-model select {
	font: inherit;
	font-size: 0.92em;
	font-weight: 600;
	color: var(--tk-text);
	background: var(--tk-raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23f5b041' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
	border: 1px solid var(--tk-line);
	border-radius: 999px;
	padding: 7px 34px 7px 14px;
	appearance: none;
	-webkit-appearance: none;
	max-width: 46vw;
	cursor: pointer;
}
.tokify-model select:disabled { opacity: 0.6; cursor: not-allowed; }

.tokify-bar-right {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.tokify-new {
	font: inherit;
	font-size: 0.88em;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--tk-muted);
	background: transparent;
	border: 1px solid var(--tk-line);
	border-radius: 999px;
	padding: 7px 12px;
	cursor: pointer;
}
.tokify-new:hover { color: var(--tk-text); border-color: var(--tk-muted); }

/* El saldo: la moneda Tokify es el elemento protagonista del widget. */
.tokify-balance {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--tk-text);
	background: var(--tk-raised);
	border: 1px solid var(--tk-line);
	border-radius: 999px;
	padding: 4px 14px 4px 4px;
	font-weight: 700;
	font-size: 0.92em;
	font-variant-numeric: tabular-nums;
	text-decoration: none;
	white-space: nowrap;
}
.tokify-balance:hover { border-color: var(--tk-gold); color: var(--tk-text); }
.tokify-balance.is-low { border-color: var(--tk-gold); }
.tokify-balance.is-low::after {
	content: "Recargar";
	color: var(--tk-on-gold);
	background: var(--tk-gold);
	border-radius: 999px;
	padding: 2px 8px;
	margin-right: -8px;
	font-size: 0.85em;
}

.tokify-coin,
.tokify-avatar,
.tokify-welcome-coin {
	display: inline-grid;
	place-items: center;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--tk-gold);
	color: var(--tk-on-gold);
	font-weight: 800;
	box-shadow: inset 0 0 0 2px rgba(43, 26, 5, 0.18), inset 0 -3px 0 rgba(43, 26, 5, 0.15);
}
.tokify-coin { width: 26px; height: 26px; font-size: 0.8em; }

/* ---------- Conversación ---------- */
.tokify-log {
	flex: 1;
	overflow-y: auto;
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	scroll-behavior: smooth;
}

.tokify-row { display: flex; gap: 10px; align-items: flex-end; }
.tokify-row-user { justify-content: flex-end; }
.tokify-avatar { width: 30px; height: 30px; font-size: 0.85em; }

.tokify-msg {
	max-width: 80%;
	padding: 11px 15px;
	border-radius: 18px;
	line-height: 1.55;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.tokify-row-user .tokify-msg {
	background: var(--tk-gold);
	color: var(--tk-on-gold);
	border-bottom-right-radius: 6px;
	font-weight: 500;
}
.tokify-row-assistant .tokify-msg {
	background: var(--tk-raised);
	color: var(--tk-text);
	border-bottom-left-radius: 6px;
}
.tokify-msg strong { font-weight: 700; }
.tokify-msg .tokify-h { display: inline-block; margin-top: 4px; font-size: 1.05em; }
.tokify-msg code {
	font-family: var(--tk-mono);
	font-size: 0.88em;
	background: var(--tk-night);
	border-radius: 6px;
	padding: 1px 6px;
}
.tokify-msg pre {
	background: var(--tk-night);
	border-radius: 10px;
	padding: 12px 14px;
	margin: 8px 0;
	overflow-x: auto;
	white-space: pre;
}
.tokify-msg pre code { background: none; padding: 0; }

.tokify-cost {
	display: block;
	margin-top: 8px;
	font-size: 0.78em;
	color: var(--tk-muted);
	font-variant-numeric: tabular-nums;
}

.tokify-dots { display: inline-flex; gap: 5px; padding: 4px 2px; }
.tokify-dots i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--tk-muted);
	animation: tokify-dot 1.2s infinite ease-in-out;
}
.tokify-dots i:nth-child(2) { animation-delay: 0.15s; }
.tokify-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tokify-dot {
	0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-4px); }
}

.tokify-alert {
	align-self: stretch;
	color: var(--tk-danger);
	background: var(--tk-danger-bg);
	border-radius: 14px;
	padding: 12px 14px;
	line-height: 1.5;
}
.tokify-alert-action {
	display: inline-block;
	margin-left: 10px;
	color: var(--tk-on-gold);
	background: var(--tk-gold);
	border-radius: 999px;
	padding: 3px 12px;
	font-weight: 700;
	text-decoration: none;
}

/* ---------- Bienvenida ---------- */
.tokify-welcome {
	margin: auto;
	text-align: center;
	max-width: 520px;
	padding: 10px 6px;
}
.tokify-welcome-coin {
	width: 60px;
	height: 60px;
	font-size: 1.6em;
	margin-bottom: 14px;
	animation: tokify-flip 0.9s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}
@keyframes tokify-flip {
	from { transform: translateY(14px) rotateY(180deg); opacity: 0; }
	to { transform: none; opacity: 1; }
}
.tokify-welcome-title {
	font-size: 1.45em;
	font-weight: 800;
	line-height: 1.25;
	margin: 0 0 6px;
	color: var(--tk-text);
}
.tokify-welcome-text {
	color: var(--tk-muted);
	margin: 0 0 18px;
}
.tokify-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}
.tokify-chip {
	font: inherit;
	font-size: 0.9em;
	color: var(--tk-text);
	background: var(--tk-raised);
	border: 1px solid var(--tk-line);
	border-radius: 14px;
	padding: 9px 14px;
	text-align: left;
	line-height: 1.35;
	cursor: pointer;
	text-decoration: none;
	transition: border-color 0.15s, background 0.15s;
}
.tokify-chip:hover { border-color: var(--tk-gold); background: var(--tk-raised-2); color: var(--tk-text); }

/* ---------- Caja de escritura ---------- */
.tokify-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0 14px;
	padding: 6px 6px 6px 16px;
	background: var(--tk-raised);
	border: 1px solid var(--tk-line);
	border-radius: 24px;
}
.tokify-form:focus-within { border-color: var(--tk-gold); }
.tokify-form textarea {
	flex: 1;
	font: inherit;
	color: var(--tk-text);
	background: transparent;
	border: 0;
	outline: 0;
	box-shadow: none;
	resize: none;
	padding: 9px 0;
	min-height: 40px;
	max-height: 160px;
	line-height: 1.45;
}
.tokify-form textarea::placeholder { color: var(--tk-muted); opacity: 1; }
.tokify-send {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: var(--tk-gold);
	color: var(--tk-on-gold);
	cursor: pointer;
	padding: 0;
}
.tokify-send:hover { background: var(--tk-gold-deep); }
.tokify-send:disabled { background: var(--tk-raised-2); color: var(--tk-muted); cursor: not-allowed; }

.tokify-foot {
	margin: 8px 0 12px;
	text-align: center;
	font-size: 0.78em;
	color: var(--tk-muted);
}

/* ---------- Botones genéricos ---------- */
.tokify-btn {
	font: inherit;
	font-weight: 700;
	background: var(--tk-gold);
	color: var(--tk-on-gold);
	border: 0;
	border-radius: 999px;
	padding: 0 20px;
	min-height: 44px;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.tokify-btn:hover { background: var(--tk-gold-deep); color: var(--tk-on-gold); }
.tokify-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tokify-btn-small { min-height: 34px; padding: 0 14px; font-size: 0.85em; flex-shrink: 0; }

.tokify :focus-visible,
.tokify-panel :focus-visible {
	outline: 3px solid var(--tk-gold);
	outline-offset: 2px;
}

.tokify-guest { padding: 32px 24px; height: auto; text-align: center; }

/* ---------- Pestañas [tokify_panel] ---------- */
.tokify-panel {
	max-width: 760px;
	margin: 0 auto;
	font-family: var(--tk-font);
}
.tokify-tabs {
	display: inline-flex;
	flex-wrap: wrap; /* v0.14.0: con 7 pestañas, pasan a otra fila en vez de salirse de la pantalla */
	gap: 4px;
	max-width: 100%;
	box-sizing: border-box;
	margin-bottom: 12px;
	padding: 5px;
	background: var(--tk-night);
	border: 1px solid var(--tk-line);
	border-radius: 26px;
}
.tokify-tabs [role="tab"] {
	font: inherit;
	font-size: 0.95em;
	font-weight: 700;
	color: var(--tk-muted);
	background: transparent;
	border: 0;
	border-radius: 999px;
	padding: 8px 18px;
	white-space: nowrap;
	cursor: pointer;
}
.tokify-tabs [role="tab"]:hover { color: var(--tk-text); }
.tokify-tabs [role="tab"][aria-selected="true"] {
	color: var(--tk-on-gold);
	background: var(--tk-gold);
}

/* ---------- Pestaña API ---------- */
.tokify-api {
	height: auto;
	overflow: visible;
	padding: 6px 0;
}
.tokify-api-section {
	padding: 18px 22px;
	border-bottom: 1px solid var(--tk-line);
}
.tokify-api-section:last-child { border-bottom: 0; }
.tokify-api h3 {
	font-family: var(--tk-font);
	font-size: 1.15em;
	font-weight: 800;
	margin: 0 0 6px;
	color: var(--tk-text);
}
.tokify-api h4 {
	font-family: var(--tk-font);
	font-size: 0.95em;
	font-weight: 700;
	margin: 16px 0 8px;
	color: var(--tk-text);
}
.tokify-api a { color: var(--tk-gold); }
.tokify-hint {
	color: var(--tk-muted);
	font-size: 0.9em;
	margin: 4px 0 12px;
	line-height: 1.55;
}
.tokify-api code,
.tokify-api pre { font-family: var(--tk-mono); font-size: 0.86em; }
.tokify-api p code {
	color: var(--tk-text);
	background: var(--tk-raised);
	border-radius: 6px;
	padding: 1px 6px;
}

.tokify-copyrow {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--tk-raised);
	border: 1px solid var(--tk-line);
	border-radius: 14px;
	padding: 6px 6px 6px 14px;
}
.tokify-copyrow code {
	flex: 1;
	color: var(--tk-text);
	background: none;
	padding: 0;
	overflow-x: auto;
	white-space: nowrap;
}

.tokify-newkey {
	border: 2px solid var(--tk-gold);
	background: rgba(245, 176, 65, 0.08);
	border-radius: 16px;
	padding: 14px;
	margin-bottom: 14px;
}
.tokify-newkey p { margin: 0 0 10px; }

.tokify-keys { margin-bottom: 14px; }
.tokify-key {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--tk-line);
}
.tokify-key .tokify-hint { margin: 2px 0 0; white-space: pre-wrap; }

.tokify-link-danger {
	font: inherit;
	font-size: 0.9em;
	background: none;
	border: 1px solid var(--tk-line);
	border-radius: 999px;
	color: var(--tk-danger);
	cursor: pointer;
	padding: 6px 12px;
}
.tokify-link-danger:hover { border-color: var(--tk-danger); }
.tokify-link-danger:disabled { opacity: 0.5; cursor: wait; }

.tokify-keyform { display: flex; gap: 8px; }
.tokify-keyform input {
	flex: 1;
	font: inherit;
	color: var(--tk-text);
	background: var(--tk-raised);
	border: 1px solid var(--tk-line);
	border-radius: 999px;
	padding: 10px 16px;
	min-height: 44px;
}
.tokify-keyform input::placeholder { color: var(--tk-muted); opacity: 1; }
.tokify-keyform input:focus { border-color: var(--tk-gold); outline: 0; }

.tokify-msg-error { color: var(--tk-danger); font-size: 0.9em; margin: 10px 0 0; }

.tokify-scroll { overflow-x: auto; }
.tokify-table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.tokify-table th,
.tokify-table td {
	text-align: left;
	padding: 10px 12px 10px 0;
	border: 0;
	border-bottom: 1px solid var(--tk-line);
	vertical-align: top;
	color: var(--tk-text);
	background: none;
}
.tokify-table th { color: var(--tk-muted); font-weight: 600; }
.tokify-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.tokify-table code { color: var(--tk-gold); background: none; }

.tokify-code {
	position: relative;
	background: #120d17;
	border: 1px solid var(--tk-line);
	border-radius: 14px;
}
.tokify-code pre {
	color: var(--tk-text);
	background: none;
	border: 0;
	margin: 0;
	padding: 16px 96px 16px 16px;
	overflow-x: auto;
	white-space: pre;
	line-height: 1.55;
}
.tokify-code .tokify-btn-small { position: absolute; top: 10px; right: 10px; }

/* ---------- Móvil ---------- */
@media (max-width: 600px) {
	.tokify { border-radius: 18px; height: 82vh; }
	.tokify-api { height: auto; }
	.tokify-model-label, .tokify-new span { display: none; }
	.tokify-model { flex: 1; }
	.tokify-model select { width: 100%; max-width: 100%; text-overflow: ellipsis; }
	.tokify-new { padding: 7px 9px; }
	.tokify-unit { display: none; }
	.tokify-balance { padding-right: 12px; }
	.tokify-msg { max-width: 88%; }
	.tokify-api-section { padding: 16px; }
	.tokify-keyform { flex-direction: column; }
	.tokify-key { align-items: flex-start; }
	.tokify-welcome-title { font-size: 1.25em; }
}

@media (prefers-reduced-motion: reduce) {
	.tokify *,
	.tokify-panel * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* La caja de escritura ya marca el foco con su borde dorado. */
.tokify .tokify-form textarea:focus,
.tokify .tokify-form textarea:focus-visible { outline: none; box-shadow: none; }

/* v0.4.0: acciones de cada clave y campo de límite */
.tokify-key-actions { display: flex; gap: 14px; align-items: center; flex-shrink: 0; }
.tokify-link {
	background: none;
	border: 0;
	padding: 0;
	color: var(--tk-gold);
	cursor: pointer;
	font: inherit;
	text-decoration: underline;
}
.tokify-link:disabled { opacity: .5; cursor: default; }
.tokify-keyform input[type="number"] { max-width: 210px; }
@media (max-width: 600px) {
	.tokify-keyform input[type="number"] { max-width: none; }
	.tokify-key-actions { margin-top: 6px; }
}

/* v0.5.0: streaming */
.tokify-send.is-stop { background: var(--tk-raised-2); color: var(--tk-text, inherit); }
.tokify-send.is-stop:hover { background: var(--tk-gold-deep); color: var(--tk-on-gold); }
.tokify-row-assistant.is-streaming .tokify-msg::after {
	content: '';
	display: inline-block;
	width: .5em;
	height: 1em;
	margin-left: 2px;
	vertical-align: text-bottom;
	background: currentColor;
	opacity: .6;
	animation: tokify-caret 1s steps(1) infinite;
}
@keyframes tokify-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
	.tokify-row-assistant.is-streaming .tokify-msg::after { animation: none; }
}

/* v0.6.0: historial de conversaciones */
.tokify-chat { position: relative; }
.tokify-drawer {
	position: absolute;
	inset: 0 auto 0 0;
	width: min(340px, 88%);
	z-index: 5;
	display: flex;
	flex-direction: column;
	background: var(--tk-raised);
	border-right: 1px solid var(--tk-line);
	box-shadow: 20px 0 40px -20px rgba(0, 0, 0, .6);
}
.tokify-drawer[hidden] { display: none; }
.tokify-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var(--tk-line);
}
.tokify-drawer-close {
	background: none;
	border: 0;
	color: var(--tk-muted);
	font-size: 1.5em;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}
.tokify-drawer-close:hover { color: var(--tk-text); }
.tokify-drawer-list { flex: 1; overflow-y: auto; padding: 8px; }
.tokify-drawer-list .tokify-hint { padding: 8px; }
.tokify-conv { display: flex; align-items: center; border-radius: 12px; }
.tokify-conv:hover, .tokify-conv.is-current { background: var(--tk-raised-2); }
.tokify-conv-open {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	text-align: left;
	background: none;
	border: 0;
	color: var(--tk-text);
	font: inherit;
	padding: 10px 12px;
	cursor: pointer;
}
.tokify-conv-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92em; }
.tokify-conv-when { color: var(--tk-muted); font-size: .78em; }
.tokify-conv-del {
	background: none;
	border: 0;
	color: var(--tk-muted);
	font-size: 1.2em;
	padding: 6px 10px;
	cursor: pointer;
	opacity: .6;
}
.tokify-conv-del:hover, .tokify-conv-del:focus-visible { opacity: 1; color: var(--tk-text); }
.tokify-drawer-foot { padding: 12px 16px 16px; border-top: 1px solid var(--tk-line); font-size: .88em; }
.tokify-drawer-foot .tokify-hint { margin: 6px 0 10px; }
.tokify-switch { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.tokify-switch input { accent-color: var(--tk-gold); width: 16px; height: 16px; }

/* v0.7.0: Mi consumo y regalo de bienvenida */
.tokify-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tokify-stat {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 14px 16px;
	border: 1px solid var(--tk-line);
	border-radius: 14px;
	background: var(--tk-raised);
}
.tokify-stat-label { color: var(--tk-muted); font-size: .82em; }
.tokify-stat strong { font-size: 1.5em; font-variant-numeric: tabular-nums; }
.tokify-chart-svg { width: 100%; height: 180px; display: block; }
.tokify-chart-svg rect { fill: var(--tk-gold); }
.tokify-chart-svg rect:hover { fill: var(--tk-gold-deep); }
.tokify-chart-axis { display: flex; justify-content: space-between; color: var(--tk-muted); font-size: .78em; margin-top: 4px; }
.tokify-gift {
	margin: 0 0 16px;
	padding: 10px 14px;
	border-radius: 12px;
	background: var(--tk-raised);
	border: 1px solid var(--tk-gold);
	font-weight: 600;
}
@media (max-width: 600px) {
	.tokify-stats { grid-template-columns: 1fr; }
}

/* v0.8.0: herramientas */
.tokify-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tokify-tool-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	text-align: left;
	padding: 18px;
	border: 1px solid var(--tk-line);
	border-radius: 16px;
	background: var(--tk-raised);
	color: var(--tk-text);
	font: inherit;
	cursor: pointer;
	transition: border-color .15s, transform .15s;
}
.tokify-tool-card:hover, .tokify-tool-card:focus-visible { border-color: var(--tk-gold); transform: translateY(-2px); }
.tokify-tool-card-icon { font-size: 1.8em; line-height: 1; }
.tokify-tool-card-name { font-size: 1.05em; }
.tokify-tool-card-desc { color: var(--tk-muted); font-size: .88em; line-height: 1.45; }
.tokify-tool-card-cost { margin-top: auto; padding-top: 6px; color: var(--tk-gold); font-size: .82em; font-weight: 600; }
.tokify-tool-title { margin: 14px 0 4px; font-size: 1.3em; }
.tokify-tool-form { display: grid; gap: 14px; margin: 18px 0; }
.tokify-field { display: flex; flex-direction: column; gap: 6px; }
.tokify-field label { font-weight: 600; font-size: .92em; }
.tokify-field input, .tokify-field select, .tokify-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid var(--tk-line);
	border-radius: 10px;
	background: var(--tk-raised-2);
	color: var(--tk-text);
	font: inherit;
}
.tokify-field textarea { resize: vertical; }
.tokify-field input:focus, .tokify-field select:focus, .tokify-field textarea:focus { outline: 2px solid var(--tk-gold); outline-offset: 1px; }
.tokify-field-help { color: var(--tk-muted); font-size: .8em; }
.tokify-tool-run { justify-self: start; }
.tokify-tool-output {
	padding: 18px;
	border: 1px solid var(--tk-line);
	border-radius: 14px;
	background: var(--tk-raised);
	overflow-x: auto;
}
.tokify-tool-output.is-streaming .tokify-tool-text::after {
	content: '';
	display: inline-block;
	width: .5em;
	height: 1em;
	margin-left: 2px;
	vertical-align: text-bottom;
	background: currentColor;
	opacity: .6;
	animation: tokify-caret 1s steps(1) infinite;
}
.tokify-tool-text { white-space: pre-wrap; line-height: 1.6; }
.tokify-tool-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 4px; }

/* Documento de presupuesto en pantalla */
.tk-doc { background: #fff; color: #1d1d1f; border-radius: 10px; padding: 22px; font-size: .92em; line-height: 1.5; }
.tk-doc-type { font-size: 1.6em; font-weight: 700; }
.tk-doc-meta, .tk-doc-label { color: #666; font-size: .85em; }
.tk-doc-label { text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.tk-doc-parties { display: flex; flex-wrap: wrap; gap: 24px; margin: 18px 0; }
.tk-doc-parties > div { flex: 1 1 200px; }
.tk-doc table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.tk-doc th, .tk-doc td { padding: 7px 6px; border-bottom: 1px solid #e3e3e3; text-align: left; }
.tk-doc th { color: #666; font-size: .8em; text-transform: uppercase; }
.tk-doc .n { text-align: right; white-space: nowrap; }
.tk-doc-totals { width: auto !important; margin-left: auto !important; min-width: 240px; }
.tk-doc-totals .t td { font-weight: 700; font-size: 1.1em; border-bottom: 2px solid #1d1d1f; }
.tk-doc-notice { margin-top: 18px; color: #888; font-size: .8em; }
@media (max-width: 600px) {
	.tokify-tools-grid { grid-template-columns: 1fr; }
	.tokify-tabs { overflow-x: visible; }
	.tokify-tabs [role="tab"] { padding: 7px 12px; font-size: .9em; }
}

/* v0.9.0: escudo de privacidad y modo privado */
.tokify-privacy {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	padding: 8px 16px 0;
}
.tokify-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	border: 1px solid var(--tk-line);
	border-radius: 999px;
	background: transparent;
	color: var(--tk-muted);
	font: inherit;
	font-size: .84em;
	cursor: pointer;
}
.tokify-chip.is-on { border-color: var(--tk-gold); color: var(--tk-text); background: var(--tk-raised-2); }
.tokify-chip:disabled { opacity: .5; cursor: default; }
.tokify-privacy-note { color: var(--tk-muted); font-size: .8em; }
.tokify-words {
	margin: 8px 16px 0;
	padding: 12px 14px;
	border: 1px solid var(--tk-line);
	border-radius: 12px;
	background: var(--tk-raised);
}
.tokify-words textarea {
	width: 100%;
	box-sizing: border-box;
	margin: 6px 0 8px;
	padding: 8px 10px;
	border: 1px solid var(--tk-line);
	border-radius: 10px;
	background: var(--tk-raised-2);
	color: var(--tk-text);
	font: inherit;
}
.tokify-words-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tokify-shield-badge {
	display: block;
	margin-top: 6px;
	color: var(--tk-muted);
	font-size: .78em;
}
.tokify-chat.is-private { box-shadow: 0 0 0 2px #8b5cf6 inset; }
.tokify-chat.is-private .tokify-privacy-note { color: #c4b5fd; }
.tokify-tool-shield { font-size: .88em; }

/* v0.9.1: recuadro para visitantes */
.tokify-guest {
	max-width: 620px;
	margin: 0 auto;
	padding: 36px 32px !important;
	text-align: left !important;
	border: 1px solid var(--tk-line);
	border-radius: 20px;
	background: var(--tk-raised);
	color: var(--tk-text);
}
.tokify-guest-kicker { margin: 0 0 6px; color: var(--tk-gold); font-weight: 600; font-size: .9em; }
.tokify-guest-title { margin: 0 0 20px; font-size: 1.6em; line-height: 1.25; }
.tokify-guest-points { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.tokify-guest-points li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; }
.tokify-guest-icon { font-size: 1.3em; line-height: 1.2; flex-shrink: 0; }
.tokify-guest-gift {
	margin: 0 0 20px;
	padding: 10px 14px;
	border: 1px solid var(--tk-gold);
	border-radius: 12px;
}
.tokify-guest-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tokify-guest-actions .tokify-btn { text-decoration: none; }
.tokify-btn-ghost {
	background: transparent !important;
	color: var(--tk-text) !important;
	border: 1px solid var(--tk-line) !important;
}
.tokify-btn-ghost:hover { border-color: var(--tk-gold) !important; }
@media (max-width: 600px) {
	.tokify-guest { padding: 24px 20px !important; }
	.tokify-guest-actions .tokify-btn { flex: 1 1 100%; text-align: center; justify-content: center; }
}
