/* STM PRO · Portal de máquinas — misma identidad que sat.stmpro.es */

@font-face { font-family: 'Archivo'; font-weight: 700 900; font-display: swap; src: url(../fonts/archivo-700-normal-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-400-normal-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-500-normal-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-mono-600-normal-latin.woff2) format('woff2'); }
@font-face { font-family: 'Blinker'; font-weight: 400; font-display: swap; src: url(../fonts/blinker-400-normal-latin.woff2) format('woff2'); }
@font-face { font-family: 'Blinker'; font-weight: 600; font-display: swap; src: url(../fonts/blinker-600-normal-latin.woff2) format('woff2'); }
@font-face { font-family: 'Blinker'; font-weight: 700; font-display: swap; src: url(../fonts/blinker-700-normal-latin.woff2) format('woff2'); }

:root {
	--stm-ink: #121214;
	--stm-steel: #55565c;
	--stm-line: #dcdcde;
	--stm-line-soft: #ececee;
	--stm-paper: #f6f5f3;
	--stm-white: #ffffff;
	--stm-signal: #c8102e;
	--stm-signal-dark: #8c0c20;
	--stm-ok: #00a32a;
	--stm-warn: #b26200;
	--stm-warn-bg: #fff4e5;
	--stm-err-bg: #fde8eb;
	--stm-ok-bg: #e6f6ea;
	--stm-radius: 6px;
	--f-head: 'Archivo', -apple-system, BlinkMacSystemFont, sans-serif;
	--f-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--f-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--stm-paper); color: var(--stm-ink); font: 15px/1.5 var(--f-body); }
a { color: var(--stm-ink); text-decoration-color: var(--stm-signal); text-underline-offset: 3px; }
a:hover { color: var(--stm-signal); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 800; letter-spacing: -0.01em; margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; }
code { font-family: var(--f-mono); font-size: .9em; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.small, small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.stm-muted { color: var(--stm-steel); }

/* ---------- Cabecera ---------- */
.stm-top { background: var(--stm-ink); color: #fff; border-bottom: 3px solid var(--stm-signal); position: sticky; top: 0; z-index: 10; }
.stm-top__in { max-width: 1320px; margin: 0 auto; padding: 0 16px; min-height: 64px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.stm-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 10px 0; }
.stm-brand img { height: 26px; width: auto; display: block; }
.stm-brand__tag { font-family: var(--f-head); font-weight: 800; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: #fff; background: var(--stm-signal); padding: 3px 8px; border-radius: 3px; }
.stm-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.stm-nav a { color: #d6d6d9; text-decoration: none; font-family: var(--f-head); font-weight: 700; font-size: .86rem; letter-spacing: .03em; text-transform: uppercase; padding: 21px 12px 18px; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.stm-nav a:hover { color: #fff; }
.stm-nav a.is-active { color: #fff; border-bottom-color: #fff; }
.stm-user { display: flex; gap: 14px; align-items: center; font-size: .85rem; color: #b9b9bd; }
.stm-user a { color: #fff; }

/* ---------- Estructura ---------- */
.stm-main { max-width: 1320px; margin: 0 auto; padding: 28px 16px 48px; }
.stm-foot { text-align: center; color: var(--stm-steel); font-size: .78rem; padding: 0 16px 28px; }
.stm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stm-head h1 { margin: 0; }
.stm-kicker { margin: 0 0 4px; font-family: var(--f-head); font-weight: 700; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--stm-signal); }
.stm-sub { margin: 6px 0 0; color: var(--stm-steel); }
.stm-back { margin: 0 0 10px; font-size: .9rem; }
.stm-back a { text-decoration: none; color: var(--stm-steel); }
.stm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px; margin-bottom: 20px; }
.stm-grid > .stm-card { margin-bottom: 0; }

.stm-card { background: var(--stm-white); border: 1px solid var(--stm-line); border-radius: var(--stm-radius); padding: 22px; margin-bottom: 20px; }
.stm-card--flush { padding: 0; overflow: hidden; }
.stm-card__title { padding: 18px 22px 14px; margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--stm-line-soft); }
.stm-card p:last-child { margin-bottom: 0; }
.stm-empty { padding: 28px 22px; color: var(--stm-steel); margin: 0; }
.stm-empty h2 { color: var(--stm-ink); }
.stm-note { background: var(--stm-white); border-left: 3px solid var(--stm-signal); padding: 10px 14px; font-size: .88rem; color: var(--stm-steel); margin: 0 0 20px; border-radius: 0 var(--stm-radius) var(--stm-radius) 0; }
.stm-flash { background: var(--stm-ok-bg); border: 1px solid #b7e2c3; color: #0b5c22; padding: 10px 14px; border-radius: var(--stm-radius); margin: 0 0 18px; }
.stm-link-sm { font-family: var(--f-body); font-weight: 400; font-size: .8rem; text-transform: none; letter-spacing: 0; }

/* ---------- Tarjetas de cifras ---------- */
.stm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stm-stat { background: var(--stm-white); border: 1px solid var(--stm-line); border-radius: var(--stm-radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.stm-stat span { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--stm-steel); font-family: var(--f-head); font-weight: 700; }
.stm-stat strong { font-family: var(--f-head); font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.stm-stat strong.mono { font-family: var(--f-mono); font-size: 1.5rem; font-weight: 600; }
.stm-stat.is-alert { border-color: var(--stm-signal); background: var(--stm-err-bg); }
.stm-stat.is-alert strong { color: var(--stm-signal); }
.stm-stat--link:hover { border-color: var(--stm-ink); }
.stm-stat--link.is-on { border-color: var(--stm-ink); box-shadow: inset 0 0 0 1px var(--stm-ink); }

/* ---------- Tablas ---------- */
.stm-table-wrap { overflow-x: auto; }
.stm-scroll { max-height: 420px; overflow-y: auto; }
.stm-scroll--tall { max-height: 640px; }
.stm-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.stm-table th { text-align: left; font-family: var(--f-head); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--stm-steel); padding: 10px 14px; border-bottom: 1px solid var(--stm-line); background: #fafafa; position: sticky; top: 0; white-space: nowrap; }
.stm-table td { padding: 10px 14px; border-bottom: 1px solid var(--stm-line-soft); vertical-align: top; }
.stm-table td small { display: block; color: var(--stm-steel); }
.stm-table tbody tr:last-child td { border-bottom: 0; }
.stm-table .num { text-align: right; white-space: nowrap; }
.stm-table tr.is-link { cursor: pointer; }
.stm-table tr.is-link:hover td { background: #faf9f7; }
.stm-table td a { text-decoration: none; font-weight: 600; }
.stm-table--raw tr.is-mapped td { background: var(--stm-ok-bg); }
.stm-table--form td { vertical-align: middle; }
.stm-table--form input { width: 100%; min-width: 180px; }

/* ---------- Estados ---------- */
.stm-pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; line-height: 1.5; }
.stm-pill--ok { background: var(--stm-ok-bg); color: #0b5c22; border-color: #b7e2c3; }
.stm-pill--idle { background: #f0f0f1; color: var(--stm-ink); border-color: var(--stm-line); }
.stm-pill--warn { background: var(--stm-warn-bg); color: var(--stm-warn); border-color: #f5d3a6; }
.stm-pill--err { background: var(--stm-err-bg); color: var(--stm-signal-dark); border-color: #ffb3bf; }
.stm-pill--off { background: transparent; color: var(--stm-steel); border-color: var(--stm-line); }

/* ---------- Formularios ---------- */
.stm-form { display: grid; gap: 14px; }
.stm-form label { display: grid; gap: 5px; font-size: .82rem; font-weight: 600; color: var(--stm-steel); }
.stm-form--cols { grid-template-columns: 1fr 1fr; }
.stm-form--cols .span2 { grid-column: 1 / -1; }
.stm-form--cols4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stm-form fieldset { border: 1px solid var(--stm-line); border-radius: var(--stm-radius); padding: 12px 14px 14px; margin: 0; }
.stm-form legend { font-family: var(--f-head); font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; padding: 0 6px; }
.stm-help { margin: -6px 0 0; font-size: .82rem; }
input[type=text], input[type=search], input[type=email], input[type=password], select, textarea {
	font: inherit; font-size: .92rem; color: var(--stm-ink); background: #fff; border: 1px solid #c3c4c7; border-radius: 4px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--stm-ink); outline-offset: 1px; border-color: var(--stm-ink); }
.stm-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stm-inline label { display: flex; gap: 8px; align-items: center; font-size: .85rem; font-weight: 600; color: var(--stm-steel); }
.stm-inline input[type=search] { width: 260px; max-width: 100%; }
.stm-inline select { width: auto; }
.stm-inline-form { margin-top: 18px; grid-template-columns: 1fr auto; align-items: end; }

.stm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 .9rem var(--f-body); background: var(--stm-ink); color: #fff; border: 1px solid var(--stm-ink); border-radius: 4px; padding: 9px 16px; cursor: pointer; text-decoration: none; white-space: nowrap; justify-self: start; }
.stm-btn:hover { background: var(--stm-signal); border-color: var(--stm-signal); color: #fff; }
.stm-btn--ghost { background: #fff; color: var(--stm-ink); }
.stm-btn--ghost:hover { background: var(--stm-ink); border-color: var(--stm-ink); }
.stm-btn--danger { background: var(--stm-signal); border-color: var(--stm-signal); }
.stm-btn--danger:hover { background: var(--stm-signal-dark); border-color: var(--stm-signal-dark); }
.stm-link-btn { background: none; border: 0; color: var(--stm-signal); cursor: pointer; font: inherit; font-size: .82rem; padding: 0; }

.stm-dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: .9rem; }
.stm-dl dt { color: var(--stm-steel); }
.stm-dl dd { margin: 0; }
.stm-dl--wide { grid-template-columns: 120px 1fr; }
.stm-copy { cursor: copy; background: var(--stm-paper); border: 1px solid var(--stm-line); padding: 4px 8px; border-radius: 4px; word-break: break-all; display: inline-block; }
.stm-secret { color: transparent; text-shadow: 0 0 7px rgba(0,0,0,.55); user-select: none; }

.stm-list { list-style: none; margin: 0; padding: 0; }
.stm-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stm-line-soft); }
.stm-list a { text-decoration: none; }

.stm-details > summary { cursor: pointer; font-family: var(--f-head); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.stm-details[open] > summary { margin-bottom: 14px; }
.stm-danger > summary { color: var(--stm-signal); }
.stm-card .stm-details { margin-top: 20px; }

/* ---------- Facturación ---------- */
.stm-bill__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--stm-line); background: #fafafa; }
.stm-bill__head h2 { margin: 0 0 2px; text-transform: none; letter-spacing: 0; font-size: 1.1rem; }
.stm-bill__head h2 a { text-decoration: none; }
.stm-bill__head p { margin: 0; color: var(--stm-steel); }
.stm-bill__total { font-size: 1.3rem; }
.stm-grand { display: flex; justify-content: space-between; align-items: center; background: var(--stm-ink); color: #fff; border-color: var(--stm-ink); }
.stm-grand span { font-family: var(--f-head); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.stm-grand strong { font-size: 1.6rem; }

/* ---------- Acceso (igual que sat.stmpro.es/acceder) ---------- */
.stm-login { min-height: 100vh; margin: 0; display: grid; place-items: center; background: var(--stm-paper) center / cover no-repeat; font-family: 'Blinker', sans-serif; padding: 24px 16px; }
.stm-login__box { width: 100%; max-width: 660px; text-align: center; }
.stm-login__logo { margin: 0 0 28px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stm-login__logo img { width: 100%; max-width: 620px; height: auto; }
.stm-login__logo span { font-family: 'Blinker', sans-serif; font-weight: 700; font-size: .95rem; letter-spacing: .4em; text-transform: uppercase; color: var(--stm-signal); }
.stm-login__form { max-width: 210px; margin: 0 auto; display: grid; gap: 6px; justify-items: center; }
.stm-login__form label { font-size: .82rem; color: var(--stm-ink); white-space: nowrap; }
.stm-login__form label span { color: var(--stm-signal); }
.stm-login__form input[type=text], .stm-login__form input[type=password] { padding: 6px 8px; border: 1px solid #8c8f94; border-radius: 4px; margin-bottom: 10px; }
.stm-login__check { display: flex; gap: 5px; align-items: center; margin-bottom: 12px; }
.stm-login__form button { font: 600 .8rem 'Blinker', sans-serif; background: #000; color: #fff; border: 0; border-radius: 4px; padding: 8px 18px; cursor: pointer; }
.stm-login__form button:hover { background: var(--stm-signal); }
.stm-login__error { width: 100%; background: var(--stm-err-bg); color: var(--stm-signal-dark); border: 1px solid #ffb3bf; border-radius: 4px; padding: 6px 8px; font-size: .82rem; margin: 0 0 10px; }
.stm-login__nota { margin: 80px auto 0; max-width: 620px; font-size: .78rem; color: #8a8a8f; }

@media (max-width: 760px) {
	.stm-top__in { gap: 6px 14px; padding-top: 8px; }
	.stm-nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
	.stm-nav::-webkit-scrollbar { display: none; }
	.stm-nav a { padding: 10px 10px 12px; }
	.stm-user { margin-left: auto; }
	.stm-form--cols { grid-template-columns: 1fr; }
	.stm-dl { grid-template-columns: 1fr; gap: 0 0; }
	.stm-dl dt { margin-top: 8px; }
	.stm-main { padding-top: 20px; }
	.stm-bill__head { flex-direction: column; align-items: flex-start; }
}
