/* ARMERILLO V2 - UI (dark) */

:root{
  --bg:#0b0f16;
  --panel:#0f1722;
  --panel2:#0c121c;
  --text:#e6edf7;
  --muted:#a6b3c6;
  --line:rgba(255,255,255,.08);
  --primary:#2a78ff;
  --primary2:#1f63da;
  --btn:#1a2536;
  --btn2:#22324a;
  --danger:#7a1f2b;
  --danger2:#9a2a39;
  --ok:#1f6f4a;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background: radial-gradient(1100px 650px at 50% 15%, rgba(60,90,140,.18), transparent 60%),
              linear-gradient(180deg, var(--bg), #070a10 70%);
  color:var(--text);
}

a{color:inherit;text-decoration:none}
a:hover{text-decoration:underline}

.wrapper{
  display:flex;
  min-height:100vh;
}

/* SIDEBAR */
.sidebar{
  width:280px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-right:1px solid var(--line);
  padding:14px 12px;
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px 14px;
  border-bottom:1px solid var(--line);
  margin-bottom:12px;
}
.brand .logo{
  width:34px;height:34px;border-radius:10px;
  background: rgba(120,160,220,.20);
  border:1px solid rgba(120,160,220,.35);
}
.brand .brand-photo{
  width:34px;height:34px;border-radius:10px;
  object-fit:cover;
  border:1px solid rgba(120,160,220,.35);
  background: rgba(120,160,220,.12);
}
.brand .title{
  font-weight:800;
  letter-spacing:.4px;
  line-height:1.1;
}
.brand .subtitle{
  font-size:12px;color:var(--muted);
}

.nav{
  display:flex;
  flex-direction:column;
  gap:10px;
}

/* cada item: izquierda texto, derecha tags */
.nav a{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;

  width:100%;
  padding:12px 12px;
  border-radius:14px;

  background: rgba(255,255,255,.02);
  border:1px solid var(--line);
}

.nav a:hover{
  background: rgba(255,255,255,.04);
  text-decoration:none;
}

.nav a.active{
  background: rgba(42,120,255,.18);
  border-color: rgba(42,120,255,.38);
}

.nav .tag{
  flex:0 0 auto;
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  color:var(--muted);
  background: rgba(255,255,255,.03);
}

/* MAIN */
.main{
  flex:1;
  padding:18px 18px 28px;
  min-width:0;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius:14px;
  margin-bottom:14px;
}

.topbar .left{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}
.topbar .left .where{
  font-weight:700;
}
.topbar .left .hint{
  font-size:12px;
  color:var(--muted);
}

.topbar .right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.badge{
  display:inline-block;
  font-size:12px;
  padding:4px 10px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius:999px;
  color:var(--muted);
}

.card{
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius:16px;
  padding:14px;
  min-width:0;
}

/* Cards con poca info (más delgado) */
.card-slim{ padding:12px; }

/* Evita desbordes por zoom en grids */
.grid-2 > *, .grid-3 > *{ min-width:0; }

/* Tarjetas de métricas superiores */
.stat{ padding:12px; }

/* Tablas responsivas: no rompen el layout al hacer zoom */
.table{ table-layout:fixed; width:100%; }
.table th, .table td{ word-break:break-word; }

h1{margin:0 0 10px;font-size:26px}
.sub{color:var(--muted); margin:0 0 12px}

/* TOOLBAR */
.toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:10px 0 12px;
  flex-wrap:wrap;
}
.toolbar .actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* BUTTONS */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: var(--btn);
  cursor:pointer;
  text-decoration:none;
  white-space:nowrap;

  /* CLAVE: legible en móvil */
  color:#fff;
  -webkit-text-fill-color:#fff;
}
.btn:hover{background:var(--btn2); text-decoration:none}
.btn-primary{background:var(--primary); border-color:rgba(255,255,255,.10)}
.btn-primary:hover{background:var(--primary2)}
.btn-danger{background:var(--danger); border-color:rgba(255,255,255,.10)}
.btn-danger:hover{background:var(--danger2)}
.btn-muted{background:rgba(255,255,255,.04)}

.btn-sm{padding:6px 10px;border-radius:10px;font-size:12px;line-height:1.1;}

/* Users: botones de accion alineados y simetricos */
.actions-cell{width:260px;}
.btn-group{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.btn-group .btn,
.btn-group button.btn{
  min-width:92px;
  justify-content:center;
}
.btn-group form{margin:0;}

/* TABLE */
.table{
  width:100%;
  border-collapse:collapse;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--line);
}
.table th,.table td{
  padding:12px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:middle;
}
.table th{
  color:var(--muted);
  font-weight:600;
  background: rgba(255,255,255,.03);
}
.table tr:hover td{background: rgba(255,255,255,.02)}
.table tr:last-child td{border-bottom:none}

/* FORMS */
.form-card{padding:16px}

/* 4 columnas en escritorio, 2 en mediano, 1 en móvil */
.form-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px 14px;
  margin-top:12px;
}
.form-row{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}
.form-row label{
  font-size:12px;
  color:var(--muted);
}
input, select, textarea{
  width:100%;
  padding:11px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(10,14,22,.65);
  color:var(--text);
  outline:none;
}
textarea{min-height:92px; resize:vertical}

.help{
  font-size:12px;
  color:var(--muted);
}

.form-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:14px;
  flex-wrap:wrap;
}

.full{grid-column:1 / -1}

/* Responsive */
@media (max-width: 1100px){
  .form-grid{grid-template-columns: repeat(2, minmax(0, 1fr));}
}
@media (max-width: 980px){
  .sidebar{width:240px}
}
@media (max-width: 760px){
  .wrapper{flex-direction:column}
  .sidebar{
    width:100%;
    height:auto;
    position:relative;
  }
  .main{padding:14px}
  .form-grid{grid-template-columns:1fr}
}

/* =========================
   AUTH / LOGIN
   ========================= */
body.auth{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}

.auth-wrap{
  width:100%;
  max-width: 360px;
}

.login-card{
  padding:16px;
}

.login-head{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}

.login-logo{
  width:40px;
  height:40px;
  border-radius:14px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,.14);
}

.login-title{
  margin:0;
  font-size:18px;
  letter-spacing:.2px;
}

.login-sub{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
}

.login-form{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.login-btn{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  font-weight:700;
}

.login-hint{
  margin-top:10px;
  border-top:1px solid var(--line);
  padding-top:10px;
  color:var(--muted);
  font-size:12px;
}

.hint-title{font-weight:700; color:var(--text); margin-bottom:6px}
.hint-grid{display:grid; grid-template-columns: 1fr; gap:4px}
.hint-k{color:var(--text); font-weight:700}
.hint-s{opacity:.6}
.hint-v{color:var(--muted)}

.alert{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  margin: 10px 0 12px;
}

.alert-danger{
  border-color: rgba(154,42,57,.55);
  background: rgba(154,42,57,.12);
  color: #ffd7dd;
}

/* Password toggle elegante dentro del input */
.login-pass{
  position:relative;
}

.login-pass input{
  height: 38px;
  padding: 8px 44px 8px 10px; /* espacio para el botón */
  border-radius: 12px;
}

.pass-toggle{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  width:34px;
  height:30px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color:#fff;
  -webkit-text-fill-color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  line-height:1;
}

.pass-toggle:hover{
  background: rgba(255,255,255,.10);
}

.pass-toggle:active{
  transform: translateY(-50%) scale(.98);
}

/* Mobile */
@media (max-width: 480px){
  body.auth{ padding: 12px; }
  .auth-wrap{ max-width: 330px; }
  .login-title{ font-size: 17px; }
}
/* ==========================
   DASHBOARD (orden y simetría)
   ========================== */

.page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}

.page-title{ margin:0; }

.page-sub{
  margin-top:6px;
  opacity:.75;
  font-size:13px;
}

.page-head__actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.grid-3{
  margin-top:12px;
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}

.grid-2{
  margin-top:12px;
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

@media (max-width: 980px){
  .grid-2{ grid-template-columns:1fr; }
}

@media (max-width: 860px){
  .grid-3{ grid-template-columns:1fr; }
  .page-head{ flex-direction:column; align-items:stretch; }
  .page-head__actions{ justify-content:flex-start; }
}

.card-head{ margin-bottom:10px; }
.card-title{ margin:0; font-size:16px; }
.card-sub{ margin-top:4px; opacity:.75; font-size:13px; }

.dash-bg-select{ min-width:160px; }

.pill-row{ display:flex; gap:8px; flex-wrap:wrap; margin-top:6px; margin-bottom:8px; }
.pill-metric{ display:inline-flex; gap:8px; align-items:center; }
.pill__k{ opacity:.8; }
.pill__v{ font-weight:700; }

.dash-details{ margin-top:10px; border:1px solid rgba(255,255,255,.08); border-radius:14px; padding:10px; background: rgba(255,255,255,.02); }
.dash-summary{ cursor:pointer; font-weight:700; list-style:none; }
.dash-summary::-webkit-details-marker{ display:none; }
.dash-details__body{ margin-top:10px; }

@media (max-width: 480px){
  .dash-bg-select{ min-width:100%; }
}

/* Accesos rápidos */
.quick-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
}

@media (max-width: 520px){
  .quick-grid{ grid-template-columns:1fr; }
}

.quick{
  display:block;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  text-decoration:none;
}

.quick:hover{ background: rgba(255,255,255,.07); }

.quick .t{ font-weight:700; color:#fff; }
.quick .s{ margin-top:4px; opacity:.75; font-size:13px; }

/* Consulta rápida */
.lookup{ margin-top:6px; }
.lookup__label{ display:block; font-size:13px; opacity:.75; margin-bottom:6px; }
.lookup__row{ display:flex; gap:8px; flex-wrap:wrap; }
.lookup__select{ width:180px; }
.lookup__input{ flex:1; min-width:220px; }
.lookup__btn{ height:38px; }
.lookup__hint{ margin-top:8px; font-size:12px; opacity:.65; }

.lookup-out{ margin-top:12px; }
.lk-loading{ padding:10px; opacity:.8; }

.lk-card{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  border-radius:14px;
  padding:12px;
}

.lk-block{
  margin-top:10px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  border-radius:14px;
  padding:12px;
}

.lk-title{ font-weight:700; margin-bottom:8px; }
.lk-line{ margin-top:4px; }
.lk-row{ margin-top:6px; display:flex; gap:8px; flex-wrap:wrap; }
.lk-empty{ opacity:.7; font-size:13px; padding:6px 0; }

.pill{
  display:inline-block;
  padding:3px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  font-size:12px;
}

/* Armamento layout uniforme */
.armo-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.armo-col-25,
.armo-col-50,
.armo-col-75,
.armo-col-100 {
  width: 100%;
}

.lk-table{ margin-top:8px; }

/* ===== Comunicaciones: evitar inputs muy angostos en tablas ===== */
.comm-table{ display:block; overflow-x:auto; }
.comm-table{ border-radius:12px; }
.comm-table .input{ width:100%; }
.comm-table td .input,
.comm-table td textarea.input{ min-width:150px; }
.comm-table td:nth-child(3) .input{ min-width:96px; }
.comm-table td:nth-child(4) .input{ min-width:150px; }
.comm-table td textarea.input{ min-height:78px; resize:vertical; }

/* ===== Intendencia: filas tipo grid (inputs visibles) ===== */
.items-head,
.item-row{
  display:grid;
  /*
    Ajuste de anchos para que los campos de escritura (Elemento/Serial/Observaciones)
    no queden tan angostos dentro de la tarjeta (grid-2).
  */
  grid-template-columns:
    minmax(190px, 1.25fr)
    minmax(170px, 1fr)
    minmax(96px, 0.55fr)
    minmax(150px, 0.85fr)
    minmax(260px, 1.5fr)
    minmax(110px, 0.65fr);
  gap:10px;
  align-items:start;
}

.items-head{
  padding:10px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:12px;
  background: rgba(255,255,255,.02);
  font-size:12px;
  font-weight:700;
  color: rgba(255,255,255,.90);
}

.items-rows{ margin-top:10px; }

.item-row{
  padding:10px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  background: rgba(0,0,0,.12);
}

.item-row textarea.input{
  min-height:86px;
  resize:vertical;
}

@media (max-width: 900px){
  .items-head{ display:none; }
  .item-row{ grid-template-columns: 1fr; }
}
