/* =========================================================
   CIVIC Business — Réplica de la edición de catálogo de
   WhatsApp Business (Catálogo · Artículo · Agregar/Editar)
   ========================================================= */
:root {
  --wa-bar: #f39200;
  --orange: #f39200;
  --orange-dark: #d67f00;
  --orange-soft: #fff4e5;
  --text: #111b21;
  --text-2: #667781;
  --text-3: #8696a0;
  --line: #e9edef;
  --line-2: #d1d7db;
  --bg: #ffffff;
  --gray: #f0f2f5;
  --hover: #f5f6f6;
  --danger: #ea0038;
  --ff: "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.45 var(--ff); color: var(--text); background: #dfe3e6; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { margin: 0; font-weight: 500; }
p { margin: 0; }

.wbtn { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 24px; border-radius: 22px; background: var(--orange); color: #fff; font-weight: 500; transition: background-color .15s; }
.wbtn:hover { background: var(--orange-dark); }
.wbtn[disabled] { opacity: .5; pointer-events: none; }
.wa-link { color: var(--orange-dark); text-decoration: none; font-size: 14px; }
.wa-link:hover { text-decoration: underline; }

/* ---------- Login ---------- */
.login { position: relative; min-height: 100vh; background: #eae6df; }
.login__band { position: absolute; top: 0; left: 0; right: 0; height: 222px; background: var(--orange); }
.login__wrap { position: relative; width: min(960px, 100% - 32px); margin: 0 auto; padding-top: 28px; }
.login__brand { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 14px; font-weight: 500; letter-spacing: .06em; margin-bottom: 40px; }
.login__brand img { width: 38px; height: 38px; border-radius: 8px; }
.login__card { display: grid; grid-template-columns: 1.2fr 1fr; gap: 50px; padding: 56px 60px; background: #fff; border-radius: 3px; }
.login__info h1 { font-size: 28px; font-weight: 300; color: #41525d; margin-bottom: 24px; line-height: 1.3; }
.login__info ol { margin: 0 0 30px; padding-left: 24px; color: #3b4a54; font-size: 17px; line-height: 1.9; }
.login__form { display: grid; gap: 18px; align-content: start; }
.login__err { color: var(--danger); min-height: 1.3em; font-size: 13.5px; }
@media (max-width: 760px) {
  .login__card { grid-template-columns: 1fr; padding: 30px 24px; gap: 28px; }
  .login__info h1 { font-size: 22px; }
  .login__info ol { font-size: 15px; }
}

/* ---------- Contenedor tipo aplicación ---------- */
.device { position: relative; width: 100%; max-width: 640px; height: 100vh; height: 100dvh; margin: 0 auto; background: var(--bg); overflow: hidden; }
@media (min-width: 700px) { .device { border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); } }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.screen.enter-fwd { animation: inR .22s ease-out; }
.screen.enter-back { animation: inL .22s ease-out; }
@keyframes inR { from { transform: translateX(28px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes inL { from { transform: translateX(-28px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Barra superior (naranja de la empresa) */
.appbar { display: flex; align-items: center; gap: 6px; height: 56px; flex: none; padding: 0 4px 0 6px; background: var(--wa-bar); color: #fff; }
.appbar__title { flex: 1; min-width: 0; font-size: 19px; font-weight: 500; padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__title small { display: block; font-size: 12.5px; font-weight: 400; opacity: .85; }
a.ib { color: #fff; text-decoration: none; }
.ib { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; transition: background-color .15s; }
.ib:hover { background: rgba(255, 255, 255, .12); }
.ib svg { width: 23px; height: 23px; }
.appbar__save { height: 40px; padding: 0 14px; border-radius: 20px; font-size: 15px; font-weight: 600; letter-spacing: .04em; color: #fff; }
.appbar__save:hover { background: rgba(255, 255, 255, .12); }
.appbar__save[disabled] { opacity: .5; pointer-events: none; }
.appbar__search { flex: 1; min-width: 0; height: 40px; border: 0; outline: none; background: transparent; color: #fff; font: 17px var(--ff); padding-left: 6px; }
.appbar__search::placeholder { color: rgba(255, 255, 255, .75); }

.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb { background: #ccd0d5; }

/* ---------- Pantalla Catálogo ---------- */
.biz { display: flex; align-items: center; gap: 14px; padding: 18px 18px 16px; }
.biz__avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; overflow: hidden; background: #0b1a33; }
.biz__avatar img { width: 100%; height: 100%; object-fit: cover; }
.biz b { display: block; font-size: 17px; font-weight: 500; }
.biz small { color: var(--text-2); font-size: 13.5px; }
.notice { margin: 0 16px 12px; padding: 12px 14px; border-radius: 10px; background: #fff7e0; color: #6b5100; font-size: 13.5px; }
.notice b { font-weight: 600; }

.addrow { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 18px; text-align: left; transition: background-color .15s; }
.addrow:hover { background: var(--hover); }
.addrow__ico { width: 64px; height: 64px; flex: none; border-radius: 8px; background: var(--gray); display: grid; place-items: center; color: var(--orange-dark); }
.addrow__ico svg { width: 30px; height: 30px; }
.addrow b { font-size: 16px; font-weight: 500; }
.addrow small { display: block; color: var(--text-2); font-size: 13.5px; }

.divider { height: 8px; background: var(--gray); }
.sect { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px; }
.sect h2 { font-size: 15px; font-weight: 500; color: var(--text-2); }
.sect button { color: var(--orange-dark); font-size: 14px; font-weight: 500; }

.cols { display: flex; gap: 12px; padding: 4px 18px 18px; overflow-x: auto; scrollbar-width: none; }
.cols::-webkit-scrollbar { display: none; }
.col { flex: none; width: 108px; text-align: left; display: block; }
.col__img { display: block; position: relative; width: 108px; height: 108px; border-radius: 10px; overflow: hidden; background: var(--gray); border: 2px solid transparent; transition: border-color .15s; }
.col__img img { width: 100%; height: 100%; object-fit: cover; }
.col__img svg { position: absolute; inset: 0; margin: auto; width: 34px; height: 34px; color: var(--text-3); }
.col.is-active .col__img { border-color: var(--orange); }
.col b { display: block; margin-top: 6px; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col small { color: var(--text-2); font-size: 12.5px; }

.item { display: flex; align-items: center; gap: 16px; width: 100%; padding: 10px 18px; text-align: left; transition: background-color .15s; }
.item:hover { background: var(--hover); }
.item__img { position: relative; width: 64px; height: 64px; flex: none; border-radius: 8px; overflow: hidden; background: var(--gray); display: grid; place-items: center; color: var(--text-3); }
.item__img img { width: 100%; height: 100%; object-fit: cover; }
.item__img svg { width: 28px; height: 28px; }
.item.is-hidden .item__img img { opacity: .45; }
.item__body { flex: 1; min-width: 0; padding: 4px 0 14px; border-bottom: 1px solid var(--line); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.item:last-child .item__body { border-bottom: 0; }
.item__title, .item__desc, .item__price { display: block; }
.item__title { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__desc { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__price { font-size: 14px; margin-top: 2px; }
.item__hidden { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 13px; color: var(--text-2); }
.item__hidden svg { width: 15px; height: 15px; }
.empty { padding: 50px 30px; text-align: center; color: var(--text-2); }
.foot { padding: 20px 18px 40px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- Pantalla Artículo (detalle) ---------- */
.pd__img { position: relative; aspect-ratio: 1 / 1; max-height: 58vh; width: 100%; background: var(--gray); display: grid; place-items: center; color: var(--text-3); overflow: hidden; }
.pd__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pd__img svg { width: 60px; height: 60px; }
.pd__badge { position: absolute; left: 14px; top: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 14px; background: rgba(17, 27, 33, .75); color: #fff; font-size: 13px; }
.pd__badge svg { width: 15px; height: 15px; }
.pd__body { padding: 18px 18px 8px; }
.pd__title { font-size: 22px; font-weight: 500; line-height: 1.25; }
.pd__price { font-size: 17px; margin-top: 6px; }
.pd__desc { color: #3b4a54; margin-top: 14px; white-space: pre-line; }
.pd__meta { padding: 6px 18px 12px; }
.pd__row { display: flex; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.pd__row svg { width: 22px; height: 22px; flex: none; color: var(--text-3); margin-top: 1px; }
.pd__row b { display: block; font-weight: 400; font-size: 15px; }
.pd__row small { color: var(--text-2); font-size: 13.5px; }
.pd__feats { margin: 4px 0 0; padding-left: 18px; color: #3b4a54; }
.pd__cta { display: flex; justify-content: center; padding: 10px 18px 28px; }
.pd__cta span { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 22px; border-radius: 22px; border: 1px solid var(--line-2); color: var(--orange-dark); font-weight: 500; }
.pd__cta svg { width: 20px; height: 20px; }
.pd__hint { text-align: center; color: var(--text-3); font-size: 12.5px; padding-bottom: 26px; }

/* ---------- Pantalla Agregar / Editar artículo ---------- */
.ed { padding: 16px 18px 40px; }
.imgs { display: flex; gap: 12px; padding: 4px 0 18px; }
.imgs__add, .imgs__thumb { position: relative; width: 84px; height: 84px; flex: none; border-radius: 8px; }
.imgs__add { border: 1.5px dashed var(--line-2); background: var(--gray); color: var(--orange-dark); display: grid; place-items: center; align-content: center; gap: 2px; font-size: 12px; text-align: center; transition: border-color .15s, background-color .15s; }
.imgs__add:hover { border-color: var(--orange); background: var(--orange-soft); }
.imgs__add svg { width: 28px; height: 28px; margin: 0 auto; }
.imgs__thumb { overflow: visible; }
.imgs__thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.imgs__x { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; background: #54656f; color: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.imgs__x svg { width: 12px; height: 12px; stroke-width: 3; }
.imgs__prog { position: absolute; inset: 0; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .8); }
.imgs__prog svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.imgs__prog circle { stroke-width: 3; }
.imgs__prog .bg { stroke: #d1d7db; }
.imgs__prog .fg { stroke: var(--orange); stroke-dasharray: 119.4; stroke-dashoffset: 119.4; transition: stroke-dashoffset .2s; }
.imgs__note { color: var(--text-3); font-size: 12.5px; margin: -8px 0 12px; }

.wfield { position: relative; display: block; padding-top: 18px; margin-bottom: 6px; }
.wfield > span { position: absolute; left: 0; top: 0; font-size: 13px; color: var(--text-2); transition: color .15s; }
.wfield:focus-within > span { color: var(--orange-dark); }
.wfield input, .wfield textarea, .wfield select {
  width: 100%; border: 0; border-bottom: 2px solid var(--line-2); padding: 8px 0 8px; background: transparent;
  font: 16px var(--ff); color: var(--text); outline: none; resize: none; border-radius: 0; transition: border-color .15s;
}
.wfield input:focus, .wfield textarea:focus, .wfield select:focus { border-bottom-color: var(--orange); }
.wfield__count { position: absolute; right: 0; top: 0; font-size: 12px; color: var(--text-3); }
.wfield small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.price { display: flex; align-items: flex-end; gap: 12px; }
.price__cur { flex: none; width: 64px; }
.price__val { flex: 1; }
.price__unit { flex: 1; }

.more { display: flex; align-items: center; gap: 8px; margin: 18px 0 4px; color: var(--orange-dark); font-weight: 500; }
.more svg { width: 18px; height: 18px; transition: transform .2s; }
.more.is-open svg { transform: rotate(180deg); }

.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 6px; cursor: pointer; }
.switchrow b { display: block; font-weight: 400; font-size: 16px; }
.switchrow small { color: var(--text-2); font-size: 13.5px; }
.switchrow input { position: absolute; opacity: 0; pointer-events: none; }
.sw { position: relative; width: 36px; height: 14px; flex: none; border-radius: 7px; background: #c5cacd; transition: background-color .15s; }
.sw::after { content: ""; position: absolute; top: -3px; left: -2px; width: 20px; height: 20px; border-radius: 50%; background: #f1f1f1; border: 1px solid #c5cacd; transition: transform .15s, background-color .15s, border-color .15s; }
.switchrow input:checked + .sw { background: #ffd08a; }
.switchrow input:checked + .sw::after { transform: translateX(20px); background: var(--orange); border-color: var(--orange); }

.delrow { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 26px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--danger); font-size: 16px; text-align: left; }
.delrow svg { width: 22px; height: 22px; }

/* Ajustes (misma estructura de formulario) */
.st-group { padding: 6px 18px 10px; }
.st-group h3 { font-size: 14px; color: var(--orange-dark); font-weight: 500; margin: 14px 0 4px; }
.st-stat { display: grid; grid-template-columns: 64px 90px 64px 1fr; gap: 0 12px; }
.st-action { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 18px; text-align: left; border-bottom: 1px solid var(--line); transition: background-color .15s; }
.st-action:hover { background: var(--hover); }
.st-action svg { width: 24px; height: 24px; color: var(--text-2); flex: none; }
.st-action b { display: block; font-weight: 400; font-size: 16px; }
.st-action small { color: var(--text-2); font-size: 13.5px; }
.st-action.is-danger b, .st-action.is-danger svg { color: var(--danger); }

/* Menú desplegable (⋮) */
.menu { position: absolute; top: 6px; right: 6px; z-index: 20; min-width: 230px; padding: 8px 0; border-radius: 6px; background: #fff; border: 1px solid var(--line-2); }
.menu button, .menu a { display: block; width: 100%; padding: 12px 22px; text-align: left; font-size: 15.5px; color: var(--text); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .is-danger { color: var(--danger); }
.menu__sep { height: 1px; margin: 6px 0; background: var(--line); }
.menu-veil { position: absolute; inset: 0; z-index: 19; }

/* Diálogo */
.wdialog { width: min(420px, calc(100% - 48px)); padding: 24px 24px 12px; border: 0; border-radius: 6px; color: var(--text); }
.wdialog::backdrop { background: rgba(0, 0, 0, .4); }
.wdialog h3 { font-size: 19px; font-weight: 500; margin-bottom: 12px; }
.wdialog h3:empty { display: none; }
.wdialog p { font-size: 15px; color: var(--text-2); line-height: 1.5; margin-bottom: 18px; }
.wdialog__actions { display: flex; justify-content: flex-end; gap: 6px; }
.wdialog__actions button { padding: 10px 14px; border-radius: 4px; color: var(--orange-dark); font-weight: 600; font-size: 14.5px; letter-spacing: .04em; }
.wdialog__actions button:hover { background: var(--hover); }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; max-width: calc(100% - 40px); padding: 12px 22px; border-radius: 6px; background: #323232; color: #fff; font-size: 14.5px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s; }
.toast.is-show { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: #b3002c; }

@media (max-width: 520px) {
  .st-stat { grid-template-columns: 1fr 1fr; }
  .price { flex-wrap: wrap; }
  .price__unit { flex-basis: 100%; }
}
