/* ============== MOUPY DECÓ — Sistema visual ============== */
:root {
  /* Paleta tomada del logo */
  --greige:         #6F6C6A;
  --greige-soft:    #8A8784;
  --terracota:      #C2876B;
  --terracota-deep: #A86E54;
  --arena:          #DCC8B3;
  --taupe:          #927063;
  --caramelo:       #B6884E;
  --crema:          #F4EEE6;
  --crema-warm:     #EFE6D8;
  --paper:          #FBF7F1;
  --ink:            #2A2624;
  --ink-soft:       #4A4441;
  --line:           rgba(42, 38, 36, .12);
  --line-soft:      rgba(42, 38, 36, .06);
  --pos:            #6e8f6a;   /* verde tierra (saldos +) */
  --pos-bg:         rgba(110, 143, 106, .08);
  --neg:            #b56b5a;   /* rojo tierra (saldos −) */
  --neg-bg:         rgba(181, 107, 90, .08);

  --serif: 'Cormorant', 'Times New Roman', serif;
  --sans:  'Outfit', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  --radius: 0;          /* el mock no usa border-radius en cards */
  --radius-pill: 999px;

  --shadow-soft: 0 1px 2px rgba(42, 38, 36, .04);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.error { color: var(--neg); min-height: 1.2em; font-size: 13px; }

/* === MICRO TYPE === */
.eyebrow, .mono {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* === BRAND WORDMARK === */
.brand-wm { display: flex; align-items: center; gap: 12px; line-height: 1; }
.brand-wm .mark { width: 30px; height: 38px; flex: 0 0 auto; }
.brand-wm .wm { display: flex; flex-direction: column; gap: 2px; }
.brand-wm .wm .top { font-weight: 200; letter-spacing: .32em; font-size: 12px; }
.brand-wm .wm .bot { font-weight: 700; letter-spacing: .18em; font-size: 13px; }

/* === LOGIN === */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.login-card {
  background: var(--paper);
  padding: 48px 40px;
  border: 1px solid var(--line);
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-card .brand-wm { justify-content: center; margin-bottom: 8px; }
.login-card h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -.015em;
  margin: 12px 0 4px;
  text-align: center;
}
.login-card h1 em { font-style: italic; color: var(--terracota-deep); }
.login-card .sub { text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 16px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.login-card input {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 300;
  color: var(--ink);
  outline: none;
  transition: border-color .2s;
}
.login-card input:focus { border-color: var(--ink); }

/* === APP SHELL === */
.app { min-height: 100vh; background: var(--paper); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 32px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs button {
  background: transparent;
  border: none;
  padding: 8px 14px 10px;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--terracota-deep); }
.tabs button.active { color: var(--ink); border-color: var(--terracota); }
.user-box { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); }
.view { padding: 32px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 700px) {
  .topbar { padding: 10px 14px; }
  .view { padding: 16px; }
}

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 22px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--crema); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--terracota-deep); border-color: var(--terracota-deep); }
.btn.terra { background: var(--terracota); color: #fff; border-color: var(--terracota); }
.btn.terra:hover { background: var(--terracota-deep); border-color: var(--terracota-deep); }
.btn.ghost { border: none; border-bottom: 1px solid var(--ink); padding: 6px 0; }
.btn.ghost:hover { background: transparent; color: var(--terracota-deep); border-color: var(--terracota-deep); }
.btn.danger { color: var(--neg); border-color: var(--neg); }
.btn.danger:hover { background: var(--neg); color: var(--paper); }
.btn.small { padding: 7px 12px; font-size: 10.5px; letter-spacing: .14em; }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(3px); }

/* === CARDS === */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 24px;
  margin-bottom: 24px;
}
.card > h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -.01em;
  margin: 0 0 18px;
}
.card > h2 em { font-style: italic; color: var(--terracota-deep); }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 20px; margin: 0 0 12px; letter-spacing: -.005em; }

/* === ROWS / FIELDS === */
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 160px; }
.row.tight > * { min-width: auto; flex: 0; }
label.field { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
label.field input, label.field select, label.field textarea {
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  outline: none;
  transition: border-color .15s;
}
label.field input:focus, label.field select:focus, label.field textarea:focus { border-color: var(--ink); }
label.field input[type=number] { font-variant-numeric: tabular-nums; }

/* === TABLES === */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
}
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  font-weight: 300;
  vertical-align: top;
}
th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--crema); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }

/* === TAGS / BADGES === */
.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tag.green { color: var(--pos); border-color: var(--pos); background: var(--pos-bg); }
.tag.red { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }
.tag.yellow { color: var(--caramelo); border-color: var(--caramelo); background: rgba(182, 136, 78, .08); }

/* === CATÁLOGO INTERNO (vista en app privada) === */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 32px 24px;
}
.cat-item { background: var(--paper); display: flex; flex-direction: column; gap: 12px; }
.cat-item .img {
  aspect-ratio: 4/5;
  background: var(--arena) center/cover no-repeat;
  position: relative;
}
.cat-item .body { display: flex; flex-direction: column; gap: 8px; }
.cat-item .cat-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.cat-item h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.1; margin: 0; letter-spacing: -.005em; }
.cat-item h3 em { font-style: italic; color: var(--terracota-deep); }
.cat-item .desc { font-size: 13px; color: var(--ink-soft); margin: 0; }
.cat-item .var-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.cat-item .var-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; padding: 4px 0; border-top: 1px solid var(--line-soft); }
.cat-item .var-line:first-child { border-top: none; }
.cat-item .var-line .precio { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }

/* === CUENTAS === */
.cuenta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.cuenta-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px;
  cursor: pointer;
  transition: border-color .2s, transform .15s;
}
.cuenta-card:hover { border-color: var(--terracota); }
.cuenta-card .nombre {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.cuenta-card .saldo {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.cuenta-card .saldo.pos { color: var(--pos); }
.cuenta-card .saldo.neg { color: var(--neg); }
.cuenta-card.active { border-color: var(--ink); background: var(--crema); }

/* === MODAL === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(42, 38, 36, .35);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 24px;
}
.modal {
  background: var(--paper);
  padding: 32px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
}
.modal h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 0 0 18px;
}
.modal h2 em { font-style: italic; color: var(--terracota-deep); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* === ITEM LINES (form de compra/venta) === */
.item-line {
  display: grid;
  grid-template-columns: 1fr 100px 130px 130px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-soft);
}
.item-line.with-desc { grid-template-columns: 1fr 90px 110px 110px 110px auto; }
.item-line .btn { padding: 10px; }

.totals { background: var(--crema); padding: 16px 20px; margin: 18px 0; border: 1px solid var(--line); }
.totals .line { display: flex; justify-content: space-between; padding: 4px 0; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.totals .line.total {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 6px;
}
.totals .line.total span:last-child { font-family: var(--mono); font-style: normal; font-weight: 500; }

/* === TOAST === */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ink); color: var(--paper);
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  z-index: 200;
  animation: slideup .25s ease;
}
.toast.error { background: var(--neg); }
.toast.success { background: var(--pos); }
@keyframes slideup { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* === PHOTO PREVIEW === */
.photo-preview {
  width: 120px; height: 150px;
  object-fit: cover;
  background: var(--arena);
  display: block;
  border: 1px solid var(--line);
}

.empty { padding: 80px 20px; text-align: center; color: var(--ink-soft); }
.empty h2 { font-family: var(--serif); font-weight: 300; font-size: 38px; color: var(--ink); margin: 0 0 12px; }
.empty h2 em { font-style: italic; color: var(--terracota-deep); }

/* === MOBILE === */
@media (max-width: 700px) {
  .tabs button { padding: 6px 8px; font-size: 12px; letter-spacing: .04em; }
  .item-line, .item-line.with-desc { grid-template-columns: 1fr 1fr; }
  th, td { padding: 9px 8px; font-size: 12px; }
  .modal { padding: 22px; }
  .login-card { padding: 32px 24px; }
  .login-card h1 { font-size: 36px; }
  .card { padding: 18px; }
}
