/* ============================================================
   Design tokens -- 2026 refresh
   ------------------------------------------------------------
   Previous revision used a flat mid-gray "--paper" (#f7f8fa) as the page
   background everywhere. The user's own words: "The UI is not impressive...
   more 2026-es... use white background for lighter look." This revision
   keeps the same brand palette (indigo + amber -- ledger-blue trust, POS
   amber energy) and the same class names throughout this file (nothing in
   any .html/.js changes because of this revision -- every selector below
   still targets the exact same classes the markup already uses), but:
     - The page background is now near-white (--paper: #fbfbfd, cards sit on
       pure white #ffffff), not the previous flat gray.
     - Shadows are softer/larger-radius ("soft-UI" cards) instead of hard
       1px borders doing all the work.
     - Status badges are soft-tint pills (colored text on a pale tint of
       that same color) instead of solid saturated rectangles -- the
       dominant "2026 SaaS" badge style, and much easier on the eye across
       a page with a dozen status cells.
     - Buttons/inputs/modals got larger corner radii, a subtle hover lift,
       and calmer focus rings (a soft indigo glow instead of Bootstrap's
       default hard blue ring).
     - The sidebar keeps its dark indigo -- a light content area next to a
       dark nav rail is itself a deliberate "lighter look" (the eye rests on
       white for 95% of the screen), and it's the single most common shape
       of a 2026 SaaS admin shell -- but gets a subtle gradient, a left-edge
       active-page indicator, and softer hover states instead of a flat
       block color.
     - DataTables and Select2 (both loaded from CDN with their own, dated
       default skins) are re-skinned at the bottom of this file so they
       match the rest of the page instead of visibly clashing with it.
   Type: Sora for headings (geometric, confident), Inter for UI/body
   (dense-data legible), IBM Plex Mono for anything numeric -- invoice
   totals, stock quantities, receipt figures -- so figures always align on
   a fixed-width grid, the way a real ledger or receipt does.
   ============================================================ */
:root {
  --ink: #1a1d29;
  --ink-soft: #6b7280;
  --ink-faint: #9ca3af;
  --paper: #fbfbfd;
  --paper-raised: #ffffff;
  --paper-sunken: #f4f5f8;

  --indigo-950: #141833;
  --indigo-900: #1c2451;
  --indigo-700: #2b3a67;
  --indigo-500: #3d54a3;
  --indigo-400: #5b74c7;
  --indigo-100: #e7ebf7;
  --indigo-50: #f2f4fc;

  --amber-600: #d97328;
  --amber-500: #e8873a;
  --amber-100: #fbe8d5;
  --amber-50: #fdf3e8;

  --line: #eaecf1;
  --line-soft: #f1f2f6;

  --success: #16825a;
  --success-tint: #e5f6ee;
  --danger: #c23b3b;
  --danger-tint: #fbeaea;
  --info: #2f6fb0;
  --info-tint: #e8f1fa;
  --warning: #b7791f;
  --warning-tint: #fdf3d9;

  --shadow-xs: 0 1px 2px rgba(20, 24, 51, 0.04);
  --shadow-sm: 0 2px 8px rgba(20, 24, 51, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 24, 51, 0.08);
  --shadow-lg: 0 20px 60px rgba(10, 14, 30, 0.16);
  --shadow-focus: 0 0 0 0.2rem rgba(61, 84, 163, 0.15);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --bs-primary: var(--indigo-700);
  --bs-primary-rgb: 43, 58, 103;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-border-radius: 0.35rem;
  --bs-border-radius-sm: 0.35rem;
  --bs-border-radius-lg: 0.35rem;
  --bs-border-radius-xl: 0.35rem;
  --bs-box-shadow: var(--shadow-sm);
  --bs-link-color: var(--indigo-500);
  --bs-link-hover-color: var(--indigo-700);
}

* { scrollbar-width: thin; scrollbar-color: #c9cede transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #c9cede; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #a7aec4; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .brand-font {
  font-family: "Sora", "Inter", sans-serif;
  letter-spacing: -0.015em;
  color: var(--indigo-950);
}

a { transition: color 0.15s var(--ease); }

.num, .table td.num, .table th.num {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.text-secondary { color: var(--ink-soft) !important; }

/* ---------- App shell: sidebar + topbar ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--paper);
}

.app-sidebar {
  width: 365px;
  flex-shrink: 0;
  background: linear-gradient(190deg, var(--indigo-900) 0%, var(--indigo-950) 100%);
  color: #cfd6ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 16px rgba(10, 14, 30, 0.12);
  z-index: 10;
}

.app-sidebar .brand {
  padding: 1.35rem 1.25rem 1.1rem;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar .brand .tick {
  width: 11px; height: 11px; border-radius: 3px;
  background: var(--amber-500);
  box-shadow: 0 0 0 4px rgba(232, 135, 58, 0.18);
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* A tenant-uploaded logo (see CompaniesController's logo upload endpoint) replaces the .tick
   mark above -- sized to roughly match that mark's visual weight in the sidebar header, not the
   logo's native resolution (uploads are capped at 2MB but not at a fixed pixel size). */
.app-sidebar .brand .brand-logo {
  height: 26px;
  max-width: 140px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
  background: #fff;
  padding: 2px;
}

.app-sidebar nav {
  flex: 1;
  padding: 0.85rem 0.65rem;
  overflow-y: auto;
}

.app-sidebar .nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #7c86ad;
  padding: 1rem 0.7rem 0.35rem;
}

.app-sidebar .nav-link {
  position: relative;
  color: #cfd6ee;
  border-radius: 0.6rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.1rem;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}

.app-sidebar .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; opacity: 0.85; }

.app-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.app-sidebar .nav-link.active {
  background: rgba(232, 135, 58, 0.14);
  color: #fff;
  font-weight: 600;
}

.app-sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.65rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--amber-500);
}

.app-sidebar .nav-link.active i { opacity: 1; color: var(--amber-500); }

.app-sidebar .sidebar-foot {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.app-topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  padding: 0.9rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}

.app-topbar h5 {
  font-weight: 700;
}

/* Small initials chip next to the signed-in user's email -- see layout.js's initials() helper. */
.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--indigo-100);
  color: var(--indigo-700);
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.app-content {
  padding: 1.75rem;
  animation: content-fade-in 0.25s var(--ease);
}

@keyframes content-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Cards, receipt motif ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--paper-raised);
}

.card-header {
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line-soft);
  border-top-left-radius: var(--bs-border-radius-lg) !important;
  border-top-right-radius: var(--bs-border-radius-lg) !important;
  font-family: "Sora", sans-serif;
  font-weight: 600;
  padding: 0.95rem 1.25rem;
}

.card-body { padding: 1.25rem; }

/* A torn/perforated edge, echoing a receipt tear-off -- used sparingly
   as this build's one signature flourish, on receipt-adjacent cards. */
.receipt-edge {
  position: relative;
}
.receipt-edge::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 10px;
  background-image: radial-gradient(circle at 8px 0, transparent 6px, var(--paper) 6.5px);
  background-size: 16px 10px;
  background-repeat: repeat-x;
}

.stat-card {
  position: relative;
  border-radius: var(--bs-border-radius-lg);
  padding: 1.2rem 1.35rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--indigo-500), var(--amber-500));
  opacity: 0.85;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-card .stat-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--indigo-950);
  margin-top: 0.2rem;
}

/* ---------- Status badges: soft-tint pills instead of solid blocks ---------- */
.badge {
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  padding: 0.42em 0.75em;
  border-radius: 999px;
}

.badge-status-draft { background: #eef0f4; color: var(--ink-soft); }
.badge-status-posted, .badge-status-completed, .badge-status-accepted, .badge-status-active { background: var(--success-tint); color: var(--success); }
.badge-status-cancelled, .badge-status-voided, .badge-status-rejected, .badge-status-inactive { background: var(--danger-tint); color: var(--danger); }
.badge-status-open, .badge-status-sent { background: var(--info-tint); color: var(--info); }
.badge-status-closed, .badge-status-expired { background: #eef0f4; color: var(--ink-soft); }
.badge-status-pending { background: var(--warning-tint); color: var(--warning); }

/* ---------- Buttons ---------- */
.btn {
  height: 35px;
  font-weight: 600;
  border-radius: var(--bs-border-radius);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background 0.12s var(--ease), border-color 0.12s var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--indigo-700);
  border-color: var(--indigo-700);
  box-shadow: 0 2px 10px rgba(43, 58, 103, 0.25);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--indigo-900);
  border-color: var(--indigo-900);
  box-shadow: 0 4px 14px rgba(43, 58, 103, 0.32);
}

.btn-outline-secondary {
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-outline-secondary:hover {
  background: var(--paper-sunken);
  border-color: #d4d7e0;
  color: var(--ink);
}

.btn-outline-danger:hover { box-shadow: 0 2px 10px rgba(194, 59, 59, 0.2); }

.btn-amber {
  background: var(--amber-500);
  border-color: var(--amber-500);
  color: #1c2451;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(232, 135, 58, 0.3);
}
.btn-amber:hover {
  background: var(--amber-600);
  border-color: var(--amber-600);
  color: #1c2451;
}

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-color: var(--line);
  border-radius: var(--bs-border-radius);
}
.form-control:focus, .form-select:focus {
  border-color: var(--indigo-400);
  box-shadow: var(--shadow-focus);
}
.form-label { font-weight: 600; font-size: 0.86rem; color: var(--ink); }
.form-switch .form-check-input:checked { background-color: var(--indigo-700); border-color: var(--indigo-700); }

/* ---------- Tables ---------- */
.table {
  --bs-table-bg: transparent;
  vertical-align: middle;
}
.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  background: var(--paper-sunken);
}
.table td, .table th { border-color: var(--line-soft); padding: 0.7rem 0.85rem; }
.table-hover > tbody > tr:hover > * { background-color: var(--indigo-50); }

/* ---------- Modals ---------- */
.modal-content {
  border: none;
  border-radius: var(--bs-border-radius-xl);
  box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--line-soft); padding: 1.15rem 1.5rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--line-soft); padding: 1.1rem 1.5rem; }
.modal-title { font-family: "Sora", sans-serif; font-weight: 700; }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(232, 135, 58, 0.25), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(61, 84, 163, 0.35), transparent 45%),
    linear-gradient(160deg, var(--indigo-950), var(--indigo-700));
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper-raised);
  border-radius: var(--bs-border-radius-xl);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
}

/* Same page chrome as .auth-card (login/register), just wide enough for a document's line-item
   table -- used by the public, anonymous verify.html page. */
.verify-card {
  width: 100%;
  max-width: 640px;
  background: var(--paper-raised);
  border-radius: var(--bs-border-radius-xl);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
}

.verify-card .verify-logo {
  max-height: 48px;
  max-width: 180px;
  object-fit: contain;
}

/* POS terminal */
.pos-cart-line { border-bottom: 1px dashed var(--line); padding: 0.5rem 0; }
.pos-total { font-family: "IBM Plex Mono", monospace; font-size: 2rem; font-weight: 700; color: var(--indigo-950); }

/* Skeleton loading state for tables while fetching */
.skeleton-row td { background: linear-gradient(90deg, #eef0f4 25%, #f7f8fa 37%, #eef0f4 63%); background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- DataTables re-skin (default CDN skin looks dated next to the rest of this page) ---------- */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line);
  border-radius: var(--bs-border-radius);
  /* padding: 0.3rem 0.6rem; */
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  outline: none;
  border-color: var(--indigo-400);
  box-shadow: var(--shadow-focus);
}
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate {
  color: var(--ink-soft);
  font-size: 0.86rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--bs-border-radius-sm) !important;
  border: 1px solid transparent !important;
  margin-left: 2px;
  /* padding: 0.3rem 0.65rem !important; */
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--indigo-700) !important;
  border-color: var(--indigo-700) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--paper-sunken) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.4;
}
table.dataTable thead .sorting:before, table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_desc:after {
  opacity: 0.35;
}

/* ---------- Select2 re-skin ---------- */
.select2-container--default .select2-selection--single {
  border: 1px solid var(--line);
  border-radius: var(--bs-border-radius);
  height: calc(1.5em + 0.75rem + 2px);
  padding: 0.2rem 0.1rem;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.85rem;
  color: var(--ink);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: calc(1.5em + 0.75rem);
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--indigo-400);
  box-shadow: var(--shadow-focus);
}
.select2-dropdown {
  border-color: var(--line);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--indigo-500);
}
.select2-search--dropdown .select2-search__field {
  border: 1px solid var(--line);
  border-radius: var(--bs-border-radius-sm);
}


.page-link {
    height: 30px;
    padding-top: 6px;
    font-size: 12px;
}

.dataTables_info {
	font-size: 12px;
}


/* Compact styling without zoom or transform scaling */

/* 16px → 14.4px:
   reduces all rem-based fonts, spacing, and Bootstrap controls by 10%. */
html {
  font-size: 90%;
}

/* Reduce dimensions originally defined in pixels */
.app-sidebar {
  width: 328.5px; /* Previously 365px */
}

.btn {
  height: 31.5px; /* Previously 35px */
}

.app-sidebar .brand .tick {
  width: 9.9px;
  height: 9.9px;
  border-radius: 2.7px;
}

.app-sidebar .brand .brand-logo {
  height: 23.4px;
  max-width: 126px;
  border-radius: 3.6px;
  padding: 1.8px;
}

.app-sidebar .nav-link.active::before {
  width: 2.7px;
  border-radius: 0 2.7px 2.7px 0;
}

.auth-card {
  max-width: 378px; /* Previously 420px */
}

.verify-card {
  max-width: 576px; /* Previously 640px */
}

.verify-card .verify-logo {
  max-height: 43.2px;
  max-width: 162px;
}

.page-link {
  height: 27px;
  padding-top: 5.4px;
  font-size: 10.8px;
}

.dataTables_info {
  font-size: 10.8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  margin-left: 1.8px;
}

/* Smaller shadows */
:root {
  --shadow-xs: 0 0.9px 1.8px rgba(20, 24, 51, 0.04);
  --shadow-sm: 0 1.8px 7.2px rgba(20, 24, 51, 0.06);
  --shadow-md: 0 7.2px 21.6px rgba(20, 24, 51, 0.08);
  --shadow-lg: 0 18px 54px rgba(10, 14, 30, 0.16);
}

.app-sidebar {
  box-shadow: 1.8px 0 14.4px rgba(10, 14, 30, 0.12);
}

/* Smaller scrollbars */
*::-webkit-scrollbar {
  width: 7.2px;
  height: 7.2px;
}

*::-webkit-scrollbar-thumb {
  border-radius: 7.2px;
}

/* Keep viewport-height sections at full height */
.app-shell,
.auth-page {
  min-height: 100vh;
}

.app-sidebar {
  height: 100vh;
}

/* ---------- Toastr re-skin ---------- */
#toast-container > div {
  border-radius: var(--bs-border-radius);
  box-shadow: var(--shadow-lg);
  opacity: 0.98;
}
#toast-container > .toast-success { background-color: var(--success); }
#toast-container > .toast-error { background-color: var(--danger); }

@media (max-width: 900px) {
  .app-sidebar { position: fixed; z-index: 1040; transform: translateX(-100%); transition: transform .2s ease; }
  .app-sidebar.open { transform: translateX(0); }
}
