/* Inventario Ecofil — paleta de marca */
:root {
  --choco: #322E2C;
  --olive: #71874D;
  --lemon: #ADC064;
  --brown: #B2A88F;
  --bg: #F6F5F1;
  --card: #FFFFFF;
  --line: #E4E1D8;
  --danger: #B4482F;
  --warn: #C99A2E;
  --info: #4E7A9B;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, sans-serif;
  background: var(--bg);
  color: var(--choco);
  font-size: 15px;
}
a { color: var(--olive); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
  background: var(--choco);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 22px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; }
.brand img { height: 30px; }
.brand span { color: var(--lemon); letter-spacing: .5px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: #E9E7E1; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav a.act { background: var(--olive); color: #fff; }
.userbox { display: flex; align-items: center; gap: 10px; }
.uname { font-size: 13px; }
.uname small { color: var(--brown); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 18px 60px; }
.footer { text-align: center; color: var(--brown); font-size: 12.5px; padding: 18px; }

h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 700; margin: 24px 0 10px; }
.sub { color: #7a756e; margin: 0 0 20px; font-size: 14px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* Cards y grillas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { text-align: center; }
.stat .num { font-size: 30px; font-weight: 800; color: var(--olive); }
.stat .lbl { font-size: 13px; color: #7a756e; }
.stat.alerta .num { color: var(--danger); }

/* Tablas */
.tabla { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tabla th { background: var(--choco); color: #fff; text-align: left; padding: 10px 12px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.tabla td { padding: 10px 12px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.tabla tr:hover td { background: #FBFAF6; }
.tabla-scroll { overflow-x: auto; }

/* Badges de estado */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-operativo { background: #E7EED9; color: #4C6030; }
.badge-mantenimiento { background: #F5E9CB; color: #8A6A1D; }
.badge-danado { background: #F4DBD3; color: #8C3A26; }
.badge-prestado { background: #DCE8F0; color: #35566E; }
.badge-baja { background: #E5E3DE; color: #6E6A64; }
.badge-abierto { background: #F4DBD3; color: #8C3A26; }
.badge-en_proceso { background: #F5E9CB; color: #8A6A1D; }
.badge-resuelto { background: #E7EED9; color: #4C6030; }
.badge-vencida { background: var(--danger); color: #fff; }
.badge-proxima { background: #F5E9CB; color: #8A6A1D; }

/* Botones */
.btn {
  display: inline-block; background: var(--olive); color: #fff; border: none;
  padding: 9px 18px; border-radius: 8px; font-weight: 700; font-size: 14px;
  cursor: pointer; font-family: inherit;
}
.btn:hover { background: #5F7440; text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-outline { background: transparent; border: 1.5px solid var(--brown); color: inherit; }
.btn-outline:hover { background: rgba(178,168,143,.15); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #93381F; }
.btn-lemon { background: var(--lemon); color: var(--choco); }
.btn-lemon:hover { background: #97AC4F; }

/* Formularios */
form.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
label.campo { display: block; font-size: 12.5px; font-weight: 700; color: #6E6A64; margin-bottom: 12px; }
label.campo span { display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--choco);
}
form.filtros input, form.filtros select { width: auto; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--olive); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.flash-ok { background: #E7EED9; color: #4C6030; }
.flash-error { background: #F4DBD3; color: #8C3A26; }

/* Ficha pública */
.ficha { max-width: 480px; margin: 30px auto; }
.ficha .foto { width: 100%; max-height: 260px; object-fit: contain; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.ficha dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 16px 0; }
.ficha dt { font-weight: 700; color: #6E6A64; font-size: 13px; }
.ficha dd { margin: 0; font-size: 14px; }

/* Login */
.login-box { max-width: 380px; margin: 60px auto; }
.login-box .brand-big { text-align: center; margin-bottom: 18px; }
.login-box .brand-big img { height: 44px; }

/* Etiquetas QR imprimibles */
.hoja-etiquetas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.etiqueta {
  border: 1.5px dashed var(--brown); border-radius: 8px; padding: 10px;
  text-align: center; background: #fff; page-break-inside: avoid;
}
.etiqueta .qr { display: flex; justify-content: center; margin-bottom: 6px; }
.etiqueta .cod { font-weight: 800; font-size: 13px; }
.etiqueta .mod { font-size: 11px; color: #6E6A64; }
@media print {
  .topbar, .footer, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
}

/* Detalle activo */
.detalle-head { display: flex; gap: 20px; flex-wrap: wrap; }
.detalle-head .foto { width: 200px; height: 160px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.muted { color: #7a756e; font-size: 13px; }

@media (max-width: 640px) {
  .hoja-etiquetas { grid-template-columns: repeat(2, 1fr); }
  .ficha dl { grid-template-columns: 110px 1fr; }
}
