:root {
  --ink: #171717;
  --muted: #667085;
  --red: #c92127;
  --red2: #a71419;
  --paper: #f4f6f8;
  --card: #fff;
  --line: #e4e7ec;
  --ok: #178847;
  --warn: #b76e00;
  --shadow: 0 8px 24px #10182812;
  --r: 22px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #101828;
}
.shell {
  max-width: 780px;
  margin: auto;
  min-height: 100vh;
  padding-bottom: 98px;
}
.top {
  background: linear-gradient(145deg, #111, #292929);
  color: white;
  padding: calc(14px + env(safe-area-inset-top)) 18px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brandmark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--red);
  display: grid;
  place-items: center;
  font-size: 26px;
}
.brand h1 {
  font-size: 17px;
  margin: 0;
}
.brand small {
  opacity: 0.72;
}
.status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pill {
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ffffff18;
}
.pill.ok {
  background: #173e29;
  color: #aaf0c5;
}
.content {
  padding: 16px;
}
.hero {
  height: 150px;
  border-radius: var(--r);
  background: url("../assets/banner.jpg") center/cover;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #0004, transparent 65%);
}
.sectionTitle {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 22px 2px 12px;
}
.sectionTitle h2 {
  font-size: 20px;
  margin: 0;
}
.sectionTitle span {
  font-size: 12px;
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.tile {
  border: 0;
  text-align: left;
  min-height: 128px;
  border-radius: 20px;
  padding: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.tile .ico {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 25px;
  margin-bottom: 13px;
  background: #f2f4f7;
}
.tile strong {
  display: block;
  font-size: 16px;
}
.tile small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.25;
}
.tile.primary {
  background: linear-gradient(145deg, var(--red), var(--red2));
  color: #fff;
}
.tile.primary small {
  color: #ffe5e5;
}
.tile.dark {
  background: #202326;
  color: #fff;
}
.tile.dark small {
  color: #cfd4dc;
}
.wide {
  grid-column: 1/-1;
  min-height: 105px;
}
.bottom {
  position: fixed;
  z-index: 20;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(780px, 100%);
  background: #fff;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 28px #10182810;
}
.nav {
  border: 0;
  background: none;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  padding: 5px;
}
.nav b {
  display: block;
  font-size: 23px;
  margin-bottom: 2px;
}
.nav.active {
  color: var(--red);
}
.pagehead {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.back {
  border: 0;
  background: #fff;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 20px;
}
.card {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}
.field label {
  font-size: 12px;
  font-weight: 800;
  color: #475467;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 13px;
  padding: 13px;
  font: inherit;
  background: #fff;
}
.field textarea {
  min-height: 90px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  border: 0;
  border-radius: 13px;
  padding: 12px 15px;
  font-weight: 800;
}
.btn.red {
  background: var(--red);
  color: #fff;
}
.btn.ghost {
  background: #f2f4f7;
}
.list {
  display: grid;
  gap: 10px;
}
.row {
  background: #fff;
  border-radius: 17px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow);
}
.row small {
  color: var(--muted);
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
}
.syncbar {
  font-size: 12px;
  margin-top: 8px;
  color: #667085;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.kpi {
  background: #fff;
  padding: 14px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.kpi b {
  display: block;
  font-size: 20px;
  margin-top: 5px;
}
.modal {
  position: fixed;
  inset: 0;
  background: #0008;
  z-index: 50;
  display: grid;
  place-items: end center;
}
.sheet {
  background: #fff;
  width: min(780px, 100%);
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh;
  overflow: auto;
}
@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .wide {
    grid-column: auto;
  }
  .hero {
    height: 210px;
  }
}
.field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  font: inherit;
  color: #101828;
}
.mini {
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  padding: 7px 10px;
  font-weight: 700;
  background: #eef4ff;
  color: #175cd3;
}
.grow {
  flex: 1;
}
.quick {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.quickbtn {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f2f4f7;
  color: #344054;
  text-decoration: none;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}
.quickbtn.wa {
  background: #e8f8ee;
  color: #08783f;
}
.quickbtn.map {
  background: #eef4ff;
  color: #175cd3;
}
.locations {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.locations a {
  font-size: 12px;
  color: #175cd3;
  text-decoration: none;
}
.notice {
  background: #fff8e7;
  border: 1px solid #f3d68a;
  color: #694100;
  border-radius: 15px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.35;
}
.checks {
  display: grid;
  gap: 8px;
}
.checks label {
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
}
.field small {
  color: #667085;
  line-height: 1.3;
}
.clientrow {
  align-items: flex-start;
}
/* Construcción 1.1.1 R4: controles preparados para iconografía grande y colorida */
.toolbarCard {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  background: #fff;
  border-radius: 20px;
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.bigSearch {
  width: 100%;
  min-height: 56px;
  border: 1px solid #d0d5dd;
  border-radius: 15px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
}
.iconAction {
  border: 0;
  border-radius: 16px;
  min-width: 126px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.iconAction span {
  font-size: 28px;
  line-height: 1;
}
.primaryAction {
  background: linear-gradient(145deg, var(--red), var(--red2));
  color: #fff;
}
.selectorbox {
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 17px;
  padding: 12px;
}
.selectorActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.btn.soft {
  background: #eef4ff;
  color: #175cd3;
  padding: 10px 13px;
}
.quickbtn.call {
  background: #eef4ff;
  color: #175cd3;
}
.quickbtn.edit {
  background: #fff4e5;
  color: #9a4e00;
}
.toggleLine {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0;
  font-weight: 700;
}
.toggleLine input {
  width: 20px;
  height: 20px;
}
.futureIconSpace {
  min-width: 56px;
  min-height: 56px;
}
@media (max-width: 520px) {
  .toolbarCard {
    grid-template-columns: 1fr;
  }
  .iconAction {
    min-height: 58px;
    width: 100%;
  }
  .selectorActions .btn {
    flex: 1;
    min-height: 46px;
  }
}
.locationChip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  padding: 6px 8px;
}
.locationChip > span {
  font-size: 12px;
  color: #667085;
}
.miniEdit {
  border: 0;
  background: #fff4e5;
  color: #9a4e00;
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
}
.detailGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.detailGrid > div {
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  padding: 12px;
}
.detailGrid small,
.detailGrid b {
  display: block;
}
.detailGrid small {
  color: #667085;
  margin-bottom: 4px;
}
@media (max-width: 520px) {
  .detailGrid {
    grid-template-columns: 1fr;
  }
  .toolbarCard {
    grid-template-columns: 1fr;
  }
  .iconAction {
    min-height: 56px;
  }
}

/* Construcción R6 · primera capa visual empresarial */
:root {
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #16803b;
  --amber: #d97706;
  --purple: #7c3aed;
  --pink: #c026d3;
}
body {
  background: linear-gradient(180deg, #eef1f5 0, #f7f8fa 260px, #f4f6f8 100%);
}
.top {
  padding-bottom: 18px;
  box-shadow: 0 10px 30px #0002;
}
.brandmark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-size: 31px;
  box-shadow: 0 8px 22px #c9212748;
}
.brand h1 {
  font-size: 18px;
  letter-spacing: -0.2px;
}
.brand small {
  font-size: 12px;
}
.pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #ffffff12;
}
.userpill {
  cursor: pointer;
  color: #fff;
}
.hero {
  height: 176px;
  border: 1px solid #ffffff90;
  box-shadow: 0 14px 32px #1018281c;
}
.sectionTitle {
  margin-top: 25px;
}
.sectionTitle h2 {
  font-size: 23px;
  letter-spacing: -0.5px;
}
.sectionTitle span {
  font-weight: 700;
}
.grid {
  gap: 14px;
}
.tile {
  min-height: 158px;
  padding: 18px;
  border: 1px solid #ffffffb8;
  box-shadow: 0 9px 24px #10182812;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.tile:active {
  transform: scale(0.975);
}
.tile .ico {
  width: 68px;
  height: 68px;
  border-radius: 21px;
  font-size: 36px;
  margin-bottom: 15px;
  background: linear-gradient(145deg, #f8fafc, #e8edf3);
  box-shadow:
    inset 0 0 0 1px #fff,
    0 6px 14px #10182812;
}
.tile strong {
  font-size: 18px;
  letter-spacing: -0.25px;
}
.tile small {
  font-size: 13px;
  line-height: 1.35;
}
.tile.primary .ico,
.tile.dark .ico {
  background: #ffffff20;
  box-shadow: inset 0 0 0 1px #ffffff18;
}
.tile.wide {
  min-height: 128px;
}
.module-trabajos .ico {
  background: #e8eefc;
  color: #1d4ed8;
}
.module-clientes .ico {
  background: #e8f7ee;
  color: #16803b;
}
.module-cobros .ico {
  background: #fff4dc;
  color: #b45309;
}
.module-cotizaciones .ico {
  background: #f3e8ff;
  color: #7c3aed;
}
.module-materiales .ico {
  background: #ffeadb;
  color: #c2410c;
}
.module-empleados .ico {
  background: #e0f5f8;
  color: #087f8c;
}
.module-reportes .ico {
  background: #e9e7ff;
  color: #5b4fc7;
}
.module-mas .ico,
.module-usuarios .ico {
  background: #eceff3;
  color: #344054;
}
.module-nuevo .ico {
  background: #ffffff25;
  color: #fff;
}
.pagehead {
  margin: 4px 0 18px;
}
.pagehead h2 {
  font-size: 24px;
  letter-spacing: -0.45px;
}
.back {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  font-size: 27px;
  box-shadow: var(--shadow);
}
.card {
  border: 1px solid #fff;
  padding: 18px;
}
.field input,
.field textarea,
.field select {
  min-height: 50px;
  font-size: 16px;
}
.btn {
  min-height: 48px;
  padding: 12px 17px;
  font-size: 14px;
  cursor: pointer;
}
.btn.red {
  box-shadow: 0 7px 18px #c9212732;
}
.selectorbox {
  padding: 14px;
}
.selectorActions .btn {
  min-height: 48px;
}
.bigSearch {
  min-height: 60px;
}
.iconAction {
  min-height: 60px;
}
.iconAction span {
  font-size: 32px;
}
.row {
  min-height: 70px;
  align-items: center;
}
.quickbtn {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.detailGrid > div {
  min-height: 74px;
}
.bottom {
  padding-top: 7px;
  box-shadow: 0 -10px 30px #10182816;
}
.nav {
  min-height: 62px;
  border-radius: 15px;
  font-size: 11px;
  transition: background 0.12s ease;
}
.nav b {
  font-size: 27px;
  line-height: 29px;
}
.nav.active {
  background: #fff0f1;
  color: var(--red);
}
.modal {
  backdrop-filter: blur(4px);
}
.sheet {
  border-radius: 28px 28px 0 0;
  padding-top: 24px;
  box-shadow: 0 -18px 55px #0003;
}
.sheet h2 {
  font-size: 24px;
  margin-top: 0;
}
@media (min-width: 700px) {
  .tile {
    min-height: 170px;
  }
  .tile .ico {
    width: 72px;
    height: 72px;
    font-size: 39px;
  }
  .hero {
    height: 230px;
  }
}
@media (max-width: 390px) {
  .content {
    padding: 13px;
  }
  .grid {
    gap: 10px;
  }
  .tile {
    min-height: 150px;
    padding: 14px;
  }
  .tile .ico {
    width: 62px;
    height: 62px;
    font-size: 33px;
  }
  .tile strong {
    font-size: 16px;
  }
  .bottom {
    padding-left: 4px;
    padding-right: 4px;
  }
  .nav {
    padding-left: 2px;
    padding-right: 2px;
  }
}

/* 1.2.1 · operación empresarial */
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
.pagehead > div {
  min-width: 0;
}
.pagehead h2 {
  margin: 0;
  overflow-wrap: anywhere;
}
.topGap {
  margin-top: 14px;
}
.muted {
  color: var(--muted);
}
.compact {
  padding: 14px;
}
.sectionRow,
.rowline,
.totalLine {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.sectionRow h3 {
  margin: 0;
}
.subcard {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px;
  margin-top: 10px;
  background: #fbfcfd;
}
.subcard small,
.minirow small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #175cd3;
}
.minirow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
}
.totalLine {
  padding-top: 14px;
  margin-top: 7px;
  border-top: 2px solid var(--ink);
}
.statusHero {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(145deg, #171717, #303030);
  color: #fff;
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.statusHero small,
.statusHero b {
  display: block;
}
.statusHero b {
  font-size: 19px;
}
.statusDot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #54d67a;
  box-shadow: 0 0 0 6px #54d67a22;
}
.statusActions {
  margin-left: auto;
}
.photoGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.photoGrid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
}
.photoGrid img {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.photoGrid figcaption {
  font-size: 11px;
  padding: 8px;
  color: #475467;
}
.timeline {
  display: grid;
  gap: 0;
}
.timeline > div {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  position: relative;
  padding: 6px 0;
}
.timeline i {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--red);
}
.timeline span small {
  display: block;
  color: var(--muted);
}
.signature {
  width: 100%;
  height: 180px;
  border: 2px dashed #98a2b3;
  border-radius: 14px;
  background: #fff;
  touch-action: none;
}
.reportGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.reportGrid > div {
  background: #fff;
  border-radius: 18px;
  padding: 15px;
  box-shadow: var(--shadow);
}
.reportGrid small,
.reportGrid b {
  display: block;
}
.reportGrid b {
  font-size: 19px;
  margin-top: 6px;
}
.reportGrid .result {
  grid-column: 1/-1;
  background: #171717;
  color: #fff;
}
.danger {
  background: #fff0f0;
  color: #a71419;
}
.benefits {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
}
.benefits summary {
  font-weight: 800;
  cursor: pointer;
}
.stickyActions {
  position: sticky;
  bottom: calc(-20px - env(safe-area-inset-bottom));
  background: #fff;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  z-index: 2;
}
.sessionrow {
  width: 100%;
  border: 0;
  text-align: left;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}
.checkline input {
  width: 20px;
  height: 20px;
}
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(90vw, 520px);
  padding: 12px 16px;
  border-radius: 13px;
  background: #171717;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 30px #0004;
}
.toast.ok {
  background: #176b3a;
}
.jobPage .card h3 {
  margin-top: 0;
}
.jobPage p {
  line-height: 1.5;
}
@media (max-width: 520px) {
  .statusHero {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .statusActions {
    width: 100%;
    margin-left: 27px;
  }
  .statusActions .btn {
    width: 100%;
  }
  .photoGrid {
    grid-template-columns: 1fr;
  }
  .reportGrid {
    grid-template-columns: 1fr;
  }
  .reportGrid .result {
    grid-column: auto;
  }
  .sectionRow {
    align-items: flex-start;
  }
  .sectionRow .btn {
    min-width: 100px;
  }
  .shell {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .modal {
    align-items: stretch;
  }
  .sheet {
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    padding-top: calc(18px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  .top {
    position: relative;
  }
  .bottom {
    position: sticky;
    left: 0;
    transform: none;
    width: 100%;
  }
  .shell {
    padding-bottom: 0;
  }
  .sheet {
    max-height: 100dvh;
  }
}

/* 1.2.2 · acceso y sincronización Supabase */
.authShell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 18px
    calc(24px + env(safe-area-inset-bottom));
  background:
    linear-gradient(145deg, #121212e8, #121212b8),
    url("../assets/banner.jpg") center / cover;
}
.authCard {
  width: min(100%, 460px);
  padding: 24px;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 24px 70px #0007;
}
.authBrand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.authBrand h1 {
  margin: 0;
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.08;
}
.authBrand p,
.authHelp {
  margin: 6px 0 0;
}
.authCard .field {
  margin: 14px 0;
}
.authCard .wide {
  width: 100%;
}
.syncpill {
  cursor: pointer;
}
.syncpill:disabled {
  opacity: 0.7;
}
.toast.warn {
  background: #9a6700;
}
.notice.danger {
  background: #fff0f0;
  color: #8a171a;
}
