
:root{
  --app-bg:#f5f7fb;
  --card-bg:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --primary:#0d6efd;
  --border:#e6ebf2;
  --shadow:0 10px 30px rgba(15, 23, 42, .06);
  --radius:18px;
  --control-h:46px;
}

html{font-size:16px;}
body{
  background:var(--app-bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
body.sidebar-open{overflow:hidden;}
@media (max-width: 991.98px){body.sidebar-open{position:fixed;width:100%;}}

.app-shell{display:flex;min-height:100vh;}
.sidebar{
  width:270px;
  min-width:270px;
  background:linear-gradient(180deg,#111827 0%,#1f2937 100%);
  position:sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
}
.sidebar .nav-link{
  border-radius:14px;
  margin-bottom:4px;
  padding:.82rem .95rem;
  font-weight:500;
  display:flex;
  align-items:center;
}
.sidebar .nav-link.active,
.sidebar .nav-link:hover{background:rgba(255,255,255,.12);}
.sidebar .nav-link i{font-size:1rem;}

.sidebar{
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.sidebar nav{
  padding-bottom:2rem;
}


.main-content{flex:1;min-width:0;display:flex;flex-direction:column;}
.topbar{
  position:sticky;
  top:0;
  z-index:1020;
  min-height:72px;
  backdrop-filter:saturate(180%) blur(8px);
}
.content-wrapper{padding:1.1rem 1.1rem 1.4rem;}
.content-wrapper > .alert:first-child{margin-bottom:1rem;}

h1,h2,h3,h4,h5{letter-spacing:-.02em;}
h3{font-size:2rem;font-weight:700;}
small.text-muted{display:inline-block;margin-top:.18rem;}

.card-soft{
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  background:var(--card-bg);
  overflow:hidden;
}
.card-soft .card-header{
  background:#fff;
  border-bottom:1px solid var(--border);
  padding:1rem 1.15rem;
}
.card-soft .card-body{padding:1.15rem;}
.card-soft .card-footer{
  background:#fff;
  border-top:1px solid var(--border);
  padding:1rem 1.15rem;
}

.stat-card{
  height:100%;
  min-height:132px;
}
.stat-card .card-body{
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.stat-card p{
  font-size:.95rem;
  margin-bottom:.35rem !important;
}
.stat-card h3{
  font-size:1.6rem;
  line-height:1.15;
  margin:0;
  word-break:break-word;
}

.form-label{
  font-weight:600;
  color:#111827;
  margin-bottom:.42rem;
}
.form-control,
.form-select,
.btn{
  border-radius:14px;
}
.form-control,
.form-select{
  min-height:var(--control-h);
  border-color:#d7deea;
  background:#fff;
  padding:.72rem .9rem;
  font-size:.98rem;
}
.form-control:focus,
.form-select:focus{
  border-color:rgba(13,110,253,.45);
  box-shadow:0 0 0 .22rem rgba(13,110,253,.12);
}
textarea.form-control{
  min-height:120px;
  resize:vertical;
}
.input-group > .form-control,
.input-group > .form-select,
.input-group > .btn{
  min-height:var(--control-h);
}

.btn{
  min-height:44px;
  padding:.65rem 1rem;
  font-weight:600;
}
.btn-sm{
  min-height:36px;
  padding:.4rem .75rem;
  border-radius:12px;
}

.table-responsive{
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
}
.table{margin-bottom:0;}
.table > :not(caption) > * > *{
  padding:.85rem .85rem;
  vertical-align:middle;
}
.table thead th{
  background:#f8fafc;
  color:#374151;
  font-size:.92rem;
  font-weight:700;
  white-space:nowrap;
}
.table tbody td{font-size:.95rem;}
.badge{
  border-radius:999px;
  padding:.45rem .65rem;
  font-weight:600;
}

.search-result-card{
  border:1px solid rgba(0,0,0,.08);
  border-radius:16px;
  padding:14px;
  background:#fff;
  height:100%;
  box-shadow:0 2px 8px rgba(15,23,42,.04);
}
.coordinate-help{font-size:.88rem;color:#6c757d;}
.receipt-hero{
  background:linear-gradient(135deg,#0d6efd,#0dcaf0);
  color:#fff;
  border-radius:20px;
  padding:22px;
}
.receipt-tile{
  border:1px dashed rgba(13,110,253,.22);
  border-radius:16px;
  padding:14px;
  background:#f8fbff;
  height:100%;
}
.action-stack{
  display:flex;
  gap:.5rem;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.printable-card{max-width:960px;margin:0 auto;}

.content-wrapper .d-flex.justify-content-between.align-items-center.mb-3,
.content-wrapper .d-flex.flex-wrap.gap-2.justify-content-between.align-items-center.mb-3,
.content-wrapper .d-flex.justify-content-between.align-items-center.mb-4{
  gap:.75rem;
}

.sidebar-backdrop{display:none;}

@media (max-width: 1199.98px){
  h3{font-size:1.8rem;}
  .stat-card{min-height:124px;}
}

@media (max-width: 991.98px){
  .sidebar{
    position:fixed;
    inset:0 auto 0 0;
    z-index:1045;
    transform:translateX(-100%);
    transition:transform .25s ease;
    overflow-y:auto;
    overflow-x:hidden;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-y;
    max-width:86vw;
    width:290px;
    min-width:290px;
    max-height:100dvh;
    height:100dvh;
    box-shadow:0 18px 40px rgba(0,0,0,.28);
  }
  .sidebar.open{transform:translateX(0);}
  .sidebar-backdrop{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.45);
    z-index:1040;
  }
  body.sidebar-open .sidebar-backdrop{display:block;}
  .topbar{min-height:66px;}
  .content-wrapper{padding:1rem;}
  h3{font-size:1.65rem;}
  .card-soft .card-body,
  .card-soft .card-header,
  .card-soft .card-footer{padding:1rem;}
}

@media (max-width: 767.98px){
  html{font-size:15px;}
  .topbar{
    padding-left:.8rem !important;
    padding-right:.8rem !important;
  }
  .topbar .btn{min-height:38px;}
  .content-wrapper{padding:.85rem;}
  .card-soft{border-radius:16px;}
  .card-soft .card-body,
  .card-soft .card-header,
  .card-soft .card-footer{padding:.9rem;}
  .stat-card{min-height:112px;}
  .stat-card h3{font-size:1.4rem;}
  .form-control,
  .form-select,
  .btn{
    min-height:44px;
    font-size:16px;
  }
  .table-responsive{
    border-radius:14px;
  }
  .table thead th,
  .table tbody td{
    font-size:.92rem;
  }
  .content-wrapper .btn,
  .action-stack .btn{
    width:100%;
  }
  .action-stack{
    flex-direction:column;
    align-items:stretch;
  }
  .content-wrapper .d-flex.justify-content-between.align-items-center.mb-3,
  .content-wrapper .d-flex.flex-wrap.gap-2.justify-content-between.align-items-center.mb-3,
  .content-wrapper .d-flex.justify-content-between.align-items-center.mb-4{
    flex-direction:column;
    align-items:stretch !important;
  }
  .content-wrapper .d-flex.justify-content-between.align-items-center.mb-3 > a,
  .content-wrapper .d-flex.flex-wrap.gap-2.justify-content-between.align-items-center.mb-3 > a,
  .content-wrapper .d-flex.justify-content-between.align-items-center.mb-4 > a{
    width:100%;
  }
  .table-responsive table{
    min-width:640px;
  }
}

@media (max-width: 575.98px){
  .sidebar{max-width:90vw;width:300px;min-width:300px;}
  h3{font-size:1.52rem;}
  .topbar .small.text-muted{font-size:.8rem;}
  .content-wrapper{padding:.75rem;}
  .stat-card p{font-size:.9rem;}
}

@media print{
  .sidebar,.topbar,.no-print,.sidebar-backdrop{display:none !important;}
  body{background:#fff;}
  .main-content,.content{width:100%;}
  .content-wrapper,.container-fluid{padding:0 !important;}
  .card-soft{box-shadow:none;border:0;}
}


.kpi-mini{min-height:110px}
.section-actions{display:flex;gap:.5rem;flex-wrap:wrap}
.filter-pills .btn{border-radius:999px}
.list-compact td,.list-compact th{white-space:nowrap}
.timeline-note{border-left:4px solid #dee2e6;padding-left:1rem}
@media (max-width: 767.98px){
  .list-compact td,.list-compact th{white-space:normal}
  .section-actions .btn{width:100%}
}

.pagination .page-link{border-radius:12px;margin-right:.35rem;border-color:var(--border);color:var(--text);background:var(--card-bg);}
.pagination .page-item.active .page-link{background:var(--primary);border-color:var(--primary);color:#fff;}
.badge-pill-soft{padding:.55rem .8rem;border-radius:999px;}
.kpi-label{font-size:.9rem;color:var(--muted);}
.kpi-value{font-size:1.35rem;font-weight:700;}
.theme-surface{background:var(--card-bg);color:var(--text);}
html[data-theme="dark"]{
  --app-bg:#0b1220;
  --card-bg:#111827;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --border:#243041;
  --shadow:0 14px 34px rgba(0,0,0,.35);
}
html[data-theme="dark"] body{background:var(--app-bg);color:var(--text);}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .card-soft .card-header,
html[data-theme="dark"] .card-soft .card-footer,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .search-result-card,
html[data-theme="dark"] .receipt-tile,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .dropdown-menu{background:var(--card-bg)!important;color:var(--text);}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .card-soft,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .list-group-item{border-color:var(--border)!important;}
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .small.text-muted,
html[data-theme="dark"] .coordinate-help{color:var(--muted)!important;}
html[data-theme="dark"] .form-label,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] .fw-semibold,
html[data-theme="dark"] .table,
html[data-theme="dark"] .page-link{color:var(--text)!important;}
html[data-theme="dark"] .table thead th{background:#0f172a;color:#cbd5e1;}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select{background:#0f172a;color:#e5e7eb;}
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-danger{color:#e5e7eb;border-color:#4b5563;}
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-danger:hover{color:#fff;}
html[data-theme="dark"] .receipt-tile{background:#0f172a;}
html[data-theme="dark"] .alert{border-color:transparent;}

.alert-strip{border-radius:16px}
.alert-icon-circle{width:48px;height:48px;border-radius:999px;display:flex;align-items:center;justify-content:center;font-size:1.15rem;flex:0 0 auto}

html[data-theme="dark"] body,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] p,
html[data-theme="dark"] span,
html[data-theme="dark"] div,
html[data-theme="dark"] td,
html[data-theme="dark"] th,
html[data-theme="dark"] li,
html[data-theme="dark"] label,
html[data-theme="dark"] a:not(.btn):not(.nav-link){color:var(--text);}
html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea.form-control::placeholder{color:#94a3b8;opacity:1;}
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .accordion-button,
html[data-theme="dark"] .pagination .page-link,
html[data-theme="dark"] .alert-strip,
html[data-theme="dark"] .receipt-hero,
html[data-theme="dark"] .timeline-note,
html[data-theme="dark"] .search-result-card,
html[data-theme="dark"] .theme-surface{
  background-color:var(--card-bg)!important;
  color:var(--text)!important;
  border-color:var(--border)!important;
}
html[data-theme="dark"] .accordion-button:not(.collapsed){box-shadow:none;background:#172132;color:var(--text)!important;}
html[data-theme="dark"] .table tbody tr,
html[data-theme="dark"] .table tbody td,
html[data-theme="dark"] .table tbody th,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .dropdown-item{background:transparent;color:var(--text)!important;}
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus{background:#172132!important;}
html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .link-dark,
html[data-theme="dark"] .text-body,
html[data-theme="dark"] .text-black{color:var(--text)!important;}
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light{background:var(--card-bg)!important;color:var(--text)!important;}
html[data-theme="dark"] .alert-primary{background:rgba(13,110,253,.14)!important;color:#dbeafe!important;border-color:rgba(13,110,253,.3)!important;}
html[data-theme="dark"] .alert-warning{background:rgba(245,158,11,.14)!important;color:#fde68a!important;border-color:rgba(245,158,11,.3)!important;}
html[data-theme="dark"] .alert-danger{background:rgba(239,68,68,.14)!important;color:#fecaca!important;border-color:rgba(239,68,68,.3)!important;}
html[data-theme="dark"] .alert-success{background:rgba(34,197,94,.14)!important;color:#bbf7d0!important;border-color:rgba(34,197,94,.3)!important;}
html[data-theme="dark"] .btn-close{filter:invert(1) grayscale(1) brightness(200%);}
html[data-theme="dark"] .badge.bg-warning,
html[data-theme="dark"] .badge.text-bg-warning{color:#111827!important;}
html[data-theme="dark"] .topbar .text-muted,
html[data-theme="dark"] .card .text-muted,
html[data-theme="dark"] .list-group-item .text-muted,
html[data-theme="dark"] small.text-muted{color:#9ca3af!important;}
html[data-theme="dark"] .receipt-hero{background:linear-gradient(135deg,#1d4ed8,#0891b2)!important;color:#fff!important;}
html[data-theme="dark"] .sidebar .text-muted,
html[data-theme="dark"] .sidebar small{color:rgba(255,255,255,.72)!important;}


.receipt-page .btn{min-height:42px}
.receipt-page .border{border-color:var(--border) !important}
html[data-theme="dark"] .receipt-hero{background:linear-gradient(135deg,#1d4ed8,#0891b2)!important;color:#fff;}
html[data-theme="dark"] .receipt-page .border{border-color:var(--border)!important}
@media print{
  .receipt-page .card{break-inside:avoid-page; page-break-inside:avoid;}
  .receipt-page .table-responsive{overflow:visible !important;}
}

.btn-print-receipt{background:#f8fafc;border:1px solid #cbd5e1;color:#0f172a;}
.btn-print-receipt:hover{background:#e2e8f0;color:#0f172a;border-color:#94a3b8;}
html[data-theme="dark"] .btn-print-receipt{background:#1f2937!important;border-color:#475569!important;color:#f8fafc!important;}
html[data-theme="dark"] .btn-print-receipt:hover{background:#334155!important;border-color:#64748b!important;color:#ffffff!important;}


html[data-theme="dark"] .btn-print-receipt{background:#111827!important;border-color:#111827!important;color:#ffffff!important;opacity:1!important;}
html[data-theme="dark"] .btn-print-receipt:hover{background:#000000!important;border-color:#000000!important;color:#ffffff!important;}


html[data-theme="dark"] .alert-info{
  background:rgba(56,189,248,.16)!important;
  color:#e0f2fe!important;
  border-color:rgba(56,189,248,.34)!important;
}
html[data-theme="dark"] .alert-info strong,
html[data-theme="dark"] .alert-info div,
html[data-theme="dark"] .alert-info span,
html[data-theme="dark"] .alert-info small,
html[data-theme="dark"] .alert-info a:not(.btn){
  color:#e0f2fe!important;
}
html[data-theme="dark"] .alert-secondary{
  background:#172132!important;
  color:#e5e7eb!important;
  border-color:#334155!important;
}
