/* =========================================================
   Irú — Base compartida (sistema interno + futura web)
   Identidad: paleta del logo · Fraunces (títulos) + DM Sans (texto/interfaz)
   ========================================================= */

:root {
  /* Paleta de marca (LOGO IRÚ.pdf) */
  --salvia: #b1b291;
  --oliva: #898b5c;
  --crema: #feffe2;
  --terracota: #bf6c15;
  --arcilla: #894e10;
  --durazno: #ffd390;

  /* Derivados para que el texto se lea bien sobre crema */
  --oliva-700: #6e7046;
  --oliva-800: #555736;
  --salvia-50: #f3f3e8;
  --salvia-100: #e8e9d8;
  --durazno-50: #fff4e0;
  --terracota-50: #fbeee1;

  /* Estados (siempre acompañados de texto) */
  --verde: #4b7a36;
  --verde-50: #e8f0de;
  --ambar: #8a5a0b;
  --ambar-50: #fff1d6;
  --rojo: #a8412b;
  --rojo-50: #f8e6df;

  /* Neutros cálidos */
  --bg: #f8f7ee;
  --surface: #fffffa;
  --ink: #34342a;
  --ink-2: #57574a;
  --muted: #858470;
  --line: #e5e3d2;
  --line-2: #efeee2;

  /* Tipografía */
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;

  /* Forma */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(52, 52, 42, .05);
  --shadow: 0 6px 24px rgba(52, 52, 42, .07);
  --shadow-lg: 0 24px 60px rgba(52, 52, 42, .18);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 500; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--oliva); outline-offset: 2px; }

.display { font-family: var(--font-display); font-optical-sizing: auto; font-variation-settings: "SOFT" 100, "WONK" 0; }

/* Motivo de la marca: los cinco puntitos del logo */
.dots { display: inline-flex; align-items: center; gap: 4px; }
.dots i { display: block; border-radius: 50%; background: var(--salvia); }
.dots i:nth-child(1) { width: 4px; height: 4px; }
.dots i:nth-child(2) { width: 5px; height: 5px; }
.dots i:nth-child(3) { width: 7px; height: 7px; }
.dots i:nth-child(4) { width: 9px; height: 9px; }
.dots i:nth-child(5) { width: 11px; height: 11px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px;
  font-weight: 500; font-size: 14px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s, color .15s, transform .1s;
  background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--salvia); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--oliva-700); color: var(--crema); border-color: var(--oliva-700); }
.btn-primary:hover { background: var(--oliva-800); border-color: var(--oliva-800); }
.btn-accent { background: var(--terracota); color: #fff; border-color: var(--terracota); font-weight: 600; }
.btn-accent:hover { background: var(--arcilla); border-color: var(--arcilla); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--salvia-50); border-color: transparent; }
.btn-soft { background: var(--salvia-50); color: var(--oliva-800); border-color: transparent; }
.btn-soft:hover { background: var(--salvia-100); border-color: transparent; }
.btn-danger { color: var(--rojo); }
.btn-danger:hover { background: var(--rojo-50); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 15.5px; }
.btn-icon { width: 42px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn-block { width: 100%; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 84px; padding: 11px 14px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--oliva); box-shadow: 0 0 0 4px rgba(137, 139, 92, .16); }
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-group .input { padding-left: 28px; }
.input-group:not(:has(.prefix)) .input { padding-left: 14px; }
.input-group .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-group:has(.suffix) .input { padding-right: 32px; }

.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 42px; border-radius: 999px; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease);
}
.switch input:checked + .track { background: var(--oliva-700); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(137, 139, 92, .25); }

/* Selector de opciones en pastillas (medio de pago, categoría…) */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; cursor: pointer; color: var(--ink-2); transition: all .15s;
}
.pill:hover { border-color: var(--salvia); }
.pill.on { background: var(--oliva-700); border-color: var(--oliva-700); color: var(--crema); }

/* ---------- Badges de estado ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2);
}
.badge svg { width: 13px; height: 13px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-pagado { background: var(--verde-50); color: var(--verde); }
.b-por-vencer { background: var(--ambar-50); color: var(--ambar); }
.b-vencido { background: var(--rojo-50); color: var(--rojo); }
.b-pendiente { background: var(--salvia-50); color: var(--oliva-800); }
.b-baja { background: var(--line-2); color: var(--muted); }

/* Etiqueta de tipo de taller: punto de color + nombre (el color nunca va solo) */
.tag { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.tag::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--oliva)); flex: none; }

/* ---------- Chips de filtro ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; color: var(--ink-2); cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--salvia); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--crema); }
.chip .n { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.chip .sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.chip.toggle.on { background: var(--surface); color: var(--ink); border-color: var(--ink-2); }
.chip.toggle:not(.on) { opacity: .55; }
.chip.toggle:not(.on) .sw { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 20px 22px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h2 { font-family: var(--font-display); font-size: 19px; color: var(--oliva-800); }
.card-title small { color: var(--muted); font-size: 13px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(52, 52, 42, .38); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .18s var(--ease);
}
.modal {
  width: 100%; max-width: 540px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: rise .22s var(--ease);
}
.modal-lg { max-width: 780px; }
.modal-sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px 6px; }
.modal-head h3 { font-family: var(--font-display); font-size: 22px; color: var(--oliva-800); }
.modal-body { padding: 14px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 24px 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@media (max-width: 600px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 94dvh; }
  .modal-head { padding: 20px 18px 4px; }
  .modal-body { padding: 12px 18px; }
  .modal-foot { padding: 12px 18px 18px; }
  .modal-foot .btn { flex: 1; }
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px); justify-items: center; text-align: center;
}
.toast { background: var(--ink); color: var(--crema); padding: 11px 18px; border-radius: 99px; font-size: 14px; box-shadow: var(--shadow-lg); animation: rise .2s var(--ease); }
.toast.ok { background: var(--oliva-800); }
.toast.err { background: var(--rojo); color: #fff; }

/* ---------- Foto (placeholder con el logo) ---------- */
.ph { position: relative; background: var(--salvia-50); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ph::after { content: ""; width: 46%; aspect-ratio: 1; background: url("../img/logo.png") center / contain no-repeat; opacity: .55; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.ph:has(img)::after { display: none; }

/* Utilidades */
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--verde); }
.neg { color: var(--rojo); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px; }
.empty strong { display: block; color: var(--ink-2); font-family: var(--font-display); font-weight: 500; font-size: 17px; margin-bottom: 4px; }
.empty .dots { margin-bottom: 14px; }
