﻿:root {
  --app-bg: #f8fafc;
  --app-surface: #ffffff;
  --app-border: #e2e8f0;
  --app-text: #0f172a;
  --app-muted: #64748b;
  --app-primary: #2563eb;
  --app-primary-hover: #1d4ed8;
  --app-radius: 0.625rem;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}

body {
  margin-bottom: 64px;
  background-color: var(--app-bg);
  color: var(--app-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Minimalist Top Navbar */
.app-navbar {
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.app-navbar .navbar-brand {
  color: var(--app-text) !important;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.app-navbar .nav-link {
  color: #475569 !important;
  font-weight: 500;
  font-size: 0.925rem;
  padding: 0.45rem 0.75rem !important;
  border-radius: 0.4rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link.show,
.app-navbar .nav-link.active {
  color: var(--app-primary) !important;
  background-color: #eff6ff;
}
.app-navbar .dropdown-menu {
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -4px rgba(15, 23, 42, 0.04);
  padding: 0.35rem;
  margin-top: 0.35rem;
}
.app-navbar .dropdown-item {
  border-radius: 0.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  color: var(--app-text);
}
.app-navbar .dropdown-item:hover,
.app-navbar .dropdown-item:focus {
  background-color: #f1f5f9;
  color: var(--app-primary);
}
.app-navbar .btn-link.nav-link {
  text-decoration: none;
}

/* Page Headings & Surfaces */
main > h1,
.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-text);
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--app-text);
}

.app-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 1.25rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}

.stat-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.85rem;
}

.stat-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.stat-icon.is-blue { background: #e7f0ff; color: #0d6efd; }
.stat-icon.is-green { background: #e6f6ec; color: #198754; }
.stat-icon.is-amber { background: #fff4d6; color: #b7791f; }
.stat-icon.is-red { background: #fde8e8; color: #c53030; }

.inv-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.1rem 0.2rem 0.1rem 0;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

.inv-link:hover { background: #e7f0ff; }
.stat-info {
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  color: #6c757d;
  line-height: 1;
  vertical-align: middle;
}

.stat-info:hover { color: #0d6efd; }
.stat-info svg { width: 0.95rem; height: 0.95rem; }
.inv-link svg { width: 0.85rem; height: 0.85rem; }

/* Controls & Buttons */
.btn {
  font-weight: 500;
  border-radius: 0.45rem;
}
.btn-primary {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}
.btn-primary:hover {
  background-color: var(--app-primary-hover);
  border-color: var(--app-primary-hover);
}
.form-control,
.form-select {
  border-color: #cbd5e1;
  border-radius: 0.45rem;
}
.form-control:focus,
.form-select:focus,
.btn:focus,
.btn:active:focus,
.form-check-input:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Minimalist Badges */
.badge-soft {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1.2;
}
.badge-soft-success { background-color: #dcfce7; color: #166534; }
.badge-soft-secondary { background-color: #f1f5f9; color: #475569; }
.badge-soft-warning { background-color: #fef3c7; color: #92400e; }
.badge-soft-primary { background-color: #dbeafe; color: #1e40af; }

/* DataTables / Grid Styling */
.dt-container {
  background: var(--app-surface);
  padding: 1rem 1.25rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.dt-container .dt-search input,
.dt-container .dt-length select {
  border-color: #cbd5e1;
  border-radius: 0.4rem;
  font-size: 0.875rem;
}
table.grid {
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
}
table.grid thead tr:first-child th {
  background-color: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--app-border);
  padding: 0.65rem 0.6rem;
  white-space: nowrap;
}
table.grid thead tr.grid-filters th {
  background-color: #f8fafc;
  padding: 0.35rem 0.4rem 0.55rem 0.4rem;
  border-bottom: 1px solid var(--app-border);
  font-weight: normal;
  cursor: default !important;
}
table.grid thead tr.grid-filters th .dt-column-order {
  display: none !important;
}
table.grid thead tr.grid-filters th .dt-column-header {
  display: block;
}

/* Modern sleek SVG sort indicators */
table.dataTable thead > tr:first-child > th.dt-orderable-asc .dt-column-order,
table.dataTable thead > tr:first-child > th.dt-orderable-desc .dt-column-order,
table.dataTable thead > tr:first-child > th.dt-ordering-asc .dt-column-order,
table.dataTable thead > tr:first-child > th.dt-ordering-desc .dt-column-order {
  width: 14px;
  min-height: 16px;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
table.dataTable thead > tr:first-child > th .dt-column-order::before,
table.dataTable thead > tr:first-child > th .dt-column-order::after {
  border: 0 !important;
  position: static !important;
}
table.dataTable thead > tr:first-child > th .dt-column-order::after {
  display: none !important;
}
table.dataTable thead > tr:first-child > th .dt-column-order::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 6l3-3 3 3M5 10l3 3 3-3'/%3E%3C/svg%3E");
}
table.dataTable thead > tr:first-child > th:hover .dt-column-order::before {
  opacity: 0.85;
}
table.dataTable thead > tr:first-child > th.dt-ordering-asc {
  color: var(--app-primary);
}
table.dataTable thead > tr:first-child > th.dt-ordering-asc .dt-column-order::before {
  opacity: 1 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232563eb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 13V3M4 7l4-4 4 4'/%3E%3C/svg%3E");
}
table.dataTable thead > tr:first-child > th.dt-ordering-desc {
  color: var(--app-primary);
}
table.dataTable thead > tr:first-child > th.dt-ordering-desc .dt-column-order::before {
  opacity: 1 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232563eb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3v10M4 9l4 4 4-4'/%3E%3C/svg%3E");
}
table.grid thead tr.grid-filters input,
table.grid thead tr.grid-filters select {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.35rem;
  background-color: #fff;
  color: var(--app-text);
  height: 1.85rem;
}
table.grid thead tr.grid-filters input:focus,
table.grid thead tr.grid-filters select:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
table.grid tbody td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 0.9rem;
}
table.grid tbody tr:hover td {
  background-color: #f8fafc;
}
table.grid tfoot td {
  padding: 0.65rem 0.6rem;
  background-color: #f8fafc;
  border-top: 2px solid var(--app-border);
}

.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  line-height: 56px;
  background: var(--app-surface);
  border-top: 1px solid var(--app-border);
  font-size: 0.85rem;
}

.month-picker{display:flex;flex-wrap:wrap;gap:.25rem;min-width:0;position:relative;z-index:1}
.month-btn{border:1px solid #dee2e6;background:#fff;color:#374151;border-radius:4px;padding:.25rem .65rem;font-size:.8rem;font-weight:500;line-height:1.3;white-space:nowrap;text-transform:capitalize;cursor:pointer;transition:background-color .15s,border-color .15s,color .15s,box-shadow .15s}
.month-btn:hover:not(:disabled):not(.active){background:#eef2ff;border-color:#a5b4fc;color:#1d4ed8}
.month-btn:focus-visible{outline:0;box-shadow:0 0 0 .2rem rgba(37,99,235,.25)}
.month-btn.billed:not(.active){background:#ecfdf3;border-color:#a7e3c0;color:#0f5132}
.month-btn.active{background:#2563eb;border-color:#2563eb;color:#fff;box-shadow:0 1px 3px rgba(37,99,235,.4)}
.month-btn:disabled{background:#f8f9fa;border-color:#eceff1;color:#c3c9cf;cursor:default}


.app-navbar .dropdown-item.active {
  color: var(--app-primary);
  background-color: #eff6ff;
  font-weight: 600;
}
