:root {
  --ink: #16130f;
  --paper: #fbf7f0;
  --tint: #f3ead9;
  --brand: #ff5a1f;
  --brand-dark: #d9430c;
  --green: #1f8f5f;
  --wa: #25d366;
  --red: #c4372a;
  --muted: #6b645a;
  --line: #e6dccb;
  --r: 16px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--body); background: var(--paper); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--brand-dark); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.1; }
h2 { font-size: 1.6rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; }
input, select, button { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; padding: 3rem 1rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .75rem 1.2rem; border-radius: 999px; border: 2px solid var(--brand); background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .12s, background .12s; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:active { transform: scale(.97); }
.btn--sm { padding: .5rem .9rem; font-size: .88rem; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--tint); border-color: var(--tint); }
.btn--wa { background: var(--wa); border-color: var(--wa); }
.btn--wa:hover { background: #1fb957; border-color: #1fb957; }
.btn--danger { background: transparent; color: var(--red); border-color: #f0c9c4; }
.btn--danger:hover { background: #fbe9e6; border-color: #fbe9e6; }

/* Carga */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 3rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; padding: 2rem 1.2rem; background: radial-gradient(ellipse at top, #ffe6d9, var(--paper) 60%); }
.login__card { width: min(400px, 100%); background: #fff; border-radius: 24px; padding: 2.4rem 1.8rem; text-align: center; box-shadow: 0 24px 50px -24px rgba(60,40,10,.35); }
.login__card h1 { font-size: 2rem; margin: 1rem 0 .4rem; }
.login__card h1 span { color: var(--brand); }
.login__card > p { color: var(--muted); margin-bottom: 1.6rem; }
.gbtn { display: flex; justify-content: center; min-height: 44px; margin-bottom: .8rem; }
.devform { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px dashed var(--line); display: grid; gap: .5rem; }
.logo-mark { width: 64px; height: 64px; border-radius: 18px; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.5rem; }
.logo-mark.sm { width: 34px; height: 34px; border-radius: 10px; font-size: .85rem; }

/* Barra superior */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .7rem max(1rem, env(safe-area-inset-left)); padding-top: max(.7rem, env(safe-area-inset-top)); background: rgba(251,247,240,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.brand b { color: var(--brand); }
.top__nav { display: flex; gap: .3rem; margin-left: auto; }
.top__nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; padding: .45rem .8rem; border-radius: 999px; }
.top__nav a.on { background: var(--ink); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--tint); display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: var(--ink); text-decoration: none; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Página */
.page { width: min(1100px, 100%); margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.page.narrow { max-width: 560px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: #fff3e8; border: 1px solid #ffd7bf; border-radius: var(--r); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.banner--ok { background: #e7f5ee; border-color: #c4e6d4; display: block; }
.search input { width: 100%; padding: .85rem 1.1rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 1rem; }
.search input:focus, .form input:focus, .form select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.chips { display: flex; gap: .45rem; overflow-x: auto; padding: .9rem 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; padding: .5rem .9rem; border-radius: 999px; font-weight: 500; font-size: .88rem; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Tarjetas de proveedor */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .9rem; }
.sup { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; display: flex; flex-direction: column; gap: .55rem; }
.sup--locked { background: repeating-linear-gradient(135deg, #fff, #fff 10px, #fcf8f2 10px, #fcf8f2 20px); }
.sup--locked h3 { color: var(--muted); letter-spacing: .05em; }
.tagcat { align-self: flex-start; font-size: .75rem; font-weight: 600; background: var(--tint); padding: .2rem .6rem; border-radius: 999px; }
.sup__info { list-style: none; display: grid; gap: .3rem; font-size: .9rem; margin: .2rem 0; }
.sup__info span { display: inline-block; min-width: 110px; color: var(--muted); }
.sup__actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: auto; padding-top: .4rem; }
.sup__lock { font-weight: 600; color: var(--muted); font-size: .9rem; margin-top: auto; }

/* Cards / formularios */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.3rem; margin-bottom: 1rem; display: grid; gap: .9rem; }
.form h3 { margin-bottom: .2rem; }
.form__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.span2 { grid-column: span 2; }
label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; }
label input:not([type=checkbox]), label select, .devform input { padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400; font-size: .95rem; width: 100%; }
.switch { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.switch input, .urow__cats input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Admin */
.tabs { display: flex; gap: .3rem; background: var(--tint); padding: .3rem; border-radius: 999px; margin-bottom: 1.2rem; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .55rem 1.1rem; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.list { display: grid; gap: .6rem; margin-top: .6rem; }
.urow { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; display: grid; grid-template-columns: 1.4fr auto 1fr auto; gap: .8rem 1.2rem; align-items: center; }
.urow__who { display: grid; min-width: 0; }
.urow__who span { overflow: hidden; text-overflow: ellipsis; }
.urow__cats summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.urow__cats[open] { grid-column: 1 / -1; order: 5; }
.urow__cats label { display: flex; align-items: center; gap: .5rem; font-weight: 400; padding: .3rem 0; }
.urow__cats[open] summary { margin-bottom: .4rem; }
.urow__btns { display: flex; gap: .4rem; order: 6; }
.prow { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.prow.off { opacity: .6; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%); background: var(--ink); color: #fff; padding: .8rem 1.2rem; border-radius: 12px; font-weight: 500; transition: transform .25s; z-index: 100; max-width: calc(100% - 32px); }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .brand__txt { display: none; }
  .top__nav { margin-left: 0; }
  .avatar { margin-left: auto; }
  .form__grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .urow { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
}
