/* =========================================================
   common.css — shared design system for Invoice Management UI
   (login, invoices list, invoice upload, invoice extraction, ...)
   ========================================================= */

:root {
  --primary: #13379a;
  --primary-dark: #0e266f;
  --primary-rgb: 19, 55, 154;
  /* keep in sync with --primary, used for rgba() shadows/focus rings */
  --ink: #16213e;
  --muted: #6b7a99;
  --panel-bg: #eef2fb;
  --border: #e3e8f4;
  --bg: #f4f6fb;
  --danger: #e0393e;
  --success: #1c9a55;
}

html{ overflow-x: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

/* =========================================================
   LOGIN PAGE ILLUSTRATION (only used by the auth screen)
   ========================================================= */

.auth-wrapper {
  min-height: 100vh;
}

.auth-left {
  background: linear-gradient(180deg, #eef3fc 0%, #e7edfa 100%);
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.auth-left .brand-icon {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 25px rgba(var(--primary-rgb), 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 22px;
}

.auth-left h1 {
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--ink);
}

.auth-left .tagline {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.auth-left p.desc {
  color: var(--muted);
  max-width: 320px;
  margin: 0 auto 30px;
}

.illustration {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 260px;
  margin-bottom: 30px;
}

.illu-laptop {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 230px;
  height: 150px;
  background: #fff;
  border: 8px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 20px 30px rgba(22, 33, 62, 0.15);
}

.illu-laptop:after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: -25px;
  right: -25px;
  height: 14px;
  background: #b9c2d6;
  border-radius: 4px;
}

.illu-invoice-title {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary);
  padding: 12px 0 4px 14px;
  letter-spacing: 1px;
}

.illu-lines span {
  display: block;
  height: 6px;
  background: #dbe2f2;
  border-radius: 3px;
  margin: 8px 14px;
}

.illu-lines span:nth-child(2) {
  width: 70%
}

.illu-lines span:nth-child(3) {
  width: 50%
}

.illu-check {
  position: absolute;
  bottom: 14px;
  right: 20px;
  width: 34px;
  height: 34px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 16px;
}

.illu-folders {
  position: absolute;
  left: 0;
  bottom: 20px;
  display: flex;
}

.illu-folders .folder {
  width: 26px;
  height: 90px;
  background: var(--primary);
  border-radius: 4px;
  margin-right: 4px;
  position: relative;
  box-shadow: 0 8px 14px rgba(var(--primary-rgb), 0.2);
}

.illu-folders .folder:nth-child(2) {
  background: #4270e6;
}

.illu-folders .folder:nth-child(3) {
  background: #5a84ec;
}

.illu-folders .folder:after {
  content: "";
  position: absolute;
  top: 14px;
  left: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.illu-calculator {
  position: absolute;
  left: 6px;
  bottom: -6px;
  width: 92px;
  height: 60px;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: 0 10px 18px rgba(22, 33, 62, 0.2);
}

.illu-calculator:before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  height: 12px;
  background: #7ee0c3;
  border-radius: 3px;
}

.illu-calculator .keys {
  position: absolute;
  top: 26px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.illu-calculator .keys span {
  background: #3a4a72;
  border-radius: 2px;
}

.illu-plant {
  position: absolute;
  right: 10px;
  bottom: 20px;
  width: 46px;
  text-align: center;
}

.illu-plant .pot {
  width: 36px;
  height: 28px;
  background: var(--ink);
  border-radius: 0 0 8px 8px;
  margin: 0 auto;
}

.illu-plant .leaves {
  font-size: 34px;
  color: #3fae6a;
  line-height: 1;
}

.illu-papers {
  position: absolute;
  right: -6px;
  bottom: 0;
  width: 80px;
  height: 56px;
}

.illu-papers .sheet {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 14px rgba(22, 33, 62, 0.12);
}

.illu-papers .sheet:nth-child(1) {
  transform: rotate(-4deg);
}

.illu-papers .sheet:nth-child(2) {
  transform: rotate(3deg);
}

.illu-papers .sheet:nth-child(3) {
  transform: rotate(-1deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.illu-papers .sheet:nth-child(3):before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 6px solid var(--primary);
  border-right-color: transparent;
}

.feature-row {
  display: flex;
  gap: 34px;
  margin-top: 10px;
}

.feature-item {
  text-align: center;
  max-width: 100px;
}

.feature-item .feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 14px rgba(22, 33, 62, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--primary);
  margin: 0 auto 10px;
}

.feature-item .feature-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.feature-item .feature-sub {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.auth-right {
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 34px;
  box-shadow: 0 10px 40px rgba(22, 33, 62, 0.06);
}

.avatar-circle {
  width: 68px;
  height: 68px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--primary);
  margin: 0 auto 18px;
}

.login-card h2 {
  font-weight: 700;
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.login-card .subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 26px;
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
}

.input-icon-wrap .toggle-eye {
  left: auto;
  right: 14px;
  cursor: pointer;
}

.input-icon-wrap .form-control {
  padding-left: 40px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 0.92rem;
}

.input-icon-wrap .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
  background: #fff;
}

.input-icon-wrap .form-control.pr-icon {
  padding-right: 40px;
}

.options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 22px;
}

.options-row .form-check-label {
  font-size: 0.85rem;
  color: var(--ink);
}

.forgot-link {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.forgot-link:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

.btn-signin {
  background: var(--primary);
  border-color: var(--primary);
  height: 48px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-signin:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.divider {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 20px 0;
}

.divider:before,
.divider:after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  padding: 0 12px;
}

.btn-sso {
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  background: #fff;
}

.btn-sso:hover {
  background: #f2f6ff;
  color: var(--primary-dark);
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 22px;
}

/* =========================================================
   TOP NAVBAR (used stand-alone on login/upload, or as
   .content-topbar inside the app shell)
   ========================================================= */

.topbar {
  background: linear-gradient(90deg, #16255c 0%, #1c3aa8 100%);
  min-height: 66px;
  display: flex;
  align-items: center;
  padding: 12px 26px;
  color: #fff;
  gap: 16px;
}

.topbar-heading {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.topbar-heading .brand-sub {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.topbar-actions {
  gap: 16px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.topbar .brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.15rem;
}

.topbar .brand .brand-icon {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 1rem;
}

.topbar .brand-sub {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 1px;
}

.topbar .user-area {
  display: flex;
  align-items: center;
  gap: 22px;
}

.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.topbar .user-chip .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.topbar .signout {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
}

.topbar .signout:hover {
  opacity: 1;
  color: #fff;
}

.topbar .back-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  text-decoration: none;
  font-size: 1rem;
}

.topbar .back-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.topbar .help-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  opacity: 0.92;
}

.topbar .help-link:hover {
  opacity: 1;
  color: #fff;
}

.topbar .btn-outline-light-sm {
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  background: transparent;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 8px 16px;
  white-space: nowrap;
}

.topbar .btn-outline-light-sm:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* =========================================================
   APP SHELL — sidebar + main content layout
   ========================================================= */

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

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 250px;
  min-width: 250px;
  background: #101a3d;
  color: #cbd3ea;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, min-width 0.2s ease, transform 0.2s ease;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1030;
}

.sidebar-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 62px;
}

.sidebar-brand .brand-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  margin-top: 2px; /* optical alignment against the first line of wrapped brand text */
}

.sidebar-brand .brand-text {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: break-word;
  min-width: 0;
  flex: 1;
}

.sidebar-brand .brand-text small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: #8b95bd;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c689a;
  padding: 18px 20px 8px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
}

.sidebar-nav .nav-item {
  padding: 2px 12px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cbd3ea;
  font-size: 0.87rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav .nav-link i {
  font-size: 1.05rem;
  min-width: 20px;
  text-align: center;
  color: #8b95bd;
}

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

.sidebar-nav .nav-link:hover i {
  color: #fff;
}

.sidebar-nav .nav-item.active .nav-link {
  background: var(--primary);
  color: #fff;
}

.sidebar-nav .nav-item.active .nav-link i {
  color: #fff;
}

.sidebar-nav .nav-link .badge-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 20px;
  padding: 2px 8px;
}

.sidebar-nav .nav-item.active .nav-link .badge-count {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer .avatar {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.sidebar-footer .user-meta {
  overflow: hidden;
  white-space: nowrap;
  line-height: 1.25;
}

.sidebar-footer .user-meta .name {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.sidebar-footer .user-meta .role {
  color: #8b95bd;
  font-size: 0.72rem;
}

.sidebar-footer .signout-icon {
  margin-left: auto;
  color: #8b95bd;
  font-size: 1rem;
}

.sidebar-footer .signout-icon:hover {
  color: #fff;
}

.sidebar.collapsed {
  width: 76px;
  min-width: 76px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link .badge-count,
.sidebar.collapsed .user-meta,
.sidebar.collapsed .signout-icon {
  display: none;
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
}

.sidebar.collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .sidebar-footer {
  justify-content: center;
}

/* ---------- MAIN CONTENT (sibling of .sidebar inside .app-shell) ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  /* prevents table/content overflow from stretching the flex item */
  display: flex;
  flex-direction: column;
}

/* .sidebar is now position:fixed (taken out of normal flow), so main-content
   must reserve space for it manually via margin-left. Desktop only — on
   mobile the sidebar becomes a full overlay drawer instead of pushing
   content, so margin-left stays 0 there. */
@media (min-width: 992px) {
  .main-content {
    margin-left: 250px;
    transition: margin-left 0.2s ease;
  }
  .sidebar.collapsed ~ .main-content {
    margin-left: 76px;
  }
}

.content-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 1.1rem;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- MOBILE: sidebar becomes an off-canvas drawer ---------- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 61, 0.5);
  z-index: 1020;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.show {
    display: block;
  }
}

/* =========================================================
   PAGE LAYOUT
   ========================================================= */

.page-wrap {
  padding: 26px 30px 50px;
  max-width: 1400px;
  margin: 40px 25px;
  /* margin: 0 auto; */
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.page-header p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* =========================================================
   CARD PANEL
   ========================================================= */

.card-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(22, 33, 62, 0.03);
}

.card-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.card-panel-header i {
  color: var(--primary);
  font-size: 1.1rem;
}

.card-panel-header h2 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.card-panel-body {
  padding: 24px;
}

/* Bootstrap's .row carries -15px side margins that are normally cancelled out
   by a .container's matching padding. We use .row directly inside
   card-panel-body with no .container wrapper, so without this override the
   row bleeds 15px past the card on both sides — this is what caused the
   page-wide horizontal scrollbar and right-edge fields (e.g. "Bank Account
   for Payment") getting cut off. */
.card-panel-body > .row {
  margin-left: -12px;
  margin-right: -12px;
}

.card-panel-body > .row > [class*="col-"] {
  padding-left: 12px;
  padding-right: 12px;
}

/* =========================================================
   FORM ELEMENTS
   ========================================================= */

.form-group label {
  font-weight: 600;
  font-size: 0.83rem;
  color: var(--ink);
  margin-bottom: 6px;
  display: block;
}

.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}

.filters-card label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  margin-bottom: 6px;
  display: block;
}

.form-control {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.88rem;
  height: 42px;
  color: var(--ink);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

textarea.form-control {
  height: auto;
  resize: vertical;
}

.input-with-icon {
  position: relative;
}

.input-with-icon i,
.input-with-icon .prefix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.input-with-icon i {
  right: 12px;
}

.input-with-icon .prefix {
  left: 12px;
  font-weight: 600;
}

.input-with-icon .form-control {
  padding-right: 34px; /* reserves room for the trailing icon (calendar, eye, etc.) so text never runs under it */
}

.input-with-icon .form-control.has-prefix {
  padding-left: 30px;
}

/* clickable icon variant (password show/hide) — the base .input-with-icon i
   rule above is pointer-events:none since it's normally decorative
   (calendar/currency icons); this opts a specific icon back into being
   interactive without affecting those. */
.input-with-icon .toggle-eye {
  pointer-events: auto;
  cursor: pointer;
}

/* date/amount range pairs used on filter bars */
.date-range-group,
.amount-range-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range-group .sep,
.amount-range-group .sep {
  color: var(--muted);
  font-size: 0.85rem;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn-app-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 10px 20px;
}

.btn-app-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-app-outline {
  border: 1px solid var(--border);
  color: var(--ink);
  background: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 10px 20px;
}

.btn-app-outline:hover {
  background: #f4f6fb;
}

.btn-app-success-outline {
  border: 1px solid var(--success);
  color: var(--success);
  background: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 10px 20px;
}

.btn-app-success-outline:hover {
  background: #eafaf1;
}

.btn-upload {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 10px 18px;
  white-space: nowrap;
}

.btn-upload:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-apply {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: 8px;
  height: 42px;
  white-space: nowrap;
}

.btn-apply:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-clear {
  border: 1px solid var(--border);
  color: var(--ink);
  background: #fff;
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: 8px;
  height: 42px;
  white-space: nowrap;
}

.btn-clear:hover {
  background: #f4f6fb;
}

/* =========================================================
   FILE UPLOAD PAGE
   ========================================================= */

.upload-card{
  background:#fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(22,33,62,0.04);
  overflow: hidden;
}
.upload-card-header{
  display:flex;
  align-items:flex-start;
  gap: 18px;
  padding: 28px 30px 22px;
}
.upload-card-header .header-icon{
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  background: #e6eeff;
  color: var(--primary);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 24px;
}
.upload-card-header h1{
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.upload-card-header p{
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}
.upload-card-body{
  padding: 4px 30px 6px;
  border-top: 1px solid var(--border);
  padding-top: 26px;
}
.form-control.select-field{
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.9rem;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237d879c' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.form-control.select-field:focus{
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.1);
}
.dropzone{
  border: 2px dashed #bcd0f7;
  background: #f5f8ff;
  border-radius: 12px;
  padding: 42px 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dropzone:hover, .dropzone.dragover{
  background: #eef3ff;
  border-color: var(--primary);
}
.dropzone-icon{
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  position: relative;
}
.dropzone-icon .doc{
  width: 62px;
  height: 76px;
  background: #fff;
  border: 2px solid #a9c1f2;
  border-radius: 6px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}
.dropzone-icon .doc:before{
  content:"";
  position:absolute;
  top: 20px; left: 10px;
  width: 14px; height: 14px;
  border-radius:50%;
  background:#bcd0f7;
}
.dropzone-icon .doc:after{
  content:"";
  position:absolute;
  bottom: 8px; left: 8px; right: 8px;
  height: 22px;
  background: #d7e3fb;
  clip-path: polygon(0 100%, 30% 40%, 55% 70%, 75% 20%, 100% 100%);
}
.dropzone-icon .badge-circle{
  position:absolute;
  bottom: -4px;
  right: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 14px;
  border: 3px solid #f5f8ff;
}
.dropzone-text{
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.dropzone-or{
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.btn-browse{
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: 8px;
  padding: 8px 20px;
}
.btn-browse:hover{
  background: #eef3ff;
  color: var(--primary-dark);
}
.dropzone-hint{
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 14px;
  line-height: 1.5;
}
.file-preview{
  display:none;
  align-items:center;
  justify-content:space-between;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 0.85rem;
}
.file-preview .file-info{
  display:flex;
  align-items:center;
  gap: 10px;
}
.file-preview .file-info i{
  color: var(--primary);
  font-size: 1.2rem;
}
.file-preview .remove-file{
  color: var(--muted);
  cursor: pointer;
  background:none;
  border:none;
  font-size: 1rem;
}
.file-preview .remove-file:hover{ color:#e0393e; }
.upload-card-footer{
  border-top: 1px solid var(--border);
  padding: 20px 30px;
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  flex-wrap: wrap;
  background: #fafbfd;
}
.btn-submit{
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 10px 22px;
  color: #fff;
}
.btn-submit:hover{
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}
.btn-clear-form{
  border: 1px solid var(--border);
  color: var(--ink);
  background: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 10px 22px;
}
.btn-clear-form:hover{ background:#f4f6fb; }
.btn-close-form{
  border: 1px solid var(--border);
  color: var(--ink);
  background: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 10px 22px;
}
.btn-close-form:hover{ background:#f4f6fb; }
@media (max-width: 575.98px){
  .upload-card-header{ flex-direction: column; align-items: center; text-align:center; }
  .upload-card-footer{ justify-content: stretch; }
  .upload-card-footer .btn{ flex:1; }
}

/* =========================================================
   STATUS BADGES
   ========================================================= */

.badge-status {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge-paid {
  background: #e2f6ea;
  color: #1c9a55;
}

.badge-pending-payment {
  background: #fef3d9;
  color: #c68a12;
}

.badge-pending-approval {
  background: #e6eeff;
  color: var(--primary);
}

/* =========================================================
   DATA TABLE (invoice list, and any other listing screen)
   ========================================================= */

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.table-card-header h2 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
}

.btn-refresh {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh:hover {
  background: #f4f6fb;
  color: var(--ink);
}

table.invoice-table {
  width: 100%;
  margin-bottom: 0;
  font-size: 0.85rem;
  white-space: nowrap;
}

table.invoice-table thead th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  border-top: none;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

table.invoice-table thead th.active-sort {
  color: var(--primary);
}

table.invoice-table thead th i {
  font-size: 0.7rem;
  margin-left: 3px;
  opacity: 0.55;
}

table.invoice-table thead th.active-sort i {
  opacity: 1;
}

table.invoice-table tbody td {
  padding: 13px 16px;
  vertical-align: middle;
  border-top: 1px solid var(--border);
  color: var(--ink);
}

table.invoice-table tbody tr:hover {
  background: #f8fafc;
}

table.invoice-table tbody td.invoice-number {
  font-weight: 600;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.show-entries {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink);
}

.show-entries select {
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 4px 8px;
  font-size: 0.85rem;
}

.pagination-wrap .page-item .page-link {
  border-radius: 6px;
  margin: 0 3px;
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.85rem;
  padding: 6px 12px;
}

.pagination-wrap .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination-wrap .page-item .page-link:hover {
  background: #f4f6fb;
}

.entries-note {
  font-size: 0.83rem;
  color: var(--muted);
}

/* =========================================================
   LINE ITEMS TABLE (invoice extraction / review screen)
   ========================================================= */

.form-grid label {
  display: block;
}

.line-items-table {
  width: 100%;
  min-width: 720px;
  margin-bottom: 0;
  font-size: 0.86rem;
}

.line-items-table thead th {
  background: #f8fafc;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border);
  border-top: none;
  padding: 10px 12px;
  white-space: nowrap;
}

.line-items-table thead th .required {
  color: var(--danger);
}

.line-items-table tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  border-top: 1px solid var(--border);
}

.line-items-table tbody tr:hover {
  background: #fafbfd;
}

.line-items-table .form-control {
  height: 38px;
  font-size: 0.85rem;
}

.line-no-cell {
  width: 46px;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
}

.line-total-cell .input-with-icon .prefix {
  font-size: 0.8rem;
}

.btn-remove-line {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #fdecea;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-line:hover {
  background: #fbdad8;
}

.btn-add-line {
  border: 1px dashed var(--primary);
  color: var(--primary);
  background: #f5f8ff;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 9px 18px;
}

.btn-add-line:hover {
  background: #eef3ff;
}

.totals-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.totals-row .totals-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.totals-row .totals-value {
  width: 180px;
}

.totals-row .totals-value .form-control {
  background: #f8fafc;
  font-weight: 700;
}

.line-items-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.action-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 18px 4px 4px;
}

/* =========================================================
   GL CODING PAGE
   ========================================================= */

/* topbar invoice-number pill (goes in the top-nav-bar actions slot) */
.invoice-number-pill{
  display:inline-block; background: rgba(255,255,255,0.15); color:#fff;
  font-weight: 700; font-size: 0.85rem; padding: 8px 14px; border-radius: 8px; white-space: nowrap;
}

/* read-only header info bar (replaces editable form-group grid when data can't be changed) */
.readonly-info-bar{ padding: 16px 24px; display:flex; flex-wrap:wrap; gap: 30px; }
.readonly-info-bar .info-item{ min-width: 140px; }
.readonly-info-bar .info-label{
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.readonly-info-bar .info-value{ font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.readonly-info-bar .info-value.highlight{ color: var(--primary); font-weight: 700; }
.card-panel-header .badge-readonly{ font-size: 0.72rem; font-weight: 500; color: var(--muted); margin-left: 6px; }

/* collapsible card-panel-header (Bootstrap collapse handles aria-expanded automatically) */
.card-panel-header.collapsible{ cursor: pointer; justify-content: space-between; }
.collapse-toggle-icon{ margin-left: auto; color: var(--muted); transition: transform 0.2s ease; }
.card-panel-header.collapsible[aria-expanded="false"] .collapse-toggle-icon{ transform: rotate(-90deg); }

/* tabs (Invoice Line Items / GL Coding Details) */
.nav-tabs-app{ border-bottom: 1px solid var(--border); padding: 0 24px; }
.nav-tabs-app .nav-link{
  border: none; color: var(--muted); font-weight: 600; font-size: 0.88rem;
  padding: 14px 4px; margin-right: 28px; border-bottom: 2px solid transparent; border-radius: 0;
}
.nav-tabs-app .nav-link.active{ color: var(--primary); border-bottom-color: var(--primary); background: none; }

/* two-column split: line items + summary on the left, GL coding editor on the right */
.gl-split{ display:flex; gap: 20px; align-items:flex-start; padding: 20px; }
.gl-split-left{ flex: 0 0 380px; max-width: 380px; }
.gl-split-right{ flex: 1; min-width: 0; }
@media (max-width: 1199.98px){
  .gl-split{ flex-direction: column; }
  .gl-split-left{ max-width: 100%; flex: 1 1 auto; width: 100%; }
}

/* left: invoice line items mini table with row selection */
.line-items-mini{ width: 100%; font-size: 0.82rem; margin-bottom: 0; }
.line-items-mini thead th{
  background: #f8fafc; font-size: 0.68rem; text-transform: uppercase; color: var(--muted);
  font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.line-items-mini tbody td{ padding: 10px; border-top: 1px solid var(--border); vertical-align: middle; }
.line-items-mini tbody tr{ cursor: pointer; }
.line-items-mini tbody tr:hover{ background: #f8fafc; }
.line-items-mini tbody tr.selected{ background: #eaf0ff; }
.line-items-mini tbody tr.selected td{ font-weight: 600; }
.line-items-mini tfoot td{ padding: 10px; font-weight: 700; border-top: 2px solid var(--border); }

.badge-balanced{
  display:inline-flex; align-items:center; gap: 4px; background:#e2f6ea; color: var(--success);
  font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}

/* coding summary box under the line items table */
.coding-summary{ padding: 16px; }
.coding-summary .summary-row{ display:flex; align-items:center; justify-content:space-between; padding: 6px 0; font-size: 0.85rem; }
.coding-summary .summary-row .dot{ width: 8px; height: 8px; border-radius: 50%; display:inline-block; margin-right: 8px; }
.dot-primary{ background: var(--primary); }
.dot-success{ background: var(--success); }
.summary-alert-success{
  display:flex; align-items:center; gap: 8px; background:#e2f6ea; color: var(--success);
  font-size: 0.82rem; font-weight: 600; padding: 10px 14px; border-radius: 8px; margin-top: 10px;
}

/* right: GL coding editor for the selected line */
.gl-line-header{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.gl-line-header h3{ font-size: 0.95rem; font-weight: 700; color: var(--primary); margin: 0; }
.gl-line-header .line-item-name{ color: var(--ink); font-weight: 600; }
.gl-line-header .line-total-readout{ font-size: 0.9rem; font-weight: 700; white-space: nowrap; }
.gl-line-header .line-total-readout .value{ color: var(--primary); }

.gl-coding-table{ width: 100%; min-width: 760px; font-size: 0.83rem; margin-bottom: 0; }
.gl-coding-table thead th{
  background: #f8fafc; font-weight: 700; font-size: 0.72rem; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.gl-coding-table thead th .required{ color: var(--danger); }
.gl-coding-table tbody td{ padding: 6px 8px; vertical-align: middle; border-top: 1px solid var(--border); }
.gl-coding-table .form-control{ height: 36px; font-size: 0.82rem; }
.gl-code-lookup{ position: relative; }
.gl-code-lookup i{ position:absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.8rem; pointer-events:none; }

.coded-total-row{ display:flex; justify-content:flex-end; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); font-weight: 700; font-size: 0.9rem; }
.coded-total-row .value{ color: var(--primary); }

/* bottom informational banner above the action footer */
.note-banner{ background: #eef3ff; color: var(--ink); font-size: 0.82rem; padding: 12px 24px; }
.note-banner strong{ color: var(--primary); }

/* =========================================================
   INVOICE APPROVAL TABLE — View Invoice + Action columns
   ========================================================= */

.btn-view-invoice{
  display:inline-flex; align-items:center; gap: 6px;
  border: 1px solid var(--primary); color: var(--primary); background: #fff;
  font-weight: 600; font-size: 0.8rem; border-radius: 6px; padding: 5px 14px; white-space: nowrap;
}
.btn-view-invoice:hover{ background: #f2f6ff; color: var(--primary-dark); }

.action-dropdown{ position: relative; display: inline-block; }
.btn-actions{
  display:inline-flex; align-items:center; gap: 6px;
  border: 1px solid var(--primary); color: var(--primary); background: #fff;
  font-weight: 600; font-size: 0.8rem; border-radius: 6px; padding: 5px 12px; white-space: nowrap;
}
.btn-actions:hover{ background: #f2f6ff; color: var(--primary-dark); }
.btn-actions::after{ display: none; } /* remove Bootstrap's default caret, we show our own icon */

.action-dropdown .dropdown-menu{
  min-width: 160px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(22,33,62,0.12);
}
.action-dropdown .dropdown-item{
  display:flex; align-items:center; gap: 8px;
  border-radius: 6px; padding: 8px 10px; font-size: 0.85rem; font-weight: 600;
}
.action-dropdown .dropdown-item i{ font-size: 1rem; }
.action-dropdown .dropdown-item.item-approve{ color: var(--success); }
.action-dropdown .dropdown-item.item-approve:hover{ background: #eafaf1; color: var(--success); }
.action-dropdown .dropdown-item.item-reject{ color: var(--danger); }
.action-dropdown .dropdown-item.item-reject:hover{ background: #fdecea; color: var(--danger); }

/* =========================================================
   INVOICE APPROVAL PAGE
   ========================================================= */

/* topbar user-chip with a role line underneath the name (Approver, Finance Admin, ...) */
.topbar .user-chip .user-meta{ line-height: 1.2; text-align: left; }
.topbar .user-chip .user-meta .name{ font-weight: 600; font-size: 0.9rem; }
.topbar .user-chip .user-meta .role{ font-size: 0.72rem; opacity: 0.75; }

.topbar .close-btn{
  display:flex; align-items:center; gap: 6px; color:#fff; text-decoration:none;
  font-size: 0.88rem; font-weight: 500; opacity: 0.92; white-space: nowrap;
}
.topbar .close-btn:hover{ opacity: 1; color:#fff; }

.btn-refresh-outline{
  border: 1px solid var(--primary); color: var(--primary); background:#fff;
  font-weight: 600; font-size: 0.86rem; border-radius: 8px; padding: 9px 18px; white-space: nowrap;
}
.btn-refresh-outline:hover{ background:#f5f8ff; }

/* toolbar row sitting above the table: total count on the left, sort description on the right */
.table-toolbar{
  display:flex; align-items:center; justify-content:space-between; flex-wrap: wrap;
  gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.table-toolbar .total-count{ font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.table-toolbar .total-count .count{ color: var(--primary); font-weight: 700; }
.table-toolbar .sorted-by{ font-size: 0.82rem; color: var(--muted); }
.table-toolbar .sorted-by .sort-field{ color: var(--primary); font-weight: 600; text-decoration: underline; text-decoration-style: dotted; }

/* "View" pill button in the invoice table */
.btn-view-invoice{
  border: 1px solid var(--primary); color: var(--primary); background:#fff;
  font-weight: 600; font-size: 0.78rem; border-radius: 20px; padding: 5px 14px; white-space: nowrap;
}
.btn-view-invoice:hover{ background:#f5f8ff; color: var(--primary-dark); }

/* "Actions" dropdown toggle + Approve/Reject menu */
.btn-actions-toggle{
  border: 1px solid var(--border); color: var(--ink); background:#fff;
  font-weight: 600; font-size: 0.78rem; border-radius: 8px; padding: 6px 12px; white-space: nowrap;
  display:inline-flex; align-items:center; gap: 6px;
}
.btn-actions-toggle:hover, .btn-actions-toggle:focus{ background:#f4f6fb; }
.btn-actions-toggle::after{ display: none; } /* replace Bootstrap's default caret with our own chevron icon */

.actions-dropdown-menu{
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(22,33,62,0.12);
  padding: 6px; min-width: 160px;
}
.actions-dropdown-menu .dropdown-item{
  display:flex; align-items:center; gap: 8px; border-radius: 6px;
  font-size: 0.85rem; font-weight: 500; padding: 8px 10px;
}
.actions-dropdown-menu .dropdown-item-approve{ color: var(--success); }
.actions-dropdown-menu .dropdown-item-approve:hover{ background:#e2f6ea; color: var(--success); }
.actions-dropdown-menu .dropdown-item-reject{ color: var(--danger); }
.actions-dropdown-menu .dropdown-item-reject:hover{ background:#fdecea; color: var(--danger); }