:root {
  --primary: #2563eb; --primary-dark: #1d4ed8;
  --danger: #ef4444; --success: #16a34a;
  --bg: #f8fafc; --surface: #ffffff;
  --text: #0f172a; --muted: #64748b;
  --border: #e2e8f0; --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { text-decoration: none; color: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.nav { display: flex; justify-content: space-between; align-items: center; height: 60px; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--primary); }
.nav-links { display: flex; gap: 1rem; list-style: none; align-items: center; }
.nav-links a { font-size: 0.9rem; font-weight: 500; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

.btn { display: inline-block; padding: 0.5rem 1rem; border: none; border-radius: var(--radius); cursor: pointer; font-weight: 500; font-size: 0.9rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 2rem 0; }
.card { background: var(--surface); padding: 1.2rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.03); }
.card h3 { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.card .value { font-size: 1.8rem; font-weight: 700; }
.value.green { color: var(--success); } .value.red { color: var(--danger); } .value.yellow { color: #d97706; }

.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); margin-top: 1rem; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; font-weight: 600; }

.badge { padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-ok { background: #dcfce7; color: #15803d; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-crit { background: #fee2e2; color: #b91c1c; }

@media (max-width: 768px) {
  .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--surface); flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--border); }
  .nav-links.active { display: flex; }
  .mobile-menu-btn { display: block; }
}

/* ========== PRINT RECEIPT STYLES ========== */
@media print {
  body * {
    visibility: hidden;
  }
  #receipt-area, #receipt-area * {
    visibility: visible;
  }
  #receipt-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #000;
    background: #fff;
  }
  .no-print {
    display: none !important;
  }
  .receipt-header {
    text-align: center;
    border-bottom: 2px dashed #000;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .receipt-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
  }
  .receipt-header p {
    margin: 2px 0;
    font-size: 11px;
  }
  .receipt-meta {
    margin: 10px 0;
    font-size: 11px;
  }
  .receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 11px;
  }
  .receipt-table th, .receipt-table td {
    padding: 4px 2px;
    border-bottom: 1px dotted #ccc;
    text-align: left;
  }
  .receipt-table th {
    font-weight: bold;
  }
  .receipt-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
  }
  .receipt-sign {
    text-align: center;
    width: 45%;
  }
  .receipt-sign-line {
    border-top: 1px solid #000;
    margin-top: 30px;
    padding-top: 5px;
  }
  .receipt-note {
    margin-top: 15px;
    font-size: 10px;
    font-style: italic;
    text-align: center;
  }
}

/* Receipt preview (non-print) */
.receipt-preview {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  max-width: 400px;
  margin: 0 auto;
}
.receipt-preview .receipt-header {
  border-bottom: 2px dashed #ccc;
  padding-bottom: 10px;
  margin-bottom: 10px;
  text-align: center;
}
.receipt-preview table {
  width: 100%;
  font-size: 12px;
}
.receipt-preview th, .receipt-preview td {
  padding: 4px 2px;
  border-bottom: 1px dotted #eee;
}