/* ============================================================
   Vendi — by OnlyFunPeople Studios
   Identidad "laboratorio de ideas":
   Experimentamos. Aprendemos. Creamos. / Curiosity builds everything.
   Paleta OnlyFunPeople: #0D0D0D #F2F2F0 #33C7B3 #222222 #4B4B4B
   Acentos: #FFD166 #FF6B6B #6EC6FF #B07CFF #A7F070
   ============================================================ */
:root {
  --bg: #0D0D0D;
  --bg-2: #161616;
  --card: #222222;
  --card-2: #1B1B1B;
  --txt: #F2F2F0;
  --muted: #9a9a94;
  --a: #33C7B3;
  --a-strong: #4CD6C4;
  --a-soft: rgba(51, 199, 179, 0.13);
  --a-soft-2: rgba(51, 199, 179, 0.24);
  --line: #2e2e2e;
  --ring: rgba(51, 199, 179, 0.5);
  --good: #A7F070;
  --warn: #FFD166;
  --bad: #FF6B6B;
  --info: #6EC6FF;
  --playful: #FF9F6A;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.4), 0 14px 40px rgba(0, 0, 0, 0.6);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--txt);
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  background-image: radial-gradient(1100px 520px at 15% -10%, rgba(51, 199, 179, 0.09), transparent),
                    radial-gradient(900px 520px at 110% 0%, rgba(110, 198, 255, 0.06), transparent);
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

a { color: var(--a-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Aplicación ---- */
.app { display: flex; min-height: 100vh; }

/* ---- Marca ---- */
.brand-login { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; justify-content: flex-start; }
.brand-logo { flex: 0 0 auto; }
.brand-title { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; color: var(--txt); line-height: 1; }
.brand-title span { color: var(--a-strong); }
.brand-sub-login { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.2px; }
.brand-side { margin: 0 4px 20px; }
.brand-side .brand-title { font-size: 24px; }

/* ---- Sidebar ---- */
.side {
  width: 250px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow: auto; }
.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  border-radius: 11px;
  margin: 1px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background 0.15s, color 0.15s;
}
.nav button .nav-ic { display: inline-flex; color: var(--muted); flex: 0 0 auto; }
.nav button .nav-ic svg { display: block; }
.nav button:hover { background: var(--a-soft); color: var(--txt); }
.nav button:hover .nav-ic { color: var(--a-strong); }
.nav button.active { background: var(--a-soft); color: var(--a-strong); font-weight: 700; border-radius: 11px; }
.nav button.active .nav-ic { color: var(--a-strong); }

.side-foot { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.nav-logout {
  width: 100%; border: 0; background: transparent; text-align: left;
  padding: 9px 12px; border-radius: 10px; font-size: 13.5px; color: var(--muted);
  display: flex; align-items: center; gap: 10px; font-weight: 500;
}
.nav-logout:hover { background: rgba(248, 113, 113, 0.1); color: var(--bad); }

/* ---- Main ---- */
.main { flex: 1; display: flex; justify-content: center; }
.main .scroll { width: 100%; max-width: 1180px; padding: 30px 32px 60px; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 26px; letter-spacing: -0.4px; color: var(--txt); }
.subtitle { margin: 3px 0 0; color: var(--muted); font-size: 14px; font-weight: 500; }

/* ---- Botones ---- */
.btn {
  border: 0; border-radius: 11px; padding: 10px 16px;
  background: var(--a-soft); color: var(--a-strong); font-weight: 600;
  touch-action: manipulation;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn svg { display: block; }
.btn.primary { background: linear-gradient(135deg, #33C7B3, #27a697); color: #0D0D0D; box-shadow: 0 6px 20px rgba(51, 199, 179, 0.30); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.secondary { background: #2a2a2a; color: var(--txt); }
.btn.secondary:hover { background: #343434; }
.btn.danger { background: rgba(248, 113, 113, 0.12); color: var(--bad); }
.btn.danger:hover { background: rgba(248, 113, 113, 0.22); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Tarjetas y cuadrículas ---- */
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.metric-card { display: flex; flex-direction: column; transition: box-shadow 0.15s, transform 0.1s; }
.metric-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.metric { font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: -0.5px; word-break: break-word; color: var(--txt); }
.metric-hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; font-weight: 500; }

.panel { margin-top: 20px; }
.panel h2 { font-size: 17px; margin: 0 0 14px; letter-spacing: -0.2px; }
.panel.card h2 { font-size: 17px; margin: 0 0 14px; }

/* ---- Toolbar ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input { max-width: 360px; }
.toolbar input, .toolbar select,
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px;
  background: var(--card-2); width: 100%; color: var(--txt);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.toolbar input:focus, .toolbar select:focus, .field input:focus, .field select:focus,
.field textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--a-soft-2); }
.toolbar input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #6c6480; }

/* ---- Tablas ---- */
.tablewrap { overflow: auto; max-height: 70vh; }
.tablewrap.tall { max-height: none; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th, .table td { padding: 12px 11px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13.5px; vertical-align: top; color: var(--txt); }
.table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(51, 199, 179, 0.06); }
.table td b { color: var(--txt); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.paid { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.pending { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.partial { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.delivered { background: var(--a-soft); color: var(--a-strong); }
.progress { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.ready { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.cancel { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.received { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.catalog { background: var(--a-soft); color: var(--a-strong); font-size: 10.5px; }

.empty { text-align: center; color: var(--muted); padding: 30px 16px; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(8, 6, 14, 0.7); display: none; align-items: center; justify-content: center; padding: 18px; z-index: 9; }
.modal.show { display: flex; }
.modalbox { background: var(--card-2); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: min(800px, 96vw); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.modalbox-sm { width: min(560px, 96vw); }
.mhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
.mhead h2 { margin: 0; font-size: 20px; letter-spacing: -0.3px; color: var(--txt); }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.full { grid-column: 1 / -1; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---- Login ---- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 18px; }
.loginbox { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 34px; width: min(400px, 92vw); text-align: center; box-shadow: var(--shadow-hover); }
.loginbox .brand-login { margin-bottom: 16px; }
.loginbox h2 { margin: 10px 0; }
.loginbox input { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; margin: 9px 0; background: var(--card-2); color: var(--txt); }
.loginbox input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--a-soft-2); }
.error { color: var(--bad); min-height: 20px; font-size: 13px; }

.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--card-2); color: var(--txt); border: 1px solid var(--line); border-radius: 11px;
  padding: 12px; font-weight: 600; margin: 14px 0 0; touch-action: manipulation;
}
.btn-google:hover { background: #2a2a2a; }
.divider {
  display: flex; align-items: center; gap: 10px; color: var(--muted);
  font-size: 12px; text-transform: uppercase; margin: 16px 0 6px; letter-spacing: 0.3px;
  font-weight: 600;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.note-oauth { font-size: 12px; }

/* ---- Pagos ---- */
.paylist .payrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.payrow .grow { flex: 1; min-width: 200px; }
.summary-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.summary-line strong { font-size: 16px; }

/* ---- Items del pedido ---- */
#items-wrap { margin-top: 6px; }
.item-line { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.item-info { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.item-nums { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 13.5px; }
.item-nums b { color: var(--txt); }
.order-total { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 4px 2px; margin-top: 8px; border-top: 1px solid var(--line); font-weight: 600; }
.order-total strong { font-size: 19px; color: var(--a-strong); }

.check { display: flex !important; align-items: center; gap: 8px; font-weight: 600 !important; text-transform: none !important; letter-spacing: 0 !important; }
.check input { width: auto; }

/* ---- Calendario ---- */
.day-block { margin-bottom: 14px; }
.day-label { font-weight: 700; color: var(--a-strong); margin-bottom: 8px; font-size: 14px; }
.day-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--card); }
.day-item .label { text-transform: none; }

/* ---- Footer ---- */
.app-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 26px 0 6px; border-top: 1px solid var(--line); margin-top: 34px; letter-spacing: 0.2px; }

.note { background: var(--a-soft); border: 1px dashed var(--line); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--muted); margin-top: 12px; }

/* ---- Responsive ---- */
@media (max-width: 1020px) {
  .grid.cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .side { width: 78px; padding: 20px 10px; }
  .side .brand-sub-login { display: none; }
  .side .brand-logo { width: 34px; height: 34px; }
  .brand-side { flex-direction: column; gap: 2px; }
  .nav button { justify-content: center; padding: 12px; }
  .nav button .nav-txt { display: none; }
  .nav-logout { justify-content: center; }
  .nav-logout .nav-txt { display: none; }
  .side-foot { text-align: center; }
}

@media (max-width: 640px) {
  .app { display: block; }
  .side {
    position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: auto;
    padding: 8px 6px; z-index: 8; border-right: 0;
    border-top: 1px solid var(--line); flex-direction: row; align-items: center;
  }
  .brand-side { display: none; }
  .nav {
    display: flex; flex-direction: row; justify-content: space-around;
    overflow-x: auto; width: 100%;
  }
  .nav button { margin: 0; padding: 10px 8px; font-size: 0; flex-direction: column; gap: 3px; border-radius: 10px; }
  .nav button .nav-ic { color: var(--muted); }
  .nav button .nav-txt { display: block; font-size: 9.5px; font-weight: 600; }
  .nav button.active .nav-txt { color: var(--a-strong); }
  .side-foot { display: none; }
  .main .scroll { padding: 20px 16px 96px; }
  .grid.cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .form { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .modalbox { padding: 18px; }
  .table { min-width: 0; }
  .pagehead { align-items: flex-start; flex-direction: column; }
  .pagehead .btn { width: 100%; justify-content: center; }
}
