:root {
  --bg: #f3f3f4;
  --side: #f7f7f8;
  --paper: #ffffff;
  --ink: #16161a;
  --muted: #6e6e76;
  --faint: #8b8b93;
  --line: #e6e6ea;
  --line-strong: #d8d8de;
  --hover: #efeff1;
  --green: #17803d;
  --green-bg: #e9f8ee;
  --amber: #b86e00;
  --amber-bg: #fff4e5;
  --red: #d23b3b;
  --red-bg: #fdecec;
  --shadow: 0 1px 2px rgba(22, 22, 26, 0.04);
  --side-w: 248px;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
button { cursor: pointer; }

.side { display: none; }
.shell { min-height: 100vh; }
.pagehead { padding: 18px 16px 0; }
.crumb { color: var(--faint); font-size: 13px; margin-bottom: 10px; }
.crumb b { color: var(--ink); font-weight: 600; }
.pagehead-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pagehead h1 { font-size: 32px; letter-spacing: -0.04em; font-weight: 700; line-height: 1.1; }
.sub { color: var(--muted); margin-top: 6px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
main { padding: 16px 16px 108px; }

.mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: block; object-fit: cover; flex: none;
}
.av {
  width: 36px; height: 36px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #111; color: white; font-weight: 700; flex: none;
}
.av { width: 32px; height: 32px; font-size: 13px; background: #2a2a2e; }
.av.orange { background: #ff5a1f; }
.av.gray { background: #8d8d95; }
.av.green { background: #17803d; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: white; color: var(--ink);
  font-weight: 600; box-shadow: var(--shadow);
}
.btn.dark { background: #111; color: white; border-color: #111; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; box-shadow: none; }

.segments { display: flex; gap: 6px; overflow: auto; padding-bottom: 2px; margin-bottom: 12px; }
.segments a, .segments span, .segments button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px; border-radius: 999px;
  background: white; border: 1px solid var(--line); color: var(--muted); font-weight: 600;
  white-space: nowrap;
}
.segments a.on, .segments span.on, .segments button.on { background: #111; color: white; border-color: #111; }
.segments em {
  font-style: normal; background: rgba(255,255,255,.16); border-radius: 999px; padding: 0 6px; font-size: 12px;
}
.segments a:not(.on) em, .segments button:not(.on) em { background: var(--hover); color: var(--ink); }

.search {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  background: white; border: 1px solid var(--line); margin-bottom: 12px;
}
.search input, .search select { border: 0; outline: 0; width: 100%; background: transparent; min-height: 40px; font-size: 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 10px; border-radius: 999px;
  background: white; border: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.chip b { color: var(--ink); font-weight: 600; }

.table-card {
  background: white; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); overflow: auto;
}
.sheet { width: 100%; border-collapse: collapse; display: none; }
.sheet th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.sheet td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sheet tr:last-child td { border-bottom: 0; }
.sheet tbody tr:hover { background: #fafafa; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell small, .muted, .rowcard em { color: var(--muted); font-style: normal; display: block; font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.sheet th.num { text-align: right; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--amber-bg); color: var(--amber); font-size: 12px; font-weight: 700;
}
.pill i { width: 7px; height: 7px; border-radius: 99px; background: currentColor; display: inline-block; }
.pill.pagado, .pill.pagada, .pill.pagados, .pill.viva { background: var(--green-bg); color: var(--green); }
.pill.muerto, .pill.muerta, .pill.vencido { background: var(--red-bg); color: var(--red); }

.rowcard {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.rowcard strong { display: block; font-size: 15px; }
.rowend { text-align: right; display: grid; justify-items: end; gap: 6px; }
.rowend b { font-size: 15px; font-variant-numeric: tabular-nums; }
.only-desk { display: none; }
.stack { display: grid; }
.empty {
  background: transparent; border: 0; box-shadow: none; padding: 8px 8px 24px;
  color: var(--muted); text-align: center;
}
.empty::before {
  content: "";
  display: block;
  width: min(320px, 100%);
  height: 150px;
  margin: 0 auto 8px;
  background: url("/static/empty.png") center/contain no-repeat;
}

.metrics { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
.metric {
  background: white; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow);
}
.metric span { color: var(--muted); font-size: 13px; }
.metric b { display: block; font-size: 26px; letter-spacing: -0.04em; margin-top: 4px; }

.card, form.card, .panel {
  background: white; border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink); }
input, select {
  min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px;
  background: white; font-size: 16px;
}
.error { color: var(--red); background: var(--red-bg); padding: 10px 12px; border-radius: 12px; }
.section-label { font-size: 13px; color: var(--muted); font-weight: 700; margin: 18px 0 8px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.94); border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--faint); font-size: 11px; font-weight: 650;
}
.tabbar a.on { color: var(--ink); }
.tabbar svg { width: 22px; height: 22px; }
.phonebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 0;
}
.phonebar .brandline { display: flex; align-items: center; gap: 10px; }
.phonebar strong { display: block; font-size: 14px; }
.phonebar span { color: var(--muted); font-size: 12px; }
.plus {
  width: 40px; height: 40px; border-radius: 999px; background: #111; color: white;
  display: inline-flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1;
}

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login form { width: min(400px, 100%); display: grid; gap: 12px; }
.login h1 { font-size: 28px; letter-spacing: -0.04em; }

.capture { display: grid; gap: 10px; }
.home-grid { display: grid; gap: 16px; }
.lote-grid { display: grid; gap: 16px; }

@media (max-width: 1099px) {
  .pagehead-row { flex-direction: column; align-items: flex-start; }
  .pagehead h1 { font-size: 34px; }
}

@media (min-width: 800px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .pagehead, main { padding-left: 28px; padding-right: 28px; }
  .capture { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
  body { display: grid; grid-template-columns: var(--side-w) 1fr; background: var(--side); }
  .side {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100vh; padding: 18px 12px 14px;
    background: var(--side);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
  .brand strong { display: block; font-size: 15px; }
  .brand span { color: var(--muted); font-size: 12px; }
  .side-label { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 14px 12px 6px; }
  .side a.nav {
    display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px;
    border-radius: 10px; color: #3a3a40; font-weight: 600;
  }
  .side a.nav svg { width: 18px; height: 18px; color: #5c5c64; }
  .side a.nav.on { background: #ececef; color: var(--ink); }
  .side a.nav .count {
    margin-left: auto; background: white; border-radius: 999px; min-width: 22px; text-align: center;
    font-size: 12px; padding: 1px 6px; color: var(--muted);
  }
  .grow { flex: 1; }
  .me { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 12px; }
  .me:hover { background: var(--hover); }
  .me strong { display: block; font-size: 14px; }
  .me span { color: var(--muted); font-size: 12px; }
  .shell { background: var(--bg); border-left: 1px solid var(--line); min-height: 100vh; }
  .phonebar, .tabbar { display: none; }
  main { padding-bottom: 40px; }
  .only-phone { display: none; }
  .only-desk { display: block; }
  .sheet { display: table; }
  .table-card.only-desk { display: block; }
  .home-grid, .lote-grid { grid-template-columns: 1fr 1fr; }
  .lote-grid { grid-template-columns: 1.15fr .95fr .9fr; align-items: start; }
}
