/* PerfilSoft — Shared Design System
   Extracted from all module pages to eliminate ~2500 lines of duplication.
   Every CRUD page imports this + keeps only page-specific overrides. */

:root {
  --ink: #3d2c1e; --ink-2: #5c3a07;
  --ink-soft: #8b7355; --ink-soft-2: #a68a6b; --ink-soft-3: #c9a882;
  --line: #e6d5c3; --line-2: #d4c4b0;
  --bg: #ffffff; --bg-soft: #fdf8f3; --bg-cream: #f5ebe0;
  --green: #8b5a0b; --green-dk: #5c3a07; --green-soft: #f5ebe0;
  --orange: #b8860b; --orange-soft: #fef7ed;
  --red: #dc2626; --red-soft: #fef2f2;
  --yellow: #b8860b; --yellow-soft: #fef7ed;
  --copper: #b8860b; --copper-dk: #8b5a0b; --copper-soft: #fef7ed;
  --sh-1: 0 1px 2px rgba(61,44,30,.04);
  --sh-2: 0 4px 16px rgba(61,44,30,.06), 0 1px 3px rgba(61,44,30,.04);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink); background: var(--bg-soft);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* === LAYOUT === */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
@media (max-width: 980px) { .app { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* === SIDEBAR === */
.sidebar {
  background: var(--bg); border-right: 1px solid var(--line);
  padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sb-logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 16px; letter-spacing: -.025em;
  padding: 4px 8px 18px; border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.mark {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, #8b5a0b 0%, #b8860b 100%);
  border-radius: 6px; position: relative;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 2px 6px rgba(139,90,11,.25);
}
.mark::before, .mark::after { content: ''; position: absolute; background: rgba(255,255,255,.85); }
.mark::before { left: 50%; top: 4px; bottom: 4px; width: 1.5px; transform: translateX(-.75px); }
.mark::after { top: 50%; left: 4px; right: 4px; height: 1.5px; transform: translateY(-.75px); }
.sb-sec {
  font-size: 10.5px; font-weight: 700; color: var(--ink-soft-3);
  text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px;
}
.ni {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; font-size: 13.5px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; transition: all 120ms; position: relative;
}
.ni:hover { background: var(--bg-soft); color: var(--ink); }
.ni.active { background: var(--green-soft); color: var(--green); font-weight: 600; }
.ni.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; background: var(--green); border-radius: 0 3px 3px 0;
}
.ni.locked { opacity: .55; cursor: not-allowed; }
.ni svg { width: 18px; height: 18px; flex-shrink: 0; }
.ni-bg { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 100px; }
.ni-bg.count { background: var(--orange); color: white; }
.ni-bg.pro { background: var(--yellow-soft); color: #78350f; }
.sb-user {
  margin-top: auto; padding: 14px 8px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #8b5a0b, #b8860b);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

/* === MAIN === */
main { padding: 24px 32px 80px; max-width: 1200px; }
@media (max-width: 700px) { main { padding: 16px; } }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.brc { font-size: 13px; color: var(--ink-soft-3); }
.brc b { color: var(--ink); font-weight: 600; }
h1.page-title { font-size: 28px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 4px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 24px; }

/* === TOOLBAR === */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-input {
  flex: 1; max-width: 360px; background: var(--bg); border: 1.5px solid var(--line);
  border-radius: 9px; padding: 10px 12px 10px 36px; font-size: 14px; outline: none; font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23475569' stroke-width='2'><circle cx='7' cy='7' r='4.5'/><path d='M11 11l3 3'/></svg>");
  background-repeat: no-repeat; background-position: 12px center;
}
.search-input:focus { border-color: var(--green); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 9px; font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer; transition: all 150ms; font-family: inherit;
}
.btn-green { background: var(--green); color: white; box-shadow: 0 4px 14px rgba(31,41,55,.22); }
.btn-green:hover { background: var(--green-dk); transform: translateY(-1px); }
.btn-p { background: var(--ink); color: white; }
.btn-p:hover { background: var(--ink-2); }
.btn-g { background: var(--bg); color: var(--ink); border-color: var(--line-2); }
.btn-g:hover { background: var(--bg-soft); }
.btn svg { width: 14px; height: 14px; }
.btn-icon { padding: 7px 10px; font-size: 12.5px; }
.btn-icon.danger:hover { background: var(--red-soft); color: var(--red); border-color: #fecaca; }

/* === CARD / TABLE === */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--sh-1); }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--ink-soft-2);
  text-transform: uppercase; letter-spacing: .04em; padding: 14px 16px;
  background: var(--bg-soft); border-bottom: 1px solid var(--line);
}
thead th.right { text-align: right; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-soft); }
td.right { text-align: right; }

/* === BADGES === */
.badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.badge.pend { background: var(--yellow-soft); color: #78350f; }
.badge.prog { background: #dbeafe; color: #1e40af; }
.badge.done { background: #dcfce7; color: #166534; }
.badge.activo { background: #dcfce7; color: #166534; }
.badge.inactivo { background: var(--red-soft); color: #dc2626; }

/* === EMPTY STATE === */
.empty { padding: 80px 30px; text-align: center; }
.empty svg { width: 56px; height: 56px; color: var(--ink-soft-3); margin-bottom: 16px; }
.empty h3 { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 14px; color: var(--ink-soft); margin-bottom: 18px; max-width: 360px; margin-left: auto; margin-right: auto; }

/* === MODAL === */
.modal-bg {
  position: fixed; inset: 0; background: rgba(10,14,26,.55); z-index: 500;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--bg); width: 100%; max-width: 580px; max-height: calc(100vh - 40px);
  border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.modal-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.modal-h h3 { font-size: 15.5px; font-weight: 700; }
.modal-h .close {
  width: 32px; height: 32px; border-radius: 7px; background: transparent;
  border: 1px solid var(--line); cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--ink-soft);
}
.modal-h .close:hover { background: var(--bg-soft); color: var(--ink); }
.modal-h .close svg { width: 13px; height: 13px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end; background: var(--bg-soft);
}

/* === FORM === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fld label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.fld label .req { color: var(--orange); margin-left: 2px; }
.fld input, .fld select, .fld textarea {
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font-size: 13.5px; font-family: inherit; color: var(--ink);
  outline: none; width: 100%;
}
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--green); }
.fld textarea { resize: vertical; min-height: 60px; }
.fld .help { font-size: 11.5px; color: var(--ink-soft-3); }

/* === TOAST === */
.toast {
  position: fixed; bottom: 28px; right: 28px; background: var(--green); color: white;
  padding: 14px 20px; border-radius: 11px; font-weight: 600; font-size: 14px;
  box-shadow: 0 12px 32px rgba(31,41,55,.35); display: flex; align-items: center; gap: 10px;
  opacity: 0; transform: translateY(20px); transition: all 240ms cubic-bezier(.2,.8,.2,1);
  pointer-events: none; z-index: 2000;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: var(--red); }
.toast svg { width: 18px; height: 18px; }

/* === INVENTORY SPECIFIC === */
.stock-low { color: #dc2626; font-weight: 700; }
.stock-ok { color: #166534; font-weight: 600; }
