:root{
  --bg:#121212;
  --panel:#1b1b1b;
  --text:#f5f5f5;
  --muted:#bdbdbd;
  --accent:#ffcc00;
  --accent-hover:#e6b800;
  --border:#2a2a2a;
}

*{ box-sizing: border-box; }

body{
  margin:0;
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.topbar{
  display:flex;
  align-items:center;
  gap:12px;
  padding:16px 20px;
  border-bottom:1px solid var(--border);
}

h1{
  font-size:1.2rem;
  margin:0;
  color:var(--accent);
}

.badge{
  display:inline-block;
  font-size:0.75rem;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#222;
}
.badge-demo{
  color:#111;
  background:var(--accent);
  border-color:transparent;
}
.badge-state{
  min-width:120px;
  text-align:center;
}
.badge-state-ok{
  background:#1f3021;
  border-color:#2f7b32;
  color:#b8f2bb;
}
.badge-state-warn{
  background:#311f1f;
  border-color:#7b2f2f;
  color:#f2b8b8;
}

.container{
  max-width:980px;
  margin:0 auto;
  padding:20px;
}

.panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:20px;
  margin-bottom:16px;
  box-shadow: 0 6px 18px rgba(0,0,0,.2);
}

.peso{
  font-size:4rem;
  font-weight:800;
  letter-spacing:1px;
  margin:8px 0 0 0;
}

.estado{
  font-size:1.1rem;
  margin-top:8px;
}

.acciones{
  margin-top:18px;
}

.form-guardar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  margin-bottom:10px;
}

input[type="text"], select, input[type="password"], input[type="number"]{
  padding:10px 12px;
  font-size:1rem;
  border-radius:8px;
  border:1px solid var(--border);
  background:#101010;
  color:var(--text);
  min-width:220px;
}

.login-input{
  background-color:#101010 !important;
  color:var(--text) !important;
  width:100%;
  height:44px;
  line-height:44px;
  padding:0 12px;
  box-sizing:border-box;
  border-radius:10px !important;
  border:1px solid var(--border) !important;
  box-shadow:none !important;
  background-clip: padding-box;
  caret-color: var(--text);
  font-size:1rem;
}

.login-title{
  margin:0 0 12px 0;
  text-align:center;
}

.login-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 12px;
}

.login-table td{
  border:none;
  padding:0;
}

.login-label{
  width:90px;
  text-align:left;
  color:var(--text);
  font-weight:600;
  padding-right:12px;
  white-space:nowrap;
}

.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus{
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0px 1000px #101010 inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

.login-input:-moz-autofill{
  box-shadow: 0 0 0px 1000px #101010 inset !important;
  -moz-text-fill-color: var(--text);
}

.login-input:autofill{
  box-shadow: 0 0 0px 1000px #101010 inset !important;
}

.login-input:focus{
  outline:none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(255,204,0,0.2) !important;
}

button{
  padding:10px 16px;
  font-size:1rem;
  background-color: var(--accent);
  color:#111;
  border:none;
  border-radius:10px;
  cursor:pointer;
  transition: transform .05s ease, background .15s ease;
}
button:hover{
  background-color: var(--accent-hover);
}
button:active{
  transform: translateY(1px);
}

.alert{
  margin-top:12px;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid #7b2f2f;
  background:#311f1f;
  color:#f2b8b8;
  font-weight:600;
  display:block;
}
.alert[hidden]{
  display:none;
}
.alert-warn{
  border-color:#7b2f2f;
}

.buttons-row{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  margin-top:8px;
}

.topbar{
  display:flex;
  align-items:center;
  gap:12px;
}

.topbar-left{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}

.topbar-center{
  flex:1 1 auto;
  display:flex;
  justify-content:center;
  align-items:center;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
}

.topbar-logo{
  max-height:36px;
  width:auto;
  opacity:0.7;
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.4));
}

@media (max-width: 720px){
  .topbar-logo{
    max-height:28px;
  }
}

.table-wrap{
  width:100%;
  overflow:auto;
  border-radius:10px;
  border:1px solid var(--border);
}

.table-wrap--modal{
  overflow:visible;
}

.detalle-table{
  min-width:100%;
}

table{
  width:100%;
  border-collapse: collapse;
}

th, td{
  padding:10px;
  border-bottom:1px solid var(--border);
  text-align:center;
}

.th-actions,
.td-actions{
  text-align:right;
  width:180px;
}

.actions-inline{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}
.detalle-table .actions-cell{
  white-space:nowrap;
  gap:8px;
}
th{
  background:#202020;
  position:sticky;
  top:0;
  z-index:1;
}
tr:nth-child(even) td{
  background:#161616;
}

.muted{
  color:var(--muted);
  text-align:center;
  margin:0;
  padding:8px 0;
}

/* ===== Modal ===== */
.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:1000;
}
.modal.open{ display:flex; }
.modal.modal-front{
  z-index:1200;
}
.modal__content{
  background:#1e1e1e;
  color:var(--text);
  border:1px solid var(--border);
  border-radius:14px;
  max-width:520px;
  width:100%;
  padding:20px;
  overflow:visible;
  box-shadow:0 10px 30px rgba(0,0,0,.6);
}
.modal__content h3{
  margin:0 0 8px 0;
  color:var(--accent);
}
.modal__actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:10px;
}

.modal-field-input{
  width:100%;
  min-width:0;
}

.modal-checkbox-field{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  margin-top:12px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#101010;
  color:var(--text);
  font-size:1rem;
  font-weight:600;
  cursor:pointer;
}

.modal-checkbox-field:focus-within{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(255,204,0,0.2);
}

.modal-checkbox-input{
  width:20px;
  height:20px;
  margin:0;
  accent-color:var(--accent);
  cursor:pointer;
  flex:0 0 auto;
}

.hint{
  color:var(--muted);
  margin-top:6px;
}

.suggest-wrapper{
  position:relative;
  display:flex;
  flex-direction:column;
  min-width:220px;
  flex:1 1 220px;
}

.suggestions{
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  right:0;
  background:#1f1f1f;
  border:1px solid var(--border);
  border-radius:10px;
  box-shadow:0 10px 24px rgba(0,0,0,.35);
  max-height:220px;
  overflow:auto;
  display:none;
  z-index:1200;
}
.suggestions.open{ display:block; }
.suggestions button{
  width:100%;
  text-align:left;
  padding:8px 12px;
  background:transparent;
  border:none;
  color:var(--text);
  cursor:pointer;
  font-size:0.95rem;
}
.suggestions button:hover,
.suggestions button:focus,
.suggestions button.active{
  background:#262626;
  outline:none;
}

.product-pick-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin:14px 0;
}
.product-pick-btn{
  width:100%;
  text-align:left;
  padding:12px 14px;
  background:#2a2a2a;
  border:1px solid var(--border);
  border-radius:10px;
  color:var(--text);
  cursor:pointer;
  font-size:0.95rem;
  line-height:1.35;
}
.product-pick-btn:hover,
.product-pick-btn:focus{
  border-color:var(--accent);
  background:#333;
}

@media (max-width: 600px){
  .peso{ font-size:2.7rem; }
}
