/* ══════════════════════════════════════════════════
   Panasonic DP-C262 Panel · Stylesheet
   ══════════════════════════════════════════════════ */

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

:root {
  --bg:       #f1f5f9;
  --surface:  #ffffff;
  --border:   #e2e8f0;
  --text:     #0f172a;
  --muted:    #64748b;
  --primary:  #1d4ed8;
  --primary-h:#1e40af;
  --success:  #16a34a;
  --warn:     #d97706;
  --danger:   #dc2626;
  --sidebar-w:220px;
  --radius:   10px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px; border-bottom: 1px solid #1e293b;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 15px; font-weight: 700; color: #f8fafc; }
.brand-sub  { font-size: 11px; color: #64748b; }

.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 7px;
  color: #94a3b8; text-decoration: none; font-size: 13px;
  transition: background .15s, color .15s;
}
.nav-item:hover, .nav-item.active {
  background: #1e293b; color: #f8fafc;
}
.nav-item.active { font-weight: 600; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid #1e293b; display: flex; flex-direction: column; gap: 8px; }
.agent-status { font-size: 11px; padding: 4px 8px; border-radius: 4px; }
.agent-status.fresh  { color: #4ade80; }
.agent-status.stale  { color: #fb923c; }
.btn-logout { font-size: 12px; color: #94a3b8; text-decoration: none; padding: 4px 0; }
.btn-logout:hover { color: #f8fafc; }

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 20px; font-weight: 700; }

/* ── Printer badge ── */
.printer-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.printer-badge.idle    { background: #dcfce7; color: #15803d; }
.printer-badge.offline { background: #fee2e2; color: #991b1b; }
.printer-badge.printing{ background: #dbeafe; color: #1e40af; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.badge-age { font-size: 10px; opacity: .7; }

@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.4 } }

/* ── Alerts ── */
.alert-warning {
  margin: 16px 28px 0; padding: 10px 14px; border-radius: 7px;
  background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; font-size: 13px;
}
.alert-warning a { color: #92400e; font-weight: 600; }
.alert-error {
  background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
  padding: 10px 14px; border-radius: 7px; margin-bottom: 16px; font-size: 13px;
}

/* ── Dashboard grid ── */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 20px; padding: 24px 28px;
}

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.span-2 { grid-column: span 2; }
.card-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-hd h2 { font-size: 14px; font-weight: 700; color: var(--text); }
.card-link { font-size: 12px; color: var(--primary); text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* ── Tóner ── */
.toner-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.toner-item { display: flex; flex-direction: column; gap: 6px; }
.toner-item.warn .toner-label { color: var(--danger); }
.toner-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.toner-track { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.toner-fill  { height: 100%; border-radius: 5px; transition: width .4s ease; }
.toner-pct   { font-size: 13px; font-weight: 700; }

/* ── Contadores ── */
.counters-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.counter-cell { text-align: center; padding: 10px 6px; background: var(--bg); border-radius: 7px; }
.counter-val  { font-size: 20px; font-weight: 800; color: var(--primary); }
.counter-lbl  { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

/* ── Queue rows ── */
.queue-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.queue-row:last-child { border-bottom: none; }
.qjob  { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.quser { color: var(--muted); font-size: 12px; }
.queue-more { font-size: 12px; color: var(--muted); padding-top: 8px; }

/* ── Scan rows ── */
.scan-row a { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 13px; }
.scan-row:last-child a { border-bottom: none; }
.scan-sz { margin-left: auto; color: var(--muted); font-size: 11px; }

/* ── Quick actions ── */
.quick-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── Empty state ── */
.empty { color: var(--muted); font-size: 13px; padding: 12px 0; text-align: center; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; border: none; transition: all .15s;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: #eff6ff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-block    { width: 100%; }
.btn-sm       { padding: 5px 10px; font-size: 12px; }

/* ── Duplex page ── */
.duplex-section { display: flex; flex-direction: column; gap: 20px; }
.duplex-row { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.duplex-row:last-child { border-bottom: none; }
.duplex-label { display: flex; justify-content: space-between; align-items: center; }
.duplex-label strong { font-size: 14px; }
.duplex-val  { font-size: 20px; font-weight: 800; color: var(--primary); }
.duplex-controls { display: flex; align-items: center; gap: 8px; }
.duplex-controls input[type=range] { flex: 1; accent-color: var(--primary); }
.btn-step {
  width: 32px; height: 32px; border-radius: 6px; border: 1.5px solid var(--border);
  background: var(--surface); font-size: 18px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); transition: background .1s;
}
.btn-step:hover { background: var(--bg); }

/* ── Scans page ── */
.scans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; }
.scan-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.scan-thumb { height: 120px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.scan-info  { padding: 10px 12px; }
.scan-name  { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-meta  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.scan-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ── Diagnostics ── */
.diag-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.diag-table th { background: var(--bg); text-align: left; padding: 8px 12px; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.diag-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.diag-ok   td:first-child { border-left: 3px solid var(--success); }
.diag-fail td:first-child { border-left: 3px solid var(--danger); }
.config-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.config-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.config-table td:first-child { color: var(--muted); width: 40%; }
.config-table code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-family: monospace; }

/* ── Login ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #0f172a; }
.login-box {
  background: var(--surface); border-radius: 14px; padding: 36px 40px;
  width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 20px; font-weight: 800; margin-top: 10px; }
.login-logo p  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--muted); }
.form-group input {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 14px; outline: none; transition: border .15s;
}
.form-group input:focus { border-color: var(--primary); }
.login-footer { text-align: center; font-size: 11px; color: var(--muted); margin-top: 20px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1e293b; color: #f8fafc;
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  z-index: 9999; transition: opacity .25s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ── Toner page ── */
.toner-page-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 24px 28px; }

/* ── Queue page ── */
.queue-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.queue-table th { background: var(--bg); text-align: left; padding: 9px 12px; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.queue-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.queue-table tr:last-child td { border-bottom: none; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .brand-text, .nav-item span:not(:first-child), .agent-status, .btn-logout { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .dashboard-grid { grid-template-columns: 1fr; padding: 16px; }
  .span-2 { grid-column: span 1; }
  .toner-grid { grid-template-columns: repeat(2,1fr); }
}
