/* Smartgrid · Administración (usa las variables de app.css) */
.adm { font-size: 15px; }
.adm-wrap { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }
.adm-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.adm-top__right { display: flex; gap: 8px; }
.adm-top__right form { margin: 0; }
.adm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.adm-head h1 { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: -.01em; }
.adm-card { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--edge);
    border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.adm-card h2 { margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.adm-card.empty { color: var(--muted); text-align: center; padding: 36px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }
code { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
a { color: var(--link); }

/* botones */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2);
    background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--line-3); }
.btn:disabled { opacity: .6; cursor: default; }
.btn--primary { background: var(--pv); border-color: var(--pv); color: #1b1300; }
.btn--primary:hover { background: #ffc54d; }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--danger-bg); border-color: var(--danger-edge); color: var(--danger-text); }
.btn--small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }

/* avisos */
.note { padding: 11px 16px; border-radius: 12px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.note--ok { background: var(--ok-bg); border-color: var(--ok-edge); color: var(--ok-text); }
.note--error { background: var(--warn-bg); border-color: var(--warn-edge); color: var(--warn-text); }
.note--info { background: var(--info-bg); border-color: var(--info-edge); color: var(--info-text); }
.note a { color: inherit; font-weight: 600; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; margin: 10px 0 2px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-word; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); vertical-align: 2px; margin-left: 6px; }

/* sedes */
.site__head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.site__head h2 { text-transform: none; letter-spacing: -.01em; font-size: 21px; color: var(--text); margin: 0 0 4px; }
.site__actions { display: flex; gap: 8px; }
.site.is-off { opacity: .6; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px; border-bottom: 1px solid var(--edge); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--edge); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.is-off td { opacity: .55; }
.tbl tr:target td { background: rgba(247, 183, 51, .07); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; margin: 0; }
.kind { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 9px; vertical-align: 1px; }
.kind--inverter { background: var(--pv); } .kind--battery { background: var(--bat); } .kind--charger { background: var(--ev); }

/* formularios */
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--text); }
.form small, .adm-login small { font-weight: 400; color: var(--faint); font-size: 12.5px; line-height: 1.4; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .adm-login input {
    width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--input-bg); color: var(--text); font: inherit; font-weight: 500; }
.form input:focus, .form select:focus, .adm-login input:focus { outline: none; border-color: var(--pv); box-shadow: 0 0 0 3px rgba(247, 183, 51, .18); }
.form input::placeholder { color: var(--faint); }
.form label.check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; align-self: center; }
.form label.check small { flex-basis: 100%; }
.form label.check.inline { display: inline-flex; margin-left: 8px; font-weight: 500; color: var(--muted); }
.form input[type=checkbox], .form input[type=radio] { width: 17px; height: 17px; accent-color: var(--pv); }
.form fieldset { border: 1px solid var(--edge); border-radius: 14px; padding: 14px 16px 16px; margin: 16px 0 0; }
.form legend { padding: 0 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.form fieldset > small { display: block; margin-top: 10px; }
.grid2, .grid3 { display: grid; gap: 16px 18px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.grid2 + .grid3, .grid3 + .grid3, fieldset + .grid3 { margin-top: 16px; }
.form__actions { display: flex; gap: 10px; margin-top: 20px; }
.form__actions.sticky { position: sticky; bottom: 0; padding: 14px 0; margin: 0 0 16px; background: linear-gradient(180deg, transparent, var(--bg) 35%); }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line-2); border-right: 0; border-radius: 10px 0 0 10px; color: var(--faint); font-weight: 500; background: var(--surface); }
.prefix input { border-radius: 0 10px 10px 0 !important; }
.pw { display: flex; gap: 8px; }

.kind-pick { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.kind-opt { flex-direction: row !important; }
.kind-opt input { position: absolute; opacity: 0; }
.kind-opt span { display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line-2); cursor: pointer; font-weight: 600; }
.kind-opt input:checked + span { border-color: var(--pv); background: rgba(247, 183, 51, .1); }
.kind-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(247, 183, 51, .3); }

.geo { display: flex; gap: 8px; margin-bottom: 10px; }
.geo-results { list-style: none; margin: 0 0 12px; padding: 4px; border-radius: 12px; border: 1px solid var(--edge); background: var(--input-bg); }
.geo-results li button { width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.geo-results li button:hover { background: var(--surface-2); }
.geo-results li.muted { padding: 9px 12px; }
.geo-map { display: flex; align-items: flex-end; padding-bottom: 11px; font-size: 14px; }

.split { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.split p { margin: 0 0 6px; }
.danger { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-color: var(--danger-edge); }
.confirm-input { margin-top: 8px; max-width: 160px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--input-bg); color: var(--text); font: inherit; }
.danger .check { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); }

/* acceso */
.adm-login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.adm-login__card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.adm-login__card h1 { margin: 0; font-size: 22px; }
.adm-login__card p { margin: 0; }
.adm-login label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }

@media (max-width: 800px) {
    .grid2, .grid3 { grid-template-columns: 1fr; }
    .span2, .span3 { grid-column: auto; }
    .tbl thead { display: none; }
    .tbl tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--edge); }
    .tbl td { display: block; border: 0; padding: 3px 0; }
    .row-actions { text-align: left; }
    .split, .danger { flex-direction: column; align-items: stretch; }
}

.form [hidden], .adm [hidden] { display: none !important; }

.site__actions form { margin: 0; }
.kv dd { white-space: pre-wrap; }
.note--error .kv dt, .note--ok .kv dt { color: inherit; opacity: .75; }

/* fotos de equipos */
.dev-cell { display: flex; align-items: center; gap: 12px; }
.thumb { width: 52px; height: 44px; object-fit: contain; border-radius: 8px; background: #eef1f5; flex: none; }
.thumb--empty { display: grid; place-items: center; background: var(--surface); border: 1px dashed var(--line-2); }
.thumb--empty .kind { margin: 0; }
.img-field { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.img-preview { aspect-ratio: 6 / 5; border-radius: 14px; background: #eef1f5; display: grid; place-items: center; overflow: hidden; }
.img-preview img { width: 100%; height: 100%; object-fit: contain; }
.img-preview .muted { color: #6b7790; }
.img-controls { display: grid; gap: 14px; }
.form input[type=file] { padding: 8px; }
@media (max-width: 800px) { .img-field { grid-template-columns: 1fr; } .img-preview { max-width: 260px; } }

.adm-top .brandline { margin: 0; }
.adm-top .logo { height: 32px; }
.adm-top__right { align-items: center; }
.adm-login .logo { height: 56px; }

.kiosk-tbl select { min-width: 0; }
.kiosk-tbl td { vertical-align: top; }
.kiosk-custom { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--muted); }
.kiosk-custom input { width: 96px !important; }

/* ---------- ventana de resultados («Probar») ---------- */
.modal { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-2); border-radius: 20px;
    background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); overflow: hidden; }
.modal[open] { display: flex; flex-direction: column; animation: pop .22s ease-out; }
.modal::backdrop { background: rgba(5, 10, 22, .55); backdrop-filter: blur(3px); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head { display: flex; align-items: center; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--edge); position: relative; }
.modal__head h2 { margin: 0 32px 6px 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; text-transform: none; color: var(--text); }
.modal__icon { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; }
.modal--ok .modal__icon { background: var(--ok-bg); color: var(--bat); }
.modal--warn .modal__icon { background: var(--warn-bg); color: var(--pv); }
.modal--err .modal__icon { background: var(--danger-bg); color: #ef4444; }
.modal__icon .st { animation: pop .35s ease-out; }
.modal__counts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.cnt { display: inline-flex; align-items: center; gap: 5px; }
.modal__x { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent;
    color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.modal__x:hover { background: var(--surface-2); color: var(--text); }
.modal__rows { list-style: none; margin: 0; padding: 12px 16px; overflow: auto; flex: 1;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; align-content: start; }
.mrow--wide { grid-column: 1 / -1; }
.mrow__img { width: 46px; height: 38px; object-fit: contain; border-radius: 8px; background: #eef1f5; flex: none; }
.modal__photo { position: relative; flex: none; width: 104px; height: 86px; border-radius: 16px; background: #eef1f5; display: grid; place-items: center; }
.modal__photo img { width: 92%; height: 92%; object-fit: contain; }
.modal__badge { position: absolute; right: -8px; bottom: -8px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    background: var(--panel); box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
@media (max-width: 720px) { .modal__rows { grid-template-columns: 1fr; } }
.mrow { display: flex; gap: 12px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--edge); }
.mrow .st { flex: none; margin-top: 1px; }
.mrow b { display: block; font-size: 13.5px; font-weight: 600; }
.mrow span { display: block; font-size: 13.5px; color: var(--muted); word-break: break-word; margin-top: 2px; }
.mrow--err { background: var(--danger-bg); } .mrow--err span { color: var(--danger-text); }
.mrow--warn { background: var(--warn-bg); } .mrow--warn span { color: var(--warn-text); }
.st--ok { color: var(--bat); } .st--err { color: #ef4444; } .st--warn { color: var(--pv); } .st--off, .st--info { color: var(--faint); }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 18px; border-top: 1px solid var(--edge); }
.modal__foot form { margin: 0; }
.note--warn { background: var(--warn-bg); border-color: var(--warn-edge); color: var(--warn-text); }

.tag--co { background: var(--info-bg); color: var(--info-text); }

.prod-now { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; line-height: 1.6; align-self: start; }
.prod-now b { display: block; margin-bottom: 2px; }

/* Histórico mensual importado */
.tbl--num th:not(:first-child), .tbl--num td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.tbl--num { margin: 10px 0; }
.form--row { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin: 12px 0 4px; }
.form--row label { min-width: 220px; }
h3.sub { margin: 22px 0 4px; font-size: 14px; }

/* ===== Ajustes en pestañas verticales ===== */
.set-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 22px; align-items: start; }
.set-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.set-nav__btn {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
    padding: 12px 14px; border-radius: 14px; cursor: pointer; font: inherit;
    background: transparent; border: 1px solid var(--edge); color: var(--muted);
    transition: border-color .15s ease, background .15s ease;
}
.set-nav__btn b { font-size: 14px; color: var(--text); font-weight: 700; }
.set-nav__btn small { font-size: 12px; color: var(--faint); line-height: 1.3; }
.set-nav__btn:hover { border-color: var(--pv); }
.set-nav__btn:focus-visible { outline: 2px solid var(--pv); outline-offset: 2px; }
.set-nav__btn.is-on {
    background: linear-gradient(180deg, rgba(247, 183, 51, .14), rgba(247, 183, 51, .04));
    border-color: var(--pv); box-shadow: inset 4px 0 0 var(--pv);
}
.set-body { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.set-body > .form { display: flex; flex-direction: column; gap: 18px; }
.set-pane { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.set-pane[hidden] { display: none !important; }
@media (max-width: 800px) {
    .set-layout { grid-template-columns: 1fr; gap: 14px; }
    .set-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
    .set-nav__btn { min-width: 190px; flex: none; }
}

/* Ajustes: logo grande y el título «Smartgrid · Administración» debajo */
.adm-top--ajustes { align-items: flex-start; }
.adm-top--ajustes .brandline { flex-direction: column; align-items: flex-start; gap: 10px; }
.adm-top--ajustes .brandline .brand { padding-left: 0; border-left: 0; }
.adm-top--ajustes .logo { height: 76px; width: auto; }
@media (max-width: 800px) { .adm-top--ajustes .logo { height: 56px; } }

.form__actions[hidden], .form__actions button[hidden] { display: none !important; }

/* Modo kiosko: ajustes agrupados por tema */
.kiosk-note { margin: 12px 0 4px; }
.kiosk-group { margin: 18px 0 0; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kiosk-group > .grid2, .kiosk-group > .grid3 { margin-top: 0; }
.kiosk-group .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.kiosk-group label.check { align-self: start; padding-top: 2px; }
.kiosk-group__top label.check { display: flex; }
.kiosk-texts textarea { width: 100%; box-sizing: border-box; }
.kiosk-test { padding-top: 12px; border-top: 1px dashed var(--edge); }
@media (max-width: 800px) { .kiosk-group .grid2 { grid-template-columns: 1fr; } }

/* Separador y acción de refresco bajo las pestañas de ajustes */
.set-nav__sep { height: 1px; background: var(--edge); margin: 6px 4px; }
.set-nav__refresh { margin: 0; }
.set-nav__btn--action { width: 100%; flex-direction: row; align-items: center; gap: 10px; cursor: pointer; }
.set-nav__btn--action svg { flex: none; color: var(--pv); }
.set-nav__btn--action span { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.set-nav__btn--action:hover svg { transform: rotate(-60deg); transition: transform .3s ease; }

/* Popup de confirmación de «Actualizar paneles» */
.panels-dlg { border: 0; padding: 0; background: transparent; max-width: min(440px, calc(100vw - 32px)); width: 100%; color: var(--text); }
.panels-dlg::backdrop { background: rgba(8, 14, 12, .55); backdrop-filter: blur(3px); }
.panels-dlg[open] { animation: panelsIn .18s ease-out; }
@keyframes panelsIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.panels-dlg__box { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--edge);
    border-radius: 20px; box-shadow: var(--shadow); padding: 26px 26px 22px; text-align: center; margin: 0; }
.panels-dlg__icon { display: inline-flex; align-items: center; justify-content: center; width: 96px; height: 96px; border-radius: 24px;
    margin-bottom: 14px; color: var(--pv); background: rgba(247, 183, 51, .12); border: 1px solid rgba(247, 183, 51, .35); }
.panels-dlg h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.panels-dlg p { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.panels-dlg__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Botón «Ver kiosko» (y menú de sedes) junto a «Ver panel» */
.btn--ico { display: inline-flex; align-items: center; gap: 7px; }
.btn--ico svg { flex: none; }
.kmenu { position: relative; }
.kmenu > summary { list-style: none; cursor: pointer; user-select: none; }
.kmenu > summary::-webkit-details-marker { display: none; }
.kmenu__car { font-size: 11px; opacity: .7; }
.kmenu__list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px; display: flex; flex-direction: column; padding: 6px;
    background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; box-shadow: var(--shadow); }
.kmenu__list a { padding: 9px 12px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 14px; }
.kmenu__list a:hover { background: rgba(247, 183, 51, .14); }

/* Cabecera algo más compacta para que quepan «Ver panel», «Ver kiosko» y «Salir» en una fila */
.adm-top { gap: 10px 12px; }
.adm-top__right { gap: 6px; margin-left: auto; }
.adm-top__right .btn { padding-left: 13px; padding-right: 13px; }
.adm-top .tabs__item { padding-left: 16px; padding-right: 16px; }
