:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f3f6fb;
  --sidebar: #ffffff;
}

body {
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 270px;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-icon, .brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
}

.sidebar-brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #475569;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 600;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #eaf1ff;
  color: var(--primary-dark);
}

.content-wrap {
  flex: 1;
  min-width: 0;
}

.topbar {
  min-height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
}

.main-content {
  padding: 24px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .04);
}

.stat-card {
  padding: 18px;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.login-page,
.install-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, .12), transparent 30%),
    linear-gradient(135deg, #eef4ff 0%, #f8fafc 48%, #ffffff 100%);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px 16px;
}

.login-card {
  position: relative;
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 38px 38px 34px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .10);
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, #f97316, #2563eb, #0ea5e9);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  text-align: center;
}

.login-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.login-brand span {
  font-weight: 800;
  font-size: 18px;
  color: var(--primary-dark);
}

.login-card h1 {
  font-size: 31px;
  line-height: 1.12;
  margin: 0 0 8px;
}

.login-card p {
  color: var(--muted);
  margin: 0;
}

.login-card .btn-primary {
  min-height: 48px;
  font-weight: 700;
}

.login-footer {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  color: #64748b;
  font-size: 12px;
  padding: 0 4px;
  text-align: center;
}

.table td,
.table th {
  vertical-align: middle;
}

.receipt-preview {
  max-height: 360px;
  width: 100%;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  padding: 18px 2px 0;
}

.print-only {
  display: none;
}

@media (max-width: 991.98px) {
  .sidebar {
    display: none;
  }
  .main-content {
    padding: 18px;
  }
  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .app-footer {
    flex-direction: column;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 11px;
  }
  .sidebar,
  .topbar,
  .no-print,
  .collapse,
  .dt-container .dt-search,
  .dt-container .dt-length,
  .dt-container .dt-info,
  .dt-container .dt-paging,
  .dt-container .dt-layout-row:not(.dt-layout-table),
  .dataTables_filter,
  .dataTables_length,
  .dataTables_info,
  .dataTables_paginate {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  .content-wrap,
  .app-shell {
    display: block;
    min-height: auto;
  }
  .main-content {
    padding: 0;
  }
  .page-title {
    display: block;
    margin-bottom: 8px;
  }
  .page-title h1 {
    display: block;
    font-size: 18px;
    margin: 0 0 2px;
  }
  .page-title .text-muted {
    display: block;
    font-size: 10px;
    color: #000 !important;
    margin-bottom: 8px;
  }
  .panel,
  .stat-card {
    box-shadow: none;
    border: 0;
    padding: 0 !important;
    background: #fff;
  }
  .row.g-3.mb-3 {
    display: table;
    width: 100%;
    margin: 0 0 8px !important;
  }
  .row.g-3.mb-3 > [class*="col-"] {
    display: table-cell;
    width: auto;
    padding: 0 6px 0 0;
  }
  .stat-card {
    border: 1px solid #000 !important;
    padding: 5px 6px !important;
  }
  .stat-card .text-muted {
    color: #000 !important;
    font-size: 9px;
  }
  .stat-card .h4 {
    font-size: 13px;
    margin: 2px 0 0;
  }
  .table-responsive {
    overflow: visible !important;
  }
  .table {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: collapse !important;
    font-size: 9px;
  }
  .table th,
  .table td {
    border: 1px solid #000 !important;
    padding: 4px 5px !important;
    vertical-align: top;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  .table thead th {
    background: #e5e5e5 !important;
    color: #000 !important;
    font-weight: 700;
    text-align: center;
  }
  .ledger-title {
    text-align: center;
    margin-bottom: 10px;
  }
  .ledger-title h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 2px;
    letter-spacing: 0;
  }
  .ledger-title div {
    font-size: 11px;
  }
  .ledger-table {
    width: 100% !important;
    table-layout: auto;
    border-collapse: collapse !important;
  }
  .ledger-table th,
  .ledger-table td {
    border: 1px solid #000 !important;
    padding: 5px 6px !important;
    vertical-align: top;
  }
  .ledger-table thead th {
    background: #e5e5e5 !important;
    color: #000 !important;
    font-weight: 700;
    text-align: center;
  }
  .ledger-table .badge {
    border: 0 !important;
    color: #000 !important;
    background: transparent !important;
    padding: 0;
  }
}
