/* ============================================================
   Portal IT · Doka — estilos
   Identidad: amarillo Doka sobre azul-acero industrial
   ============================================================ */
:root {
  --doka-yellow: #FFE500;
  --doka-blue:  #003ECC;
  --ink:        #0A1A3F;   /* azul Doka muy oscuro */
  --ink-2:      #13265C;
  --steel:      #34495E;
  --line:       #E2E6EA;
  --paper:      #F6F7F8;
  --white:      #FFFFFF;
  --muted:      #6B7A88;
  --ok:         #1E8E5A;
  --ok-bg:      #E4F4EC;
  --info:       #2B6CB0;
  --info-bg:    #E3EEF8;
  --warn:       #B7791F;
  --warn-bg:    #FBF0DC;
  --danger:     #C53030;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(21,32,43,.08), 0 6px 24px rgba(21,32,43,.06);
  --mono:       'SF Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;
  --sans:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  font-size: 15px;
}

/* ---------- Layout: sidebar + main ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  background: var(--ink);
  color: #C7D1DA;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.brand {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: var(--doka-yellow);
}
.brand .logo {
  display: block;
}
.brand .logo img {
  width: 100%;
  max-width: 150px;
  height: auto;
  display: block;
}
.brand .sub {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--doka-blue);
  font-weight: 700;
}
.nav { padding: 14px 12px; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 8px;
  color: #C7D1DA;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--doka-yellow); color: var(--ink); font-weight: 600; }
.nav a .ic { width: 18px; text-align: center; font-size: 15px; }
.nav .group { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: #5A6B79; padding: 16px 13px 6px; }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: var(--muted);
}
.sidebar-foot a { color: #C7D1DA; text-decoration: none; }
.sidebar-foot a:hover { color: #fff; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.topbar .who { font-size: 13px; color: var(--muted); }
.content { padding: 28px; max-width: 1180px; }

/* ---------- Cards / stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--doka-yellow); }
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.stat.alt .n { color: var(--info); }
.stat.ok .n { color: var(--ok); }
.stat.warn .n { color: var(--warn); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-body { padding: 22px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FBFBFC; }
td .mono { font-family: var(--mono); font-size: 12.5px; color: var(--steel); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .2px; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: #ECEFF1; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter .12s, background .12s, border-color .12s;
  font-family: inherit;
}
.btn-primary { background: var(--doka-yellow); color: var(--ink); }
.btn-primary:hover { filter: brightness(.95); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--steel); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-icon { padding: 7px 9px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--steel); margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(254,221,0,.25);
}
.field textarea { resize: vertical; min-height: 70px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #BCE5CE; }
.alert-err { background: #FCE8E8; color: var(--danger); border: 1px solid #F4C7C7; }

/* ---------- Filters bar ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 18px; }
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 160px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  background-image:
    radial-gradient(circle at 15% 20%, rgba(0,62,204,.35) 0, transparent 38%),
    radial-gradient(circle at 85% 80%, rgba(255,229,0,.10) 0, transparent 40%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-wrap .grid-bg {
  position: absolute;
  inset: 0;
  opacity: .5;
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 2;
  background: var(--white);
  border-radius: 16px;
  padding: 36px 38px;
  width: 100%;
  max-width: 390px;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  border-top: 5px solid var(--doka-yellow);
}
.login-card .logo {
  background: var(--doka-yellow);
  padding: 14px 18px;
  border-radius: 10px;
  display: block;
  margin-bottom: 18px;
}
.login-card .logo img { width: 100%; max-width: 180px; height: auto; display: block; margin: 0 auto; }
.login-card h1 { font-size: 17px; margin: 4px 0 4px; color: var(--ink); }
.login-card p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .4; }

.row-actions { display: flex; gap: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border-bottom: none; border-right: 1px solid rgba(255,255,255,.08); padding: 14px; }
  .brand .sub { display: none; }
  .nav { display: flex; padding: 8px; flex: 1; }
  .nav .group { display: none; }
  .nav a { margin-bottom: 0; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
