/* ═══════════════════════════════════════════════════════════
   TUYOOK — Industrial Control Room Aesthetic
   Fuente: IBM Plex Mono + DM Sans
   Paleta: Carbón profundo + Verde señal + Ámbar
═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;600&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg-base:       #0b0d11;
  --bg-panel:      #12151c;
  --bg-card:       #1a1e28;
  --bg-card2:      #20263a;
  --border:        #2a3044;
  --border-bright: #3a4560;
  --accent-green:  #00e676;
  --accent-green2: #00c853;
  --accent-amber:  #ffab00;
  --accent-red:    #ff3d00;
  --accent-blue:   #448aff;
  --text-primary:  #e8eaf0;
  --text-secondary:#8892a8;
  --text-dim:      #4a5270;
  --mono:          'IBM Plex Mono', monospace;
  --sans:          'DM Sans', sans-serif;
  --radius:        6px;
  --radius-lg:     12px;
  --shadow:        0 4px 24px rgba(0,0,0,.5);
  --shadow-card:   0 2px 12px rgba(0,0,0,.4);
  --transition:    .18s cubic-bezier(.4,0,.2,1);
  --sidebar-w:     240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--sans);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Layout ──────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-body {
  padding: 28px;
  flex: 1;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: .05em;
}

.brand-version {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.nav-section {
  padding: 16px 12px 8px;
}

.nav-label {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 4px 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: .88rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0,230,118,.08);
  color: var(--accent-green);
  border-left: 2px solid var(--accent-green);
  margin-left: -1px;
}

.nav-item .icon {
  width: 18px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-family: var(--mono);
  font-size: .6rem;
  padding: 2px 6px;
  border-radius: 20px;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--bg-card);
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #2979ff, #7c4dff);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name { font-size: .82rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .7rem; color: var(--text-dim); font-family: var(--mono); }

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* ─── Stats Grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--accent-green));
}

.stat-card:hover { border-color: var(--border-bright); transform: translateY(-1px); }

.stat-label {
  font-family: var(--mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.stat-sub {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ─── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

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

thead { background: var(--bg-card2); }

th {
  padding: 11px 16px;
  text-align: left;
  font-family: var(--mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ─── Badges / Pills ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.badge-green  { background: rgba(0,230,118,.12); color: var(--accent-green); }
.badge-amber  { background: rgba(255,171,0,.12); color: var(--accent-amber); }
.badge-red    { background: rgba(255,61,0,.12);  color: var(--accent-red); }
.badge-blue   { background: rgba(68,138,255,.12);color: var(--accent-blue); }
.badge-gray   { background: rgba(136,146,168,.1);color: var(--text-secondary); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--accent-green); color: #000; }
.btn-primary:hover { background: var(--accent-green2); }

.btn-secondary { background: var(--bg-card2); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card); border-color: var(--border-bright); }

.btn-danger { background: rgba(255,61,0,.15); color: var(--accent-red); border: 1px solid rgba(255,61,0,.3); }
.btn-danger:hover { background: var(--accent-red); color: #fff; }

.btn-amber { background: rgba(255,171,0,.15); color: var(--accent-amber); border: 1px solid rgba(255,171,0,.3); }
.btn-amber:hover { background: var(--accent-amber); color: #000; }

.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-lg { padding: 13px 28px; font-size: .95rem; }

.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: .88rem;
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(0,230,118,.12);
}

select { cursor: pointer; }

.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ─── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin-bottom: 16px;
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: rgba(0,230,118,.08); border-color: var(--accent-green); color: var(--accent-green); }
.alert-error   { background: rgba(255,61,0,.08);  border-color: var(--accent-red);   color: var(--accent-red); }
.alert-warning { background: rgba(255,171,0,.08); border-color: var(--accent-amber); color: var(--accent-amber); }
.alert-info    { background: rgba(68,138,255,.08);border-color: var(--accent-blue);  color: var(--accent-blue); }

/* ─── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: .83rem;
  color: var(--text-secondary);
  margin-top: 3px;
  font-family: var(--mono);
}

/* ─── Live dot ────────────────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

/* ─── Presence record row ─────────────────────────────────── */
.worker-thumb {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.worker-thumb-placeholder {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-card2);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  color: var(--text-dim);
  font-weight: 700;
}

.method-icon { font-size: 1rem; }

/* ─── Kiosk specific ──────────────────────────────────────── */
.kiosk-layout {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
}

.kiosk-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
}

.kiosk-clock {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 300;
  color: var(--accent-green);
  letter-spacing: .08em;
}

.kiosk-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.kiosk-left {
  padding: 40px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.kiosk-right {
  padding: 40px;
  display: flex;
  flex-direction: column;
}

.camera-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border);
  background: #000;
}

.camera-container video,
.camera-container canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.face-guide {
  width: 180px; height: 220px;
  border: 2px solid rgba(0,230,118,.5);
  border-radius: 50%;
  box-shadow: 0 0 0 1000px rgba(0,0,0,.3);
}

.fingerprint-zone {
  width: 200px; height: 200px;
  border: 2px solid var(--border-bright);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.fingerprint-zone:hover, .fingerprint-zone.scanning {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px rgba(0,230,118,.15);
}

.fingerprint-zone.scanning::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 2px;
  background: var(--accent-green);
  animation: scan 1.5s linear infinite;
  box-shadow: 0 0 8px var(--accent-green);
}

@keyframes scan {
  0% { top: 0; left: -100%; }
  100% { top: 100%; left: 100%; }
}

.fp-icon { font-size: 4rem; opacity: .5; }
.fingerprint-zone.scanning .fp-icon { opacity: 1; color: var(--accent-green); }

/* Result overlay */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

.result-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.result-icon {
  font-size: 5rem;
  animation: pop .4s cubic-bezier(.17,.67,.32,1.3);
}

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.result-name {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
}

.result-time {
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--text-secondary);
}

/* ─── QR Scanner ──────────────────────────────────────────── */
.qr-scanner-wrap {
  position: relative;
  width: 300px; height: 300px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border);
  margin: 0 auto;
}

.qr-target {
  position: absolute;
  inset: 20px;
  border: 2px solid var(--accent-green);
  border-radius: var(--radius);
  opacity: .7;
}

.qr-target::before, .qr-target::after {
  content: '';
  position: absolute;
  background: var(--accent-green);
}

/* ─── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-left {
  background: linear-gradient(135deg, #0b1120 0%, #0d1f3a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,230,118,.06), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
}

.login-hero-icon { font-size: 5rem; margin-bottom: 24px; }

.login-hero-title {
  font-family: var(--mono);
  font-size: 3rem;
  font-weight: 600;
  color: var(--accent-green);
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.login-hero-sub {
  font-size: .95rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 320px;
  line-height: 1.7;
}

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  background: var(--bg-panel);
}

.login-form-wrap { width: 100%; max-width: 380px; }

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-sub {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* ─── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1.2rem; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Utilities ───────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: .82rem; }
.text-mono { font-family: var(--mono); }
.text-muted { color: var(--text-secondary); }
.text-dim { color: var(--text-dim); }
.text-green { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .kiosk-body { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .input-grid, .input-grid-3 { grid-template-columns: 1fr; }
}
