/* DISER Boletas — estilos minimalistas */

:root {
  --green: #0F6E56;
  --green-soft: #E1F5EE;
  --green-ink: #04342C;
  --ink: #1a1a1a;
  --muted: #555;
  --hint: #777;
  --line: #e0ddd0;
  --surface: #f5f4ee;
  --paper: #ffffff;
  --error: #993C1D;
  --error-soft: #FBEAE2;
  --info: #185FA5;
  --info-soft: #E6F1FB;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #fafaf6;
  line-height: 1.5;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: "SF Mono", Menlo, monospace; font-size: 0.9em; background: var(--surface); padding: 1px 5px; border-radius: 3px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; background: var(--green); color: #fff;
}
.topbar .brand { display: flex; align-items: baseline; gap: 14px; }
.topbar .logo { font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.topbar .tag { font-size: 12px; opacity: 0.75; }
.topbar .nav { display: flex; align-items: center; gap: 16px; }
.topbar .nav a { color: #fff; opacity: 0.9; }
.topbar .nav a:hover { opacity: 1; text-decoration: none; }
.topbar .user { font-size: 12px; opacity: 0.85; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; margin-right: 6px; }
.topbar .user .role { font-size: 10px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.5px; }

.bottombar {
  margin-top: 36px; padding: 16px 28px; color: var(--hint);
  text-align: center; border-top: 1px solid var(--line);
  background: #fff;
}

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

.flashes { max-width: 1080px; margin: 16px auto 0; padding: 0 20px; }
.flash {
  padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 8px;
  border: 1px solid var(--line); background: #fff;
}
.flash-success { background: var(--green-soft); border-color: #9FE1CB; color: var(--green-ink); }
.flash-error { background: var(--error-soft); border-color: #f3c2ad; color: var(--error); }
.flash-info { background: var(--info-soft); border-color: #b8d4ef; color: var(--info); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 24px; margin-bottom: 22px;
}

.hero h1 { margin: 0 0 4px; font-size: 22px; }
.hero { margin-bottom: 18px; }
.hero .muted { font-size: 13px; }

h1, h2 { color: var(--ink); }
h1 { margin-top: 0; }
h2 { margin: 0 0 14px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }

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

.actions {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.search-form { display: flex; gap: 6px; flex: 1; max-width: 320px; margin-left: auto; }
.search-form input[type="search"] {
  flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px;
}

.back { display: inline-block; margin-bottom: 10px; font-size: 13px; }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 6px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
}
.btn-primary { background: var(--green); color: #fff !important; }
.btn-primary:hover { opacity: 0.9; text-decoration: none; }
.btn-link { background: transparent; color: var(--green); border-color: var(--line); padding: 6px 12px; font-size: 13px; }
.btn-link:hover { background: var(--green-soft); text-decoration: none; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.grid th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); background: var(--surface); }
table.grid th.r, table.grid td.r { text-align: right; }
table.grid tr:hover td { background: #fcfbf7; }

form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
form .row { display: flex; gap: 16px; }
form .row .field { flex: 1; }
form label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
form input[type="text"], form input[type="date"], form input[type="number"], form input[type="file"], form select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px;
  font-family: inherit; background: #fff;
}
form input:focus, form select:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }

.login-card { max-width: 480px; margin: 60px auto; }
.login-card h1 { margin-top: 0; }
.login-card form { margin-top: 16px; }
.login-card details { margin-top: 24px; }
.login-card details summary { cursor: pointer; padding: 6px 0; }

/* Badges para roles y estado */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  border: 1px solid transparent;
}
.badge-admin      { background: #FBE9E2; color: #993C1D; border-color: #f3c2ad; }
.badge-supervisor { background: #E6F1FB; color: #185FA5; border-color: #b8d4ef; }
.badge-empleado   { background: var(--green-soft); color: var(--green-ink); border-color: #9FE1CB; }
.badge-ok         { background: var(--green-soft); color: var(--green-ink); border-color: #9FE1CB; }
.badge-off        { background: #eee; color: #555; border-color: #ddd; }

/* Checkbox alineado a label */
form .field label input[type="checkbox"] { margin-right: 6px; transform: translateY(1px); }

/* Wrapper para tablas que pueden necesitar scroll horizontal */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table.grid { min-width: 560px; }

/* ================================================================
   RESPONSIVE — celulares (≤ 720px)
   ================================================================ */
@media (max-width: 720px) {

  /* Topbar: la marca arriba, el menú abajo, todo wrap-friendly */
  .topbar {
    flex-direction: column; align-items: stretch; gap: 10px;
    padding: 10px 14px;
  }
  .topbar .brand { justify-content: space-between; }
  .topbar .nav {
    flex-wrap: wrap; gap: 8px 14px;
    justify-content: flex-start;
    border-top: 1px solid rgba(255,255,255,0.15); padding-top: 8px;
  }
  .topbar .nav a { font-size: 14px; padding: 4px 0; }
  .topbar .user {
    align-items: flex-start; flex-direction: row; gap: 8px;
    width: 100%; flex-wrap: wrap;
  }
  .topbar .user .role { font-size: 10px; }

  .container { margin: 16px auto; padding: 0 14px; }
  .flashes { padding: 0 14px; }

  .card { padding: 16px 14px; border-radius: 8px; }

  /* Acciones: full-width, sin pelearse por el espacio */
  .actions { gap: 10px; }
  .actions .btn-primary { width: 100%; text-align: center; }
  .search-form {
    margin-left: 0; max-width: none; width: 100%; flex-wrap: wrap;
  }
  .search-form input[type="search"] { min-width: 0; }

  /* Filas de formulario apiladas */
  form .row { flex-direction: column; gap: 0; }

  /* Botones más cómodos al dedo */
  .btn { min-height: 44px; line-height: 1.2; }
  .btn-link { min-height: 38px; }

  .login-card { margin: 18px auto; }

  /* Tablas tipo "cards" — cada fila se ve como una tarjeta */
  table.grid.responsive thead { display: none; }
  table.grid.responsive,
  table.grid.responsive tbody,
  table.grid.responsive tr,
  table.grid.responsive td { display: block; width: 100%; }
  table.grid.responsive tr {
    border: 1px solid var(--line); border-radius: 8px;
    margin-bottom: 12px; padding: 6px 4px; background: #fff;
  }
  table.grid.responsive tr:hover td { background: transparent; }
  table.grid.responsive td {
    border: none; padding: 8px 12px; text-align: left !important;
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap;
  }
  table.grid.responsive td::before {
    content: attr(data-label);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--muted); font-weight: 600; min-width: 90px;
  }
  table.grid.responsive td:empty { display: none; }
  /* Acciones (la última celda con varios botones) ocupan toda la fila */
  table.grid.responsive td.actions-cell {
    flex-direction: column; align-items: stretch; gap: 6px;
    border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px;
  }
  table.grid.responsive td.actions-cell::before { display: none; }
  table.grid.responsive td.actions-cell .btn { width: 100%; text-align: center; }

  /* Tablas no-responsive: scroll horizontal en wrapper */
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
}
