:root {
  --stone: #00a868;
  --stone-dark: #006b45;
  --stone-soft: #e7f8f1;
  --ink: #101514;
  --muted: #66736f;
  --line: #dce5e1;
  --panel: #ffffff;
  --canvas: #f4f7f5;
  --charcoal: #1f2523;
  --warning: #b87503;
  --danger: #b23b3b;
  --info: #2867a8;
  --radius: 8px;
  --shadow: 0 16px 38px rgba(17, 24, 39, 0.065);
  --shadow-soft: 0 8px 20px rgba(16, 21, 20, 0.045);
  --shadow-strong: 0 22px 58px rgba(16, 21, 20, 0.13);
  --sidebar: #0b1210;
  --surface: rgba(255, 255, 255, 0.9);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f8fbf9 0%, #eff5f2 48%, #f7faf8 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.app-shell.locked,
.login-screen.hidden {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.16), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #f8fbf9, #eef5f1);
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid rgba(199, 213, 207, 0.86);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 249, 0.92));
  box-shadow: var(--shadow-strong);
}

.login-brand {
  padding: 12px;
  border: 1px solid rgba(0, 168, 104, 0.16);
  border-radius: var(--radius);
  color: #fff;
  background: #0b1210;
  justify-content: center;
}

.login-brand div span {
  color: var(--muted);
}

.login-brand .brand-logo {
  height: 46px;
  max-width: 250px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.login-form input {
  min-height: 44px;
  border: 1px solid rgba(199, 213, 207, 0.9);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
}

.login-form input:focus {
  outline: 2px solid rgba(0, 168, 104, 0.24);
  border-color: var(--stone);
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 800;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #101514;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
  transition:
    width 180ms ease,
    padding 180ms ease;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 232px;
  height: 42px;
  object-fit: contain;
  object-position: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--stone);
  color: #052117;
  font-weight: 900;
  font-size: 1.25rem;
}

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

.brand div span {
  color: #aab7b2;
  font-size: 0.85rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.sidebar-toggle {
  min-height: 34px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: #dce5e1;
}

.sidebar-toggle span {
  width: 10px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 86px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 14px;
}

.app-shell.sidebar-collapsed .brand,
.app-shell.sidebar-collapsed .nav-button {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-logo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  object-position: left center;
}

.app-shell.sidebar-collapsed .brand div,
.app-shell.sidebar-collapsed .nav-button > span:nth-child(2),
.app-shell.sidebar-collapsed .nav-expand-icon,
.app-shell.sidebar-collapsed .nav-sublist,
.app-shell.sidebar-collapsed .sidebar-panel {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle span {
  transform: rotate(225deg);
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #c9d6d1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}

.nav-button > span:nth-child(2) {
  flex: 1;
}

.nav-button:hover,
.nav-button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-button.active {
  box-shadow: inset 3px 0 0 var(--stone);
}

.nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(0, 168, 104, 0.16);
  color: #7ff0bd;
  font-weight: 800;
}

.nav-expand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #dce5e1;
  background: rgba(255, 255, 255, 0.06);
}

.nav-expand-icon::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.nav-expand-icon.open::before {
  transform: rotate(225deg);
}

.nav-sublist {
  display: grid;
  gap: 4px;
  padding-left: 44px;
}

.nav-subbutton {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #aab7b2;
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
}

.nav-subbutton:hover,
.nav-subbutton.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-panel strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  margin: 8px 0;
}

.sidebar-panel p,
.panel-label {
  color: #b4c0bc;
  font-size: 0.88rem;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  display: block;
  color: var(--stone-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

h2 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.topbar-actions,
.profile,
.week-pill,
.hero-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
}

.week-pill,
.profile {
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.week-pill {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.week-pill span,
.profile small {
  color: var(--muted);
  font-size: 0.78rem;
}

.profile > span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--charcoal);
  font-size: 0.78rem;
  font-weight: 800;
}

.mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 9px;
}

.mobile-menu span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: var(--ink);
}

.hero-summary {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.12), rgba(255, 255, 255, 0)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-metrics {
  align-self: stretch;
  flex-wrap: wrap;
}

.hero-metrics div {
  min-width: 118px;
  padding: 14px;
  border-radius: var(--radius);
  background: #f7faf8;
  border: 1px solid var(--line);
}

.hero-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.hero-metrics strong {
  font-size: 1.55rem;
}

.content-area {
  display: grid;
  gap: 18px;
}

.page-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(199, 213, 207, 0.86);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.1), rgba(255, 255, 255, 0.9) 42%),
    var(--panel);
  box-shadow: 0 14px 36px rgba(16, 21, 20, 0.07);
}

.page-hero h2 {
  margin: 6px 0 8px;
  color: var(--ink);
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.page-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.breadcrumbs span,
.breadcrumbs strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.breadcrumbs span::after {
  content: "/";
  color: rgba(102, 115, 111, 0.52);
}

.breadcrumbs span:last-child::after {
  content: "";
}

.breadcrumbs strong {
  color: var(--stone-dark);
}

.page-hero-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 220px;
}

.subnav {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.subnav-button,
.primary-button,
.secondary-button,
.icon-button {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
}

.subnav-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
}

.subnav-button.active {
  color: #fff;
  border-color: var(--stone-dark);
  background: var(--stone-dark);
}

.filter-panel {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #f5faf7);
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.04);
}

.filter-panel strong {
  display: block;
  margin-bottom: 4px;
}

.filter-panel span,
.filter-panel label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.filter-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-controls label {
  display: grid;
  gap: 6px;
}

.filter-controls input,
.filter-controls select {
  min-width: 150px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fbfdfc;
  font-weight: 800;
}

.filter-controls input:focus,
.filter-controls select:focus {
  outline: 2px solid rgba(0, 168, 104, 0.24);
  border-color: var(--stone);
}

.period-month-control {
  display: grid;
  grid-template-columns: 34px minmax(150px, 1fr) 34px;
  align-items: center;
  gap: 6px;
}

.period-month-control input {
  min-width: 0;
  width: 100%;
}

.month-step-button {
  width: 34px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.month-step-button:hover {
  color: var(--stone-dark);
  border-color: rgba(0, 168, 104, 0.45);
  background: rgba(0, 168, 104, 0.08);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin: 12px 0 10px;
}

.table-search {
  display: grid;
  gap: 6px;
  min-width: min(320px, 100%);
}

.table-search span,
.table-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.table-search input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font-weight: 800;
}

.table-search input:focus {
  outline: 2px solid rgba(0, 168, 104, 0.24);
  border-color: var(--stone);
}

.primary-button,
.secondary-button {
  padding: 9px 13px;
}

.primary-button {
  color: #fff;
  border-color: var(--stone-dark);
  background: var(--stone-dark);
}

.primary-button:hover {
  background: var(--stone);
}

.primary-button.compact {
  min-height: 34px;
  white-space: nowrap;
}

.secondary-button.compact {
  min-height: 34px;
  padding: 7px 11px;
  white-space: nowrap;
}

.secondary-button {
  color: var(--ink);
  background: #f7faf8;
}

.icon-button {
  min-height: 32px;
  padding: 6px 9px;
  color: var(--stone-dark);
  background: var(--stone-soft);
  border-color: transparent;
}

.icon-button.danger {
  color: var(--danger);
  background: #ffe8e8;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

.card,
.metric-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
}

.card,
.table-card {
  padding: 18px;
}

.metric-card {
  padding: 16px;
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-head,
.section-head,
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--stone-soft);
  color: var(--stone-dark);
  font-weight: 900;
}

.metric-card span,
.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.75rem;
}

.trend {
  color: var(--stone-dark);
  font-weight: 800;
  font-size: 0.82rem;
}

.trend.down {
  color: var(--danger);
}

.progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e8eeeb;
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: var(--stone);
}

.list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.list li:last-child {
  border-bottom: 0;
}

.empty-state {
  min-height: 154px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px dashed #bdd4ca;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 168, 104, 0.08), rgba(255, 255, 255, 0.92));
}

.empty-state-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--stone-dark);
  background: var(--stone-soft);
  font-weight: 900;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
}

.empty-state p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.empty-state-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state-note {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.tag,
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 168, 104, 0.16);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--stone-dark);
  background: var(--stone-soft);
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.72;
}

.status.success {
  color: var(--stone-dark);
  background: #e7f8f1;
  border-color: rgba(0, 168, 104, 0.2);
}

.status.warning {
  color: var(--warning);
  background: #fff4dd;
  border-color: rgba(184, 117, 3, 0.18);
}

.status.danger {
  color: var(--danger);
  background: #ffe8e8;
  border-color: rgba(178, 59, 59, 0.18);
}

.status.info {
  color: var(--info);
  background: #e8f2ff;
  border-color: rgba(40, 103, 168, 0.18);
}

.status.neutral {
  color: #68736f;
  background: #f1f5f3;
  border-color: rgba(104, 115, 111, 0.16);
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e7edea;
  overflow: hidden;
}

.bar-fill {
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--stone-dark), var(--stone));
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.donut {
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--stone) 0 64%, #232927 64% 79%, #dfe7e3 79%);
}

.donut::after {
  content: attr(data-label);
  width: 82px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--panel);
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.people-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.people-table {
  min-width: 760px;
}

.payroll-card {
  overflow: hidden;
}

.payroll-visual {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.payroll-visual-spaced {
  margin-top: 14px;
}

.payroll-stack {
  display: flex;
  min-height: 58px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #eef4f1;
}

.payroll-stack span {
  width: var(--value);
  min-width: 6px;
  background: var(--color);
}

.payroll-bars {
  display: grid;
  gap: 12px;
}

.payroll-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.5fr) minmax(0, 1fr) 46px;
  gap: 12px;
  align-items: center;
}

.payroll-row div:first-child {
  display: grid;
  gap: 2px;
}

.payroll-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.payroll-table {
  min-width: 1060px;
}

.goals-table {
  min-width: 1120px;
}

.commercial-goals-form {
  display: grid;
  gap: 16px;
}

.agent-results-form .goal-form-section {
  overflow: hidden;
}

.agent-results-form .compact-section {
  padding: 12px;
  background: #ffffff;
}

.agent-results-form .compact-section .form-grid {
  align-items: end;
}

.client-results-table {
  min-width: 1580px;
}

.churn-results-table {
  min-width: 880px;
}

.client-results-table th,
.client-results-table td {
  vertical-align: middle;
}

.client-results-table .switch-control {
  margin: 0 auto;
}

.churn-results-table .switch-control,
.churn-results-table .recovery-toggle {
  margin: 0 auto;
}

.client-results-table .table-input {
  min-width: 112px;
}

.client-results-table .table-input.wide {
  min-width: 190px;
}

.commercial-goal-status {
  border-left: 3px solid #f59e0b;
}

.commercial-goal-status.goal-complete {
  border-left-color: #00a868;
}

.goal-distribution-progress,
.goal-form-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.goal-comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.goal-comparison-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 13px;
  border: 1px solid #f2d18b;
  border-radius: 8px;
  background: #fffaf0;
}

.goal-comparison-card.complete {
  border-color: #a9e4ca;
  background: #f2fcf7;
}

.goal-comparison-card > div:first-child,
.goal-comparison-card .comparison-vs {
  display: grid;
  gap: 4px;
}

.goal-comparison-card span,
.goal-comparison-card small,
.comparison-bar span {
  color: #68746f;
  font-size: 0.72rem;
  font-weight: 800;
}

.goal-comparison-card strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.comparison-vs {
  padding-top: 10px;
  border-top: 1px solid rgba(104, 116, 111, 0.18);
}

.comparison-vs > span {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #dfe7e3;
  text-transform: uppercase;
}

.comparison-bar {
  display: grid;
  gap: 6px;
}

.goal-progress-item,
.goal-preview-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 11px;
  border: 1px solid #e1e8e5;
  border-radius: 7px;
  background: #ffffff;
}

.goal-progress-item > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.goal-progress-item span,
.goal-preview-item small {
  color: #68746f;
  font-size: 0.72rem;
}

.goal-preview-item.complete {
  border-color: #a9e4ca;
  background: #f2fcf7;
}

.goal-preview-item.pending {
  border-color: #f2d18b;
  background: #fffaf0;
}

.goal-form-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dde5e2;
  border-radius: 8px;
  background: #fbfdfc;
}

.goal-form-section small {
  color: #68746f;
  font-size: 0.7rem;
  font-weight: 500;
}

.positive-text {
  color: #008653;
}

.warning-text {
  color: #a66400;
}

@media (max-width: 900px) {
  .goal-distribution-progress,
  .goal-form-preview,
  .goal-comparison-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .goal-distribution-progress,
  .goal-form-preview,
  .goal-comparison-grid {
    grid-template-columns: 1fr;
  }
}

.finance-table {
  min-width: 820px;
}

.payable-summary-card {
  display: grid;
  gap: 16px;
}

.payable-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.payable-column {
  min-width: 220px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbf9;
}

.payable-column.danger {
  background: #fff7f7;
  border-color: #f0c7c7;
}

.payable-column.warning {
  background: #fffaf0;
  border-color: #efd9a5;
}

.payable-column.info {
  background: #f2f8ff;
  border-color: #c5dcf4;
}

.payable-column.success {
  background: #f2fbf7;
  border-color: #bfe4d3;
}

.payable-column-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.payable-column-head > span {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--stone-dark);
  background: var(--stone-soft);
  font-weight: 900;
}

.payable-column-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.payable-list {
  display: grid;
  gap: 8px;
}

.payable-item {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(199, 213, 207, 0.82);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
}

.payable-item > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.payable-item span:not(.status) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.config-finance-card {
  display: grid;
  gap: 16px;
}

.config-list {
  display: grid;
  gap: 12px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbf9;
}

.config-chip-list {
  display: grid;
  gap: 8px;
}

.config-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(199, 213, 207, 0.82);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.86);
}

.config-chip > div:first-child {
  display: grid;
  gap: 6px;
}

.supplier-report-card {
  display: grid;
  gap: 16px;
}

.supplier-report-list {
  display: grid;
  gap: 10px;
}

.supplier-report-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(140px, 0.35fr) minmax(130px, 0.25fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(199, 213, 207, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.supplier-report-item.contract-report-item {
  grid-template-columns: 42px minmax(0, 1fr) minmax(150px, 0.32fr) minmax(130px, 0.22fr) auto;
}

.supplier-rank {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--stone-dark);
  background: var(--stone-soft);
  font-weight: 900;
}

.supplier-values {
  display: grid;
  gap: 3px;
}

.supplier-values span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.forecast-card {
  display: grid;
  gap: 16px;
}

.scenario-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scenario-button {
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
}

.scenario-button span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.scenario-button.active {
  color: #fff;
  border-color: var(--stone-dark);
  background: var(--stone-dark);
}

.scenario-button.active span {
  color: #dce5e1;
}

.forecast-timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.forecast-month {
  min-width: 220px;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(199, 213, 207, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.forecast-month.negative {
  border-color: #f0c7c7;
  background: #fff7f7;
}

.forecast-bar {
  display: grid;
  gap: 6px;
}

.forecast-bar span {
  display: block;
  width: var(--value);
  min-width: 6px;
  height: 8px;
  border-radius: 999px;
  background: var(--color);
}

.forecast-lines {
  display: grid;
  gap: 7px;
}

.forecast-lines div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.forecast-lines strong {
  color: var(--ink);
}

.budget-card {
  display: grid;
  gap: 16px;
}

.budget-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.budget-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(199, 213, 207, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

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

.plan-bar-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(199, 213, 207, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
}

.plan-bar-item.over-budget {
  border-color: #f0c7c7;
  background: #fff7f7;
}

.finance-form {
  align-self: start;
}

.wide-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.wide-label input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fbfdfc;
}

.wide-label input:focus {
  outline: 2px solid rgba(0, 168, 104, 0.24);
  border-color: var(--stone);
}

.payroll-note-row td {
  padding-top: 0;
  background: #fbfdfc;
}

.payroll-note-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.table-input {
  width: 118px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
}

.table-input.wide {
  width: 100%;
}

.table-input:focus {
  outline: 2px solid rgba(0, 168, 104, 0.24);
  border-color: var(--stone);
}

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

.collaborator-form {
  display: grid;
  gap: 18px;
}

.form-section {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.form-section + .form-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-section h3 {
  margin-bottom: 0;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.form-grid input,
.form-grid select,
.benefit-row input,
.benefit-row select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fbfdfc;
}

.form-grid input:focus,
.form-grid select:focus,
.benefit-row input:focus,
.benefit-row select:focus,
.note-box:focus {
  outline: 2px solid rgba(0, 168, 104, 0.24);
  border-color: var(--stone);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.benefits-list {
  display: grid;
  gap: 10px;
}

.benefit-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.6fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faf8;
}

.benefit-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(16, 21, 20, 0.52);
}

.modal-card {
  width: min(1040px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  padding: 18px;
}

.modal-card.wide-modal {
  width: min(1220px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin-bottom: 4px;
}

.feedback-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.feedback-toast {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid rgba(199, 213, 207, 0.92);
  border-left: 4px solid var(--stone);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 249, 0.94));
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.16);
}

.feedback-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--stone-dark);
  background: var(--stone-soft);
  font-weight: 900;
}

.feedback-toast.warning {
  border-left-color: var(--warning);
}

.feedback-toast.warning .feedback-icon {
  color: var(--warning);
  background: #fff4dd;
}

.feedback-toast.error {
  border-left-color: var(--danger);
}

.feedback-toast.error .feedback-icon {
  color: var(--danger);
  background: #ffe8e8;
}

.feedback-toast.info {
  border-left-color: var(--info);
}

.feedback-toast.info .feedback-icon {
  color: var(--info);
  background: #e8f2ff;
}

.feedback-toast strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

.feedback-toast span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.confirmation-layer {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(16, 21, 20, 0.52);
}

.confirmation-card {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.confirmation-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--warning);
  background: #fff4dd;
  font-weight: 900;
}

.confirmation-card h3 {
  margin-bottom: 4px;
}

.confirmation-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirmation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.danger-action {
  background: var(--danger);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.kanban-column {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faf8;
}

.kanban-card {
  padding: 12px;
  margin-top: 10px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.note-box {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--ink);
  background: #fbfdfc;
}

.split-stat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.split-stat:last-child {
  border-bottom: 0;
}

.rank {
  display: grid;
  gap: 12px;
}

.rank-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
}

.rank-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: #fff;
  font-weight: 800;
}

/* Premium visual layer */
.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  padding: 26px 18px;
  background:
    linear-gradient(180deg, rgba(0, 168, 104, 0.13), rgba(0, 0, 0, 0) 34%),
    var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 18px 0 50px rgba(16, 21, 20, 0.08);
}

.brand {
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  box-shadow:
    inset 0 -10px 18px rgba(0, 0, 0, 0.12),
    0 12px 26px rgba(0, 168, 104, 0.22);
}

.brand strong {
  font-size: 1.02rem;
}

.nav-list {
  gap: 10px;
}

.nav-button {
  min-height: 48px;
  padding: 10px 11px;
  border: 1px solid transparent;
  font-weight: 780;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.nav-button:hover {
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(127, 240, 189, 0.2);
  box-shadow:
    inset 3px 0 0 var(--stone),
    0 10px 26px rgba(0, 0, 0, 0.16);
}

.nav-icon {
  background: rgba(0, 168, 104, 0.18);
  border: 1px solid rgba(127, 240, 189, 0.14);
}

.nav-sublist {
  margin: -2px 0 2px;
  padding-left: 52px;
}

.nav-subbutton {
  position: relative;
  min-height: 34px;
  font-size: 0.9rem;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.nav-subbutton.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--stone);
  transform: translateY(-50%);
}

.sidebar-panel {
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.18), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.workspace {
  padding: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: -28px -28px 20px;
  padding: 22px 28px 16px;
  background: rgba(248, 251, 249, 0.86);
  border-bottom: 1px solid rgba(220, 229, 225, 0.72);
  backdrop-filter: blur(18px);
}

.eyebrow {
  color: var(--stone-dark);
}

h1 {
  letter-spacing: 0;
}

.week-pill,
.profile,
.hero-summary,
.subnav,
.card,
.metric-card,
.table-card {
  border-color: rgba(199, 213, 207, 0.86);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.week-pill,
.profile {
  box-shadow: 0 8px 20px rgba(16, 21, 20, 0.05);
}

.profile > span {
  background:
    linear-gradient(135deg, var(--stone-dark), var(--charcoal));
}

.hero-summary {
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.13), rgba(255, 255, 255, 0.76) 42%),
    rgba(255, 255, 255, 0.82);
}

.hero-metrics div {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.subnav {
  padding: 5px;
  box-shadow: var(--shadow-soft);
  overflow-x: auto;
  flex-wrap: nowrap;
  width: 100%;
}

.subnav-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 14px;
  border-color: transparent;
}

.subnav-button:hover {
  color: var(--ink);
  background: rgba(0, 168, 104, 0.08);
}

.subnav-button.active {
  background:
    linear-gradient(180deg, var(--stone), var(--stone-dark));
  box-shadow: 0 8px 18px rgba(0, 107, 69, 0.18);
}

.card,
.table-card {
  padding: 20px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 253, 252, 0.82));
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--stone), rgba(0, 168, 104, 0.08));
}

.grid.cols-4 > .metric-card:first-child,
.grid.cols-3 > .metric-card:first-child {
  border-color: rgba(0, 107, 69, 0.24);
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.13), rgba(255, 255, 255, 0.92) 46%),
    var(--surface);
}

.grid.cols-4 > .metric-card:first-child::before,
.grid.cols-3 > .metric-card:first-child::before {
  height: 4px;
  background: linear-gradient(90deg, var(--stone-dark), var(--stone));
}

.metric-card:hover {
  border-color: rgba(0, 168, 104, 0.34);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.metric-icon {
  background: linear-gradient(180deg, #e8faf3, #d8f4ea);
  border: 1px solid rgba(0, 168, 104, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.metric-card strong {
  letter-spacing: 0;
}

.primary-button,
.secondary-button,
.icon-button {
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.primary-button {
  background: linear-gradient(180deg, var(--stone), var(--stone-dark));
  box-shadow: 0 10px 22px rgba(0, 107, 69, 0.18);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  border-color: rgba(199, 213, 207, 0.9);
  background: rgba(255, 255, 255, 0.78);
}

.icon-button {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.tag,
.status {
  border: 1px solid rgba(0, 168, 104, 0.16);
}

.progress,
.bar-track {
  background: #e4ece8;
  box-shadow: inset 0 1px 2px rgba(16, 21, 20, 0.05);
}

.progress > span,
.bar-fill {
  background: linear-gradient(90deg, var(--stone-dark), var(--stone));
}

table {
  border-spacing: 0;
}

th {
  background: rgba(247, 250, 248, 0.9);
  color: #5a6864;
}

td {
  background: rgba(255, 255, 255, 0.42);
}

tbody tr:hover td {
  background: rgba(231, 248, 241, 0.36);
}

.table-wrap {
  border: 1px solid rgba(220, 229, 225, 0.82);
  border-radius: var(--radius);
}

.table-wrap table {
  min-width: 100%;
}

.list li {
  border-color: rgba(220, 229, 225, 0.74);
}

.kanban-column,
.kanban-card,
.benefit-row,
.payroll-stack {
  border-color: rgba(199, 213, 207, 0.86);
  background: rgba(247, 250, 248, 0.78);
}

.rank-number {
  background: linear-gradient(135deg, var(--stone-dark), var(--charcoal));
}

.form-grid input,
.form-grid select,
.benefit-row input,
.benefit-row select,
.wide-label input,
.table-input,
.note-box {
  border-color: rgba(199, 213, 207, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.modal-backdrop {
  background: rgba(10, 18, 15, 0.62);
  backdrop-filter: blur(8px);
}

.modal-card {
  border-color: rgba(255, 255, 255, 0.52);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 249, 0.94));
  box-shadow: var(--shadow-strong);
}

.modal-head {
  border-color: rgba(220, 229, 225, 0.82);
}

/* Final premium polish */
body {
  background:
    radial-gradient(circle at top left, rgba(0, 168, 104, 0.055), transparent 30%),
    linear-gradient(180deg, #fbfcfb 0%, #f4f7f5 46%, #fafbf9 100%);
}

.workspace {
  padding: 26px 30px;
}

.topbar {
  margin: -26px -30px 20px;
  padding: 16px 30px 13px;
  background: rgba(251, 252, 251, 0.9);
}

.topbar h1 {
  font-size: clamp(1.48rem, 2.45vw, 2.05rem);
}

.week-pill,
.profile {
  min-height: 42px;
  padding: 7px 10px;
}

.profile > span {
  width: 30px;
  height: 30px;
}

.secondary-button.compact,
.primary-button.compact {
  min-height: 32px;
  padding: 7px 10px;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(0, 168, 104, 0.08), rgba(0, 0, 0, 0) 30%),
    #0d1412;
  box-shadow: 14px 0 34px rgba(16, 21, 20, 0.055);
}

.brand {
  min-height: 48px;
  padding: 6px 6px 16px;
}

.nav-list {
  gap: 7px;
}

.nav-button {
  min-height: 44px;
  padding: 9px 10px;
  color: #bdcbc6;
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.085);
  box-shadow: inset 2px 0 0 var(--stone);
}

.nav-icon {
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.055);
  color: #8df0c4;
}

.nav-subbutton {
  min-height: 31px;
  color: #9fb0aa;
  font-size: 0.85rem;
}

.sidebar-panel {
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.page-hero,
.hero-summary {
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.055), rgba(255, 255, 255, 0.94) 40%),
    rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.page-hero {
  padding: 20px;
}

.page-hero h2 {
  font-size: clamp(1.34rem, 2.15vw, 1.85rem);
}

.page-hero p {
  max-width: 700px;
  font-size: 0.94rem;
  font-weight: 650;
}

.subnav {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 6px 16px rgba(16, 21, 20, 0.035);
}

.subnav-button {
  min-height: 34px;
  padding: 7px 12px;
}

.subnav-button.active {
  background: var(--stone-dark);
  box-shadow: 0 7px 14px rgba(0, 107, 69, 0.14);
}

.card,
.table-card,
.metric-card {
  border-color: rgba(207, 219, 214, 0.86);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 22px rgba(16, 21, 20, 0.04);
}

.card,
.table-card {
  padding: 18px;
}

.metric-card {
  min-height: 126px;
  padding: 16px;
}

.metric-card::before {
  background: linear-gradient(90deg, rgba(0, 168, 104, 0.58), rgba(0, 168, 104, 0.04));
}

.grid.cols-4 > .metric-card:first-child,
.grid.cols-3 > .metric-card:first-child {
  background:
    linear-gradient(135deg, rgba(0, 168, 104, 0.075), rgba(255, 255, 255, 0.94) 50%),
    rgba(255, 255, 255, 0.9);
}

.metric-card:hover {
  box-shadow: 0 12px 30px rgba(16, 21, 20, 0.07);
}

.metric-card strong {
  font-size: 1.58rem;
}

.metric-icon {
  width: 34px;
  height: 34px;
  background: #f0faf6;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.96rem;
}

th,
td {
  padding: 10px 10px;
  font-size: 0.86rem;
}

th {
  background: #f8faf9;
  color: #64716d;
  font-size: 0.72rem;
}

td {
  background: rgba(255, 255, 255, 0.54);
}

.table-toolbar {
  margin: 8px 0 9px;
}

.table-search input {
  min-height: 34px;
  background: rgba(255, 255, 255, 0.92);
}

.empty-state {
  min-height: 132px;
  background: linear-gradient(135deg, rgba(0, 168, 104, 0.045), rgba(255, 255, 255, 0.94));
}

.kanban-card,
.kanban-column,
.benefit-row,
.payroll-stack {
  background: rgba(250, 252, 251, 0.84);
}

@media (max-width: 1120px) {
  .grid.cols-4,
  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-summary {
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 320px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 26px 18px;
  }

  .app-shell.sidebar-collapsed .brand,
  .app-shell.sidebar-collapsed .nav-button {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .brand div,
  .app-shell.sidebar-collapsed .nav-button > span:nth-child(2),
  .app-shell.sidebar-collapsed .nav-expand-icon,
  .app-shell.sidebar-collapsed .nav-sublist,
  .app-shell.sidebar-collapsed .sidebar-panel {
    display: initial;
  }

  .app-shell.sidebar-collapsed .nav-sublist,
  .app-shell.sidebar-collapsed .sidebar-panel {
    display: grid;
  }

  .app-shell.sidebar-collapsed .nav-expand-icon {
    display: grid;
  }

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

  .workspace {
    padding: 16px;
  }

  .mobile-menu {
    display: block;
    flex: 0 0 auto;
  }

  .topbar {
    align-items: flex-start;
    margin: -16px -16px 18px;
    padding: 16px;
  }

  .topbar-actions {
    display: none;
  }

  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .people-layout,
  .payroll-visual,
  .benefit-row,
  .supplier-report-item,
  .scenario-switcher,
  .budget-grid,
  .plan-bars,
  .kanban {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-controls {
    justify-content: stretch;
  }

  .filter-controls label {
    flex: 1 1 180px;
  }

  .hero-summary {
    padding: 18px;
  }

  .page-hero {
    flex-direction: column;
    padding: 18px;
  }

  .page-hero-meta {
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
  }

  .hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-metrics div {
    min-width: 0;
    padding: 10px;
  }

  .hero-metrics strong {
    font-size: 1.2rem;
  }

  .bar-row {
    grid-template-columns: 82px minmax(0, 1fr) 42px;
  }

  .payroll-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .metric-head,
  .section-head,
  .row-between {
    align-items: flex-start;
    flex-direction: column;
  }

  .subnav {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .filter-controls label,
  .filter-controls input,
  .filter-controls select {
    width: 100%;
  }

  .subnav-button {
    width: auto;
  }

  .form-grid,
  .form-actions,
  .benefit-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-card {
    max-height: 94vh;
    padding: 14px;
  }

  .modal-head {
    flex-direction: column;
  }
}

/* Codex/macOS inspired light interface */
:root {
  --stone: #111111;
  --stone-dark: #111111;
  --stone-soft: #f3f4f6;
  --ink: #111111;
  --muted: #6b7280;
  --line: #e5e7eb;
  --panel: #ffffff;
  --canvas: #fafafa;
  --charcoal: #111111;
  --warning: #9a6700;
  --danger: #b42318;
  --info: #2563eb;
  --radius: 8px;
  --shadow: none;
  --shadow-soft: none;
  --shadow-strong: 0 18px 44px rgba(0, 0, 0, 0.12);
  --sidebar: #ffffff;
  --surface: #ffffff;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: #111111;
  background: #ffffff;
  text-rendering: optimizeLegibility;
}

.app-shell {
  grid-template-columns: 236px minmax(0, 1fr);
  background: #ffffff;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 68px minmax(0, 1fr);
}

.sidebar {
  padding: 18px 12px;
  color: #111111;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  box-shadow: none;
}

.brand {
  min-height: 42px;
  padding: 4px 4px 14px;
  border-bottom: 1px solid #eeeeee;
  justify-content: center;
}

.brand-logo {
  max-width: 190px;
  height: 34px;
  filter: none;
  opacity: 0.92;
  object-position: center;
}

.app-shell.sidebar-collapsed .brand-logo {
  width: 34px;
  height: 34px;
}

.sidebar-toggle {
  min-height: 30px;
  color: #6b7280;
  background: #ffffff;
  border-color: #e5e7eb;
}

.nav-list {
  gap: 3px;
}

.nav-button {
  min-height: 36px;
  padding: 7px 8px;
  color: #374151;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  transform: none;
}

.nav-button:hover,
.nav-button.active {
  color: #111111;
  background: #f4f4f5;
  box-shadow: none;
  transform: none;
}

.nav-button.active {
  font-weight: 650;
}

.nav-icon {
  width: 24px;
  height: 24px;
  color: #111111;
  background: transparent;
  border: 0;
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-expand-icon {
  width: 24px;
  height: 24px;
  color: #6b7280;
  background: transparent;
}

.nav-sublist {
  gap: 1px;
  margin: 0;
  padding-left: 34px;
}

.nav-subbutton {
  min-height: 28px;
  padding: 5px 8px;
  color: #6b7280;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}

.nav-subbutton:hover,
.nav-subbutton.active {
  color: #111111;
  background: #f4f4f5;
}

.nav-subbutton.active::before {
  display: none;
}

.sidebar-panel {
  padding: 12px;
  color: #111111;
  background: #fafafa;
  border-color: #eeeeee;
  box-shadow: none;
}

.sidebar-panel strong {
  font-size: 1.45rem;
}

.sidebar-panel p,
.panel-label {
  color: #6b7280;
  font-size: 0.8rem;
}

.workspace {
  padding: 20px 24px 28px;
  background: #ffffff;
}

.topbar {
  position: sticky;
  top: 0;
  margin: -20px -24px 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #eeeeee;
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.topbar h1,
h1 {
  color: #111111;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  font-weight: 650;
}

h2 {
  color: #111111;
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  font-weight: 650;
}

h3 {
  margin-bottom: 10px;
  color: #111111;
  font-size: 0.9rem;
  font-weight: 650;
}

.eyebrow,
.breadcrumbs,
.week-pill span,
.profile small,
.muted {
  color: #6b7280;
}

.eyebrow,
.breadcrumbs {
  font-size: 0.68rem;
  font-weight: 650;
}

.breadcrumbs strong {
  color: #111111;
}

.week-pill,
.profile {
  min-height: 36px;
  padding: 6px 9px;
  border-color: #e5e7eb;
  background: #ffffff;
  box-shadow: none;
}

.profile > span {
  width: 26px;
  height: 26px;
  color: #ffffff;
  background: #111111;
  font-size: 0.7rem;
}

.primary-button,
.secondary-button,
.icon-button,
.subnav-button {
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 550;
  box-shadow: none;
}

.primary-button {
  color: #ffffff;
  background: #111111;
  border-color: #111111;
}

.primary-button:hover {
  background: #000000;
}

.secondary-button,
.icon-button {
  color: #111111;
  background: #ffffff;
  border-color: #d1d5db;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: none;
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 30px;
  padding: 6px 10px;
}

.content-area {
  gap: 14px;
}

.page-hero,
.hero-summary,
.card,
.table-card,
.metric-card,
.subnav,
.filter-panel,
.kanban-card,
.kanban-column,
.benefit-row,
.payroll-stack,
.empty-state {
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
}

.page-hero {
  padding: 16px;
}

.page-hero h2 {
  margin: 5px 0 6px;
}

.page-hero p {
  max-width: 680px;
  color: #4b5563;
  font-size: 0.88rem;
  font-weight: 400;
}

.page-hero-meta {
  min-width: 180px;
}

.subnav {
  gap: 4px;
  padding: 4px;
  background: #f9fafb;
}

.subnav-button {
  min-height: 30px;
  padding: 6px 10px;
  color: #4b5563;
  background: transparent;
  border-color: transparent;
}

.subnav-button:hover,
.subnav-button.active {
  color: #111111;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.subnav-button.active {
  border-color: #e5e7eb;
}

.grid {
  gap: 14px;
}

.card,
.table-card {
  padding: 14px;
}

.metric-card {
  min-height: 108px;
  padding: 13px;
  background: #ffffff;
}

.metric-card::before,
.grid.cols-4 > .metric-card:first-child::before,
.grid.cols-3 > .metric-card:first-child::before {
  height: 0;
  background: transparent;
}

.grid.cols-4 > .metric-card:first-child,
.grid.cols-3 > .metric-card:first-child {
  border-color: #d1d5db;
  background: #ffffff;
}

.metric-card:hover {
  border-color: #d1d5db;
  box-shadow: none;
  transform: none;
}

.metric-card span {
  color: #6b7280;
  font-size: 0.76rem;
}

.metric-card strong {
  margin-top: 6px;
  color: #111111;
  font-size: 1.28rem;
  font-weight: 650;
}

.metric-icon {
  width: 26px;
  height: 26px;
  color: #4b5563;
  background: #f4f4f5;
  border: 0;
  box-shadow: none;
  font-size: 0.72rem;
}

.trend {
  color: #4b5563;
  font-size: 0.74rem;
  font-weight: 550;
}

.progress,
.bar-track {
  height: 6px;
  background: #f3f4f6;
  box-shadow: none;
}

.progress > span,
.bar-fill {
  background: #111111;
}

.tag,
.status {
  min-height: 21px;
  padding: 2px 7px;
  color: #374151;
  background: #f9fafb;
  border-color: #e5e7eb;
  font-size: 0.7rem;
  font-weight: 550;
}

.status.success {
  color: #166534;
  background: #f0fdf4;
  border-color: #dcfce7;
}

.status.warning {
  color: #92400e;
  background: #fffbeb;
  border-color: #fef3c7;
}

.status.danger {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fee2e2;
}

.status.info {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #dbeafe;
}

.status.neutral {
  color: #4b5563;
  background: #f9fafb;
  border-color: #e5e7eb;
}

th,
td {
  padding: 8px 9px;
  font-size: 0.82rem;
}

th {
  color: #6b7280;
  background: #fafafa;
  font-size: 0.68rem;
  font-weight: 650;
}

td {
  background: #ffffff;
}

tbody tr:hover td {
  background: #fafafa;
}

.table-wrap {
  border-color: #e5e7eb;
}

.table-toolbar {
  margin: 6px 0 8px;
}

.table-search input,
.filter-controls input,
.filter-controls select,
.form-grid input,
.form-grid select,
.benefit-row input,
.benefit-row select,
.wide-label input,
.table-input,
.note-box,
.login-form input {
  min-height: 34px;
  color: #111111;
  background: #ffffff;
  border-color: #d1d5db;
  border-radius: 7px;
  box-shadow: none;
  font-size: 0.86rem;
}

.table-search input:focus,
.filter-controls input:focus,
.filter-controls select:focus,
.form-grid input:focus,
.form-grid select:focus,
.benefit-row input:focus,
.benefit-row select:focus,
.wide-label input:focus,
.table-input:focus,
.note-box:focus,
.login-form input:focus {
  outline: 2px solid #d1d5db;
  border-color: #111111;
}

.empty-state {
  min-height: 112px;
  padding: 14px;
  background: #ffffff;
}

.empty-state-icon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  color: #4b5563;
  background: #f4f4f5;
}

.rank-number {
  width: 26px;
  height: 26px;
  background: #111111;
  font-size: 0.76rem;
}

.modal-backdrop {
  background: rgba(17, 17, 17, 0.28);
  backdrop-filter: blur(8px);
}

.modal-card,
.confirmation-card,
.login-card {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.login-screen {
  background: #ffffff;
}

.login-brand {
  color: #111111;
  background: #ffffff;
  border-color: #e5e7eb;
  justify-content: center;
}

.feedback-toast {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.12);
}

.feedback-icon {
  color: #ffffff;
  background: #111111;
}

@media (max-width: 760px) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    margin: -14px -14px 14px;
    padding: 12px 14px;
  }

  .sidebar {
    background: #ffffff;
  }
}

/* Scrollable fixed left menu */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.nav-list {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.nav-group {
  gap: 2px;
}

.nav-button {
  min-height: 32px;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 0.84rem;
}

.nav-button.active {
  background: #f5f5f5;
  box-shadow: inset 2px 0 0 #008f5a;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  font-size: 0.66rem;
}

.nav-expand-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.nav-expand-icon::before {
  width: 6px;
  height: 6px;
  border-width: 1.5px;
}

.nav-sublist {
  gap: 0;
  padding-left: 27px;
}

.nav-subbutton {
  min-height: 25px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 0.78rem;
}

.nav-list::-webkit-scrollbar {
  width: 8px;
}

.nav-list::-webkit-scrollbar-track {
  background: transparent;
}

.nav-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border: 2px solid #ffffff;
  border-radius: 999px;
}

.nav-list::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.sidebar-panel {
  flex: 0 0 auto;
}

.receipt-field {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.receipt-field input[type="file"] {
  padding: 8px;
  background: #ffffff;
}

.receipt-field small,
.receipt-current span {
  color: #6b7280;
  font-size: 0.78rem;
}

.receipt-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #fafafa;
}

.receipt-current div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.receipt-current strong {
  overflow-wrap: anywhere;
}

.checkbox-label {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  min-height: 0;
}

.route-page-head {
  margin: 2px 0 14px;
}

.route-modal-card {
  width: min(940px, calc(100vw - 32px));
}

.route-city-fieldset {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #dce5e1;
  border-radius: 8px;
  background: #fbfdfc;
}

.route-city-fieldset legend {
  padding: 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.route-city-fieldset > p {
  margin: 0 0 10px;
  font-size: 0.78rem;
}

.route-city-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.route-city-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e0e7e4;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2926;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.route-city-option:has(input:checked) {
  border-color: #58c99a;
  background: #effbf5;
  color: #006b45;
}

.route-city-option input {
  width: 15px;
  height: 15px;
  min-height: 0;
  accent-color: #00a868;
}

.route-city-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.route-neighborhood-option span {
  display: grid;
  gap: 1px;
}

.route-neighborhood-option small {
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 500;
}

.territory-registry {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8e5;
}

.territory-registry-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.territory-registry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e1e8e5;
  border-radius: 7px;
  background: #ffffff;
}

.territory-registry-item > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.territory-registry-item strong,
.territory-registry-item span {
  overflow-wrap: anywhere;
}

.territory-registry-item span {
  color: #6b7280;
  font-size: 0.72rem;
}

@media (max-width: 900px) {
  .route-city-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .route-page-head {
    align-items: stretch;
  }

  .route-page-head .primary-button {
    width: 100%;
  }

  .route-city-grid {
    grid-template-columns: 1fr;
  }

  .territory-registry-list {
    grid-template-columns: 1fr;
  }
}

.receipt-button {
  min-width: 66px;
}

.payroll-base-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 6px;
  margin-bottom: 5px;
}

.payroll-base-fields label {
  display: grid;
  gap: 3px;
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 600;
}

.payroll-base-fields .table-input {
  width: 100%;
  min-width: 0;
}

.topbar {
  justify-content: flex-start;
}

.topbar-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  object-fit: contain;
  object-position: center;
}

.topbar-actions {
  margin-left: auto;
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    height: 100vh;
    max-height: 100vh;
  }

  .topbar-mark {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .receipt-current {
    align-items: flex-start;
    flex-direction: column;
  }

  .payroll-base-fields {
    grid-template-columns: 1fr;
  }
}

/* Color only operational indicators and charts */
:root {
  --success: #16a34a;
  --success-soft: #ecfdf3;
  --warning-soft: #fffbeb;
  --danger-soft: #fef2f2;
  --info-soft: #eff6ff;
  --chart-green: #10b981;
  --chart-blue: #3b82f6;
  --chart-amber: #f59e0b;
  --chart-red: #ef4444;
}

.metric-icon {
  color: var(--chart-green);
  background: var(--success-soft);
}

.metric-card:nth-child(2) .metric-icon {
  color: var(--chart-blue);
  background: var(--info-soft);
}

.metric-card:nth-child(3) .metric-icon {
  color: var(--chart-amber);
  background: var(--warning-soft);
}

.metric-card:nth-child(4) .metric-icon {
  color: var(--chart-red);
  background: var(--danger-soft);
}

.metric-card::before,
.grid.cols-4 > .metric-card:first-child::before,
.grid.cols-3 > .metric-card:first-child::before {
  height: 3px;
  background: var(--chart-green);
}

.metric-card:nth-child(2)::before {
  background: var(--chart-blue);
}

.metric-card:nth-child(3)::before {
  background: var(--chart-amber);
}

.metric-card:nth-child(4)::before {
  background: var(--chart-red);
}

.progress,
.bar-track {
  background: #eef2f7;
}

.progress > span,
.bar-fill {
  background: linear-gradient(90deg, var(--chart-blue), var(--chart-green));
}

.bar-row:nth-child(2) .bar-fill,
.payroll-row:nth-child(2) .bar-fill {
  background: linear-gradient(90deg, #60a5fa, var(--chart-blue));
}

.bar-row:nth-child(3) .bar-fill,
.payroll-row:nth-child(3) .bar-fill {
  background: linear-gradient(90deg, #fbbf24, var(--chart-amber));
}

.bar-row:nth-child(4) .bar-fill,
.payroll-row:nth-child(4) .bar-fill {
  background: linear-gradient(90deg, #fb7185, var(--chart-red));
}

.donut {
  background:
    conic-gradient(var(--chart-green) var(--value, 76%), #eef2f7 0);
}

.status.success,
.tag.success {
  color: #166534;
  background: var(--success-soft);
  border-color: #bbf7d0;
}

.status.warning,
.tag.warning {
  color: #92400e;
  background: var(--warning-soft);
  border-color: #fde68a;
}

.status.danger,
.tag.danger {
  color: #991b1b;
  background: var(--danger-soft);
  border-color: #fecaca;
}

.status.info,
.tag.info {
  color: #1d4ed8;
  background: var(--info-soft);
  border-color: #bfdbfe;
}

.status.neutral,
.tag.neutral {
  color: #4b5563;
  background: #f9fafb;
  border-color: #e5e7eb;
}

.status::before {
  opacity: 1;
}

.trend:not(.down) {
  color: var(--success);
}

.trend.down {
  color: var(--danger);
}

.rank-number {
  background: linear-gradient(135deg, var(--chart-blue), var(--chart-green));
}

.supplier-rank {
  color: #ffffff;
  background: linear-gradient(135deg, var(--chart-amber), var(--chart-green));
}

.empty-state-icon {
  color: var(--chart-blue);
  background: var(--info-soft);
}

.feedback-icon {
  background: var(--success-soft);
  color: var(--success);
}

.inline-form-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.compact-head {
  margin-bottom: 10px;
}

[hidden] {
  display: none !important;
}

.installment-editor {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.installment-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.installment-rows {
  display: grid;
  gap: 8px;
}

.installment-row {
  display: grid;
  grid-template-columns: 34px minmax(160px, 1fr) minmax(140px, 1fr);
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.installment-row > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #f2f4f5;
  font-weight: 800;
  font-size: 0.82rem;
}

.installment-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.installment-row input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fbfdfc;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.table-sort-button span {
  min-width: 12px;
  color: var(--stone);
  font-size: 0.78rem;
}

.table-sort-button:hover,
.table-sort-button.active {
  color: var(--ink);
}

.table-total-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px;
  background: #f8faf9;
  border-top: 1px solid var(--line);
}

.table-total-bar span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-total-bar strong {
  color: var(--ink);
}

@media (max-width: 720px) {
  .installment-editor-head,
  .installment-row {
    grid-template-columns: 1fr;
  }

  .installment-row > span {
    width: 100%;
    justify-content: start;
    padding-left: 10px;
  }
}

/* Stone product UI refresh - June 2026 */
:root {
  --stone: #16b86a;
  --stone-dark: #087a49;
  --stone-soft: #eaf8f1;
  --stone-pale: #f4fbf7;
  --ink: #151b19;
  --muted: #63736d;
  --line: #dce5e1;
  --line-strong: #c9d7d1;
  --panel: #ffffff;
  --canvas: #f7f9f8;
  --charcoal: #17201d;
  --warning: #a96800;
  --danger: #c33838;
  --info: #2469b2;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(22, 45, 36, 0.055);
  --shadow-soft: 0 3px 12px rgba(22, 45, 36, 0.045);
  --shadow-strong: 0 24px 64px rgba(16, 37, 29, 0.16);
  --sidebar: #ffffff;
  --surface: #ffffff;
}

html {
  background: var(--canvas);
}

body {
  color: var(--ink);
  background: var(--canvas);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.42;
}

::selection {
  color: #073c27;
  background: #b9efd3;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
  background: var(--canvas);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 68px minmax(0, 1fr);
}

.workspace {
  min-width: 0;
  padding: 0 28px 36px;
  background: var(--canvas);
}

.sidebar {
  padding: 18px 12px 14px;
  color: var(--ink);
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: none;
  gap: 14px;
}

.brand {
  min-height: 48px;
  padding: 2px 8px 14px;
  border-bottom: 1px solid #edf1ef;
}

.brand-logo {
  width: 100%;
  max-width: 194px;
  height: 38px;
  opacity: 1;
}

.app-shell.sidebar-collapsed .brand-logo {
  width: 36px;
  height: 36px;
  object-fit: cover;
  object-position: left center;
}

.sidebar-toggle {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
}

.sidebar-toggle:hover {
  color: var(--stone-dark);
  border-color: #b9ddcb;
  background: var(--stone-pale);
}

.nav-list {
  gap: 3px;
  padding: 2px 3px 4px 0;
  scrollbar-color: #cdd9d4 transparent;
}

.nav-group {
  gap: 2px;
}

.nav-button {
  min-height: 38px;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #3e4b46;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 600;
}

.nav-button:hover {
  color: var(--ink);
  background: #f5f8f6;
}

.nav-button.active {
  color: #075f3b;
  border-color: #d7eee2;
  background: var(--stone-soft);
  box-shadow: none;
  font-weight: 700;
}

.nav-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 7px;
  color: #5c6b65;
  background: #f2f5f3;
  font-size: 0.67rem;
}

.nav-button.active .nav-icon {
  color: #ffffff;
  background: var(--stone);
}

.nav-expand-icon {
  color: #7b8984;
}

.nav-sublist {
  gap: 2px;
  padding: 2px 0 4px 36px;
}

.nav-subbutton {
  min-height: 29px;
  padding: 5px 8px;
  border-radius: 7px;
  color: #71807a;
  font-size: 0.79rem;
  font-weight: 550;
}

.nav-subbutton:hover {
  color: var(--ink);
  background: #f5f8f6;
}

.nav-subbutton.active {
  color: #087a49;
  background: #eef9f3;
  font-weight: 700;
}

.sidebar-panel {
  padding: 12px;
  border: 1px solid #d9ece2;
  border-radius: 8px;
  color: var(--ink);
  background: var(--stone-pale);
  box-shadow: none;
}

.sidebar-panel strong {
  color: var(--stone-dark);
  font-size: 1.35rem;
}

.sidebar-panel p,
.panel-label {
  color: var(--muted);
  font-size: 0.76rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 72px;
  margin: 0 -28px 22px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: none;
  backdrop-filter: blur(16px);
}

.topbar-mark {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  padding: 5px;
  border-radius: 8px;
  background: var(--stone-soft);
}

.topbar h1,
h1 {
  color: var(--ink);
  font-size: 1.42rem;
  font-weight: 720;
}

h2 {
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 720;
}

h3 {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
}

.eyebrow,
.breadcrumbs {
  color: #6d7b76;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.week-pill,
.profile {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.week-pill strong,
.profile strong {
  font-size: 0.82rem;
}

.profile > span {
  width: 28px;
  height: 28px;
  color: #ffffff;
  background: var(--stone-dark);
}

.content-area {
  width: 100%;
  gap: 16px;
}

.page-hero {
  min-height: auto;
  padding: 4px 2px 6px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.page-hero h2 {
  margin: 5px 0 4px;
  font-size: 1.65rem;
}

.page-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-hero-meta {
  min-width: auto;
}

.subnav {
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f0;
  box-shadow: none;
}

.subnav-button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #5e6d67;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 650;
}

.subnav-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
}

.subnav-button.active {
  color: #075f3b;
  border-color: #d4e6dc;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(22, 45, 36, 0.06);
}

.grid {
  gap: 14px;
}

.card,
.table-card,
.metric-card,
.filter-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.card,
.table-card {
  padding: 17px;
}

.metric-card {
  min-height: 120px;
  padding: 15px;
  overflow: hidden;
}

.metric-card::before,
.grid.cols-4 > .metric-card:first-child::before,
.grid.cols-3 > .metric-card:first-child::before {
  height: 3px;
}

.metric-card.success::before,
.grid.cols-4 > .metric-card.success:first-child::before,
.grid.cols-3 > .metric-card.success:first-child::before {
  background: var(--chart-green);
}

.metric-card.warning::before,
.grid.cols-4 > .metric-card.warning:first-child::before,
.grid.cols-3 > .metric-card.warning:first-child::before {
  background: var(--chart-amber);
}

.metric-card.danger::before,
.grid.cols-4 > .metric-card.danger:first-child::before,
.grid.cols-3 > .metric-card.danger:first-child::before {
  background: var(--chart-red);
}

.metric-card:hover {
  border-color: #c6d8d0;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.77rem;
}

.metric-card strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 750;
}

.metric-icon {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  font-size: 0.7rem;
}

.metric-card.success .metric-icon {
  color: var(--chart-green);
  background: var(--success-soft);
}

.metric-card.warning .metric-icon {
  color: var(--chart-amber);
  background: var(--warning-soft);
}

.metric-card.danger .metric-icon {
  color: var(--chart-red);
  background: var(--danger-soft);
}

.trend {
  font-size: 0.72rem;
  font-weight: 700;
}

.metric-card.success .trend {
  color: var(--chart-green);
}

.metric-card.warning .trend {
  color: var(--chart-amber);
}

.metric-card.danger .trend {
  color: var(--chart-red);
}

.progress,
.bar-track {
  height: 6px;
  background: #edf2ef;
}

.progress > span,
.bar-fill {
  background: linear-gradient(90deg, #0a9b5a, #20c477);
}

.metric-card.success .progress > span {
  background: linear-gradient(90deg, var(--chart-green), #20c477);
}

.metric-card.warning .progress > span {
  background: linear-gradient(90deg, #f59e0b, var(--chart-amber));
}

.metric-card.danger .progress > span {
  background: linear-gradient(90deg, #ef4444, var(--chart-red));
}

.section-head {
  align-items: center;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0 0 3px;
}

.section-head .muted {
  font-size: 0.8rem;
}

.filter-panel,
.period-toolbar {
  padding: 13px 15px;
  border-color: var(--line);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.filter-controls {
  gap: 10px;
}

.filter-controls label,
.form-grid label,
.wide-label,
.table-search,
.installment-row label {
  gap: 6px;
  color: #62716b;
  font-size: 0.77rem;
  font-weight: 700;
}

.table-search input,
.filter-controls input,
.filter-controls select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.benefit-row input,
.benefit-row select,
.wide-label input,
.wide-label select,
.wide-label textarea,
.table-input,
.note-box,
.login-form input,
.installment-row input {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: inset 0 1px 1px rgba(20, 45, 35, 0.025);
  font-size: 0.85rem;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.table-search input:hover,
.filter-controls input:hover,
.filter-controls select:hover,
.form-grid input:hover,
.form-grid select:hover,
.form-grid textarea:hover,
.wide-label input:hover,
.wide-label select:hover,
.wide-label textarea:hover,
.table-input:hover,
.note-box:hover,
.login-form input:hover {
  border-color: #aebfb7;
}

.table-search input:focus,
.filter-controls input:focus,
.filter-controls select:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.benefit-row input:focus,
.benefit-row select:focus,
.wide-label input:focus,
.wide-label select:focus,
.wide-label textarea:focus,
.table-input:focus,
.note-box:focus,
.login-form input:focus,
.installment-row input:focus {
  outline: 0;
  border-color: var(--stone);
  box-shadow: 0 0 0 3px rgba(22, 184, 106, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #9aa6a1;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.primary-button {
  color: #ffffff;
  border-color: var(--stone);
  background: var(--stone);
  box-shadow: 0 4px 10px rgba(22, 184, 106, 0.18);
}

.primary-button:hover {
  border-color: #0da55c;
  background: #0da55c;
  box-shadow: 0 6px 14px rgba(22, 184, 106, 0.22);
}

.secondary-button,
.icon-button {
  color: #26322e;
  border-color: var(--line-strong);
  background: #ffffff;
}

.secondary-button:hover,
.icon-button:hover {
  color: #075f3b;
  border-color: #a9d8c0;
  background: var(--stone-pale);
}

.icon-button.danger {
  color: var(--danger);
  border-color: #efd1d1;
  background: #fff7f7;
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 34px;
  padding: 7px 11px;
}

.tag,
.status {
  min-height: 23px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 750;
}

.tag {
  color: #4e5d57;
  border-color: var(--line);
  background: #f8faf9;
}

.status.success,
.tag.success {
  color: #087443;
  border-color: #bfe8d1;
  background: #eafaf1;
}

.status.warning,
.tag.warning {
  color: #946000;
  border-color: #f0d896;
  background: #fff9e9;
}

.status.danger,
.tag.danger {
  color: #ae2d2d;
  border-color: #f0c7c7;
  background: #fff1f1;
}

.status.info,
.tag.info {
  color: #205e9d;
  border-color: #c8dcf1;
  background: #eef6ff;
}

.table-toolbar {
  gap: 12px;
  margin: 8px 0 10px;
}

.table-search {
  min-width: min(380px, 100%);
}

.table-search input {
  padding-left: 34px;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(90deg, #e5ebe8, #d5e1dc) border-box;
}

.table-count {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

table {
  border-spacing: 0;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid #e8eeeb;
  font-size: 0.82rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #61706a;
  background: #f5f8f6;
  font-size: 0.67rem;
  font-weight: 750;
}

td {
  color: #26322e;
  background: #ffffff;
}

tbody tr:hover td {
  background: #f7fbf9;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-sort-button {
  color: inherit;
  font-weight: 750;
}

.table-sort-button:hover,
.table-sort-button.active {
  color: var(--stone-dark);
}

.table-sort-button span {
  margin-left: auto;
  color: #94a39d;
  font-size: 0.72rem;
  line-height: 1;
}

.table-sort-button.active span {
  color: var(--stone);
}

.table-auto-total-row td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  border-top: 1px solid #d5e1dc;
  border-bottom: 0;
  background: #f5f8f6;
  color: #52615b;
  font-size: 0.76rem;
  font-weight: 750;
}

.table-auto-total-row .table-auto-total-label {
  color: var(--ink);
  text-transform: uppercase;
}

.table-auto-total-row .table-auto-total-value {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.table-total-bar {
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #f5f8f6;
}

.table-total-bar span {
  padding: 8px 10px;
  border-color: #dbe6e1;
  background: #ffffff;
}

.empty-state {
  min-height: 190px;
  justify-content: center;
  padding: 30px 22px;
  border: 1px dashed #bfd7cb;
  border-radius: 8px;
  background: #fbfdfc;
  text-align: center;
}

.empty-state > div:not(.empty-state-icon) {
  max-width: 480px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-radius: 8px;
  color: var(--stone);
  background: var(--stone-soft);
  font-size: 0.92rem;
}

.empty-state p {
  color: var(--muted);
}

.empty-state-actions {
  justify-content: center;
}

.list li {
  padding: 10px 0;
  border-color: #e8eeeb;
}

.bar-row {
  gap: 12px;
  font-size: 0.8rem;
}

.bar-track {
  height: 8px;
}

.payable-board {
  gap: 10px;
}

.payable-column {
  gap: 10px;
  padding: 11px;
  border-color: var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.payable-column.danger {
  border-color: #efd0d0;
  background: #fff8f8;
}

.payable-column.warning {
  border-color: #edddb7;
  background: #fffcf4;
}

.payable-column.info {
  border-color: #ccdfef;
  background: #f6faff;
}

.payable-column.success {
  border-color: #c6e5d5;
  background: #f5fbf8;
}

.payable-column-head > span {
  color: var(--stone-dark);
  background: var(--stone-soft);
}

.payable-item {
  padding: 10px;
  border-color: #dbe5e0;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(20, 45, 35, 0.035);
}

.inline-form-panel,
.installment-editor,
.benefit-row,
.payroll-stack {
  border-color: var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.installment-row {
  border-color: #dde7e2;
  background: #ffffff;
}

.installment-row > span {
  color: var(--stone-dark);
  background: var(--stone-soft);
}

.modal-backdrop {
  padding: 24px;
  background: rgba(18, 31, 26, 0.36);
  backdrop-filter: blur(6px);
}

.modal-card,
.confirmation-card {
  border: 1px solid #dbe5e0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-strong);
}

.modal-card {
  padding: 20px;
}

.modal-head {
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid #e7edea;
}

.modal-head h3 {
  font-size: 1rem;
}

.form-actions {
  padding-top: 14px;
  border-top: 1px solid #edf1ef;
}

.feedback-toast {
  border-color: #dce7e2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-strong);
}

.feedback-icon {
  color: #ffffff;
  background: var(--stone);
}

.login-screen {
  padding: 28px;
  background: #f2faf6;
}

.login-card {
  width: min(420px, calc(100vw - 40px));
  max-width: 100%;
  min-width: 0;
  gap: 20px;
  padding: 26px;
  border: 1px solid #d8e7df;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 65, 42, 0.12);
}

.login-brand {
  padding: 11px;
  border-color: #d8ece2;
  background: var(--stone-pale);
}

.login-brand .brand-logo {
  max-width: 100%;
  height: 42px;
}

.login-form,
.login-form label,
.login-form input {
  min-width: 0;
  width: 100%;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .workspace {
    padding-right: 20px;
    padding-left: 20px;
  }

  .topbar {
    margin-right: -20px;
    margin-left: -20px;
    padding-right: 20px;
    padding-left: 20px;
  }

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

  .table-total-bar {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    font-size: 13px;
  }

  .workspace {
    padding: 0 14px 24px;
  }

  .login-screen {
    padding: 16px;
  }

  .login-card {
    width: min(100%, calc(100vw - 32px));
    padding: 22px;
  }

  .sidebar {
    width: min(286px, 86vw);
    padding: 16px 12px;
    box-shadow: 18px 0 42px rgba(15, 39, 29, 0.14);
  }

  .topbar {
    min-height: 62px;
    margin: 0 -14px 16px;
    padding: 10px 14px;
    gap: 9px;
  }

  .topbar-mark {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .topbar h1 {
    font-size: 1.08rem;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .profile {
    padding: 5px;
  }

  .profile > div,
  .week-pill span {
    display: none;
  }

  .week-pill {
    min-height: 34px;
    padding: 5px 8px;
  }

  .week-pill strong {
    font-size: 0.72rem;
  }

  .page-hero {
    gap: 12px;
  }

  .page-hero h2 {
    font-size: 1.35rem;
  }

  .page-hero-meta {
    width: 100%;
    align-items: stretch;
  }

  .page-hero-meta .primary-button,
  .page-hero-meta .secondary-button {
    width: 100%;
  }

  .subnav {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .subnav::-webkit-scrollbar {
    display: none;
  }

  .subnav-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 106px;
  }

  .card,
  .table-card {
    padding: 14px;
  }

  .filter-panel,
  .period-toolbar {
    padding: 12px;
  }

  .filter-controls {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-search {
    width: 100%;
    min-width: 0;
  }

  .table-count {
    align-self: flex-end;
  }

  th,
  td {
    padding: 9px;
  }

  .table-total-bar {
    grid-template-columns: 1fr;
  }

  .empty-state {
    min-height: 170px;
    align-items: center;
    flex-direction: column;
  }

  .payable-board {
    grid-template-columns: repeat(5, minmax(210px, 82vw));
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    max-height: 94vh;
    padding: 15px;
  }

  .modal-head {
    align-items: stretch;
  }

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

  .form-actions button {
    width: 100%;
  }

  .installment-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .installment-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .mobile-menu {
    width: 34px;
    height: 34px;
  }

  .topbar-mark {
    display: none;
  }

  .week-pill {
    display: none;
  }

  .primary-button,
  .secondary-button,
  .icon-button {
    min-height: 36px;
  }

  .metric-card strong {
    font-size: 1.28rem;
  }
}

.payable-column .payable-list {
  max-height: 390px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.payable-column .payable-list::-webkit-scrollbar {
  width: 7px;
}

.payable-column .payable-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd8d2;
}

.embedded-expense-card {
  margin-top: 14px;
}

.embedded-expense-table {
  max-height: 430px;
  overflow: auto;
}

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

.payment-preview > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfa;
}

.payment-preview span {
  display: block;
  margin-bottom: 4px;
  color: #62716b;
  font-size: 0.73rem;
  font-weight: 700;
}

.payment-preview strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.payment-preview-total {
  border-color: rgba(22, 184, 106, 0.35) !important;
  background: #effaf5 !important;
}

.payment-preview-total strong {
  color: var(--stone-dark);
  font-size: 1.05rem;
}

@media (max-width: 760px) {
  .payment-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.batch-payment-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.batch-payment-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfa;
  color: #62716b;
  font-size: 0.82rem;
  font-weight: 700;
}

.batch-payment-summary strong {
  color: var(--ink);
}

.batch-payment-list {
  display: grid;
  gap: 8px;
  max-height: min(58vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.batch-payment-row {
  display: grid;
  grid-template-columns: 54px minmax(210px, 1.2fr) minmax(96px, 0.5fr) minmax(126px, 0.6fr) minmax(126px, 0.6fr) minmax(104px, 0.5fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.batch-payment-row.selected {
  border-color: rgba(22, 184, 106, 0.4);
  background: #f2fbf7;
  box-shadow: 0 8px 22px rgba(20, 45, 35, 0.06);
}

.switch-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-control span {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #dfe7e3;
  cursor: pointer;
  transition: background 160ms ease;
}

.switch-control span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform 160ms ease;
}

.switch-control input:checked + span {
  background: var(--stone);
}

.switch-control input:checked + span::after {
  transform: translateX(18px);
}

.recovery-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.recovery-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.recovery-toggle span {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 112px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.recovery-toggle span::before {
  content: attr(data-off);
}

.recovery-toggle span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform 160ms ease;
}

.recovery-toggle input:checked + span {
  justify-content: flex-start;
  color: #006b3f;
  background: #dcfce7;
  border-color: #86efac;
}

.recovery-toggle input:checked + span::before {
  content: attr(data-on);
}

.recovery-toggle input:checked + span::after {
  transform: translateX(82px);
}

.batch-payment-info strong,
.batch-payment-money strong {
  display: block;
  color: var(--ink);
}

.batch-payment-info span,
.batch-payment-money span,
.batch-payment-row label {
  color: #62716b;
  font-size: 0.76rem;
  font-weight: 700;
}

.batch-payment-money.total strong {
  color: var(--stone-dark);
  font-size: 0.96rem;
}

.rmr-agent-stack {
  display: grid;
  gap: 16px;
}

.rmr-agent-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(199, 213, 207, 0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 253, 251, 0.92));
  box-shadow: var(--shadow-soft);
}

.rmr-agent-head {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(220, 229, 225, 0.9);
}

.rmr-funnel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.rmr-input-card,
.rmr-plan-input {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.rmr-input-card {
  padding: 12px;
  border: 1px solid rgba(220, 229, 225, 0.95);
  border-radius: var(--radius);
  background: #fff;
}

.rmr-input-card input,
.rmr-plan-input input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(183, 201, 194, 0.9);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.rmr-input-card input:focus,
.rmr-plan-input input:focus {
  outline: 2px solid rgba(0, 168, 104, 0.18);
  border-color: var(--stone);
}

.rmr-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 14px;
}

.rmr-conversions,
.rmr-plan-panel,
.rmr-planning-guide {
  border: 1px solid rgba(220, 229, 225, 0.95);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
}

.rmr-conversions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.rmr-conversion-line {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 7px;
  background: rgba(244, 247, 245, 0.85);
}

.rmr-conversion-line span,
.rmr-plan-results span,
.rmr-planning-guide span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.rmr-conversion-line strong,
.rmr-plan-results strong {
  font-size: 1rem;
}

.rmr-plan-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.rmr-plan-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rmr-plan-results div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 7px;
  background: rgba(231, 248, 241, 0.78);
}

.rmr-planning-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.rmr-planning-guide div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rmr-planning-guide strong {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--stone-dark);
  background: var(--stone-soft);
}

.positive-text {
  color: var(--stone-dark);
}

.warning-text {
  color: var(--warning);
}

.danger-text {
  color: var(--danger);
}

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

.ticket-detail-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(220, 229, 225, 0.95);
  border-radius: var(--radius);
  background: rgba(248, 251, 249, 0.9);
}

.ticket-detail-box span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.ticket-detail-box strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.public-ticket-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(0, 168, 104, 0.16), transparent 34%),
    linear-gradient(180deg, #f8fbf9, #eef5f1);
}

.public-ticket-card {
  width: min(920px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid rgba(199, 213, 207, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-strong);
}

.public-ticket-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(220, 229, 225, 0.95);
}

.public-ticket-brand img {
  max-width: 220px;
  height: 42px;
  object-fit: contain;
  object-position: left center;
}

.public-ticket-brand span {
  color: var(--stone-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.public-ticket-head h1,
.public-ticket-success h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: 0;
}

.public-ticket-head p,
.public-ticket-success p {
  margin: 6px 0 0;
  color: var(--muted);
}

.public-ticket-form {
  gap: 14px;
}

.public-ticket-note {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(0, 168, 104, 0.2);
  border-radius: var(--radius);
  color: var(--stone-dark);
  background: var(--stone-soft);
}

.public-ticket-note span {
  color: #4c625a;
}

.public-ticket-success {
  max-width: 720px;
  text-align: center;
}

.public-ticket-success .ticket-detail-grid {
  text-align: left;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.success-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 999px;
  color: var(--stone-dark);
  background: var(--stone-soft);
  font-size: 1.7rem;
  font-weight: 900;
}

@media (max-width: 980px) {
  .batch-payment-row {
    grid-template-columns: 48px 1fr 1fr;
  }

  .rmr-funnel-grid,
  .rmr-conversions,
  .rmr-planning-guide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rmr-analysis-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .batch-payment-row {
    grid-template-columns: 1fr;
  }

  .switch-control {
    justify-content: flex-start;
  }

  .rmr-funnel-grid,
  .rmr-conversions,
  .rmr-plan-results,
  .rmr-planning-guide {
    grid-template-columns: 1fr;
  }

  .ticket-detail-grid,
  .public-ticket-success .ticket-detail-grid {
    grid-template-columns: 1fr;
  }

  .public-ticket-screen {
    padding: 14px;
  }

  .public-ticket-card {
    padding: 18px;
  }

  .public-ticket-brand {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  #publicTicketRoot {
    min-height: 100vh;
    background: #f2f2f7;
  }

  #publicTicketRoot .public-ticket-screen {
    min-height: 100vh;
    align-items: start;
    place-items: start center;
    padding:
      max(14px, env(safe-area-inset-top))
      12px
      max(22px, env(safe-area-inset-bottom));
    background:
      linear-gradient(180deg, rgba(0, 168, 104, 0.08), rgba(242, 242, 247, 0) 210px),
      #f2f2f7;
  }

  #publicTicketRoot .public-ticket-card {
    width: min(430px, 100%);
    min-height: calc(100vh - 28px);
    align-content: start;
    gap: 18px;
    padding: 18px 14px 24px;
    border: 0;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  }

  #publicTicketRoot .public-ticket-brand {
    align-items: center;
    flex-direction: row;
    justify-content: center;
    padding: 4px 0 10px;
    border-bottom: 0;
  }

  #publicTicketRoot .public-ticket-brand img {
    max-width: 178px;
    height: 34px;
    object-position: center;
  }

  #publicTicketRoot .public-ticket-brand span {
    display: none;
  }

  #publicTicketRoot .public-ticket-head {
    display: grid;
    gap: 8px;
    text-align: left;
  }

  #publicTicketRoot .public-ticket-head h1,
  #publicTicketRoot .public-ticket-success h1 {
    font-size: 1.62rem;
    line-height: 1.08;
  }

  #publicTicketRoot .public-ticket-head p,
  #publicTicketRoot .public-ticket-success p {
    max-width: 34ch;
    margin: 0;
    color: #66736f;
    font-size: 0.92rem;
    line-height: 1.42;
  }

  #publicTicketRoot .finance-form,
  #publicTicketRoot .public-ticket-form {
    gap: 12px;
  }

  #publicTicketRoot .form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #publicTicketRoot .form-grid label,
  #publicTicketRoot .wide-label {
    gap: 7px;
    padding: 12px;
    border: 1px solid rgba(209, 213, 219, 0.76);
    border-radius: 18px;
    background: #ffffff;
    color: #4f5f59;
    font-size: 0.76rem;
    font-weight: 850;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  }

  #publicTicketRoot .form-grid input,
  #publicTicketRoot .form-grid select,
  #publicTicketRoot .form-grid textarea,
  #publicTicketRoot .wide-label input,
  #publicTicketRoot .wide-label select,
  #publicTicketRoot .wide-label textarea {
    min-height: 48px;
    padding: 10px 12px;
    border: 0;
    border-radius: 13px;
    color: #101514;
    background: #f2f2f7;
    font-size: 1rem;
    font-weight: 750;
  }

  #publicTicketRoot textarea {
    min-height: 132px;
    resize: vertical;
  }

  #publicTicketRoot input[type="file"] {
    min-height: auto;
    padding: 12px;
    font-size: 0.88rem;
  }

  #publicTicketRoot .wide-label small {
    color: #7a8782;
    font-size: 0.76rem;
  }

  #publicTicketRoot .public-ticket-note {
    padding: 13px 14px;
    border: 0;
    border-radius: 18px;
    background: #e8f7ef;
  }

  #publicTicketRoot .public-ticket-note strong {
    font-size: 0.9rem;
  }

  #publicTicketRoot .public-ticket-note span {
    color: #587067;
    font-size: 0.84rem;
    line-height: 1.35;
  }

  #publicTicketRoot .public-ticket-form > .primary-button,
  #publicTicketRoot .public-ticket-success > .primary-button {
    min-height: 52px;
    width: 100%;
    margin-top: 4px;
    border-radius: 16px;
    font-size: 0.98rem;
    box-shadow: 0 12px 24px rgba(0, 168, 104, 0.2);
  }

  #publicTicketRoot .public-ticket-form > .primary-button {
    position: sticky;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 2;
  }

  #publicTicketRoot .public-ticket-success {
    min-height: auto;
    padding-block: 28px;
    text-align: center;
  }

  #publicTicketRoot .public-ticket-success p {
    justify-self: center;
  }

  #publicTicketRoot .success-mark {
    width: 62px;
    height: 62px;
    font-size: 1.9rem;
    box-shadow: inset 0 0 0 1px rgba(0, 168, 104, 0.15);
  }

  #publicTicketRoot .ticket-detail-grid,
  #publicTicketRoot .public-ticket-success .ticket-detail-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #publicTicketRoot .ticket-detail-box {
    padding: 13px 14px;
    border: 0;
    border-radius: 16px;
    background: #f7f7fb;
  }
}

@media (max-width: 380px) {
  #publicTicketRoot .public-ticket-card {
    border-radius: 22px;
    padding-inline: 12px;
  }

  #publicTicketRoot .public-ticket-head h1,
  #publicTicketRoot .public-ticket-success h1 {
    font-size: 1.45rem;
  }
}

@media (max-width: 820px) {
  :root {
    --radius: 14px;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
    --shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.05);
  }

  html {
    background: #f2f2f7;
  }

  body {
    min-width: 0;
    overflow-x: hidden;
    color: #111827;
    background: #f2f2f7;
    font-size: 13px;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(17, 24, 39, 0.2);
    backdrop-filter: blur(5px);
    pointer-events: none;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block;
    min-height: 100dvh;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
    padding:
      max(8px, env(safe-area-inset-top))
      10px
      max(28px, env(safe-area-inset-bottom));
    background: #f2f2f7;
  }

  .sidebar,
  .app-shell.sidebar-collapsed .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(318px, 88vw);
    height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
    overflow-y: auto;
    transform: translateX(-108%);
    border: 0;
    border-radius: 0 26px 26px 0;
    color: #101514;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 20px 0 54px rgba(15, 23, 42, 0.18);
    transition: transform 220ms ease;
    scrollbar-width: thin;
    backdrop-filter: blur(18px);
  }

  body.menu-open .sidebar,
  body.menu-open .app-shell.sidebar-collapsed .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-collapsed .brand,
  .app-shell.sidebar-collapsed .nav-button {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .brand div,
  .app-shell.sidebar-collapsed .nav-button > span:nth-child(2),
  .app-shell.sidebar-collapsed .nav-expand-icon,
  .app-shell.sidebar-collapsed .nav-sublist,
  .app-shell.sidebar-collapsed .sidebar-panel {
    display: grid;
  }

  .app-shell.sidebar-collapsed .brand-logo {
    width: auto;
    height: 36px;
  }

  .sidebar .brand {
    min-height: 54px;
    justify-content: center;
    padding: 8px 6px 14px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.95);
  }

  .sidebar .brand-logo {
    width: min(210px, 74vw);
    height: 36px;
    object-fit: contain;
    object-position: center;
  }

  .sidebar-toggle {
    display: none;
  }

  .nav-list {
    gap: 4px;
    padding: 12px 0 8px;
  }

  .nav-group {
    gap: 3px;
  }

  .nav-button,
  .app-shell.sidebar-collapsed .nav-button {
    min-height: 42px;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 13px;
    color: #27322f;
    background: transparent;
    font-size: 0.92rem;
    font-weight: 780;
  }

  .nav-button:hover,
  .nav-button.active {
    color: #005d3e;
    background: #e8f7ef;
  }

  .nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    color: #0b6b49;
    background: #f1f5f3;
    font-size: 0.74rem;
  }

  .nav-button.active .nav-icon {
    color: #ffffff;
    background: var(--stone);
  }

  .nav-sublist {
    gap: 1px;
    padding: 2px 0 6px 38px;
  }

  .nav-subbutton {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 10px;
    color: #65736e;
    font-size: 0.82rem;
  }

  .nav-subbutton.active {
    color: #006b45;
    background: #edf8f3;
  }

  .sidebar-panel {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid rgba(229, 231, 235, 0.94);
    border-radius: 18px;
    color: #101514;
    background: #f7faf8;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 35;
    min-height: 58px;
    margin: 0 -10px 10px;
    padding: max(7px, env(safe-area-inset-top)) 10px 8px;
    display: grid;
    grid-template-columns: 42px 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border: 0;
    border-bottom: 1px solid rgba(218, 224, 222, 0.9);
    border-radius: 0 0 18px 18px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(18px);
  }

  .mobile-menu {
    display: grid;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(221, 228, 225, 0.95);
    border-radius: 13px;
    background: #ffffff;
    box-shadow: none;
  }

  .mobile-menu span {
    width: 15px;
    height: 1.5px;
    background: #101514;
  }

  .topbar-mark {
    width: 28px;
    height: 28px;
    padding: 5px;
    border-radius: 10px;
    background: #e8f7ef;
  }

  .topbar h1,
  .topbar h1#pageTitle {
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .week-pill {
    min-height: 34px;
    padding: 5px 8px;
    border-radius: 12px;
    background: #ffffff;
  }

  .week-pill span,
  .profile > div {
    display: none;
  }

  .week-pill strong {
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .profile {
    min-height: 34px;
    padding: 4px;
    border-radius: 999px;
    background: transparent;
  }

  .profile > span {
    width: 29px;
    height: 29px;
    font-size: 0.72rem;
  }

  #logoutButton {
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 11px;
    font-size: 0.78rem;
  }

  .content-area {
    display: grid;
    gap: 12px;
    padding: 0 0 10px;
  }

  .page-hero {
    gap: 12px;
    padding: 15px;
    border: 1px solid rgba(219, 226, 223, 0.9);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-soft);
  }

  .page-hero h2 {
    font-size: 1.42rem;
    line-height: 1.05;
  }

  .page-hero p {
    max-width: 100%;
    font-size: 0.9rem;
    line-height: 1.35;
  }

  .page-hero-meta {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .page-hero-meta .tag,
  .page-hero-meta button,
  .page-hero-meta .primary-button,
  .page-hero-meta .secondary-button {
    width: 100%;
    justify-content: center;
  }

  .subnav {
    position: sticky;
    top: 59px;
    z-index: 24;
    margin-inline: -2px;
    padding: 6px;
    overflow-x: auto;
    display: flex;
    flex-wrap: nowrap;
    border: 1px solid rgba(219, 226, 223, 0.8);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.035);
    scrollbar-width: none;
    backdrop-filter: blur(16px);
  }

  .subnav::-webkit-scrollbar {
    display: none;
  }

  .subnav-button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 12px;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .grid,
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .form-grid,
  .budget-grid,
  .route-city-grid,
  .rmr-funnel-grid,
  .rmr-conversions,
  .rmr-analysis-grid,
  .rmr-plan-results,
  .rmr-planning-guide,
  .ticket-detail-grid,
  .public-ticket-success .ticket-detail-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .metric-card,
  .table-card,
  .card,
  .filter-panel,
  .period-toolbar {
    border: 1px solid rgba(219, 226, 223, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-soft);
  }

  .metric-card {
    min-height: 94px;
    padding: 13px 14px;
  }

  .metric-card span {
    font-size: 0.82rem;
  }

  .metric-card strong {
    font-size: 1.32rem;
  }

  .metric-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .table-card,
  .card,
  .filter-panel,
  .period-toolbar {
    padding: 14px;
  }

  .section-head,
  .table-toolbar,
  .filter-controls,
  .installment-editor-head {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .section-head button,
  .section-head .primary-button,
  .section-head .secondary-button,
  .table-toolbar button,
  .filter-controls button,
  .filter-controls select,
  .filter-controls input {
    width: 100%;
  }

  .table-search {
    width: 100%;
    min-width: 0;
  }

  .table-count,
  .tag {
    justify-self: start;
  }

  .table-wrap {
    margin-inline: -6px;
    overflow-x: auto;
    border-radius: 15px;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
    font-size: 0.86rem;
  }

  th,
  td {
    padding: 10px 11px;
  }

  th {
    white-space: nowrap;
  }

  .table-total-bar {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .finance-form,
  .login-form {
    gap: 11px;
  }

  .form-grid label,
  .wide-label,
  .finance-form label,
  .login-form label {
    gap: 7px;
    font-size: 0.78rem;
  }

  .form-grid input,
  .form-grid select,
  .form-grid textarea,
  .wide-label input,
  .wide-label select,
  .wide-label textarea,
  .finance-form input,
  .finance-form select,
  .finance-form textarea,
  .login-form input {
    min-height: 46px;
    border-radius: 13px;
    font-size: 0.95rem;
  }

  .primary-button,
  .secondary-button,
  .icon-button,
  button {
    min-height: 40px;
    border-radius: 13px;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 8px -2px -2px;
    padding: 10px 0 max(2px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 18%);
  }

  .form-actions button {
    width: 100%;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(7px);
  }

  .modal-card,
  .modal-card.wide-modal,
  .modal-card.compact-modal,
  .route-modal-card {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 16px 14px max(16px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 24px 24px 0 0;
    background: #ffffff;
    box-shadow: 0 -18px 44px rgba(15, 23, 42, 0.16);
  }

  .modal-head {
    position: sticky;
    top: 0;
    z-index: 2;
    align-items: start;
    gap: 10px;
    margin: -16px -14px 10px;
    padding: 14px 14px 11px;
    border-radius: 24px 24px 0 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
  }

  .modal-head::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 42px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: #d7dfdb;
  }

  .modal-head h3 {
    margin-top: 8px;
  }

  .empty-state {
    min-height: 150px;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .payable-board {
    grid-template-columns: repeat(5, minmax(235px, 82vw));
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .payable-column {
    scroll-snap-align: start;
    border-radius: 18px;
  }

  .payable-card,
  .batch-payment-row,
  .route-card,
  .rmr-agent-card {
    border-radius: 16px;
  }

  .batch-payment-row,
  .installment-row,
  .route-form-row,
  .territory-form-row {
    grid-template-columns: 1fr;
  }

  .ticket-detail-box {
    border-radius: 16px;
  }

  .login-screen {
    min-height: 100dvh;
    padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
    background:
      linear-gradient(180deg, rgba(0, 168, 104, 0.1), rgba(242, 242, 247, 0) 210px),
      #f2f2f7;
  }

  .login-card {
    width: min(430px, 100%);
    padding: 18px;
    border: 0;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  }

  .login-brand {
    justify-content: center;
    border: 0;
    background: transparent;
  }

  .login-brand .brand-logo {
    max-width: 210px;
    height: 38px;
  }
}

@media (max-width: 420px) {
  .workspace {
    padding-inline: 8px;
  }

  .topbar {
    margin-inline: -8px;
    grid-template-columns: 40px 28px minmax(0, 1fr) auto;
  }

  .topbar-actions {
    gap: 4px;
  }

  .week-pill {
    display: none;
  }

  .page-hero h2 {
    font-size: 1.28rem;
  }

  .metric-card strong {
    font-size: 1.22rem;
  }

  .table-card,
  .metric-card,
  .card,
  .filter-panel,
  .period-toolbar {
    border-radius: 16px;
  }

  .modal-card,
  .modal-card.wide-modal,
  .modal-card.compact-modal,
  .route-modal-card {
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
  }

  table {
    min-width: 660px;
  }
}

@media (max-width: 820px) {
  .content-area > .grid.cols-4,
  .content-area > .grid.cols-3 {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(245px, 82vw);
    grid-template-columns: none;
    overflow-x: auto;
    padding: 1px 2px 7px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .content-area > .grid.cols-4::-webkit-scrollbar,
  .content-area > .grid.cols-3::-webkit-scrollbar {
    display: none;
  }

  .content-area > .grid.cols-4 > *,
  .content-area > .grid.cols-3 > * {
    scroll-snap-align: start;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) {
    margin: 0;
    overflow: visible;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 8px;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) thead {
    display: none;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) tbody,
  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) tfoot,
  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) tr,
  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td {
    display: block;
    width: 100%;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) tbody tr {
    padding: 10px 11px;
    border: 1px solid rgba(219, 226, 223, 0.9);
    border-radius: 15px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.035);
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 7px 0;
    border: 0;
    font-size: 0.88rem;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td::before {
    content: attr(data-label);
    color: #6b7772;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1.25;
    text-transform: uppercase;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td:first-child {
    padding-top: 0;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td:first-child strong {
    font-size: 0.98rem;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td:last-child {
    padding-bottom: 0;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) .table-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) .table-actions button,
  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td > button {
    width: 100%;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) tfoot tr {
    display: grid;
    gap: 7px;
    margin-top: 8px;
    padding: 11px;
    border: 1px solid rgba(199, 213, 207, 0.9);
    border-radius: 15px;
    background: #f7faf8;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) tfoot td {
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    font-weight: 900;
  }

  .table-card .table-wrap:has(input),
  .table-card .table-wrap:has(select),
  .table-card .table-wrap:has(textarea) {
    margin-inline: -8px;
    padding-inline: 8px;
    overflow-x: auto;
  }

  .table-card .table-wrap:has(input) table,
  .table-card .table-wrap:has(select) table,
  .table-card .table-wrap:has(textarea) table {
    min-width: 860px;
  }

  .metric-card .progress {
    height: 6px;
  }

  .bar-row {
    grid-template-columns: 86px minmax(0, 1fr) 40px;
    gap: 8px;
  }

  .list li {
    padding: 10px 0;
  }

  .list li .tag,
  .list li .status {
    align-self: flex-start;
  }

  .donut-wrap {
    justify-content: center;
  }

  .donut {
    width: 116px;
  }

  .topbar-actions .secondary-button.compact {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .table-card .table-wrap:not(:has(input)):not(:has(select)):not(:has(textarea)) td::before {
    font-size: 0.68rem;
  }

  .content-area > .grid.cols-4,
  .content-area > .grid.cols-3 {
    grid-auto-columns: minmax(232px, 86vw);
  }

  .page-hero-meta {
    gap: 7px;
  }

  .section-head h3,
  .table-card h3 {
    font-size: 1rem;
  }
}

@media (max-width: 820px) {
  .payroll-card {
    overflow: visible;
  }

  .payroll-visual {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .payroll-stack {
    min-height: 42px;
    border-radius: 14px;
  }

  .payroll-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  }

  .payroll-row:last-child {
    border-bottom: 0;
  }

  .table-wrap:has(.payroll-table) {
    margin: 0;
    overflow: visible;
    padding: 0;
  }

  .payroll-table,
  .payroll-table thead,
  .payroll-table tbody,
  .payroll-table tr,
  .payroll-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .payroll-table thead {
    display: none;
  }

  .payroll-table tbody {
    display: grid;
    gap: 10px;
  }

  .payroll-table tr[data-payroll-row]:not(.payroll-note-row) {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(219, 226, 223, 0.95);
    border-radius: 18px 18px 12px 12px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
  }

  .payroll-table .payroll-note-row {
    margin-top: -10px;
    padding: 0 12px 12px;
    border: 1px solid rgba(219, 226, 223, 0.95);
    border-top: 0;
    border-radius: 0 0 18px 18px;
    background: #ffffff;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.035);
  }

  .payroll-table td {
    display: grid;
    gap: 6px;
    padding: 0;
    border: 0;
  }

  .payroll-table td::before {
    content: attr(data-label);
    color: #65736e;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .payroll-table td[data-label="Colaborador"] {
    padding-bottom: 9px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  }

  .payroll-table td[data-label="Colaborador"]::before,
  .payroll-table td[data-label="PDF"]::before {
    display: none;
  }

  .payroll-table td[data-label="Total final"] {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid rgba(229, 231, 235, 0.9);
  }

  .payroll-table td[data-label="Total final"] strong {
    font-size: 1.05rem;
  }

  .payroll-base-fields {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .payroll-base-fields label {
    padding: 9px;
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 13px;
    background: #f7faf8;
  }

  .payroll-table .table-input,
  .payroll-base-fields .table-input {
    width: 100%;
    min-height: 42px;
    border-radius: 12px;
  }

  .payroll-table .icon-button {
    width: 100%;
  }
}

/* Mobile app stabilization: keep every screen inside the viewport. */
@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell,
  .workspace,
  .content-area,
  .content-area > *,
  .page-hero,
  .subnav,
  .filter-panel,
  .period-toolbar,
  .card,
  .metric-card,
  .table-card,
  .payroll-card {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .content-area {
    width: 100%;
    overflow-x: hidden;
  }

  .content-area > .grid,
  .content-area > .grid.cols-4,
  .content-area > .grid.cols-3,
  .content-area > .grid.cols-2 {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: unset;
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 0;
    gap: 10px;
    scroll-snap-type: none;
  }

  .page-hero,
  .filter-panel,
  .table-toolbar,
  .section-head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .page-hero {
    padding: 14px;
    gap: 12px;
  }

  .page-hero h2 {
    overflow-wrap: anywhere;
  }

  .page-hero-meta {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .subnav {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-controls,
  .filter-controls label,
  .filter-controls input,
  .filter-controls select,
  .section-head button,
  .table-toolbar button,
  .table-search,
  .table-search input {
    width: 100%;
    min-width: 0;
  }

  .table-card {
    overflow: hidden;
  }

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

  .table-card .table-wrap:has(input),
  .table-card .table-wrap:has(select),
  .table-card .table-wrap:has(textarea) {
    max-width: 100%;
    margin-inline: 0;
    padding-inline: 0;
    overflow-x: auto;
  }

  .payroll-card {
    overflow: hidden;
  }

  .payroll-visual {
    width: 100%;
    min-width: 0;
  }

  .payroll-table {
    min-width: 0;
  }

  .table-wrap:has(.payroll-table) {
    max-width: 100%;
    overflow: visible;
  }

  .table-card .table-wrap:has(.payroll-table),
  .table-card .table-wrap:has(.payroll-table):has(input),
  .table-card .table-wrap:has(.payroll-table):has(select),
  .table-card .table-wrap:has(.payroll-table):has(textarea) {
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table,
  .table-card .table-wrap:has(.payroll-table):has(input) .payroll-table,
  .table-card .table-wrap:has(.payroll-table):has(select) .payroll-table,
  .table-card .table-wrap:has(.payroll-table):has(textarea) .payroll-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table thead {
    display: none;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table tbody {
    display: grid;
    gap: 10px;
    width: 100%;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table tr,
  .table-card .table-wrap:has(.payroll-table) .payroll-table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table tr[data-payroll-row]:not(.payroll-note-row) {
    display: grid !important;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(219, 226, 223, 0.95);
    border-radius: 16px 16px 10px 10px;
    background: #ffffff;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table .payroll-note-row {
    margin-top: -10px;
    padding: 0 12px 12px;
    border: 1px solid rgba(219, 226, 223, 0.95);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    background: #ffffff;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table td {
    display: grid !important;
    gap: 6px;
    padding: 0;
    border: 0;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table td::before {
    content: attr(data-label);
    color: #65736e;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table td[data-label="Colaborador"] {
    padding-bottom: 9px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table td[data-label="Colaborador"]::before,
  .table-card .table-wrap:has(.payroll-table) .payroll-table td[data-label="PDF"]::before {
    display: none;
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table td[data-label="Total final"] {
    padding: 10px 0;
    border-top: 1px solid rgba(229, 231, 235, 0.9);
  }

  .table-card .table-wrap:has(.payroll-table) .payroll-table .table-input,
  .table-card .table-wrap:has(.payroll-table) .payroll-base-fields .table-input {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 520px) {
  .workspace {
    padding-inline: 8px;
  }

  .content-area {
    gap: 12px;
  }

  .page-hero,
  .filter-panel,
  .card,
  .metric-card,
  .table-card {
    border-radius: 14px;
  }

  .metric-card {
    min-height: auto;
    padding: 13px;
  }

  .metric-card strong {
    font-size: 1.2rem;
    line-height: 1.15;
  }

  .payroll-table td[data-label="Total final"] {
    grid-template-columns: 1fr;
  }
}

.filter-controls .period-month-control {
  width: 100%;
}

.filter-controls .period-month-control .month-step-button {
  width: 34px;
  min-width: 34px;
}

body.agent-app-mode {
  background: #f8faf9;
}

body.agent-app-mode .sidebar,
body.agent-app-mode .topbar {
  display: none;
}

body.agent-app-mode .workspace {
  margin: 0 auto;
  max-width: 520px;
  min-height: 100dvh;
  padding: 0;
  background: #f8faf9;
}

body.agent-app-mode .content-area {
  gap: 0;
  min-height: 100dvh;
  padding: 0;
}

.agent-app-screen {
  min-height: 100dvh;
  padding-bottom: 86px;
  background:
    radial-gradient(circle at 12% 0%, rgba(30, 185, 120, 0.13), transparent 30%),
    #f8faf9;
}

.agent-app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(213, 222, 218, 0.95);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.agent-app-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.agent-app-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 10px;
  background: #eaf8f1;
  padding: 6px;
}

.agent-app-brand strong,
.agent-app-brand span {
  display: block;
  overflow: hidden;
  max-width: 290px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-app-brand span {
  color: #61706a;
  font-size: 0.78rem;
}

.agent-app-header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}

.agent-app-header-actions .secondary-button,
.agent-app-header-actions .icon-button {
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 0.78rem;
}

.agent-app-main {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.agent-hero-card,
.agent-mobile-card {
  border: 1px solid rgba(213, 222, 218, 0.95);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.04);
}

.agent-hero-card {
  padding: 18px;
}

.agent-hero-card span {
  color: #007f4e;
  font-size: 0.76rem;
  font-weight: 900;
}

.agent-hero-card h1 {
  margin: 6px 0;
  color: #111827;
  font-size: 1.4rem;
  line-height: 1.1;
}

.agent-hero-card p {
  margin: 0;
  color: #61706a;
}

.agent-mobile-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.agent-mobile-card h2,
.agent-mobile-card h3 {
  margin: 0;
  color: #111827;
  font-size: 1rem;
}

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

.agent-kpi-card {
  display: grid;
  gap: 7px;
  min-height: 118px;
  padding: 13px;
  border: 1px solid rgba(213, 222, 218, 0.95);
  border-top: 3px solid #12b76a;
  border-radius: 16px;
  background: #ffffff;
}

.agent-kpi-card.warning {
  border-top-color: #f59e0b;
}

.agent-kpi-card.danger {
  border-top-color: #ef4444;
}

.agent-kpi-card span,
.agent-kpi-card small {
  color: #61706a;
  font-size: 0.76rem;
}

.agent-kpi-card strong {
  color: #07140f;
  font-size: 1.15rem;
}

.agent-ticket-item,
.agent-client-line,
.agent-route-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e3ebe7;
  border-radius: 14px;
  background: #fbfdfc;
}

.agent-ticket-item {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.agent-ticket-item strong,
.agent-client-line strong,
.agent-route-card strong {
  color: #07140f;
}

.agent-ticket-item span,
.agent-ticket-item p,
.agent-client-line span,
.agent-route-card span,
.agent-route-card small {
  margin: 0;
  color: #5d6b66;
  font-size: 0.84rem;
}

.agent-ticket-form {
  display: grid;
  gap: 10px;
}

.agent-ticket-form label {
  display: grid;
  gap: 6px;
  color: #65736e;
  font-size: 0.78rem;
  font-weight: 800;
}

.agent-ticket-form input,
.agent-ticket-form select,
.agent-ticket-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd8d2;
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
  color: #07140f;
  font: inherit;
}

.agent-goal-list {
  display: grid;
  gap: 10px;
}

.agent-goal-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e3ebe7;
  border-radius: 14px;
  background: #fbfdfc;
}

.agent-goal-list span {
  color: #61706a;
}

.agent-bottom-nav {
  position: fixed;
  right: max(10px, calc((100vw - 520px) / 2 + 10px));
  bottom: 10px;
  left: max(10px, calc((100vw - 520px) / 2 + 10px));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(213, 222, 218, 0.95);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.13);
  backdrop-filter: blur(18px);
}

.agent-bottom-nav button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: #52615c;
  font-size: 0.66rem;
  font-weight: 800;
}

.agent-bottom-nav button span {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 8px;
  background: #eff4f2;
  color: #07140f;
  font-size: 0.7rem;
}

.agent-bottom-nav button.active {
  background: #e9f8f1;
  color: #007f4e;
}

.agent-bottom-nav button.active span {
  background: #12b76a;
  color: #ffffff;
}
