:root {
  color-scheme: dark;
  --bg: #030b0b;
  --bg-soft: #061414;
  --panel: #071d1d;
  --panel-2: #092525;
  --panel-3: #0b3030;
  --header: #101a2d;
  --border: #1b5553;
  --border-soft: rgba(94, 192, 184, 0.18);
  --teal: #66e6d8;
  --teal-strong: #20c7b6;
  --teal-deep: #087e75;
  --yellow: #ffd21c;
  --yellow-soft: #fff0a2;
  --red: #ff6868;
  --green: #63e6aa;
  --amber: #ffb84d;
  --blue: #78b7ff;
  --text: #f6fbfa;
  --muted: #a7c2bf;
  --muted-2: #75928f;
  --sidebar: 270px;
  --topbar: 74px;
  --radius: 12px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(28, 175, 161, 0.08), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--teal);
}

button {
  border: 0;
}

svg {
  display: block;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 7px;
  background: var(--yellow);
  color: #10120f;
  font-weight: 800;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid rgba(124, 228, 217, 0.2);
  background:
    linear-gradient(180deg, rgba(3, 13, 13, 0.74), rgba(3, 13, 13, 0.96)),
    radial-gradient(circle at 50% 15%, #234e49, #061111 58%);
  box-shadow: 18px 0 40px rgba(0, 0, 0, 0.23);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 25px 18px;
}

.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  grid-template-columns: 1fr 1fr;
  place-items: center;
  border: 1px solid var(--teal-strong);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(102, 230, 216, 0.17), transparent);
  box-shadow: inset 0 0 20px rgba(102, 230, 216, 0.08);
  color: var(--teal);
  font-weight: 800;
  letter-spacing: -2px;
}

.brand-mark span:last-child {
  color: var(--yellow);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.partnership {
  margin: 0 18px 19px;
  padding: 14px 15px;
  border: 1px solid rgba(102, 230, 216, 0.16);
  border-radius: 10px;
  background: rgba(8, 35, 35, 0.76);
}

.partnership > * {
  display: block;
}

.partnership strong {
  margin-top: 3px;
}

.partnership small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.eyebrow {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payment-gate {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(99, 230, 170, 0.11), rgba(7, 29, 29, 0.96));
}

.payment-gate.is-blocked {
  border-left-color: var(--yellow);
  background: linear-gradient(90deg, rgba(255, 210, 28, 0.12), rgba(7, 29, 29, 0.96));
}

.payment-gate-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--yellow);
}

.payment-gate-icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.payment-gate h2 {
  margin: 4px 0 5px;
}

.payment-gate p,
.payment-gate small {
  margin: 0;
  color: var(--muted);
}

.inline-link-control {
  display: flex;
  min-width: 230px;
  gap: 7px;
}

.inline-link-control select {
  min-width: 145px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--text);
}

.skeleton-label { width: 150px; height: 12px; }
.skeleton-title { width: 340px; height: 38px; margin-top: 10px; }
.skeleton-kpi { height: 72px; }
.detail-grid-padded { padding: 16px; }

.agreement-shell { width: min(960px, calc(100% - 28px)); margin: 32px auto 60px; }
.agreement-hero { padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(135deg, #0a3633, #081d1d); }
.agreement-hero h1 { margin: 6px 0 8px; font-size: clamp(25px, 4vw, 40px); line-height: 1.08; }
.agreement-hero p { max-width: 760px; margin: 0; color: var(--muted); }
.agreement-actions { display: flex; gap: 8px; margin-top: 18px; }
.agreement-section { margin-top: 14px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.agreement-section h2 { margin: 0 0 12px; font-size: 17px; }
.agreement-section p, .agreement-section li { color: var(--muted); font-size: 12px; }
.agreement-section li + li { margin-top: 7px; }
.agreement-admin-panel,
.agreement-current {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.agreement-admin-panel {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr);
  gap: 22px;
  padding: 22px;
  border-left: 3px solid var(--yellow);
}
.agreement-admin-panel[hidden],
.agreement-current[hidden] { display: none; }
.agreement-admin-panel h2,
.agreement-document-header h2 { margin: 5px 0 7px; font-size: 18px; }
.agreement-admin-panel p,
.agreement-document-header p { margin: 0; color: var(--muted); font-size: 12px; }
.agreement-upload-form { display: grid; gap: 10px; align-content: start; }
.file-drop {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--aqua);
  border-radius: 9px;
  background: rgba(37, 201, 184, .05);
  font-size: 12px;
  font-weight: 800;
}
.file-drop input { color: var(--muted); }
.agreement-document-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.word-document {
  width: min(816px, calc(100% - 34px));
  min-height: 880px;
  margin: 28px auto 38px;
  padding: clamp(34px, 7vw, 76px);
  border: 1px solid #d8dce0;
  background: #fff;
  color: #172024;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .34);
  font-family: Calibri, Aptos, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.55;
}
.word-document h1 { margin: 0 0 24px; color: #10181b; font-size: 24px; text-align: center; }
.word-document h2 { margin: 24px 0 8px; color: #10181b; font-size: 17px; }
.word-document h3 { margin: 18px 0 7px; color: #10181b; font-size: 14px; }
.word-document p { margin: 0 0 9px; color: #172024; text-align: justify; }
.word-document .word-list-item { padding-left: 18px; }
.word-document .word-empty { min-height: 8px; margin: 0; }
.word-table-wrap { max-width: 100%; margin: 16px 0; overflow-x: auto; }
.word-document table { width: 100%; border-collapse: collapse; }
.word-document td { padding: 7px; border: 1px solid #9ea8ad; vertical-align: top; }
.word-document td p { margin: 0; text-align: left; }
.role-guide-panel { margin-top: 14px; }
.role-guide { display: grid; gap: 8px; padding: 12px; }
.role-guide article {
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}
.role-guide strong { color: var(--aqua); font-size: 12px; }
.role-guide small { color: var(--muted); font-size: 11px; line-height: 1.45; }

.client-source-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.client-source-search .button {
  min-height: 42px;
}

.client-search-results {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(3, 27, 27, 0.54);
}

.client-search-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.client-result {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.client-result:hover,
.client-result:focus-visible {
  border-color: var(--aqua);
  outline: none;
}

.client-result.is-selected {
  grid-template-columns: minmax(0, 1fr) auto auto;
  border-color: var(--aqua);
  cursor: default;
}

.client-result strong,
.client-result small {
  display: block;
}

.client-result small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.formula { padding: 15px; border-left: 3px solid var(--yellow); border-radius: 6px; background: #0a2928; color: #fff; font-weight: 700; }
.rate-table { width: 100%; border-collapse: collapse; }
.rate-table th, .rate-table td { padding: 11px 12px; border: 1px solid var(--border); text-align: left; }
.rate-table th { background: var(--header); color: var(--yellow); font-size: 10px; text-transform: uppercase; }

.main-nav {
  display: grid;
  gap: 3px;
  padding: 2px 12px 24px;
}

.main-nav a {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #dbe9e7;
  font-weight: 600;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.main-nav a:hover {
  border-color: rgba(102, 230, 216, 0.13);
  background: rgba(102, 230, 216, 0.07);
}

.main-nav a[aria-current="page"] {
  border-color: #2aa99e;
  background: linear-gradient(90deg, rgba(20, 124, 115, 0.38), rgba(13, 62, 60, 0.4));
  box-shadow: inset 3px 0 var(--teal);
  color: #fff;
}

.nav-index {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 7px;
  background: rgba(88, 205, 194, 0.15);
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
}

.main-nav a[aria-current="page"] .nav-index {
  background: rgba(102, 230, 216, 0.22);
  color: #fff;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: auto 15px 16px;
  padding: 12px 13px;
  border: 1px solid rgba(102, 230, 216, 0.2);
  border-radius: 9px;
  background: rgba(8, 30, 30, 0.9);
  color: var(--muted);
  font-size: 11px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(99, 230, 170, 0.13);
}

.content-shell {
  min-height: 100vh;
  padding-left: var(--sidebar);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: var(--topbar);
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(102, 230, 216, 0.18);
  background: rgba(3, 12, 12, 0.92);
  backdrop-filter: blur(16px);
}

.topbar-context {
  min-width: 180px;
}

.topbar-context > * {
  display: block;
}

.topbar-context strong {
  margin-top: 3px;
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.sync-pill,
.source-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sync-pill {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(102, 230, 216, 0.27);
  background: rgba(7, 34, 34, 0.74);
  color: var(--muted);
}

.sync-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 184, 77, 0.12);
}

.sync-pill.is-ready .sync-indicator {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(99, 230, 170, 0.12);
}

.sync-pill.is-error .sync-indicator {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 104, 104, 0.12);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 4px;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(102, 230, 216, 0.36);
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.user-chip strong,
.user-chip small {
  display: block;
}

.user-chip strong {
  font-size: 11px;
}

.user-chip small {
  color: var(--muted-2);
  font-size: 9px;
}

.icon-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 140ms ease,
    filter 140ms ease,
    border-color 140ms ease;
}

.icon-button:hover,
.button:hover {
  filter: brightness(1.08);
}

.icon-button:active,
.button:active {
  transform: translateY(1px);
}

.icon-button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--teal);
}

.icon-button svg,
.button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.menu-button {
  display: none;
}

.button {
  min-height: 38px;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.button-primary {
  background: linear-gradient(180deg, #ffe15d, var(--yellow));
  color: #151508;
  box-shadow: 0 8px 22px rgba(255, 210, 28, 0.13);
}

.button-secondary {
  border-color: #2d877f;
  background: #0d4541;
  color: #dcfffa;
}

.button-ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--teal);
}

.button-danger {
  border-color: rgba(255, 104, 104, 0.55);
  background: rgba(116, 32, 38, 0.35);
  color: #ffb9b9;
}

.button-danger.is-confirming {
  border-color: #ffcf46;
  background: rgba(108, 74, 0, 0.42);
  color: #ffe17b;
}

.button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.56;
}

main {
  width: 100%;
  padding: 22px 24px 42px;
}

.page {
  width: min(100%, 1680px);
  margin-inline: auto;
  animation: page-in 220ms ease-out;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 4px 0 0;
  font-size: clamp(24px, 3vw, 37px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.page-heading p {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-card {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(9, 39, 38, 0.98), rgba(5, 25, 25, 0.98));
  box-shadow: inset 0 3px var(--yellow);
}

.kpi-card::after {
  position: absolute;
  right: -30px;
  bottom: -48px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(76, 213, 199, 0.035);
  content: "";
}

.kpi-label,
.kpi-source,
.kpi-note {
  display: block;
}

.kpi-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-value {
  display: block;
  min-height: 34px;
  margin-top: 6px;
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.kpi-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.kpi-source {
  margin-top: 3px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 700;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.75fr);
  gap: 12px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(5, 25, 25, 0.92);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14);
}

.panel + .panel {
  margin-top: 12px;
}

.panel-header {
  display: flex;
  min-height: 69px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(9, 38, 38, 0.94), rgba(6, 29, 29, 0.94));
}

.panel-header h2,
.panel-header h3 {
  margin: 2px 0 0;
}

.panel-header h2 {
  font-size: 15px;
}

.panel-header h3 {
  font-size: 13px;
}

.panel-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(5, 23, 23, 0.86);
}

.filter-control {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  min-width: 150px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #061919;
  color: var(--text);
}

.filter-control svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--teal);
  stroke-width: 1.8;
}

.filter-control input,
.filter-control select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 10px;
}

.filter-control select {
  cursor: pointer;
}

.filter-control.search {
  min-width: min(330px, 100%);
}

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

.data-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10px;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: middle;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 51px;
  background: var(--header);
  color: var(--yellow);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.12;
  text-transform: uppercase;
}

.table-column-source {
  display: block;
  margin-top: 4px;
  color: var(--teal);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: none;
}

.invoice-table {
  min-width: 1420px;
}

.invoice-table th {
  height: auto;
  min-height: 68px;
  padding-block: 13px;
  overflow: visible;
  hyphens: none;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}

.invoice-table th:nth-child(7) {
  min-width: 145px;
}

.invoice-table th:nth-child(8) {
  min-width: 155px;
}

.invoice-table th:nth-child(9) {
  min-width: 150px;
}

.data-table tbody tr {
  background: rgba(4, 23, 23, 0.72);
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: rgba(15, 63, 61, 0.44);
}

.cell-title {
  display: block;
  color: #fff;
  font-weight: 750;
}

.cell-note,
.cell-source {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.cell-source {
  color: var(--teal);
}

.source-badge {
  padding: 5px 8px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.025);
  white-space: nowrap;
}

.source-badge.zoho {
  color: #70c5ff;
}

.source-badge.odoo {
  color: #d59aff;
}

.source-badge.portal {
  color: var(--teal);
}

.status-badge {
  padding: 5px 9px;
  background: rgba(120, 183, 255, 0.12);
  color: var(--blue);
  white-space: nowrap;
}

.status-badge.success,
.status-badge.paid,
.status-badge.active {
  background: rgba(99, 230, 170, 0.12);
  color: var(--green);
}

.status-badge.warning,
.status-badge.pending,
.status-badge.draft {
  background: rgba(255, 184, 77, 0.12);
  color: var(--amber);
}

.status-badge.danger,
.status-badge.overdue,
.status-badge.rejected {
  background: rgba(255, 104, 104, 0.12);
  color: #ff9292;
}

.amount {
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  white-space: nowrap;
}

.amount.muted {
  color: var(--muted-2);
}

.commission-entry {
  display: grid;
  min-width: 126px;
}

.commission-entry input {
  width: 100%;
  min-width: 106px;
  padding: 8px 9px;
  border: 1px solid #e2b900;
  border-radius: 7px;
  outline: 0;
  background: #fff0a3;
  color: #15201f;
  font: inherit;
  font-weight: 850;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.commission-entry input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 213, 0, 0.18);
}

.commission-entry input.is-invalid {
  border-color: #ff6868;
  background: #ffd0d0;
  color: #761e1e;
}

.invoice-panel-header {
  position: sticky;
  z-index: 5;
  top: 75px;
  background: #082827;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.commission-save-all {
  min-width: 174px;
}

.commission-save-all.has-pending {
  box-shadow: 0 0 0 3px rgba(255, 213, 0, 0.18);
}

.commissionable-amount {
  color: #9af4df;
}

.commissionable-amount.is-invalid {
  color: #ff9292;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.table-action {
  border: 0;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 38px 20px;
  text-align: center;
}

.empty-state.compact {
  min-height: 170px;
}

.empty-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 13px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--teal);
}

.empty-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.empty-state h3 {
  margin: 0;
  font-size: 14px;
}

.empty-state p {
  max-width: 460px;
  margin: 7px auto 15px;
  color: var(--muted);
  font-size: 11px;
}

.summary-list {
  display: grid;
}

.summary-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-soft);
}

.summary-item:last-child {
  border-bottom: 0;
}

.summary-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: rgba(102, 230, 216, 0.1);
  color: var(--teal);
}

.summary-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.summary-item strong,
.summary-item small {
  display: block;
}

.summary-item strong {
  font-size: 11px;
}

.summary-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.summary-value {
  color: var(--yellow);
  font-size: 11px;
  font-weight: 800;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 210, 28, 0.48);
  border-radius: 9px;
  background: rgba(255, 210, 28, 0.08);
}

.callout svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--yellow);
  stroke-width: 1.8;
}

.callout strong,
.callout small {
  display: block;
}

.callout strong {
  color: var(--yellow);
  font-size: 11px;
}

.callout small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(102, 230, 216, 0.1);
}

.progress > span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal-deep), var(--teal));
}

.modal {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--teal-strong);
  border-radius: 14px;
  background: #061b1b;
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal-small {
  width: min(610px, calc(100% - 28px));
}

.modal::backdrop {
  background: rgba(0, 8, 8, 0.76);
  backdrop-filter: blur(7px);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--header);
}

.modal-header h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.modal-header p {
  max-width: 560px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.modal-body {
  padding: 19px 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(5, 20, 20, 0.82);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-span-2 {
  grid-column: 1 / -1;
}

.field > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.field b {
  color: var(--yellow);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #041313;
  color: var(--text);
  outline: 0;
}

.field input,
.field select {
  height: 42px;
  padding: 0 12px;
}

.field textarea {
  min-height: 82px;
  resize: vertical;
  padding: 10px 12px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #637b78;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(12, 47, 46, 0.44);
}

.check-field input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--teal);
}

.check-field strong,
.check-field small {
  display: block;
}

.check-field strong {
  font-size: 10px;
}

.check-field small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.form-message {
  display: none;
  margin: 0 20px 5px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 104, 104, 0.4);
  border-radius: 7px;
  background: rgba(255, 104, 104, 0.08);
  color: #ffb5b5;
  font-size: 10px;
}

.form-message.is-visible {
  display: block;
}

.auth-panel {
  width: min(100%, 620px);
}

.auth-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.auth-form .form-message {
  margin: 0;
}

.auth-form .button {
  justify-self: start;
  min-width: 150px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 34px;
  height: 32px;
  padding: 0;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  border-color: var(--border);
  background: rgba(102, 230, 216, 0.08);
  outline: 0;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.users-panel {
  margin-bottom: 18px;
}

.user-create-form,
.self-password-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(210px, 1.5fr) minmax(130px, 0.8fr) minmax(190px, 1.2fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 35, 34, 0.38);
}

.self-password-form {
  grid-template-columns: repeat(3, minmax(190px, 1fr)) auto;
}

.field-span-all {
  grid-column: 1 / -1;
}

.user-create-form .form-message,
.self-password-form .form-message,
.password-reset-form .form-message {
  margin: 0;
}

.user-create-button {
  height: 42px;
  white-space: nowrap;
}

.user-access-list {
  display: grid;
  gap: 8px;
  padding: 16px 20px 20px;
}

.user-access-row {
  display: grid;
  grid-template-columns: 38px minmax(190px, 1.6fr) minmax(130px, 0.8fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: rgba(6, 27, 27, 0.66);
}

.user-access-identity strong,
.user-access-identity small,
.user-access-meta strong,
.user-access-meta small {
  display: block;
}

.user-access-identity strong,
.user-access-meta strong {
  font-size: 11px;
}

.user-access-identity small,
.user-access-meta small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.password-reset-dialog {
  width: min(560px, calc(100% - 28px));
}

.password-reset-body {
  display: grid;
  gap: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-item {
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(9, 40, 39, 0.58);
}

.detail-item span,
.detail-item strong {
  display: block;
}

.client-unlink-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid rgba(255, 104, 104, 0.38);
  border-radius: 10px;
  background: rgba(75, 24, 29, 0.2);
}

.client-unlink-zone.is-inactive {
  border-color: var(--border);
  background: rgba(9, 40, 39, 0.42);
}

.client-unlink-zone strong,
.client-unlink-zone p {
  display: block;
}

.client-unlink-zone strong {
  margin-top: 4px;
}

.client-unlink-zone p {
  max-width: 560px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.unlink-confirmation-note {
  grid-column: 1 / -1;
  color: #ffe17b;
  font-size: 10px;
}

.attachment-list {
  display: grid;
  min-width: 190px;
  gap: 7px;
}

.attachment-file {
  display: grid;
  gap: 5px;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(8, 35, 34, 0.68);
}

.attachment-file > span:first-child,
.attachment-file strong,
.attachment-file small {
  display: block;
}

.attachment-file strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 10px;
}

.attachment-file small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-attachments {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(9, 40, 39, 0.42);
}

@media (max-width: 620px) {
  .client-unlink-zone {
    grid-template-columns: 1fr;
  }
}

.detail-item span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.detail-item strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #092322;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

.toast::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--teal);
  content: "";
}

.toast.error::before {
  background: var(--red);
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  font-size: 11px;
}

.toast span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.skeleton {
  overflow: hidden;
  border-radius: 4px;
  background: #0e302f;
}

.skeleton::after {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  content: "";
  animation: shimmer 1.1s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(260%);
  }
}

.loading-table {
  min-height: 260px;
  padding: 20px;
}

.loading-line {
  height: 34px;
  margin-bottom: 10px;
}

.loading-line:nth-child(2) {
  width: 86%;
}

.loading-line:nth-child(3) {
  width: 92%;
}

.loading-line:nth-child(4) {
  width: 75%;
}

.is-spinning svg {
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sidebar-scrim {
  position: fixed;
  z-index: 35;
  inset: 0;
  background: rgba(0, 5, 5, 0.65);
  backdrop-filter: blur(4px);
}

@media (max-width: 1180px) {
  :root {
    --sidebar: 230px;
  }

  .sync-pill {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-grid {
    grid-template-columns: 1fr;
  }

  .user-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .self-password-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar: min(290px, 84vw);
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 220ms ease;
  }

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

  .content-shell {
    padding-left: 0;
  }

  .menu-button {
    display: inline-flex;
  }

  .topbar {
    padding-inline: 14px;
  }

  .user-chip > span:last-child {
    display: none;
  }

  main {
    padding: 18px 14px 34px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    justify-content: flex-start;
  }

  .user-access-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .user-access-meta {
    grid-column: 2;
  }

  .user-access-row .button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 580px) {
  .topbar-context .eyebrow,
  .topbar-actions .button span {
    display: none;
  }

  .topbar-context strong {
    max-width: 150px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .button {
    width: 38px;
    padding: 0;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 98px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .user-create-form,
  .self-password-form {
    grid-template-columns: 1fr;
  }

  .field-span-all {
    grid-column: auto;
  }

  .user-access-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .user-access-row .button {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: stretch;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-inline: 15px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.commission-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(150px, 190px)
    minmax(150px, 190px) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.invoice-date-filters {
  grid-template-columns: minmax(240px, 1fr) minmax(145px, 180px)
    minmax(145px, 180px) minmax(145px, 180px) auto;
}

.date-filter {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.date-filter input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
}

.amount-accent,
.amount-ok {
  color: var(--teal);
  font-weight: 900;
}

.amount-warning {
  color: var(--yellow);
  font-weight: 900;
}

@media (max-width: 900px) {
  .commission-filters {
    grid-template-columns: 1fr 1fr;
  }

  .commission-filters .search {
    grid-column: 1 / -1;
  }
}
