/* Panel Quaderns — mismo estilo que quaderns.es: marrón cálido, crema, terracota y el turquesa del logo.
   Tipografías de la web: Baloo 2 (títulos) y Quicksand (texto). Pensado primero para el móvil. */

:root {
  --brown: #96592f;
  --brown-dark: #6f4122;
  --brown-deep: #3a281d;
  --ink: #2f2219;
  --muted: #8a7a6c;
  --cream: #f8f1e7;
  --cream-2: #f3ece2;
  --paper: #fffdf9;
  --line: #eadfce;
  --terra: #c8693f;
  --terra-dark: #a9522d;
  --teal: #41b9be;
  --teal-dark: #2b9a9f;
  --teal-soft: #e3f4f4;
  --mustard: #e9b15e;
  --sand: #f4d9a8;
  --green: #3f9a5b;
  --green-soft: #e4f3e8;
  --red: #c2463a;
  --red-soft: #fbe6e2;
  --amber-soft: #fcefd6;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(58, 40, 29, .06), 0 6px 20px rgba(58, 40, 29, .07);
  --shadow-lg: 0 18px 50px rgba(58, 40, 29, .22);
  --font-title: 'Baloo 2', 'Quicksand', system-ui, sans-serif;
  --font: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--terra-dark); }
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 700; line-height: 1.15; margin: 0; color: var(--ink); }
h1 { font-size: clamp(26px, 5vw, 34px); }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
.center { text-align: center; }
.mono { font-family: ui-monospace, 'JetBrains Mono', monospace; font-size: .92em; }
.nowrap { white-space: nowrap; }

/* ---------- Arranque ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--brown); }
.boot img { width: 210px; background: #fff; border-radius: 16px; padding: 12px 16px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.97); opacity: .85; } }

/* ---------- Estructura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--brown);
  color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  box-shadow: 0 2px 12px rgba(58, 40, 29, .25);
}
.topbar .logo { background: #fff; border-radius: 12px; padding: 5px 9px; display: block; }
.topbar .logo img { height: 30px; width: auto; }
.topbar .title { font-family: var(--font-title); font-size: 20px; font-weight: 700; color: #fff; }
.topbar .who { font-size: 13px; opacity: .85; text-align: right; line-height: 1.2; }
.topbar .iconbtn { background: rgba(255, 255, 255, .14); color: #fff; border: 0; border-radius: 999px; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; position: relative; }
.topbar .iconbtn:hover { background: rgba(255, 255, 255, .24); }
.topbar .iconbtn svg { width: 22px; height: 22px; }

.layout { display: flex; min-height: calc(100vh - 60px); }
.sidenav { display: none; }
main.view { flex: 1; min-width: 0; padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 1180px; margin: 0 auto; }
/* Barra inferior (móvil) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--paper);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + var(--safe-b));
  box-shadow: 0 -6px 24px rgba(58, 40, 29, .08);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700;
  padding: 6px 2px; border-radius: 14px; position: relative;
}
.bottomnav a svg { width: 26px; height: 26px; }
.bottomnav a.on { color: var(--brown); background: var(--cream-2); }
.bottomnav a.on svg { color: var(--terra); }
.badge {
  position: absolute; top: 2px; right: calc(50% - 22px);
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--terra); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--paper);
}
.topbar .badge { top: -4px; right: -4px; border-color: var(--brown); }

@media (min-width: 960px) {
  .bottomnav { display: none; }
  .sidenav {
    display: flex; flex-direction: column; gap: 4px;
    width: 236px; flex: none;
    padding: 18px 12px; position: sticky; top: 60px; height: calc(100vh - 60px);
    background: var(--paper); border-right: 1px solid var(--line);
  }
  .sidenav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px;
    color: var(--ink); text-decoration: none; font-weight: 700; border-radius: 14px; position: relative;
  }
  .sidenav a svg { width: 22px; height: 22px; color: var(--brown); }
  .sidenav a:hover { background: var(--cream-2); }
  .sidenav a.on { background: var(--brown); color: #fff; }
  .sidenav a.on svg { color: #fff; }
  .sidenav .badge { position: static; margin-left: auto; border: 0; }
  .sidenav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
  .sidenav .foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 8px 14px; }
  main.view { padding: 26px 30px 40px; }
}

/* ---------- Componentes ---------- */
.card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; border: 1px solid rgba(234, 223, 206, .7);
}
.card + .card { margin-top: 14px; }
.card h2 { margin-bottom: 10px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 21px; }
.section-title .link { margin-left: auto; font-weight: 700; font-size: 14px; color: var(--terra-dark); text-decoration: none; }
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead h1 { flex: 1; min-width: 180px; }
.eyebrow { font-family: var(--font-title); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-dark); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s, box-shadow .15s, border-color .15s;
  min-height: 46px;
}
.btn:hover { border-color: var(--sand); background: #fff; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--terra); border-color: var(--terra); color: #fff; box-shadow: 0 6px 16px rgba(200, 105, 63, .3); }
.btn.primary:hover { background: var(--terra-dark); border-color: var(--terra-dark); }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.brown { background: var(--brown); border-color: var(--brown); color: #fff; }
.btn.brown:hover { background: var(--brown-dark); }
.btn.danger { color: var(--red); border-color: #f0c9c2; }
.btn.danger:hover { background: var(--red-soft); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--cream-2); }
.btn.sm { min-height: 36px; padding: 6px 13px; font-size: 14px; }
.btn.lg { min-height: 56px; padding: 14px 24px; font-size: 17px; }
.btn.block { width: 100%; }
.btn.icon { width: 44px; padding: 0; }
.btn.icon.sm { width: 36px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; background: var(--cream-2); color: var(--brown-dark); white-space: nowrap;
}
.pill.teal { background: var(--teal-soft); color: var(--teal-dark); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: #9a6413; }
.pill.terra { background: #f8e1d5; color: var(--terra-dark); }
.pill.dark { background: var(--brown-deep); color: #fff; }

.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 14px;
  padding: 12px 14px; font-size: 16px; font-weight: 600; outline: none; min-height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.45; font-weight: 500; }
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(65, 185, 190, .16); }
.input::placeholder { color: #b9ab9d; font-weight: 500; }
label.lbl { display: block; font-weight: 700; font-size: 14px; margin: 0 0 6px; color: var(--brown-dark); }
.field { margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.money-in { position: relative; }
.money-in .input { padding-right: 34px; }
.money-in::after { content: '€'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }

.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.search .input { padding-left: 44px; border-radius: 999px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; gap: 7px; align-items: center;
}
.chip b { background: var(--cream-2); color: var(--brown-dark); border-radius: 999px; padding: 0 8px; font-size: 12.5px; }
.chip.on { background: var(--brown); border-color: var(--brown); color: #fff; }
.chip.on b { background: rgba(255, 255, 255, .2); color: #fff; }

.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #d9cdbd; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::before { transform: translateX(22px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px rgba(65, 185, 190, .25); }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 6px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.notice { border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.notice.info { background: var(--teal-soft); color: #1f6d70; }
.notice.warn { background: var(--amber-soft); color: #7a4f0e; }
.notice.err { background: var(--red-soft); color: #8d2c22; }
.notice.ok { background: var(--green-soft); color: #2a6b3e; }
.notice .ico { font-size: 18px; line-height: 1.2; }

/* ---------- Inicio ---------- */
.hello { margin-bottom: 18px; }
.hello h1 span { color: var(--terra); }
.actions4 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 760px) { .actions4 { grid-template-columns: repeat(4, 1fr); } }
.bigaction {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 132px; padding: 16px; border-radius: 22px; text-decoration: none; color: #fff;
  box-shadow: var(--shadow); overflow: hidden; transition: transform .1s ease, box-shadow .15s; border: 0; cursor: pointer; text-align: left;
}
.bigaction:active { transform: scale(.97); }
.bigaction:hover { box-shadow: var(--shadow-lg); }
.bigaction .ic { width: 46px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, .22); display: grid; place-items: center; }
.bigaction .ic svg { width: 26px; height: 26px; }
.bigaction .lb { display: block; font-family: var(--font-title); font-size: 19px; font-weight: 700; line-height: 1.1; }
.bigaction .sub { display: block; font-size: 13px; opacity: .9; font-weight: 600; margin-top: 3px; }
.bigaction .count { position: absolute; top: 14px; right: 14px; background: #fff; color: var(--terra-dark); font-weight: 800; border-radius: 999px; min-width: 32px; height: 32px; display: grid; place-items: center; font-size: 16px; padding: 0 8px; }
.bigaction.a1 { background: linear-gradient(140deg, #c8693f, #a9522d); }
.bigaction.a2 { background: linear-gradient(140deg, #41b9be, #2b9a9f); }
.bigaction.a3 { background: linear-gradient(140deg, #96592f, #6f4122); }
.bigaction.a4 { background: linear-gradient(140deg, #e0a24a, #c4832a); }
.bigaction::after { content: ''; position: absolute; right: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .1); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--paper); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .k { font-size: 13px; font-weight: 700; color: var(--muted); }
.stat .v { font-family: var(--font-title); font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.1; margin-top: 2px; }
.stat .s { font-size: 12.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 520px) { .stat .v { font-size: 21px; } .stat { padding: 12px; } }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 90px; margin-top: 12px; }
.bars .b { flex: 1; background: var(--sand); border-radius: 6px 6px 3px 3px; min-height: 4px; position: relative; }
.bars .b.today { background: var(--terra); }
.bars .b:hover::after { content: attr(data-t); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
.bars-x { display: flex; gap: 5px; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.bars-x span { flex: 1; text-align: center; }

.two { display: grid; gap: 14px; }
.two > * { min-width: 0; }
@media (min-width: 1150px) { .two { grid-template-columns: 1.3fr 1fr; } }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.li:last-child { border-bottom: 0; }
.li .thumb { width: 48px; height: 48px; border-radius: 12px; background: var(--cream-2) center/cover; flex: none; border: 1px solid var(--line); }
.li .main { flex: 1; min-width: 0; }
.li .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .d { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li.click { cursor: pointer; border-radius: 12px; }
.li.click:hover { background: var(--cream-2); }

.feed .li { align-items: flex-start; }
.feed .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 16px; background: var(--cream-2); }

/* ---------- Pedidos ---------- */
.orders { display: grid; gap: 12px; }
@media (min-width: 900px) { .orders { grid-template-columns: 1fr 1fr; } }
.order {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
  cursor: pointer; border: 1.5px solid transparent; transition: border-color .15s;
}
.order:hover { border-color: var(--sand); }
.order.new { border-color: var(--terra); }
.order .top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.order .num { font-family: var(--font-title); font-weight: 800; font-size: 19px; }
.order .total { margin-left: auto; font-family: var(--font-title); font-weight: 800; font-size: 19px; color: var(--terra-dark); }
.order .who { font-weight: 700; }
.order .meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.order .thumbs { display: flex; gap: 6px; margin-top: 10px; }
.order .thumbs span { width: 46px; height: 46px; border-radius: 10px; background: var(--cream-2) center/cover; border: 1px solid var(--line); }
.order .thumbs em { font-style: normal; font-size: 13px; color: var(--muted); align-self: center; }

.od-items .li .thumb { width: 60px; height: 60px; }
.steps { display: flex; gap: 6px; margin: 4px 0 16px; }
.steps .st { flex: 1; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.steps .st i { display: block; height: 6px; border-radius: 999px; background: var(--line); margin-bottom: 6px; }
.steps .st.done i { background: var(--teal); }
.steps .st.done { color: var(--teal-dark); }
.steps .st.cur i { background: var(--terra); }
.steps .st.cur { color: var(--terra-dark); }
.contact { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Productos ---------- */
.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .pgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .pgrid { grid-template-columns: repeat(4, 1fr); } }
.pcard { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; border: 1.5px solid transparent; }
.pcard:hover { border-color: var(--sand); }
.pcard .ph { aspect-ratio: 1; background: #fff center/contain no-repeat; position: relative; border-bottom: 1px solid var(--line); }
.pcard .ph .tags { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.pcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .nm { font-weight: 700; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.pcard .pr { font-family: var(--font-title); font-weight: 800; font-size: 18px; color: var(--terra-dark); }
.pcard .pr s { color: var(--muted); font-size: 13px; font-weight: 600; margin-left: 4px; }
.pcard .bottom { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.pcard.dim .ph { opacity: .55; }
.stockbox { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.stockbox button { border: 0; background: transparent; width: 34px; height: 34px; font-size: 20px; font-weight: 700; cursor: pointer; color: var(--brown); }
.stockbox button:hover { background: var(--cream-2); }
.stockbox span { min-width: 30px; text-align: center; font-weight: 800; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 14px; background: #fff center/contain no-repeat; border: 1.5px solid var(--line); }
.photo .x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; font-weight: 800; display: grid; place-items: center; }
.photo .main-tag { position: absolute; bottom: 6px; left: 6px; }
.photo.add { display: grid; place-items: center; border-style: dashed; border-color: var(--sand); cursor: pointer; color: var(--brown); background: var(--cream); text-align: center; font-weight: 700; font-size: 13px; }
.photo.add svg { width: 30px; height: 30px; margin: 0 auto 4px; }
.photo.loading { background: var(--cream-2); display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--sand); border-top-color: var(--terra); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.drop {
  border: 2px dashed var(--sand); border-radius: var(--radius); padding: 26px 16px; text-align: center; background: var(--cream);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: #fff7ec; border-color: var(--terra); }
.drop .big { font-size: 40px; }
.drop b { display: block; font-family: var(--font-title); font-size: 18px; margin: 4px 0; }

/* Vendido en tienda */
.scanbox { background: var(--brown); color: #fff; border-radius: 24px; padding: 20px; box-shadow: var(--shadow); }
.scanbox h2 { color: #fff; }
.scanbox .input { border-color: transparent; font-size: 18px; }
.scanbox .btn.scan { background: #fff; color: var(--brown-dark); border-color: #fff; }
.video-wrap { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; margin-top: 12px; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.video-wrap .aim { position: absolute; left: 12%; right: 12%; top: 38%; height: 24%; border: 3px solid var(--mustard); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.sold-res { display: flex; gap: 14px; align-items: center; background: var(--paper); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.sold-res .im { width: 84px; height: 84px; border-radius: 14px; background: #fff center/contain no-repeat; border: 1px solid var(--line); flex: none; }
.sold-res + .sold-res { margin-top: 10px; }

/* Importar */
.imp-row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.imp-row:last-child { border-bottom: 0; }
.imp-row .im { width: 64px; height: 64px; border-radius: 12px; background: var(--cream-2) center/contain no-repeat; border: 1px solid var(--line); position: relative; }
.imp-row .im b { position: absolute; bottom: -6px; right: -6px; background: var(--teal); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 6px; }
.imp-fields { display: grid; grid-template-columns: 1fr 110px 80px; gap: 8px; margin-top: 6px; }
.imp-fields .input { min-height: 40px; padding: 8px 10px; font-size: 14.5px; border-radius: 10px; }
@media (max-width: 620px) { .imp-fields { grid-template-columns: 1fr 1fr; } .imp-fields .wide { grid-column: 1 / -1; } }
.progress { height: 12px; background: var(--cream-2); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal-dark)); width: 0; transition: width .25s; }

/* Redes */
.nets { display: flex; gap: 10px; flex-wrap: wrap; }
.net { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 700; user-select: none; }
.net input { display: none; }
.netlogo { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; color: #fff; flex: none; vertical-align: middle; }
.netlogo svg { width: 18px; height: 18px; }
.post .netlogo { width: 24px; height: 24px; border-radius: 7px; }
.post .netlogo svg { width: 14px; height: 14px; }
.net.on { border-color: var(--teal); background: var(--teal-soft); }
.net.off { opacity: .55; }
.netlogo.fb { background: #1877f2; }
.netlogo.ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.netlogo.tt { background: #111; }
.post { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post .im { width: 76px; height: 76px; border-radius: 14px; background: var(--cream-2) center/cover; border: 1px solid var(--line); }
.post .tx { font-size: 14px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.preview-phone { background: #fff; border-radius: 22px; border: 1px solid var(--line); overflow: hidden; max-width: 340px; margin: 0 auto; box-shadow: var(--shadow); }
.preview-phone .hd { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; font-size: 14px; }
.preview-phone .hd i { width: 30px; height: 30px; border-radius: 50%; background: var(--teal) url('img/icon-192.png') center/cover; display: block; }
.preview-phone .im { aspect-ratio: 1; background: #f4f4f4 center/cover; }
.preview-phone .tx { padding: 10px 12px 14px; font-size: 13.5px; white-space: pre-line; max-height: 220px; overflow: auto; }

/* Historial */
.act { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.act:last-child { border-bottom: 0; }
.act .when { width: 74px; flex: none; font-size: 12.5px; color: var(--muted); font-weight: 700; padding-top: 2px; }
.act .what { flex: 1; min-width: 0; }
.act.undone .what { text-decoration: line-through; color: var(--muted); }

/* Ajustes */
.setting { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .tx { flex: 1; }
.setting .tx b { display: block; }
.setting .tx span { font-size: 13.5px; color: var(--muted); }
.conn { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--cream); margin-bottom: 10px; }
.conn .st { margin-left: auto; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0 0 14px; }
.steps-list li { counter-increment: s; position: relative; padding: 4px 0 10px 40px; }
.steps-list li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 14px; }
details.adv summary { cursor: pointer; font-weight: 700; color: var(--brown-dark); padding: 6px 0; }
.tabs { display: flex; gap: 6px; background: var(--cream-2); padding: 5px; border-radius: 999px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { flex: 1; text-align: center; padding: 9px 14px; border-radius: 999px; font-weight: 700; text-decoration: none; color: var(--brown-dark); white-space: nowrap; border: 0; background: transparent; cursor: pointer; font-size: 14.5px; }
.tabs .on { background: var(--paper); box-shadow: var(--shadow); color: var(--ink); }

/* ---------- Ventanas ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(47, 34, 25, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--paper); width: 100%; max-width: 620px; max-height: 94vh; display: flex; flex-direction: column;
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); animation: up .2s ease;
}
.modal.wide { max-width: 860px; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.modal header { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.modal header h3 { flex: 1; font-size: 21px; }
.modal .body { padding: 6px 18px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal footer { display: flex; gap: 10px; padding: 12px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal footer .btn { flex: 1; }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 24px; max-height: 90vh; }
  .modal footer { padding-bottom: 14px; }
  .modal footer .btn { flex: 0 1 auto; }
  .modal footer .grow { flex: 1; }
}

#toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
@media (min-width: 960px) { #toasts { bottom: 24px; } }
.toast { background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 16px; font-weight: 600; box-shadow: var(--shadow-lg); animation: up .2s ease; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.ok { background: #2f6b45; }
.toast.err { background: var(--red); }
.toast button { margin-left: auto; background: rgba(255, 255, 255, .18); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; cursor: pointer; }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--brown) radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .08), transparent 40%); }
.auth .card { width: 100%; max-width: 410px; padding: 28px 24px; text-align: center; }
.auth .logo { width: 230px; margin: 0 auto 10px; }
.auth form { text-align: left; margin-top: 18px; }
.auth h1 { font-size: 26px; margin-bottom: 6px; }
.codein { text-align: center; font-size: 30px !important; letter-spacing: .3em; font-family: var(--font-title); }
.qr { width: 210px; margin: 12px auto; background: #fff; padding: 8px; border-radius: 12px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: auto; display: block; }

/* ---------- Impresión (hoja del pedido) ---------- */
@media print {
  body { background: #fff; }
  .topbar, .sidenav, .bottomnav, #toasts, .modal header .btn, .modal footer, .no-print { display: none !important; }
  .overlay { position: static; background: none; display: block; backdrop-filter: none; }
  .modal { box-shadow: none; max-height: none; border-radius: 0; max-width: none; }
  .modal .body { overflow: visible; }
  body.printing main.view { display: none; }
}
