/* ==================================================================
   Upwork Financial Management System
   Interface styles. Loaded after Bootstrap so these rules win.
   ================================================================== */

:root {
  --ink:          #0f172a;
  --ink-soft:     #334155;
  --muted:        #64748b;
  --muted-light:  #94a3b8;
  --line:         #e7e9ee;
  --line-soft:    #f0f2f5;
  --bg:           #f5f6f8;
  --card:         #ffffff;

  --brand:        #4f46e5;
  --brand-dark:   #4338ca;
  --brand-tint:   #eef2ff;

  --green:        #059669;
  --green-tint:   #ecfdf5;
  --amber:        #b45309;
  --amber-tint:   #fffbeb;
  --red:          #dc2626;
  --red-tint:     #fef2f2;
  --slate-tint:   #f1f5f9;

  --radius:       16px;
  --radius-sm:    10px;
  --radius-pill:  999px;

  --shadow-xs:    0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm:    0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md:    0 4px 16px rgba(15, 23, 42, .07), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg:    0 12px 40px rgba(15, 23, 42, .12);

  --sidebar-w:    262px;
  --topbar-h:     64px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ------------------------------------------------------------------
   Base
   ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "tnum";
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 650; letter-spacing: -.011em; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: none; }

img, svg, video, canvas { max-width: 100%; height: auto; }

hr { border-color: var(--line); opacity: 1; }

::selection { background: #ddd6fe; color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Numbers line up in columns. */
.num, .table td.num, .table th.num, .stat-value, .money {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.text-muted-2 { color: var(--muted); }
.fw-medium { font-weight: 550; }

/* ------------------------------------------------------------------
   App shell
   ------------------------------------------------------------------ */

.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 1045;
  transform: translateX(-100%);
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
  overscroll-behavior: contain;
}
.sidebar.is-open { transform: translateX(0); }

.sidebar-head {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.brand-mark {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand) 0%, #7c3aed 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.02em;
}
.brand-text { min-width: 0; }
.brand-name {
  font-weight: 650;
  font-size: 14.5px;
  letter-spacing: -.015em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub { font-size: 11.5px; color: var(--muted-light); line-height: 1.2; }

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px 20px;
}
.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-light);
  padding: 14px 10px 6px;
}
.nav-link-app {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8.5px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14px;
  transition: background .14s ease, color .14s ease;
  margin-bottom: 2px;
}
.nav-link-app i { font-size: 16px; width: 18px; text-align: center; color: var(--muted); flex: 0 0 18px; }
.nav-link-app span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link-app:hover { background: var(--line-soft); color: var(--ink); }
.nav-link-app.active { background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; }
.nav-link-app.active i { color: var(--brand); }

.sidebar-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line-soft);
  padding: 12px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  min-width: 0;
}
.user-chip:hover { background: var(--line-soft); }
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 50%;
  background: var(--slate-tint);
  color: var(--ink-soft);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650;
}
.user-chip .u-name {
  font-size: 13.5px; font-weight: 550; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-chip .u-role { font-size: 11.5px; color: var(--muted-light); line-height: 1.2; }

.scrim {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .34);
  backdrop-filter: blur(1px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.scrim.is-open { opacity: 1; visibility: visible; }

.main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 17px;
  transition: background .14s ease, border-color .14s ease;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

.page { padding: 20px 16px 56px; }
.page-inner { max-width: 1360px; margin: 0 auto; min-width: 0; }

/* ------------------------------------------------------------------
   Page header
   ------------------------------------------------------------------ */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.page-head .lead-title { font-size: 21px; font-weight: 680; letter-spacing: -.025em; margin: 0 0 3px; }
.page-head .lead-sub { color: var(--muted); font-size: 13.5px; margin: 0; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------ */

.card-app {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}
.card-app + .card-app { margin-top: 16px; }

.card-app-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-app-head h2, .card-app-head h3 {
  font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -.015em;
}
.card-app-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-app-body { padding: 18px; }
.card-app-body.tight { padding: 12px 18px; }
.card-app-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  background: #fcfcfd;
}

/* ------------------------------------------------------------------
   Stat cards
   ------------------------------------------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  min-width: 0;
  transition: box-shadow .18s ease, transform .18s ease;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.stat-icon {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 15px;
}
.stat-label {
  font-size: 12.5px; font-weight: 550; color: var(--muted);
  letter-spacing: -.005em;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat-value {
  font-size: 23px;
  font-weight: 680;
  letter-spacing: -.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.stat-meta { font-size: 12px; color: var(--muted); margin-top: 5px; }

.i-brand  { background: var(--brand-tint); color: var(--brand); }
.i-green  { background: var(--green-tint);  color: var(--green); }
.i-amber  { background: var(--amber-tint);  color: var(--amber); }
.i-red    { background: var(--red-tint);    color: var(--red); }
.i-slate  { background: var(--slate-tint);  color: var(--ink-soft); }

.v-green { color: var(--green); }
.v-amber { color: var(--amber); }
.v-red   { color: var(--red); }

/* ------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------ */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-app {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.6px;
}
.table-app th {
  background: #fbfbfc;
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .045em;
  text-transform: uppercase;
  padding: 10px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-app th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table-app th a:hover { color: var(--ink); }
.table-app td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-soft);
}
.table-app tbody tr:last-child td { border-bottom: 0; }
.table-app tbody tr { transition: background .12s ease; }
.table-app tbody tr:hover { background: #fbfbfd; }
.table-app tfoot td {
  padding: 12px 14px;
  background: #fbfbfc;
  border-top: 1px solid var(--line);
  font-weight: 650;
  color: var(--ink);
}
.table-app .num { text-align: right; white-space: nowrap; }
.table-app .strong { color: var(--ink); font-weight: 600; }
.table-app .wrap { white-space: normal; overflow-wrap: anywhere; min-width: 160px; }
.table-app .col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* ------------------------------------------------------------------
   Badges and pills
   ------------------------------------------------------------------ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .005em;
  white-space: nowrap;
  line-height: 1.5;
}
.status-badge::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 5px;
}
.badge-paid    { background: var(--green-tint); color: #047857; }
.badge-partial { background: var(--amber-tint); color: #b45309; }
.badge-pending { background: var(--slate-tint); color: #475569; }

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 550;
  color: var(--ink);
  min-width: 0;
  max-width: 100%;
}
.profile-dot {
  width: 8px; height: 8px; flex: 0 0 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2.5px rgba(15, 23, 42, .05);
}
.profile-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--slate-tint);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
}
.chip-muted { background: var(--line-soft); color: var(--muted); }

/* ------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */

.btn {
  --bs-btn-border-radius: var(--radius-sm);
  font-weight: 550;
  font-size: 13.8px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .06s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.btn:active { transform: translateY(.5px); }
.btn i { font-size: 15px; line-height: 1; }

.btn-brand {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.btn-ghost {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  box-shadow: var(--shadow-xs);
}
.btn-ghost:hover, .btn-ghost:focus { background: var(--line-soft); color: var(--ink); border-color: #dcdfe6; }

.btn-quiet { background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--line-soft); color: var(--ink); }

.btn-danger-soft { background: var(--red-tint); border: 1px solid #fecaca; color: var(--red); }
.btn-danger-soft:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

.btn-sm-app { padding: 5px 10px; font-size: 12.8px; border-radius: 8px; }
.btn-icon-only { padding: 5px 8px; }

.btn-block-mobile { width: auto; }

/* ------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------ */

.form-label {
  font-size: 12.8px;
  font-weight: 550;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.form-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.form-control, .form-select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8.5px 12px;
  font-size: 14px;
  color: var(--ink);
  background-color: var(--card);
  box-shadow: var(--shadow-xs);
  transition: border-color .14s ease, box-shadow .14s ease;
  max-width: 100%;
}
.form-control:focus, .form-select:focus {
  border-color: #c7d2fe;
  box-shadow: 0 0 0 3.5px rgba(79, 70, 229, .12);
}
.form-control::placeholder { color: var(--muted-light); }
.form-control:disabled, .form-select:disabled { background: var(--line-soft); color: var(--muted); }

textarea.form-control { min-height: 84px; resize: vertical; }

.input-group-text {
  background: var(--line-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  border-radius: var(--radius-sm);
}

.form-check-input { border-color: #cbd5e1; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 3.5px rgba(79, 70, 229, .12); border-color: #c7d2fe; }
.form-check-label { font-size: 13.8px; color: var(--ink-soft); }

input[type="color"].form-control {
  padding: 4px;
  height: 40px;
  width: 100%;
  min-width: 52px;
  cursor: pointer;
}

/* Filter bar */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.filter-bar .filter-actions {
  display: flex; gap: 8px; align-items: flex-end; grid-column: 1 / -1;
}

/* ------------------------------------------------------------------
   Alerts
   ------------------------------------------------------------------ */

.alert-app {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.6px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  overflow-wrap: anywhere;
}
.alert-app i { font-size: 16px; flex: 0 0 auto; margin-top: 1px; }
.alert-app .btn-close { margin-left: auto; flex: 0 0 auto; font-size: 10px; }
.alert-success-app { background: var(--green-tint); border-color: #a7f3d0; color: #065f46; }
.alert-danger-app  { background: var(--red-tint);   border-color: #fecaca; color: #991b1b; }
.alert-warning-app { background: var(--amber-tint); border-color: #fde68a; color: #92400e; }
.alert-info-app    { background: var(--brand-tint); border-color: #c7d2fe; color: #3730a3; }

/* ------------------------------------------------------------------
   Empty state
   ------------------------------------------------------------------ */

.empty {
  text-align: center;
  padding: 44px 22px;
  color: var(--muted);
}
.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--line-soft);
  color: var(--muted-light);
  display: grid; place-items: center;
  font-size: 22px;
}
.empty h3 { font-size: 15.5px; font-weight: 620; margin-bottom: 5px; color: var(--ink); }
.empty p { font-size: 13.5px; margin-bottom: 16px; max-width: 400px; margin-inline: auto; }

/* ------------------------------------------------------------------
   Summary panel (withdrawal form live totals)
   ------------------------------------------------------------------ */

.summary-panel { position: sticky; top: calc(var(--topbar-h) + 16px); }
.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.6px;
}
.summary-row:last-child { border-bottom: 0; }
.summary-row .label { color: var(--muted); min-width: 0; }
.summary-row .value { font-weight: 620; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.summary-row.total {
  margin-top: 4px;
  padding-top: 13px;
  border-top: 1.5px solid var(--line);
  border-bottom: 0;
}
.summary-row.total .label { color: var(--ink); font-weight: 600; font-size: 14px; }
.summary-row.total .value { font-size: 18.5px; letter-spacing: -.02em; }

/* ------------------------------------------------------------------
   Employee line rows in the withdrawal form
   ------------------------------------------------------------------ */

.line-rows { display: flex; flex-direction: column; gap: 10px; }

.line-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.7fr) repeat(4, minmax(88px, 1fr)) minmax(96px, 1fr) 40px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fcfcfd;
}
.line-row .line-total {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-right: 4px;
  color: var(--ink);
  font-size: 13.8px;
  overflow-wrap: anywhere;
}
.line-head {
  display: grid;
  grid-template-columns: minmax(150px, 1.7fr) repeat(4, minmax(88px, 1fr)) minmax(96px, 1fr) 40px;
  gap: 8px;
  padding: 0 10px 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: var(--muted-light);
}
.line-head .ta-r, .line-row .ta-r { text-align: right; }
.line-field-label { display: none; }
.line-remove {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-light);
  border-radius: 8px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  transition: background .14s ease, color .14s ease;
}
.line-remove:hover { background: var(--red-tint); color: var(--red); }

.line-paid-note { font-size: 11.5px; color: var(--amber); margin-top: 4px; }

/* ------------------------------------------------------------------
   Pagination
   ------------------------------------------------------------------ */

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pager-info { font-size: 12.8px; color: var(--muted); }
.pager-links { display: flex; gap: 6px; flex-wrap: wrap; }
.pager-links a, .pager-links span {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-soft);
  background: var(--card);
}
.pager-links a:hover { background: var(--line-soft); color: var(--ink); }
.pager-links .is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager-links .is-disabled { color: var(--muted-light); background: var(--line-soft); }

/* ------------------------------------------------------------------
   Modals
   ------------------------------------------------------------------ */

.modal-content {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header { border-bottom: 1px solid var(--line-soft); padding: 16px 18px; }
.modal-title { font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.modal-body { padding: 18px; }
.modal-footer { border-top: 1px solid var(--line-soft); padding: 13px 18px; gap: 8px; }
.modal-backdrop.show { opacity: .38; }

/* ------------------------------------------------------------------
   Detail lists
   ------------------------------------------------------------------ */

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px 18px;
}
.kv-item { min-width: 0; }
.kv-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .045em;
  text-transform: uppercase; color: var(--muted-light); margin-bottom: 3px;
}
.kv-value { font-size: 14.5px; font-weight: 550; color: var(--ink); overflow-wrap: anywhere; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-soft);
  min-width: 0;
}
.mini-list li:last-child { border-bottom: 0; }
.mini-list .m-body { min-width: 0; flex: 1 1 auto; }
.mini-list .m-title {
  font-size: 13.6px; font-weight: 550; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-list .m-sub { font-size: 12px; color: var(--muted); }
.mini-list .m-amount { font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13.6px; }

/* ------------------------------------------------------------------
   Bar chart (pure CSS, no chart library)
   ------------------------------------------------------------------ */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 176px;
  padding: 6px 2px 0;
  overflow-x: auto;
}
.chart-col { flex: 1 1 0; min-width: 42px; display: flex; flex-direction: column; height: 100%; }
.chart-bars { flex: 1 1 auto; display: flex; align-items: flex-end; gap: 4px; }
.chart-bar {
  flex: 1 1 0;
  border-radius: 5px 5px 2px 2px;
  min-height: 3px;
  transition: height .5s cubic-bezier(.4, 0, .2, 1);
}
.chart-bar.b-income { background: var(--brand); }
.chart-bar.b-cost   { background: #c7d2fe; }
.chart-bar.b-owner  { background: #a5b4fc; }
.chart-x {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  margin-top: 8px;
  white-space: nowrap;
}
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.2px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }

/* ------------------------------------------------------------------
   Sign-in screen
   ------------------------------------------------------------------ */

.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(1100px 480px at 12% -8%, #eef2ff 0%, rgba(238, 242, 255, 0) 62%),
    radial-gradient(900px 420px at 96% 8%, #f5f3ff 0%, rgba(245, 243, 255, 0) 58%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 396px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 30px 26px 26px;
}
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .brand-mark { width: 42px; height: 42px; margin: 0 auto 14px; font-size: 17px; border-radius: 12px; }
.auth-head h1 { font-size: 19px; font-weight: 660; margin: 0 0 4px; letter-spacing: -.02em; }
.auth-head p { font-size: 13.5px; color: var(--muted); margin: 0; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted-light); margin-top: 20px; }

/* ------------------------------------------------------------------
   Utilities
   ------------------------------------------------------------------ */

.stack-8  > * + * { margin-top: 8px; }
.stack-14 > * + * { margin-top: 14px; }
.stack-18 > * + * { margin-top: 18px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.split-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.break-anywhere { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

.divider-y { height: 1px; background: var(--line-soft); margin: 16px 0; }

.form-inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==================================================================
   Responsive
   ================================================================== */

@media (min-width: 992px) {
  .sidebar { transform: translateX(0); }
  .main { margin-left: var(--sidebar-w); }
  .scrim { display: none; }
  .page { padding: 24px 26px 64px; }
  .topbar { padding: 0 26px; }
  .split-main { grid-template-columns: minmax(0, 1fr) 336px; }
}

@media (min-width: 1200px) {
  .page { padding: 26px 32px 72px; }
  .topbar { padding: 0 32px; }
}

/* --- Tablet and below --------------------------------------------- */

@media (max-width: 991.98px) {
  .summary-panel { position: static; }
}

/* --- Employee line rows collapse into stacked cards ---------------- */

@media (max-width: 1099.98px) {
  .line-head { display: none; }
  .line-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    position: relative;
    background: var(--card);
  }
  .line-row .line-cell-employee { grid-column: 1 / -1; padding-right: 40px; }
  .line-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted-light);
    margin-bottom: 4px;
  }
  .line-row .line-cell-total {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  .line-row .line-cell-total .line-field-label { margin-bottom: 0; }
  .line-row .line-total { text-align: right; font-size: 15px; }
  .line-remove { position: absolute; top: 10px; right: 8px; }
}

/* --- Mobile -------------------------------------------------------- */

@media (max-width: 767.98px) {
  body { font-size: 14px; }

  .page { padding: 16px 13px 48px; }
  .topbar { padding: 0 13px; }
  .topbar h1 { font-size: 16px; }

  .page-head { gap: 10px; margin-bottom: 15px; }
  .page-head .lead-title { font-size: 19px; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1 1 auto; }

  .card-app-body { padding: 14px; }
  .card-app-head { padding: 13px 14px; }
  .card-app-foot { padding: 11px 14px; }
  .mini-list li { padding: 10px 14px; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 19.5px; }
  .stat-label { font-size: 12px; }

  .btn-block-mobile { width: 100%; }
  .filter-bar { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .filter-bar .filter-actions .btn { flex: 1 1 auto; }

  .kv { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

  .modal-body, .modal-header, .modal-footer { padding-left: 15px; padding-right: 15px; }
  .modal-footer .btn { flex: 1 1 auto; }

  /* Tables become stacked cards, so nothing scrolls sideways. */
  .table-cards, .table-cards thead, .table-cards tbody, .table-cards tfoot,
  .table-cards th, .table-cards td, .table-cards tr { display: block; width: 100%; }

  .table-cards thead { position: absolute; left: -9999px; top: -9999px; }

  .table-cards tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    margin-bottom: 10px;
    background: var(--card);
    box-shadow: var(--shadow-xs);
  }
  .table-cards tbody tr:hover { background: var(--card); }

  .table-cards td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border: 0;
    text-align: right;
    min-height: 0;
  }
  .table-cards td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted-light);
    padding-right: 8px;
  }
  .table-cards td:empty { display: none; }
  .table-cards td.cell-lead {
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 9px;
    margin-bottom: 6px;
    font-size: 14.5px;
  }
  .table-cards td.cell-lead::before { display: none; }
  .table-cards td.col-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line-soft);
    padding-top: 10px;
    margin-top: 6px;
    width: 100%;
  }
  .table-cards td.col-actions::before { display: none; }
  .table-cards td .wrap, .table-cards td.wrap { min-width: 0; }

  .table-cards tfoot tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfbfc;
    padding: 12px 13px;
  }
  .table-cards tfoot td { font-weight: 600; }
  .table-cards tfoot td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted-light);
  }

  .card-app-body.p-0-mobile { padding: 13px; }
  .table-wrap.cards-on-mobile { overflow: visible; }

  .chart { height: 150px; gap: 7px; }
  .chart-col { min-width: 38px; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: minmax(0, 1fr); }
  .pager-links a, .pager-links span { min-width: 30px; height: 30px; font-size: 12.5px; }
}

/* ------------------------------------------------------------------
   Accessibility and motion
   ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ------------------------------------------------------------------
   Print
   ------------------------------------------------------------------ */

@media print {
  .sidebar, .topbar, .scrim, .no-print { display: none !important; }
  .main { margin-left: 0 !important; }
  body { background: #fff; font-size: 11.5pt; }
  .page { padding: 0; }
  .card-app { box-shadow: none; border-color: #d5d8de; break-inside: avoid; }
  .table-app th { background: #f3f4f6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; }
  @page { margin: 14mm; }
}
