@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

[data-stitch-surface] {
  --stitch-bg: #070a08;
  --stitch-surface: #101510;
  --stitch-line: #3d4a3b;
  --stitch-muted: #bccbb7;
  --stitch-text: #dfe4dd;
  --stitch-green: #2fc94e;
  --stitch-headline: 'Space Grotesk', 'Archivo', system-ui, sans-serif;
  color-scheme: dark;
}
[data-stitch-surface="public"] {
  --fondo: var(--stitch-bg);
  --blanco: var(--stitch-surface);
  --tinta: var(--stitch-text);
  --gris: var(--stitch-muted);
  --linea: var(--stitch-line);
  --verde: var(--stitch-green);
  --verde-tinta: #53e667;
  --verde-suave: #18291c;
}
:is([data-stitch-surface="login"], [data-stitch-surface="panel"]) {
  --bg: var(--stitch-bg);
  --panel: var(--stitch-surface);
  --ink: var(--stitch-text);
  --muted: var(--stitch-muted);
  --line: var(--stitch-line);
  --green: var(--stitch-green);
}
[data-stitch-surface] :is(h1, h2, h3, .h1) {
  font-family: var(--stitch-headline);
}
[data-stitch-surface] :focus-visible {
  outline: 2px solid #b1cbff;
  outline-offset: 3px;
}
[data-stitch-surface="panel"] .panel-top {
  border-bottom: 1px solid var(--stitch-line);
  padding-bottom: 16px;
}
[data-stitch-surface="panel"] #dashKpis > * {
  border-color: var(--stitch-line);
  border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
  [data-stitch-surface] { scroll-behavior: auto; }
}

/* Portada de Stitch con la fotografía y navegación de Servisur. */
[data-stitch-surface="public"] .instalacion-portada {
  background: radial-gradient(ellipse at 76% 5%, #18321f, transparent 65%), #0a0f0b;
}
[data-stitch-surface="public"] .instalacion-portada .stitch-apertura {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  gap: clamp(22px, 5vw, 74px);
  align-items: center;
  width: min(1232px, calc(100% - 44px));
  margin-inline: auto;
  min-height: 0;
  padding: clamp(42px, 7vw, 102px) 0;
}
[data-stitch-surface="public"] .stitch-apertura .apertura-texto {
  width: auto;
  min-width: 0;
}
[data-stitch-surface="public"] .stitch-apertura h1 {
  color: #f0f5ee;
  font-size: clamp(2.7rem, 5.1vw, 5.1rem);
  line-height: 1.04;
  max-width: 17ch;
  overflow-wrap: break-word;
}
.stitch-apertura .sobre, .stitch-taller-barra {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: .075em;
}
.stitch-apertura .sobre { color: #7cf28d; }
[data-stitch-surface="public"] .stitch-apertura .stitch-taller {
  position: relative;
  inset: auto;
  display: grid;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(12px, 1.6vw, 22px);
  gap: 10px;
  background: #1c211c;
  border: 1px solid #3d4a3b;
  border-radius: 14px;
  box-shadow: 0 22px 48px #0006;
}
[data-stitch-surface="public"] .stitch-taller::after { display: none; }
.stitch-taller-barra {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #0a0f0b;
  color: #91f49b;
  border-radius: 5px;
  font-size: .72rem;
}
[data-stitch-surface="public"] .stitch-taller img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  border-radius: 7px;
}
[data-stitch-surface="public"] .stitch-taller figcaption {
  position: static;
  background: none;
  padding: 0;
  color: #bccbb7;
  font-size: .82rem;
}
.stitch-taller-enlaces { display: grid; gap: 5px; }
.stitch-taller-enlaces a {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 5px;
  color: #baf3bf;
  text-decoration: none;
  background: #101510;
}
.stitch-taller-enlaces a:hover, .stitch-accesos a:hover { border-color: #53e667; background: #223426; }
.stitch-accesos { padding: 24px 0; background: #141b14; }
.stitch-accesos .marco { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stitch-accesos a {
  display: grid;
  gap: 4px;
  padding: 16px;
  color: #dfe4dd;
  background: #1c211c;
  border: 1px solid #3d4a3b;
  border-radius: 8px;
  text-decoration: none;
}
.stitch-accesos a span { color: #bccbb7; font-size: .88rem; }
@media (max-width: 740px) {
  [data-stitch-surface="public"] .instalacion-portada .stitch-apertura,
  .stitch-accesos .marco { grid-template-columns: 1fr; }
}

/* Panel operativo con navegación lateral y accesos visibles en el inicio. */
[data-stitch-surface="panel"] .stitch-panel-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
  gap: 12px;
  margin: 20px 0;
}
[data-stitch-surface="panel"] .stitch-panel-actions button {
  display: grid;
  gap: 4px;
  min-height: 80px;
  padding: 14px;
  text-align: left;
  font: inherit;
  color: var(--stitch-text);
  background: var(--stitch-surface);
  border: 1px solid var(--stitch-line);
  border-radius: 10px;
}
[data-stitch-surface="panel"] .stitch-panel-actions button:hover,
[data-stitch-surface="panel"] .stitch-panel-actions [data-view="trabajosweb"] {
  border-color: var(--stitch-green);
}
[data-stitch-surface="panel"] .stitch-panel-actions span { color: var(--stitch-muted); font-size: .8rem; }
@media (min-width: 1050px) {
  [data-stitch-surface="panel"] .stitch-panel-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: 216px;
    overflow-y: auto;
    border-right: 1px solid var(--stitch-line);
    background: #101510;
  }
  [data-stitch-surface="panel"] .stitch-panel-nav .hdr-in { display: grid; grid-template-columns: auto 1fr; gap: 9px; padding: 20px 13px; }
  [data-stitch-surface="panel"] .stitch-panel-nav .hdr-nav { grid-column: 1 / -1; display: grid; justify-content: stretch; width: 100%; margin: 20px 0 0; gap: 5px; }
  [data-stitch-surface="panel"] .stitch-panel-nav .hdr-nav .who { padding: 6px; }
  [data-stitch-surface="panel"] .stitch-panel-nav :is(.hdr-tab, .hdr-ext) { border-radius: 6px; min-height: 38px; text-align: left; }
  [data-stitch-surface="panel"] > main { margin-left: 216px; }
}

.stitch-dashboard .wrap { padding-top: 24px; }
.stitch-dash-heading { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:18px; padding: clamp(16px,3vw,32px); background: #181d18; border:1px solid #3d4a3b; border-radius:12px; }
.stitch-dash-label { font: 12px var(--fm); text-transform:uppercase; letter-spacing:.08em; color:#91f49b; margin-bottom:7px; }
.stitch-dash-controls { display:flex; flex-wrap:wrap; gap:9px; align-items:end; }
.stitch-dashboard .stitch-panel-actions button { cursor:pointer; }
.stitch-dashboard .stitch-panel-actions button:disabled { opacity:.55; cursor:not-allowed; }
.stitch-dashboard #dashKpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,155px),1fr)); gap:12px; margin:18px 0; }
.stitch-dashboard #dashKpis .kpi { min-width:0; padding:16px; background:#181d18; overflow-wrap:anywhere; }
.stitch-dashboard #dashKpis .kpi:nth-child(-n+4) { border-top:2px solid #2fc94e; }
.stitch-dash-grid { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,.8fr); gap:14px; align-items:start; }
.stitch-dash-grid #dashCharts { min-width:0; margin:0; grid-template-columns:minmax(0,1fr); }
.stitch-dash-alerts { min-width:0; padding:16px; background:#181d18; border:1px solid #3d4a3b; border-radius:10px; }
.stitch-dash-alerts #atencionHoy { margin-top:14px; }
.stitch-dashboard #webMetrics { margin-top:28px; }
@media(max-width:920px) { .stitch-dash-grid { grid-template-columns:1fr; } }

.stitch-module .panel-top { margin:24px 0 14px; padding:clamp(16px,3vw,26px); background:#181d18; border:1px solid #3d4a3b; border-radius:12px; }
.stitch-module .tools { padding:12px; background:#101510; border:1px solid #3d4a3b; border-radius:8px; }
.stitch-module #salesList .ct { margin-bottom:10px; padding:16px; background:#181d18; border:1px solid #3d4a3b; border-radius:8px; }
.stitch-inbox { display:grid; grid-template-columns:minmax(0,.72fr) minmax(0,1.28fr); align-items:start; gap:14px; margin-top:16px; }
.stitch-inbox-list,.stitch-inbox-detail { min-width:0; border:1px solid #3d4a3b; border-radius:12px; background:#101510; padding:14px; overflow-wrap:anywhere; }
.stitch-inbox-list h2 { font-size:1rem; margin-bottom:12px; }
.stitch-inbox-entry { display:grid; text-align:left; gap:4px; padding:12px; min-height:48px; border:1px solid #3d4a3b; border-radius:7px; background:#1c211c; color:#dfe4dd; font:inherit; cursor:pointer; }
.stitch-inbox-entry[aria-pressed="true"] { border-left:4px solid #2fc94e; background:#243224; }
.stitch-inbox-entry small { color:#bccbb7; }
@media(max-width:760px) { .stitch-inbox { grid-template-columns:minmax(0,1fr); } }
.stitch-inbox-detail .consulta-ficha { border:0; padding:0; background:transparent; }
.stitch-inbox-detail .consulta-cab { display:grid; gap:6px; }
.stitch-inbox-detail .consulta-cab h2 { font-size:clamp(1.45rem,3vw,2rem); overflow-wrap:anywhere; }
.stitch-inbox-source { color:#91f49b; font:12px var(--fm); text-transform:uppercase; letter-spacing:.06em; }
.stitch-inbox-detail .consulta-mensaje, .stitch-inbox-note { padding:12px; background:#070a08; border-radius:7px; }
.stitch-inbox-equipment, .stitch-inbox-follow { margin-block:14px; padding:12px; background:#181d18; border-radius:8px; }
.stitch-inbox-equipment h3, .stitch-inbox-follow h3 { margin-bottom:8px; }
.stitch-inbox-product { display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; gap:8px; padding:9px 0; border-bottom:1px solid #3d4a3b; }
.stitch-inbox-low { color:#ffb4ab; }
.stitch-inbox-estimate { color:#91f49b; margin-top:10px; font-weight:700; }
.stitch-inbox-snippet { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; color:#bccbb7; font-size:.8rem; }
[data-stitch-surface="panel"] #saleLines .sale-line { display:grid; grid-template-columns:minmax(0,1fr) 76px repeat(3,auto); gap:8px; align-items:center; }
[data-stitch-surface="panel"] #saleLines .sale-line select { min-width:0; }
.sale-availability { grid-column:1/-1; }
.sale-availability[data-state="low"] { color:#ffb4ab; }
#saleBalance { margin:8px 0; }
[data-stitch-surface="panel"] :is(#saleForm,#cpForm) { border-color:#3d4a3b; background:#101510; }
@media(max-width:560px) {
  [data-stitch-surface="panel"] #saleLines .sale-line { grid-template-columns:minmax(0,1fr) repeat(3,auto); }
  [data-stitch-surface="panel"] #saleLines .sale-line select { grid-column:1/-1; }
}
[data-stitch-surface="panel"] #saleForm.stitch-sale { width:min(940px,100%); max-width:940px; }
.stitch-sale-head { position:static; border:0; background:none; backdrop-filter:none; margin-bottom:16px; }
.stitch-sale-grid { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,1fr); gap:14px; }
.stitch-sale-fields,.stitch-sale-summary { min-width:0; border:1px solid #3d4a3b; border-radius:9px; padding:clamp(12px,2vw,20px); background:#181d18; }
.stitch-sale-grid h3 { margin-bottom:10px; }
.stitch-sale-fields #saleAdd { margin:8px 0 14px; }
.stitch-sale-summary #saleSave { width:100%; margin-top:12px; }
.stitch-stock-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:14px; margin:16px 0; padding:18px; background:#181d18; border:1px solid #3d4a3b; border-radius:10px; overflow-wrap:anywhere; }
.stitch-stock-badge { padding:5px 9px; color:#a7ecb2; background:#193622; border-radius:5px; font:12px var(--fm); }
.stitch-stock-badge.is-low { color:#ffb4ab; background:#422722; }
.stitch-stock-grid .card-h { flex-wrap:wrap; }
@media(max-width:760px) { .stitch-sale-grid { grid-template-columns:minmax(0,1fr); } }
.stitch-sale-summary .sale-balance { margin:8px 0; padding:12px; border:1px solid #665136; background:#272015; color:#ffd58c; border-radius:6px; font-family:var(--fm); overflow-wrap:anywhere; }
.stitch-sale-summary #saleDescartar { width:100%; margin-top:8px; }
@media(max-width:560px) {
  .stitch-sale #saleLines .sale-line button { min-width:44px; min-height:44px; padding-inline:8px; }
}

.stitch-dashboard .stitch-dash-heading { background:linear-gradient(115deg,#101510 28%,#122617); }
.stitch-dashboard .stitch-panel-actions button:first-child { background:#2fc94e; color:#05230c; border-color:#2fc94e; }
.stitch-dashboard .stitch-panel-actions button:first-child span { color:#103719; }
.stitch-dashboard #dashKpis { grid-template-columns:repeat(auto-fit,minmax(min(100%,130px),1fr)); gap:10px; }
.stitch-dashboard #dashKpis .dash-metric { background:#0d140f; border:1px solid #26382a; padding:13px; }
.dash-metric .l { letter-spacing:.06em; font:12px var(--fm); text-transform:uppercase; }
.stitch-dashboard #dashKpis .dash-metric .v { font:700 clamp(14px,1.4vw,23px) var(--fm); }
.dash-metric[data-tone="green"] .v { color:#6ded7d; }
.dash-metric[data-tone="amber"] .v,.dash-low { color:#ffb4ab; }
.dash-category,.stitch-dash-alerts { background:#0d140f; border:1px solid #26382a; border-radius:10px; padding:16px; }
.dash-category h3,.stitch-dash-alerts h3 { margin-bottom:12px; }
.dash-category-body { display:grid; grid-template-columns:minmax(105px,.7fr) minmax(0,1fr); align-items:center; gap:12px; }
.dash-ring { display:grid; place-items:center; width:min(100%,180px); aspect-ratio:1; border-radius:50%; background:conic-gradient(var(--segments)); }
.dash-ring span { display:grid; place-content:center; text-align:center; width:79%; height:79%; border-radius:50%; background:#0d140f; font:700 20px var(--fm); }
.dash-ring small { color:#bccbb7; font:10px var(--fm); }
.dash-category ul { list-style:none; display:grid; gap:7px; }
.dash-category li { display:grid; grid-template-columns:9px minmax(0,1fr); gap:3px 7px; align-items:center; font-size:.82rem; overflow-wrap:anywhere; }
.dash-category li i { width:7px; height:7px; background:var(--swatch); border-radius:50%; }
.dash-category li strong { grid-column:2; font:11px var(--fm); color:#bccbb7; }
.dash-category footer { margin-top:14px; padding:8px; background:#182218; border-radius:5px; font:12px var(--fm); }
.dash-stock-scroll { overflow-x:auto; }
.dash-stock-scroll table { width:100%; border-collapse:collapse; font-size:.78rem; }
.dash-stock-scroll th,.dash-stock-scroll td { padding:8px 5px; border-bottom:1px solid #26382a; text-align:left; }
.dash-stock-scroll th { font:11px var(--fm); color:#bccbb7; }
.dash-stock-scroll + button { margin-top:10px; }
@media(max-width:420px){ .dash-category-body { grid-template-columns:1fr; justify-items:start; } }

.stitch-panel-mobile-menu { display:none; }
@media (max-width:1049px) {
  [data-stitch-surface="panel"] .stitch-panel-nav .hdr-in {
    display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:10px; padding:10px 14px;
  }
  [data-stitch-surface="panel"] .stitch-panel-nav .wordmark { display:block; }
  [data-stitch-surface="panel"] .stitch-panel-mobile-menu { display:inline-flex; min-height:44px; }
  [data-stitch-surface="panel"] .stitch-panel-nav .hdr-nav {
    display:none; grid-column:1/-1; grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%; margin:0; max-height:65vh; overflow:auto;
  }
  [data-stitch-surface="panel"] .stitch-panel-mobile-menu[aria-expanded="true"] + .hdr-nav { display:grid; }
  [data-stitch-surface="panel"] .stitch-panel-nav .hdr-tab { min-height:44px; border-radius:7px; text-align:left; letter-spacing:.05em; }
  [data-stitch-surface="panel"] .stitch-panel-nav .who { display:block; grid-column:1/-1; }
}
@media (max-width:560px) {
  .stitch-dashboard .wrap { width:calc(100% - 28px); }
  .stitch-dashboard #dashKpis,.stitch-dashboard .stitch-panel-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stitch-dashboard .stitch-dash-controls { width:100%; }
  .stitch-dashboard .stitch-dash-controls :is(select,button) { min-height:44px; }
  .stitch-dashboard .dash-stock-scroll { overflow:visible; }
  .dash-stock-scroll :is(table,tbody) { display:block; width:100%; }
  .dash-stock-scroll thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .dash-stock-scroll tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 8px; padding:8px; border-bottom:1px solid #26382a; }
  .dash-stock-scroll td { border:0; overflow-wrap:anywhere; }
  .dash-stock-scroll td:nth-child(2) { grid-column:1; grid-row:2; }
  .dash-stock-scroll td:last-child { grid-column:1/-1; }
  .dash-stock-scroll td button { min-height:44px; }
}

.stitch-bottom-nav { display:none; }
@media (max-width:760px) {
  [data-stitch-surface="panel"] > main { padding-bottom:calc(68px + env(safe-area-inset-bottom,0px)); }
  .stitch-bottom-nav {
    position:fixed; inset:auto 0 0; z-index:95; display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:2px; padding:4px 4px calc(4px + env(safe-area-inset-bottom,0px));
    border-top:1px solid #3d4a3b; background:#101510;
  }
  .stitch-bottom-nav button {
    position:relative; min-height:48px; min-width:0; padding:4px 1px; border-radius:6px;
    color:#bccbb7; font:600 clamp(.65rem,2.9vw,.82rem) var(--fd); cursor:pointer;
  }
  .stitch-bottom-nav button.on { color:#a5ffb1; background:#1a3520; }
  .stitch-bottom-count { display:inline-block; margin-left:2px; padding:1px 4px; background:#2fc94e; color:#071408; border-radius:12px; font:700 10px var(--fm); }
}
.stitch-bottom-count.stock-badge { background:#ffd484; color:#321e04; }
.cp-reposicion-resumen { margin:12px 0; padding:12px; background:#0a120c; border:1px solid #3d4a3b; border-radius:8px; overflow-wrap:anywhere; font:14px var(--fm); }
@media (max-width:560px) {
  [data-stitch-surface="panel"] #cpModal { align-items:flex-end; padding:0; }
  [data-stitch-surface="panel"] #cpForm { border-radius:18px 18px 0 0; margin:0; max-height:90dvh; padding-bottom:calc(18px + env(safe-area-inset-bottom,0px)); }
}
.dash-calibration { display:inline-block; margin-top:8px; padding:3px 6px; border-radius:4px; background:#382b16; color:#ffd484; font:11px var(--fm); text-transform:uppercase; }

body[data-stitch-surface="public"] #ubicacion .mapa-local {
  display: block;
  width: 100%;
  height: clamp(280px, 45vw, 380px);
  margin-bottom: 1rem;
  border: 1px solid var(--linea, #2b372e);
  border-radius: 12px;
  background: #151c16;
}

/* Mapa en espera: se carga Google solo al tocar "Ver mapa". */
body[data-stitch-surface="public"] #ubicacion .mapa-espera { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:16px; text-align:center; }

/* Cómo llegar y pie: datos que vienen del panel ("Sitio web"). */
body[data-stitch-surface="public"] #ubicacion .datos-local { margin: 0 0 18px; }
body[data-stitch-surface="public"] #ubicacion .datos-local dt { color: #9fb3a5; }
body[data-stitch-surface="public"] #ubicacion .datos-local a { color: inherit; text-underline-offset: 3px; }
body[data-stitch-surface="public"] .pie-eslogan { font-size: 13px; color: #9fb3a5; }
@media (max-width: 420px) { body[data-stitch-surface="public"] #ubicacion .datos-local > div { grid-template-columns: 1fr; gap: 2px; } }
