/* =====================================================================================================
   Estilo «tipo app» de Contable (se carga después de app.css; el punto de venta usa pdv.css y no lo lleva).
   Mismos colores de marca; más aire, esquinas más redondas, campos más cómodos y jerarquía más clara.
   · Tarjetas, campos, botones y tablas de toda la plataforma
   · Dentro de un RFC: el menú izquierdo se vuelve una barra de íconos (se abre al pasar el mouse)
   · Encabezado del RFC compacto (.rfc-banda)
   · Avisos flotantes (.aviso-flotante) en lugar del letrero de arriba
   ===================================================================================================== */
:root {
	--radius-sm: 10px;
	--radius-md: 16px;
	--shadow-sm: 0 1px 2px rgba(23, 32, 28, .04), 0 4px 14px rgba(23, 32, 28, .04);
	--rail-w: 68px;
}

/* --- Tarjetas --- */
.card { border-radius: 16px; padding: 1.25rem 1.4rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flush { padding: 0; }
/* Una tarjeta que empieza con su título lleva encabezado de sección (como los formularios nuevos), sin tocar cada pantalla */
.card:not(.flush):not(.auth):not(.sync-card) > h2:first-child, .card:not(.flush):not(.auth):not(.sync-card) > h3:first-child {
	margin: -1.25rem -1.4rem 1.1rem !important; padding: .95rem 1.4rem; border-bottom: 1px solid var(--border); border-radius: 16px 16px 0 0;
	background: linear-gradient(180deg, #fbfcfa, var(--surface)); font-size: 1.02rem; display: flex; align-items: center; gap: .55rem; }
.card:not(.flush):not(.auth):not(.sync-card) > h2:first-child::before, .card:not(.flush):not(.auth):not(.sync-card) > h3:first-child::before {
	content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
.card.flush > h2:first-child, .card.flush > h3:first-child { padding: 1rem 1.4rem .2rem; }
.grid-2 { gap: 1.1rem; }
.row { gap: .8rem 1rem; }

/* --- Campos (todo Contable) --- */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select, textarea {
	min-height: 42px; padding: .55rem .8rem; border-radius: 10px; border: 1.5px solid var(--border); background: #f8faf7;
	font-size: .92rem; transition: background .15s, border-color .15s, box-shadow .15s; }
input:not([type="checkbox"]):not([type="radio"]):hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-light); }
label { color: var(--ink); font-size: .84rem; }
.field-hint { color: var(--muted); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; }
.casilla, .check { display: flex; align-items: center; gap: .55rem; font-weight: 500; color: var(--ink); }

/* --- Botones --- */
button, .btn { border-radius: 10px; min-height: 42px; padding: .55rem 1.15rem; transition: background .15s, box-shadow .15s, transform .05s; }
button:active, .btn:active { transform: translateY(1px); }
button:not(.link):not(.ghost):hover, .btn:not(.ghost):hover { box-shadow: 0 4px 12px rgba(15, 94, 79, .22); }
.btn.ghost, button.ghost { border-width: 1.5px; background: var(--surface); }
.btn.small, button.small { min-height: 34px; border-radius: 9px; padding: .35rem .85rem; }
button.link { min-height: auto; }

/* --- Encabezados de página --- */
.page-head { margin-bottom: 1.2rem !important; align-items: flex-end; }
.page-head h1, .page-head h2 { font-size: 1.6rem; line-height: 1.2; }
.page-head .sub { font-size: .92rem; }
.page-head > div > a.small:first-child:not(.btn) { display: inline-flex; font-weight: 600; color: var(--muted); margin-bottom: .2rem; }       /* «← Regresar» */
.page-head > div > a.small:first-child:not(.btn):hover { color: var(--brand); text-decoration: none; }
.page-head .btn-row .btn, .page-head .btn-row button { border-radius: 10px; }
h2.section-title, .section-title { letter-spacing: .08em; }

/* --- Tablas --- */
th { background: transparent; color: var(--muted); font-size: .72rem; border-bottom: 1.5px solid var(--border); padding: .75rem .85rem; }
td { padding: .7rem .85rem; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: #f4f9f6; }
.card.flush .table-wrap { border-radius: 16px; }
.empty { padding: 2.2rem 1rem; text-align: center; color: var(--muted); }

/* --- Indicadores --- */
.stat-tile { border-radius: 16px; }

/* --- Pestañas --- */
.tabs a { border-radius: 999px; }

/* --- Encabezado compacto del RFC --- */
.rfc-banda { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; padding: .55rem .9rem; margin: -.2rem 0 1.1rem;
	background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); font-size: .84rem; }
.rfc-banda .rfc-id { display: flex; align-items: baseline; gap: .55rem; min-width: 0; }
.rfc-banda .rfc-id strong { font-family: "Sora", sans-serif; font-size: 1rem; letter-spacing: .02em; }
.rfc-banda .rfc-id span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
.rfc-banda .rfc-marcas { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.rfc-banda .semaforo { margin: 0; }
.rfc-banda .rfc-sync { margin: 0 0 0 auto; font-size: .78rem; }
.rfc-banda .crumb-mini { color: var(--muted); font-size: .78rem; }
.rfc-banda .crumb-mini a { color: inherit; }
@media (max-width: 760px) { .rfc-banda .rfc-sync { margin-left: 0; } .rfc-banda .rfc-id span { max-width: 22ch; } }

/* --- Dentro de un RFC: el menú izquierdo es una barra de íconos que se abre al pasar el mouse --- */
@media (min-width: 1280px) {
	html:not(.menu-izq-oculto) body.con-panel-rfc .container { margin-left: var(--rail-w); }
	body.con-panel-rfc .sidebar { width: var(--rail-w); transition: width .18s ease, box-shadow .18s ease; overflow-x: hidden; }
	body.con-panel-rfc .sidebar:hover, body.con-panel-rfc .sidebar:focus-within { width: var(--sidebar-w); box-shadow: var(--shadow-lift); }
	body.con-panel-rfc .sidebar:not(:hover):not(:focus-within) a, body.con-panel-rfc .sidebar:not(:hover):not(:focus-within) .nav-grupo > summary {
		font-size: 0; gap: 0; justify-content: center; padding-left: 0; padding-right: 0; position: relative; }
	body.con-panel-rfc .sidebar:not(:hover):not(:focus-within) .nav-grupo > summary::after,
	body.con-panel-rfc .sidebar:not(:hover):not(:focus-within) .nav-grupo > summary > span:not(.nav-badge),
	body.con-panel-rfc .sidebar:not(:hover):not(:focus-within) .plan-uso,
	body.con-panel-rfc .sidebar:not(:hover):not(:focus-within) .nav-grupo > a { display: none; }
	body.con-panel-rfc .sidebar:not(:hover):not(:focus-within) .nav-badge { position: absolute; top: 2px; right: 8px; font-size: .62rem; }
	body.con-panel-rfc .sidebar .nav-grupo > summary svg { width: 19px; height: 19px; stroke: currentColor; flex: none; }
}

/* --- Avisos flotantes --- */
.aviso-flotante { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 90; max-width: min(440px, calc(100vw - 2rem)); display: flex; align-items: flex-start; gap: .7rem;
	padding: .85rem 1rem; border-radius: 14px; background: #10251f; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: .9rem; line-height: 1.4;
	animation: aviso-entra .25s ease-out; }
.aviso-flotante .ico { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #2e9d6a; display: grid; place-items: center; font-size: .75rem; font-weight: 800; }
.aviso-flotante button { all: unset; cursor: pointer; margin-left: .3rem; opacity: .7; font-size: 1rem; line-height: 1; }
.aviso-flotante button:hover { opacity: 1; }
.aviso-flotante.sale { animation: aviso-sale .25s ease-in forwards; }
@keyframes aviso-entra { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes aviso-sale { to { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .aviso-flotante, .aviso-flotante.sale { animation: none; } }

/* --- Letreros de aviso --- */
.alert { border-radius: 12px; padding: .8rem 1rem; border: 1px solid transparent; line-height: 1.45; }
.alert.error { border-color: #efc4bc; }
.alert.info { border-color: #bcdccf; }
.alert.warn { border-color: #ecd3a8; }

/* --- Entrar, registro y recuperar contraseña --- */
body:has(.card.auth) { background: radial-gradient(1200px 600px at 10% -10%, #d7ece4 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e6f1ec 0%, transparent 55%), var(--bg); min-height: 100vh; }
.card.auth { margin-top: 8vh; padding: 2rem 2rem 1.5rem; border-radius: 22px; border: 1px solid rgba(15, 94, 79, .12); box-shadow: 0 20px 50px rgba(15, 50, 40, .12); }
.card.auth h1 { font-size: 1.6rem; margin-bottom: 1.2rem; }
.card.auth .lockup { font-size: 1.15rem; }
.card.auth label { margin-bottom: 1rem; }
.card.auth input { min-height: 48px; }
.card.auth form > button[type="submit"] { width: 100%; min-height: 50px; font-size: 1rem; border-radius: 12px; margin-top: .3rem; }
.card.auth p.small { text-align: center; }
body:has(.card.auth) .container { margin-left: auto; margin-right: auto; }

/* ---- «Ocultar cifras»: interruptor de la barra y lo que se oculta (static/js/cifras.js) ---- */
.cifras-switch { display: inline-flex; align-items: center; gap: .45rem; margin-right: .9rem; cursor: pointer; font-size: .85rem; font-weight: 500; user-select: none; }
.cifras-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cifras-riel { position: relative; width: 36px; height: 20px; border-radius: 999px; background: rgba(127, 140, 134, .45); transition: background .2s; flex: none; }
.cifras-riel::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.cifras-switch input:checked + .cifras-riel { background: #0f5e4f; }
.cifras-switch input:checked + .cifras-riel::after { transform: translateX(16px); }
.cifras-switch input:focus-visible + .cifras-riel { outline: 2px solid #0f5e4f; outline-offset: 2px; }
@media (max-width: 640px) { .cifras-texto { display: none; } }
html.ocultar-cifras .cifra,
html.ocultar-cifras td.num,
html.ocultar-cifras .stat-tile .valor,
html.ocultar-cifras input[inputmode="decimal"]:not(:focus) { filter: blur(6px); user-select: none; }
html.ocultar-cifras .cifra { display: inline-block; }


/* --- Formularios ya guardados (static/js/bloqueo.js): cerrados hasta dar «Editar» --- */
.bloqueo-barra { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin: 0 0 1rem;
	padding: .55rem .8rem; border-radius: 12px; background: var(--brand-light); color: var(--brand-dark); font-size: .9rem; }
.bloqueo-barra.editando { background: var(--amber-light); color: var(--amber); }
form.bloqueado input:disabled, form.bloqueado select:disabled, form.bloqueado textarea:disabled {
	background: var(--surface-2); color: var(--ink); opacity: 1; cursor: default; -webkit-text-fill-color: var(--ink); }
form.bloqueado button[type=submit]:disabled, form.bloqueado .btn-row button:disabled, form.bloqueado .barra-acciones { display: none; }
