/* ============ Base compartida ============ */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --text: #1d1b18;
  --muted: #6b675f;
  --border: #e2dfd8;
  --accent: #0284c7;       /* celeste principal */
  --accent-soft: #e0f2fe;  /* celeste muy suave (fondos) */
  --on-accent: #ffffff;    /* texto sobre el celeste */
  --ok: #2f9e44;
  --warn: #e67700;
  --danger: #e03131;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.06);
}
/* Modo oscuro: sigue al sistema salvo que la persona elija un tema con el botón ☀️/🌙
   (queda guardado como data-theme en <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311;
    --surface: #1d1c19;
    --surface-2: #272622;
    --text: #f1efe9;
    --muted: #a19d94;
    --border: #35332e;
    --accent: #38bdf8;
    --accent-soft: #0c2a3a;
    --on-accent: #06202e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311;
  --surface: #1d1c19;
  --surface-2: #272622;
  --text: #f1efe9;
  --muted: #a19d94;
  --border: #35332e;
  --accent: #38bdf8;
  --accent-soft: #0c2a3a;
  --on-accent: #06202e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.3);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.danger { color: var(--danger) !important; }
.warn { color: var(--warn); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: .625rem 1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: .375rem .625rem; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; cursor: default; }
.icon-btn {
  border: 0; background: transparent; color: var(--text); font-size: 1.2rem;
  width: 2.375rem; height: 2.375rem; border-radius: 8px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.badge {
  display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 6px;
  border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 700;
}

/* Formularios */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full, .check.full { grid-column: 1 / -1; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: .78rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: .5625rem .6875rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="color"] { padding: 3px; height: 42px; }
input[type="checkbox"] { width: 1.125rem; height: 1.125rem; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
@media (max-width: 600px) { .form { grid-template-columns: 1fr; } }

/* Modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: grid; place-items: center; padding: 16px;
}
.modal {
  background: var(--surface); border-radius: 16px; width: min(720px, 100%);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal > footer .left { margin-right: auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px;
  font-weight: 600; opacity: 0; transition: .25s; z-index: 100; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Estados */
.status {
  display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .76rem; font-weight: 700;
  color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); white-space: nowrap;
}
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--border); vertical-align: -1px; margin-right: 6px; }

/* Imagen de producto */
.thumb { aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.ph {
  display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
}

/* ============ Tienda ============ */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.15rem; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: .9rem; }
.hero { padding: 64px 0 40px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; max-width: 16ch; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 55ch; margin: 14px 0 24px; }
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.filters input { max-width: 420px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: .375rem .875rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; font-size: .9rem; color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr 1fr; gap: 12px; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.product { cursor: pointer; transition: .2s; display: flex; flex-direction: column; }
.product:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-body h3 { font-size: 1rem; }
.tag { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.price-row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; gap: 8px; flex-wrap: wrap; }
.price-row strong { font-size: 1.1rem; }
.star { position: absolute; top: 10px; left: 10px; background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.product .thumb { position: relative; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.custom { margin-top: 64px; }
.custom .card { padding: 28px; display: grid; grid-template-columns: 1fr 1.3fr; gap: 28px; }
.custom h2 { font-size: 1.6rem; margin-bottom: 8px; }
@media (max-width: 760px) { .custom .card { grid-template-columns: 1fr; padding: 20px; } }
.site-footer { margin-top: 64px; padding: 32px 0; border-top: 1px solid var(--border); color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { margin-right: 16px; }
.product-modal .modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.product-modal .thumb { border-radius: 10px; }
.product-modal h2 { font-size: 1.5rem; margin: 4px 0 8px; }
.product-modal .price { font-size: 1.5rem; font-weight: 800; margin: 12px 0; }
@media (max-width: 600px) { .product-modal .modal-body { grid-template-columns: 1fr; } }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.qty button { border: 0; background: var(--surface-2); color: var(--text); width: 2rem; height: 2.125rem; cursor: pointer; font-size: 1rem; }
.qty span { min-width: 34px; text-align: center; font-weight: 700; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; opacity: 0; pointer-events: none; transition: .2s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--surface);
  z-index: 45; transform: translateX(100%); transition: .25s; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item .thumb { width: 56px; border-radius: 8px; font-size: 1rem; }
.cart-item small { color: var(--muted); display: block; }
.drawer-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.drawer-foot .form { grid-template-columns: 1fr; gap: 10px; }
.total-row { display: flex; justify-content: space-between; font-size: 1.15rem; }

/* ============ Admin ============ */
.admin { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand small { display: block; font-weight: 500; font-size: .75rem; color: var(--muted); }
.sidebar .brand strong { font-size: .98rem; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: .5625rem .75rem; border-radius: 9px; text-decoration: none; font-weight: 500; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nb { margin-left: auto; font-size: .72rem; background: var(--surface-2); color: var(--text); padding: 1px 7px; border-radius: 99px; }
.nb.warn { background: var(--warn); color: #fff; }
.nb:empty { display: none; }
.app { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appbar { display: flex; align-items: center; gap: 10px; padding: 18px 28px 6px; }
.appbar h1 { font-size: 1.5rem; }
.menu { display: none; }
.content { padding: 14px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.nav-overlay { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; z-index: 60; transform: translateX(-100%); transition: .25s; }
  .nav-open .sidebar { transform: none; }
  .nav-open .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
  .menu { display: inline-block; }
  .appbar { padding: 12px 16px 4px; }
  .content { padding: 10px 16px 32px; }
}
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 12px; }
.panel.p0 { padding: 0; overflow-x: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.link { color: var(--accent); text-decoration: none; font-weight: 600; font-size: .88rem; }
.pad { padding: 20px; margin: 0; }
.welcome { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.welcome p { color: var(--muted); max-width: 65ch; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
a.stat[href]:hover { border-color: var(--accent); }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.cols-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .cols-2 { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.list li:last-child { border-bottom: 0; }
.list li small { display: block; color: var(--muted); }
.list .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.stock { margin-bottom: 12px; }
.stock-top { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 4px; gap: 8px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--ok); border-radius: 99px; }
.bar.low > div { background: var(--danger); }
.alert { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-weight: 600; margin: 8px 0 0; }
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.pipe { border-radius: 10px; padding: 12px; text-decoration: none; background: color-mix(in srgb, var(--c) 12%, transparent); border-left: 4px solid var(--c); }
.pipe strong { display: block; font-size: 1.5rem; }
.pipe span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 220px; border-top: 4px solid var(--c); transition: .15s; }
.kcol.over { outline: 2px dashed var(--c); }
.khead { display: flex; justify-content: space-between; font-weight: 700; font-size: .9rem; padding: 2px 4px 10px; }
.khead b { background: var(--surface); padding: 0 8px; border-radius: 99px; font-size: .8rem; }
.klist { display: flex; flex-direction: column; gap: 8px; }
.kempty { color: var(--muted); text-align: center; padding: 20px 0; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: grab; font-size: .88rem; display: flex; flex-direction: column; gap: 4px; }
.kcard.prio-urgente { border-left: 4px solid var(--danger); }
.kcard.prio-alta { border-left: 4px solid var(--warn); }
.kcard.dragging { opacity: .4; }
.kc-top { display: flex; justify-content: space-between; align-items: center; }
.prio { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--danger); }
.prio-alta .prio { color: var(--warn); }
.kc-client { font-weight: 600; }
.kc-items { color: var(--muted); }
.kc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--muted); }
.kc-actions { display: flex; justify-content: space-between; margin-top: 4px; }
.kc-actions button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 6px; padding: .125rem .75rem; cursor: pointer; font-size: .85rem; }
.kc-actions button:disabled { opacity: .3; cursor: default; }

/* Productos / materiales admin */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.pcard .card-body { gap: 6px; }
.pcard .thumb { cursor: pointer; }
.pcard.off .thumb { opacity: .45; }
.mini { font-size: .8rem; color: var(--muted); }
.pill { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); }
.pill.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.mcard .big-swatch { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); flex-shrink: 0; }
.mcard header { display: flex; gap: 12px; align-items: center; }
.mcard h3 { font-size: 1rem; }

.img-field { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.img-prev { width: 96px; height: 96px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: .75rem; color: var(--muted); overflow: hidden; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
.img-field > div:last-of-type { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; grid-template-columns: 1fr 70px 110px 34px; gap: 6px; margin-bottom: 6px; }
@media (max-width: 600px) { .item-row { grid-template-columns: 1fr 1fr; } .item-row > :first-child { grid-column: 1 / -1; } }
.totals { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .92rem; }
.totals b { font-variant-numeric: tabular-nums; }
.cost-box { grid-column: 1 / -1; background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; font-size: .9rem; }
.timeline { grid-column: 1 / -1; font-size: .82rem; color: var(--muted); }
.timeline ul { margin: 6px 0 0; padding-left: 18px; }
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .calc { grid-template-columns: 1fr; } }
.breakdown div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.breakdown .final { font-size: 1.3rem; font-weight: 800; color: var(--accent); border: 0; padding-top: 14px; }
.hint { margin: 0; font-size: .9rem; }
/* Buscador reutilizable (js/buscador.js) */
.bus-input { padding-left: 32px; background: var(--surface) no-repeat 10px 50% / 14px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E"); }
.bus-input.bus-elegido { border-color: var(--accent); }
.bus-lista {
  position: fixed; z-index: 95; list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.bus-lista li { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.bus-lista li small { color: var(--muted); font-size: .8rem; }
.bus-lista li.activo { background: var(--accent-soft); }
.bus-lista li.crear { color: var(--accent); font-weight: 600; }
.bus-lista li.vacio { color: var(--muted); cursor: default; }
.bus-lista mark { background: none; color: var(--accent); font-weight: 700; }
.web-tag { font-size: .7rem; font-weight: 700; color: #1c7ed6; background: color-mix(in srgb, #1c7ed6 14%, transparent); padding: 1px 7px; border-radius: 99px; margin-left: 6px; white-space: nowrap; }
.session { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.session small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.login { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login-box p { margin: 0; }
.login-box code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ============ Seguimiento de pedidos ============ */
.seg { max-width: 760px; padding-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.seg-buscar { padding: 28px; }
.seg-buscar h1, .seg-hola h1 { font-size: 1.8rem; margin-bottom: 6px; }
.seg-buscar .form { margin-top: 18px; }
.seg-buscar .danger { margin: 0; }
.seg-hola { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.seg-hola p { margin: 0; }
.seg-titulo { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 12px; }
.seg-pedido { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; overflow: visible; }
.seg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.seg-head h2 { font-size: 1.2rem; }
.seg-msg { margin: 0; }
.seg-pasos { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg-pasos li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; position: relative; color: var(--muted); font-size: .8rem; }
.seg-pasos li::before { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.seg-pasos li:first-child::before { display: none; }
.seg-pasos li.hecho::before, .seg-pasos li.actual::before { background: var(--ok); }
.seg-punto { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--surface-2); border: 2px solid var(--border); position: relative; z-index: 1; }
.seg-pasos li.hecho .seg-punto { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg-pasos li.actual .seg-punto { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.seg-pasos li.actual { color: var(--text); font-weight: 700; }
.seg-nombre { line-height: 1.2; }
.seg-pasos small { font-size: .7rem; font-weight: 400; color: var(--muted); }
.seg-items li { padding: 6px 0; }
.seg-otro { text-align: center; margin: 8px 0 0; }
@media (max-width: 560px) {
  .seg-pasos { grid-auto-flow: row; grid-template-columns: 1fr; gap: 0; }
  .seg-pasos li { flex-direction: row; text-align: left; gap: 10px; padding: 4px 0; }
  .seg-pasos li::before { top: -50%; left: 14px; right: auto; width: 3px; height: 100%; }
  .seg-pasos small { margin-left: auto; }
}
.topbar-acc { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 480px) { .hide-sm { display: none; } }
.wa-btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: .1875rem .5rem; cursor: pointer; font-size: 1rem; }
.wa-btn:hover { border-color: var(--ok); }

/* ============ Finanzas ============ */
.ok { color: var(--ok); }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pad-h { padding: 16px 20px 4px; }
.table tbody tr.static { cursor: default; }
.table tbody tr.static:hover { background: none; }
.table tbody tr.sel { background: var(--accent-soft); }
.table td small { display: block; }
.table td.acciones { white-space: nowrap; text-align: right; }
.table td.acciones .wa-btn { margin-left: 4px; }
.hbar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 80px; margin-bottom: 2px; }
.hbar > div { height: 100%; border-radius: 99px; }
.hbar.vend > div { background: var(--accent); }
.hbar.ing > div { background: var(--ok); }
.hbar.egr > div { background: var(--danger); }
.sel-sm { width: auto; padding: .3125rem .5rem; font-size: .85rem; }
.fijo-row { display: grid; grid-template-columns: 1fr 110px 70px 34px; gap: 6px; margin-bottom: 6px; align-items: center; }
.fijo-head { font-size: .78rem; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
.cobros { list-style: none; margin: 0 0 8px; padding: 0; }
.cobros li { display: grid; grid-template-columns: 1fr auto 34px; gap: 8px; align-items: center; padding: 2px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.cobro-add { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; }
#cAtajos { margin-top: 6px; gap: 6px; }
#cAtajos .chip { font-size: .8rem; padding: 4px 10px; }
@media (max-width: 600px) { .cobro-add { grid-template-columns: 1fr 1fr; } }
.stat strong span { font-size: inherit; font-weight: inherit; color: inherit; }
.stat strong .ok { color: var(--ok); }
.stat strong .warn { color: var(--warn); }

/* ============ Sitio público: menú, inicio y pedidos a medida ============ */
.topbar-in { gap: 12px; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a { text-decoration: none; padding: .5rem .75rem; border-radius: 9px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 760px) {
  .topbar-in { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 6px; }
  .site-nav { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .site-nav a { padding: .375rem .625rem; font-size: .9rem; }
}
.hero-sm { padding: 40px 0 24px; }
.hero-sm h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.hero-home { padding: 80px 0 56px; background: linear-gradient(160deg, var(--accent-soft), transparent 70%); }
.home-sec { margin-top: 72px; }
.home-sec h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 20px; }
.kicker { display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 6px; }
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.prose p { margin: 0 0 12px; max-width: 65ch; }
.nosotros { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; }
.nosotros .prose { font-size: 1.08rem; }
@media (max-width: 760px) { .nosotros { grid-template-columns: 1fr; gap: 0; } }
.stats-pub { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 16px; }
.stats-pub strong { display: block; font-size: 2rem; color: var(--accent); line-height: 1.1; }
.stats-pub span { color: var(--muted); font-size: .9rem; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.trabajo { position: relative; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--surface-2); font: inherit; color: inherit; text-align: left; }
.trabajo .thumb { transition: transform .3s; }
.trabajo:hover .thumb { transform: scale(1.04); }
.trabajo-tit { position: absolute; inset: auto 0 0 0; padding: 28px 14px 12px; font-weight: 700; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.tm-img { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 10px; margin-bottom: 14px; background: var(--surface-2); }
.casos { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.caso { display: flex; flex-direction: column; }
.caso-img { aspect-ratio: 16 / 9; }
.caso-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.caso-body h3 { font-size: 1.15rem; }
.caso-body b { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.caso-body p { margin: 0; }
.caso-res { background: color-mix(in srgb, var(--ok) 10%, transparent); border-radius: 10px; padding: 10px 12px; }
.caso-res b { color: var(--ok); }
.clientes-pub { display: flex; flex-wrap: wrap; gap: 14px; }
.cliente-pub { display: grid; place-items: center; min-width: 140px; height: 76px; padding: 10px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; font-weight: 700; color: var(--muted); }
.cliente-pub img { max-height: 54px; max-width: 150px; object-fit: contain; }
a.cliente-pub:hover { border-color: var(--accent); }
.cta-band { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 56px;
  padding: 28px; border-radius: var(--radius); background: var(--accent-soft); }
.cta-band h2 { font-size: 1.4rem; margin: 0 0 4px; }
.cta-band p { margin: 0; }
.wrap.cta-band { max-width: 1148px; }
@media (max-width: 1180px) { .wrap.cta-band { margin-left: 16px; margin-right: 16px; } }
.pasos-pub { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pasos-pub li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.pasos-pub b { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.pasos-pub strong { display: block; }
.pasos-pub span { color: var(--muted); font-size: .88rem; }
.form-card { padding: 28px; max-width: 860px; }
@media (max-width: 600px) { .form-card { padding: 18px; } }
a.card.product { text-decoration: none; }
@media (max-width: 600px) {
  .galeria { grid-template-columns: 1fr 1fr; gap: 10px; }
  .trabajo-tit { font-size: .85rem; padding: 20px 10px 8px; }
  .casos { grid-template-columns: 1fr; }
}

/* Logo */
.logo-img { height: 44px; width: 44px; flex: none; display: block; object-fit: contain; }
.sidebar .logo-img, .login-box .logo-img { height: 42px; width: 42px; }
/* El logo tiene fondo blanco propio: un borde claro suave lo separa del fondo oscuro */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-img { filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }
}
:root[data-theme="dark"] .logo-img { filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }

/* ============ Botón modo claro / oscuro ============ */
.tema-btn { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: .4375rem .75rem; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; }
.tema-btn:hover { background: var(--surface-2); }
.tema-ico { font-size: 1.05rem; line-height: 1; }
.ajustes { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.topbar-in > .ajustes { order: 2; }
.appbar .ajustes { margin-left: auto; }
.login .ajustes { position: absolute; top: 16px; right: 16px; }
/* Tamaño de letra elegido con el botón "Aa": todo lo que está en rem crece junto */
:root[data-tamano="grande"] { font-size: 112.5%; }
:root[data-tamano="muy-grande"] { font-size: 125%; }
@media (max-width: 480px) { .tema-btn { padding: .4375rem .5625rem; } }
#contactBtns .btn, .cta-band .btn { white-space: normal; text-align: center; }
.tam-ico { font-size: .95rem; font-weight: 800; letter-spacing: -.02em; }

/* Pedidos en el celular: cada pedido es una tarjeta en vez de una fila ancha que hay que deslizar */
@media (max-width: 640px) {
  .tabla-ped thead { display: none; }
  .tabla-ped, .tabla-ped tbody { display: block; }
  .tabla-ped tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
  .tabla-ped td { padding: 0; border: 0; min-width: 0; text-align: left; white-space: nowrap; }
  .tabla-ped td:nth-child(1) { order: 1; font-weight: 700; color: var(--muted); }
  .tabla-ped td:nth-child(1)::before { content: "#"; }
  .tabla-ped td:nth-child(2) { order: 2; flex: 1 1 0; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
  .tabla-ped td:nth-child(5) { order: 3; }
  .tabla-ped td:nth-child(3) { order: 4; flex-basis: 100%; max-width: none; white-space: normal; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .tabla-ped td:nth-child(4) { order: 5; font-size: .85rem; }
  .tabla-ped td:nth-child(6) { order: 6; font-size: .85rem; }
  .tabla-ped td:nth-child(7) { order: 7; font-size: .85rem; }
  .tabla-ped td:nth-child(8) { order: 8; margin-left: auto; }
  .tabla-ped td:nth-child(4)::before { content: "Entrega "; color: var(--muted); }
  .tabla-ped td:nth-child(6)::before { content: "Total "; color: var(--muted); }
  .tabla-ped td:nth-child(7)::before { content: "Saldo "; color: var(--muted); }
  .tabla-ped .wa-btn { padding: .375rem .625rem; }
}

/* Formularios del panel en el celular: pantalla completa, con Cancelar y Guardar siempre a mano abajo */
.modal-extra { display: none; }
@media (max-width: 640px) {
  #modal { padding: 0; place-items: stretch; }
  #modal .modal { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  #modal .modal-body { flex: 1; padding: 16px; }
  #modal .modal > footer { flex-wrap: nowrap; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
  #modal .modal > footer .btn { flex: 1; padding-top: .8rem; padding-bottom: .8rem; font-size: 1.05rem; }
  #modal .modal > footer .sec { display: none; }
  .modal-extra { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
  .modal-extra .btn { flex: 1 1 auto; }
  .modal-extra .left { order: 9; }
}
@media (max-width: 640px) { body:has(#modal:not([hidden])) .toast { bottom: 96px; } }
.aviso-version { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; align-items: center; gap: 12px;
  background: var(--text); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; width: max-content; max-width: calc(100vw - 24px); }
.cat-tit { margin: 18px 0 8px; font-size: 1rem; }
.cat-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.cat-lock { width: 2.375rem; text-align: center; }

/* Portada: el logo en lugar del nombre escrito (el nombre queda para buscadores y lectores de pantalla) */
.hero-logo { margin: 0 0 8px; max-width: none; }
.hero-logo img { display: block; width: clamp(150px, 26vw, 240px); height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-logo img { filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }
}
:root[data-theme="dark"] .hero-logo img { filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }
