* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; margin: 0; background: #f4f6f9; color: #1f2937; }

/* LOGIN */
.login-body {
  min-height: 100vh;
  background: url('../img/background.jpg') center/cover no-repeat fixed;
}
.login-overlay {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55);
}
.login-card {
  background: #fff; padding: 40px; border-radius: 16px; width: 360px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35); text-align: center;
}
.logo-lg { width: 110px; margin-bottom: 10px; }
.logo-sm { height: 32px; vertical-align: middle; margin-right: 8px; }
.login-card h1 { margin: 0 0 20px; font-size: 22px; }
.login-card label { display: block; text-align: left; font-size: 13px; color: #4b5563; margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.btn-primary {
  background: #2563eb; color: #fff; border: 0; padding: 12px 20px; border-radius: 8px;
  font-weight: 600; cursor: pointer; margin-top: 20px; width: 100%;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; border: 0; padding: 12px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #e5e7eb; color: #111; border: 0; padding: 12px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.alert { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }

/* TOPBAR */
.topbar {
  background: #111827; color: #fff; padding: 12px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar .brand { display: flex; align-items: center; font-weight: 700; }
.topbar nav a {
  color: #e5e7eb; text-decoration: none; margin-left: 18px; font-size: 14px;
}
.topbar nav a:hover { color: #fff; }
.userinfo { margin-left: 18px; font-size: 13px; opacity: .85; }
.btn-logout { background: #dc2626; padding: 6px 12px; border-radius: 6px; color: #fff !important; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
h1 { margin-top: 0; }
h2 { margin-top: 28px; }
.muted { color: #6b7280; font-size: 14px; }

/* CARDS */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }
.card {
  background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit;
}
.card .label { font-size: 13px; color: #6b7280; }
.card .value { font-size: 22px; font-weight: 700; }
.card.pos { border-left: 5px solid #f59e0b; }
.card.link:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.12); transform: translateY(-2px); transition: .2s; }

.bank-list { background: #fff; padding: 18px; border-radius: 14px; display: flex; gap: 40px; flex-wrap: wrap; }
.bank-list span { color: #6b7280; margin-right: 8px; }

/* TABLES */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,0.05); margin-top: 12px; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid #f1f5f9; }
.data-table th { background: #f9fafb; color: #374151; font-weight: 600; }
.data-table tr:hover td { background: #f9fafb; }
.data-table .empty { text-align: center; color: #9ca3af; padding: 24px; }

.badge { padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-cash { background: #d1fae5; color: #065f46; }
.badge-pos { background: #fef3c7; color: #92400e; }
.badge-banktransfer { background: #dbeafe; color: #1e40af; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip { padding: 6px 14px; border-radius: 999px; background: #e5e7eb; color: #111; text-decoration: none; font-size: 13px; }
.chip.active { background: #2563eb; color: #fff; }

/* REGISTER */
.panel { background: #fff; padding: 24px; border-radius: 14px; box-shadow: 0 4px 14px rgba(0,0,0,0.05); }
.grid-form { display: grid; gap: 16px; }
.grid-form label { display: flex; flex-direction: column; font-size: 13px; color: #4b5563; gap: 4px; }
.grid-form input, .grid-form select {
  padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.form-section { border: 1px dashed #e5e7eb; padding: 14px; border-radius: 10px; display: grid; gap: 10px; }
.form-section h3 { margin: 0 0 6px; font-size: 14px; color: #374151; }

.register-meta { background: #eff6ff; padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }

.actions { display: flex; gap: 12px; margin: 20px 0; flex-wrap: wrap; }

/* MODALS */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; }
.modal-content {
  background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 700px;
  max-height: 92vh; overflow-y: auto;
}
.modal-content.small { max-width: 400px; }
.modal-content.large { max-width: 960px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.bills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 20px; margin-top: 12px; }
.bills-col h3 { margin: 0 0 10px; border-bottom: 2px solid #2563eb; padding-bottom: 4px; }
.bill-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.bill-row input { width: 80px; padding: 6px; border: 1px solid #d1d5db; border-radius: 6px; text-align: right; }

/* Bill subtotals (opening & closing) */
.bills-total {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
  font-size: 13px;
  color: #374151;
  text-align: right;
}
.bills-total strong { color: #065f46; }

/* Collapsible opening bill breakdown on the open-register screen */
.opening-bills-details {
  margin: 16px 0 24px;
  background: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.opening-bills-details > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}

/* Page head with export button */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-inline { display: inline-block; width: auto; padding: 10px 16px; text-decoration: none; margin: 0; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; border: 0; cursor: pointer; color: #fff; margin-right: 4px; width: auto; }
.row-actions { white-space: nowrap; }
.alert-ok { background: #d1fae5; color: #065f46; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form label { flex: 1 1 160px; }

/* SUMMARY PAGE */
.summary-body { background: #fff; padding: 30px; }
.summary-wrap { max-width: 1000px; margin: 0 auto; }
@media print { .btn-primary, .btn-secondary { display: none; } }

/* Live drawer cards */
.card .sub { font-size: 12px; color: #6b7280; margin-top: 4px; }
.card .value.negative { color: #dc2626; }