:root {
  --ink: #10243e;
  --muted: #64748b;
  --line: #d8e5dc;
  --panel: #ffffff;
  --page: #f7faf5;
  --nav: #062b49;
  --nav-soft: #0f3d61;
  --gold: #b88416;
  --green: #21785f;
  --red: #a43f3f;
  --blue: #0f6f88;
  --accent: #20d6d0;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
  background: var(--page);
  color: var(--ink);
}

.auth-gate {
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

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

.auth-loading {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
}

.auth-loading strong {
  color: var(--ink);
  font-size: 24px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.auth-panel {
  display: grid;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(16, 36, 62, 0.1);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand h1,
.auth-brand p,
.auth-form h2,
.auth-form p {
  margin: 0;
}

.auth-brand h1 {
  font-size: 25px;
}

.auth-brand p,
.auth-form p {
  color: var(--muted);
  font-size: 13px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 8px;
  background: #edf3ef;
}

.auth-mode-button {
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.auth-mode-button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(16, 36, 62, 0.12);
}

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form > div {
  display: grid;
  gap: 4px;
  margin-bottom: 5px;
}

.auth-form label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.auth-form input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-color: var(--blue);
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

.auth-secondary-action {
  display: grid;
  justify-items: center;
  gap: 3px;
  margin-top: 4px;
  text-align: center;
}

.auth-text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.auth-submit:disabled,
.current-user button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-error {
  border: 1px solid #f0b4aa;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff5f3;
  color: #922a1f;
  font-size: 13px;
}

.current-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-user > div {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.current-user span {
  color: var(--muted);
  font-size: 12px;
}

button,
input {
  font: inherit;
}

textarea,
select {
  font: inherit;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  min-height: 100vh;
  overflow-y: auto;
  background: var(--nav);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand p {
  color: #c9d4e4;
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-section {
  display: grid;
  gap: 3px;
}

.nav-item {
  border: 0;
  color: #dce7f5;
  background: transparent;
  text-align: left;
  padding: 11px 12px;
  border-radius: 7px;
  cursor: pointer;
}

.nav-main {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  color: currentColor;
  min-width: 22px;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-base-icon,
.nav-hover-icon {
  grid-area: 1 / 1;
  display: inline-grid;
  place-items: center;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.nav-hover-icon {
  opacity: 0;
  transform: scale(0.92);
}

.nav-section.has-children.collapsed .nav-main:hover .nav-base-icon {
  opacity: 0;
}

.nav-section.has-children.collapsed .nav-main:hover .nav-hover-closed,
.nav-section.has-children.expanded .nav-hover-open {
  opacity: 1;
  transform: scale(1);
}

.nav-section.has-children.expanded .nav-base-icon,
.nav-section.has-children.expanded .nav-hover-closed {
  opacity: 0;
}

.nav-label {
  min-width: 0;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: var(--nav-soft);
  color: #fff;
}

.nav-submenu {
  display: grid;
  gap: 2px;
  margin-left: 27px;
  padding-left: 12px;
  border-left: 1px solid rgba(220, 231, 245, 0.24);
}

.nav-section.collapsed .nav-submenu {
  display: none;
}

.submenu-button {
  border: 0;
  background: transparent;
  color: #c9d4e4;
  text-align: left;
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
}

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

.status-dot {
  width: 9px;
  height: 9px;
  background: #65c98a;
  border-radius: 999px;
}

main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  min-height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eyebrow,
.quiet,
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.topbar h2 {
  font-size: 28px;
}

.sidebar-account {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-account-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f5f8fc;
  color: var(--nav);
  font-size: 13px;
  font-weight: 800;
}

.sidebar-account-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sidebar-account-identity strong,
.sidebar-account-identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-identity strong {
  font-size: 13px;
}

.sidebar-account-identity span {
  color: #c9d4e4;
  font-size: 10px;
}

.sidebar-logout-button {
  border: 0;
  padding: 6px;
  background: transparent;
  color: #dce7f5;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-logout-button:hover,
.sidebar-logout-button:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.workspace-context {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  overflow: hidden;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.workspace-context:focus-within {
  border-color: rgba(32, 214, 208, 0.68);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 2px rgba(32, 214, 208, 0.14);
}

.workspace-switcher {
  position: relative;
  display: grid;
  min-width: 0;
  width: 100%;
  color: #c9d4e4;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 30px 6px 14px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.workspace-switcher::before {
  content: "";
  position: absolute;
  inset: 9px auto 9px 7px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.workspace-switcher::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 11px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #c9d4e4;
  border-bottom: 2px solid #c9d4e4;
  transform: rotate(45deg);
  pointer-events: none;
}

.workspace-context-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px 6px 14px;
}

.workspace-switcher select {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  padding: 0;
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
  appearance: none;
  cursor: pointer;
  outline: 0;
}

.tax-year-switcher {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0;
  color: #9fb2c8;
  font-size: 11px;
  font-weight: 700;
}

.tax-year-switcher select {
  min-width: 58px;
  border: 0;
  border-radius: 5px;
  padding: 2px 4px;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.tax-year-switcher select option,
.workspace-switcher select option {
  background: #fff;
  color: var(--ink);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 32, 51, 0.04);
}

.metric-card {
  padding: 16px;
}

.metric-card-link {
  cursor: pointer;
}

.metric-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

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

.metric-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.metric-card.goal-good {
  border-color: #bcded0;
  background: #e9f5ef;
}

.metric-card.goal-good strong {
  color: var(--green);
}

.metric-card.goal-close {
  border-color: #ecd8a8;
  background: #fff8e8;
}

.metric-card.goal-close strong {
  color: var(--gold);
}

.metric-card.goal-off-track {
  border-color: #efc6c1;
  background: #fff2f0;
}

.metric-card.goal-off-track strong {
  color: var(--red);
}

.dashboard-shell {
  display: grid;
  gap: 18px;
}

.dashboard-loading,
.dashboard-empty {
  padding: 24px;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(145px, 1fr));
  gap: 12px;
}

.dashboard-kpi-card {
  display: flex;
  min-width: 0;
  min-height: 205px;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(20, 32, 51, 0.04);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.dashboard-kpi-card:hover,
.dashboard-kpi-card:focus-visible {
  border-color: #a9c9bf;
  box-shadow: 0 8px 20px rgba(16, 36, 62, 0.07);
  outline: 0;
  transform: translateY(-1px);
}

.dashboard-kpi-card.disabled {
  cursor: default;
  opacity: 0.68;
}

.dashboard-kpi-card.disabled:hover {
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(20, 32, 51, 0.04);
  transform: none;
}

.dashboard-kpi-card.goal-good {
  border-color: #bcded0;
  background: #f2faf6;
}

.dashboard-kpi-card.goal-close {
  border-color: #ecd8a8;
  background: #fffaf0;
}

.dashboard-kpi-card.goal-off-track {
  border-color: #efc6c1;
  background: #fff4f2;
}

.dashboard-kpi-card.goal-good > strong { color: var(--green); }
.dashboard-kpi-card.goal-close > strong { color: var(--gold); }
.dashboard-kpi-card.goal-off-track > strong { color: var(--red); }

.dashboard-kpi-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}

.dashboard-kpi-heading h3 {
  font-size: 13px;
  line-height: 1.25;
}

.dashboard-kpi-icon,
.dashboard-section-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
}

.dashboard-kpi-icon {
  width: 38px;
  height: 38px;
  background: #eef3ff;
  color: #275ddd;
  font-size: 20px;
}

.dashboard-kpi-icon.revenue { background: #eaf8ed; color: #1a9c4a; }
.dashboard-kpi-icon.expenses { background: #f5ecff; color: #7744d5; }
.dashboard-kpi-icon.loss { background: #ffeded; color: #dc3f3f; }
.dashboard-kpi-icon.reimbursements { background: #fff1e4; color: #e67820; }
.dashboard-kpi-icon.participation { background: #eaf8f7; color: var(--blue); }

.dashboard-kpi-card > strong {
  display: block;
  margin-top: 18px;
  font-size: clamp(18px, 1.55vw, 26px);
  line-height: 1.1;
  white-space: normal;
}

.dashboard-kpi-card.placeholder > strong {
  color: var(--muted);
  font-size: 17px;
}

.dashboard-kpi-card > p {
  min-height: 30px;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.dashboard-card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  color: #1667d9;
  font-size: 12px;
  font-weight: 750;
}

.button-link {
  align-self: start;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.dashboard-insight-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(340px, 1.25fr) minmax(300px, 1.15fr);
  gap: 14px;
  align-items: stretch;
}

.dashboard-insight-grid > .panel {
  min-height: 295px;
  padding: 18px;
}

.dashboard-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-card-header > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-card-header p {
  margin: 3px 0 0;
}

.dashboard-section-icon {
  width: 34px;
  height: 34px;
  background: #eaf8ed;
  color: #1a9c4a;
}

.dashboard-section-icon.calendar { background: #eef3ff; color: #275ddd; }
.dashboard-section-icon.actions { background: #fff1e4; color: #e67820; }

.dashboard-health-card > .quiet {
  margin: 30px 0 8px;
}

.dashboard-health-label {
  display: block;
  margin-bottom: 14px;
  font-size: 21px;
}

.dashboard-health-label.good { color: #1a9c4a; }
.dashboard-health-label.attention { color: var(--gold); }
.dashboard-health-label.risk { color: var(--red); }

.dashboard-health-track {
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebef;
}

.dashboard-health-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.dashboard-health-track .good { background: #1a9c4a; }
.dashboard-health-track .attention { background: var(--gold); }
.dashboard-health-track .risk { background: var(--red); }

.dashboard-health-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0;
}

.dashboard-health-counts span {
  display: grid;
  gap: 5px;
  padding: 0 10px;
  border-right: 1px solid var(--line);
}

.dashboard-health-counts span:first-child { padding-left: 0; }
.dashboard-health-counts span:last-child { border-right: 0; }
.dashboard-health-counts small { color: var(--muted); font-size: 10px; }
.dashboard-health-counts strong { font-size: 24px; }

.dashboard-item-list {
  display: grid;
  margin-top: 16px;
}

.dashboard-item-row,
.dashboard-action-row {
  display: grid;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 10px 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.dashboard-item-row { grid-template-columns: 46px minmax(0, 1fr) auto 10px; }
.dashboard-action-row { grid-template-columns: 30px minmax(0, 1fr) auto 10px; }

.dashboard-item-row:hover,
.dashboard-action-row:hover { background: #f8fbfa; }

.dashboard-item-row time {
  display: grid;
  justify-items: center;
  border-radius: 7px;
  padding: 5px;
  background: #fff1ef;
  color: var(--red);
}

.dashboard-item-row time strong { font-size: 15px; }
.dashboard-item-row time span { font-size: 9px; font-weight: 800; }
.dashboard-item-title { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-item-type,
.dashboard-action-count {
  border-radius: 999px;
  padding: 5px 8px;
  background: #eaf8ed;
  color: var(--green);
  font-size: 10px;
  font-weight: 750;
}

.dashboard-item-type.property { background: #eef3ff; color: #275ddd; }
.dashboard-item-type.reimbursement { background: #fff1e4; color: #b65d15; }
.dashboard-action-icon { color: var(--blue); font-size: 18px; }
.dashboard-action-count { min-width: 27px; border: 0; text-align: center; }

.dashboard-empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 180px;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.dashboard-empty-state strong { color: var(--ink); }

.dashboard-properties-panel { padding: 18px 0 0; overflow: hidden; }
.dashboard-properties-panel > .dashboard-card-header { padding: 0 18px 15px; }

.dashboard-properties-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.dashboard-properties-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
}

.dashboard-properties-table th,
.dashboard-properties-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

.dashboard-properties-table th { background: #f8fbfa; }

.dashboard-properties-table th button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.dashboard-properties-table tbody tr { cursor: pointer; }
.dashboard-properties-table tbody tr:hover,
.dashboard-properties-table tbody tr:focus { background: #f5faf8; outline: 0; }

.dashboard-property-link {
  display: flex;
  min-width: 200px;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.dashboard-property-link img,
.dashboard-property-placeholder {
  width: 48px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 7px;
  object-fit: cover;
}

.dashboard-property-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dfeee9, #bfd8d0);
  color: var(--green);
  font-weight: 800;
}

.dashboard-property-link span:last-child { display: grid; gap: 3px; }
.dashboard-property-link strong { font-size: 12px; }
.dashboard-property-link small { color: var(--muted); font-size: 10px; }

.dashboard-health-chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.dashboard-health-chip.good { background: #e9f5ef; color: var(--green); }
.dashboard-health-chip.attention { background: #fff3d9; color: #94670b; }
.dashboard-health-chip.risk { background: #fff0ee; color: var(--red); }

.dashboard-money-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-money-link:hover { color: #1667d9; text-decoration: underline; }
.dashboard-unavailable,
.dashboard-no-actions { color: var(--muted); }
.dashboard-properties-empty { margin: 0 18px 18px; }

@media (max-width: 1500px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
}

@media (max-width: 1120px) {
  .dashboard-insight-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-insight-grid > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .dashboard-kpi-grid,
  .dashboard-insight-grid { grid-template-columns: 1fr; }
  .dashboard-insight-grid > :last-child { grid-column: auto; }
  .dashboard-kpi-card { min-height: 170px; }
  .dashboard-card-header { align-items: stretch; flex-direction: column; }
  .sidebar-account { margin-top: 0; }
}

.content-grid,
.upload-layout,
.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.page-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 700;
}

.page-tab:hover {
  border-color: rgba(15, 111, 136, 0.45);
  color: var(--ink);
}

.page-tab.active {
  background: var(--nav);
  border-color: var(--nav);
  color: #fff;
}

.page-description {
  color: var(--muted);
  margin: -8px 0 18px;
}

.upload-workflow-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.upload-step-panel {
  display: none;
}

.upload-step-panel.active-upload-step {
  display: block;
}

.upload-step-panel.active-upload-step.upload-layout {
  display: grid;
}

.panel {
  padding: 16px;
}

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

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.dropzone {
  border: 1px dashed #9aa8ba;
  background: #f9fbfd;
  border-radius: 8px;
  min-height: 190px;
  position: relative;
  display: grid;
  place-items: center;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: #eef6ff;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-inner {
  text-align: center;
  color: var(--muted);
}

.dropzone-inner strong {
  color: var(--ink);
  display: block;
  margin-top: 10px;
}

.upload-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--nav), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto;
  font-size: 26px;
  line-height: 1;
}

.target-folder {
  margin: 14px 0;
  display: grid;
  gap: 5px;
}

.next-step-card {
  align-items: center;
  background: #f4fbfd;
  border: 1px solid #b9dce5;
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px;
}

.upload-queue-panel,
.classification-panel {
  margin-top: 18px;
}

.upload-queue-table {
  min-width: 1180px;
}

.upload-queue-table tbody td {
  font-size: 14px;
}

.document-queue-view {
  display: grid;
  gap: 12px;
}

.document-queue-filter-groups {
  display: grid;
  gap: 8px;
}

.document-queue-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.document-queue-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(14, 42, 71, 0.04);
}

.document-queue-filter:hover {
  border-color: rgba(15, 111, 136, 0.45);
  color: var(--ink);
}

.document-queue-filter.active {
  background: var(--nav);
  border-color: var(--nav);
  color: #fff;
  box-shadow: 0 6px 14px rgba(7, 48, 79, 0.14);
}

.document-queue-filter-count {
  color: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0.75;
}

.document-queue-filter.active .document-queue-filter-count {
  opacity: 0.9;
}

.document-type-filters {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.upload-queue-row {
  cursor: pointer;
}

.upload-queue-row.selected {
  background: #f4fbfd;
  outline: 2px solid rgba(15, 111, 136, 0.22);
  outline-offset: -2px;
}

.upload-queue-row .ghost-button {
  padding: 7px 10px;
}

.next-step-card h4 {
  margin: 6px 0 4px;
}

.next-step-card p {
  color: var(--muted);
  margin: 0;
}

.next-step-card.error {
  background: #fff7f6;
  border-color: #f0b8ad;
}

.next-step-card.processing {
  background: #f8fafc;
}

.step-status-pill {
  background: #dff8f8;
  border-radius: 999px;
  color: #0f6f88;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

code {
  background: #eef1f5;
  border: 1px solid var(--line);
  padding: 7px 9px;
  border-radius: 6px;
  color: #27364a;
  overflow-wrap: anywhere;
}

.file-list,
.run-list,
.review-list,
.summary-grid,
.code-list,
.snapshot-list,
.classification-list {
  display: grid;
  gap: 9px;
}

.empty {
  color: var(--muted);
  font-size: 14px;
}

.file-row,
.run-row,
.review-row,
.summary-item,
.snapshot-list div,
.code-row,
.classification-row,
.rule-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fff;
}

.classification-row.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(15, 111, 136, 0.12);
}

.classification-table-wrap {
  margin-bottom: 18px;
}

.classification-table {
  min-width: 1180px;
}

.classification-table .compact-actions {
  flex-wrap: nowrap;
}

.run-row {
  cursor: pointer;
}

.run-row:hover {
  border-color: #aab7c8;
}

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

.records-summary-grid {
  margin-bottom: 0;
}

.summary-item span,
.snapshot-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-item strong,
.snapshot-list strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.ghost-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.ghost-link:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.inline-source-link {
  min-height: 0;
  margin-top: 5px;
  padding: 4px 7px;
  font-size: 0.78rem;
  font-weight: 800;
}

.document-source-filename {
  color: var(--ink);
  text-decoration: none;
}

.document-source-filename:hover {
  color: var(--blue);
  text-decoration: underline;
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.mapping-table .compact-actions {
  gap: 6px;
  margin: 0;
}

.primary-button,
.danger-button,
.secondary-button,
.ghost-button {
  border: 0;
  border-radius: 7px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--nav);
  color: #fff;
}

.danger-button {
  background: var(--gold);
  color: #fff;
}

.secondary-button {
  background: var(--blue);
  color: #fff;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

.run-status {
  margin-top: 16px;
  padding: 10px;
  border-radius: 7px;
  background: #eef1f5;
  color: var(--muted);
}

.log-panel {
  margin-top: 18px;
}

pre {
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  background: #111827;
  color: #e8edf5;
  padding: 14px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-grid span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: #fff;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

.form-grid textarea,
.rule-test-grid textarea,
.rule-test-grid input,
.rule-toolbar input,
.rule-toolbar select,
.form-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

.rule-test-grid textarea {
  min-height: 116px;
  resize: vertical;
}

.classification-panel,
.settings-tabs-panel {
  margin-top: 18px;
}

.classification-form {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.entity-setup-panel {
  max-width: 980px;
  margin-top: 8px;
}

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

.logo-upload-label {
  position: relative;
}

.logo-upload-label input[type="file"] {
  position: absolute;
  inset: auto;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.logo-upload-control {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  cursor: pointer;
}

.logo-upload-control span {
  background: var(--nav);
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  font-weight: 700;
}

.logo-upload-control strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.entity-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.entity-row em {
  color: var(--muted);
  font-style: normal;
}

.entity-row a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.entity-row a:hover {
  text-decoration: underline;
}

.business-profile-panel {
  grid-column: 1 / -1;
}

.business-profile {
  display: grid;
  gap: 18px;
}

.business-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, #f7fbfb, #eef8f7);
}

.business-logo-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--nav);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.business-hero h3 {
  margin: 2px 0 4px;
  font-size: 24px;
}

.business-hero p {
  margin: 0;
  color: var(--muted);
}

.business-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.business-profile-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.business-profile-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

.business-profile-grid strong {
  font-size: 16px;
}

.business-profile-grid a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.business-profile-grid a:hover {
  text-decoration: underline;
}

.business-structure-view {
  display: grid;
  gap: 16px;
}

.business-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.business-checklist {
  display: grid;
  gap: 12px;
}

.business-checklist div {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.business-checklist .status-dot {
  margin-top: 6px;
  background: #d7c18b;
}

.business-checklist .status-dot.ready {
  background: #65c98a;
}

.business-checklist p {
  grid-column: 2;
  margin: 0;
}

.business-detail-panel {
  display: grid;
  gap: 12px;
}

.business-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.business-detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.business-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.business-subsection {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.business-subsection h4 {
  margin: 0 0 6px;
}

.business-table tr {
  cursor: pointer;
}

.business-overview-panel,
.business-detail-panel,
.business-inline-form {
  display: grid;
  gap: 18px;
}

.business-header-row,
.business-section-heading,
.business-profile-heading,
.business-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.business-header-row h3,
.business-profile-heading h3,
.business-list-header h3 {
  margin: 3px 0;
}

.business-header-meta {
  display: flex;
  align-items: center;
  gap: 24px;
}

.business-header-meta > span {
  display: grid;
  gap: 4px;
}

.business-header-meta small {
  color: var(--muted);
}

.business-summary-grid {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.business-structure-tree > ul,
.business-structure-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.business-structure-tree li {
  position: relative;
}

.business-structure-tree li > ul {
  margin: 5px 0 5px 13px;
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.business-structure-tree li > ul > li::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -22px;
  width: 16px;
  border-top: 1px solid var(--line);
}

.business-structure-tree button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 8px 6px;
  cursor: pointer;
  text-align: left;
}

.business-structure-tree button:hover {
  color: var(--blue);
  text-decoration: underline;
}

.business-tree-property button {
  font-weight: 500;
}

.business-tree-entity-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.business-tree-health {
  align-self: stretch;
  border-radius: 999px;
  flex: 0 0 4px;
  min-height: 20px;
}

.business-tree-health.healthy {
  background: var(--green);
}

.business-tree-health.progress {
  background: var(--gold);
}

.business-tree-health.attention {
  background: var(--red);
}

.business-tree-property.unassigned span {
  color: var(--muted);
  font-size: 13px;
  margin-left: 8px;
}

.business-entity-name-button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.business-entity-name-button:hover,
.business-entity-name-button:focus-visible {
  color: var(--blue);
  text-decoration: underline;
}

.business-entity-properties {
  display: grid;
  gap: 0.65rem;
}

.entity-detail-tabs {
  margin-bottom: 0.25rem;
}

.business-entity-property {
  align-items: flex-start;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  text-align: left;
}

.business-entity-property span {
  color: var(--muted);
  font-size: 0.88rem;
}

.business-entity-property:hover,
.business-entity-property:focus-visible {
  border-color: var(--blue);
}

.business-simple-list {
  margin: 0;
  padding-left: 22px;
}

.business-simple-list li {
  padding: 4px 0;
}

.business-health-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.business-health-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 4px minmax(150px, 0.8fr) minmax(180px, 1fr) auto minmax(58px, auto);
  min-height: 48px;
  padding: 8px 12px;
}

.business-health-row + .business-health-row {
  border-top: 1px solid var(--line);
}

.business-health-indicator {
  align-self: stretch;
  border-radius: 999px;
}

.business-health-row.complete .business-health-indicator {
  background: var(--green);
}

.business-health-row.attention .business-health-indicator {
  background: var(--gold);
}

.business-health-scope {
  color: var(--muted);
  font-size: 0.82rem;
}

.business-health-row .status-chip {
  justify-self: start;
}

.business-health-row .text-button {
  justify-self: end;
  margin: 0;
}

.business-ready-message {
  display: flex;
  align-items: center;
  gap: 9px;
}

.business-ready-message .status-dot {
  background: #65c98a;
}

@media (max-width: 720px) {
  .business-health-row {
    grid-template-columns: 4px minmax(0, 1fr) auto;
  }

  .business-health-scope {
    grid-column: 2;
  }

  .business-health-row strong {
    grid-column: 2;
  }

  .business-health-row .status-chip {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .business-health-row .text-button {
    grid-column: 3;
    grid-row: 3;
  }
}

.business-empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  color: var(--muted);
}

.business-empty-state p {
  margin: 0;
}

.business-table tbody tr:hover,
.business-table tbody tr:focus {
  background: #f1f8f7;
  outline: none;
}

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

.table-sort-button span {
  color: var(--teal);
  font-size: 10px;
}

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

.business-entity-edit-row td {
  vertical-align: top;
  background: #f1f8f7;
}

.business-entity-edit-row input,
.business-entity-edit-row select {
  width: 100%;
  min-width: 105px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.entity-formation-inputs {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.business-entity-edit-actions td {
  padding-top: 0;
  background: #f1f8f7;
}

.business-entity-edit-actions form,
.business-entity-edit-actions .button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.business-entity-edit-actions form {
  justify-content: space-between;
}

.business-entity-edit-actions .text-button {
  margin: 0 0 0 4px;
}

.entity-health {
  display: grid;
  gap: 6px;
  min-width: 86px;
}

.entity-health-summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.entity-health-summary span {
  color: var(--muted);
}

.entity-health-track {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ece9;
}

.entity-health-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #c58a12;
}

.entity-health.healthy .entity-health-track span {
  background: var(--green);
}

.entity-health.attention .entity-health-track span {
  background: #c6534b;
}

.readiness-label {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.readiness-label.ready {
  background: #e9f5ef;
  color: var(--green);
}

.readiness-label.attention {
  background: #fff3dd;
  color: #8a5b00;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  margin: 0 0 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

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

.business-profile-section h4 {
  margin: 0 0 12px;
}

.business-profile-section dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0;
}

.business-profile-section dl div {
  min-width: 0;
}

.business-profile-section dt {
  color: var(--muted);
  font-size: 13px;
}

.business-profile-section dd {
  margin: 4px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.business-property-create-panel {
  display: grid;
  gap: 18px;
}

.business-property-card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.business-property-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.business-property-card:hover,
.business-property-card:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(16, 36, 62, 0.1);
  outline: none;
  transform: translateY(-2px);
}

.business-property-card-image {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #dcebea, #b7d1d0);
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.business-property-card-image > img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.business-property-card-image > span:not(.business-property-card-status) {
  color: rgba(16, 36, 62, 0.55);
  font-size: 2.4rem;
  font-weight: 800;
}

.business-property-card-status {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 700;
  gap: 6px;
  left: 14px;
  padding: 7px 10px;
  position: absolute;
  top: 14px;
}

.business-property-card-status i {
  background: var(--green);
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.business-property-card-body {
  padding: 14px 16px 16px;
}

.business-property-card-body h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}

.business-property-card-body p {
  color: var(--muted);
  margin: 4px 0 0;
}

.business-property-card-code {
  font-weight: 700;
}

.business-property-profile-hero {
  align-items: center;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(180px, 260px) 1fr;
}

.business-property-profile-image {
  align-items: center;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #dcebea, #b7d1d0);
  border-radius: 12px;
  color: rgba(16, 36, 62, 0.55);
  display: flex;
  font-size: 2.4rem;
  font-weight: 800;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.business-property-profile-image img {
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  width: 100%;
}

.business-property-profile-heading {
  display: grid;
  gap: 7px;
  justify-items: start;
}

.business-property-profile-heading > div {
  align-items: center;
  display: flex;
  gap: 12px;
}

.business-property-profile-heading h3,
.business-property-profile-heading p {
  margin: 0;
}

.business-property-financial-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  margin-top: 20px;
}

.business-property-financial-grid.compact {
  grid-template-columns: repeat(2, minmax(140px, 240px));
  margin: 14px 0;
}

.business-property-financial-grid article {
  border: 1px solid var(--line);
  border-radius: 9px;
  display: grid;
  gap: 5px;
  padding: 13px;
}

.business-property-financial-grid span {
  color: var(--muted);
  font-size: 13px;
}

.property-profile-tabs {
  margin-top: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.business-property-shell {
  display: grid;
  gap: 16px;
}

.property-back-link {
  justify-self: start;
}

.property-shell-header {
  padding: 18px;
}

.property-shell-header .business-property-profile-hero {
  align-items: stretch;
  grid-template-columns: minmax(190px, 245px) minmax(210px, 0.75fr) minmax(430px, 1.35fr);
}

.property-photo-action {
  background: rgba(7, 33, 61, 0.88);
  border: 0;
  border-radius: 7px;
  bottom: 10px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 10px;
  position: absolute;
  right: 10px;
}

.property-header-location {
  color: var(--ink);
  margin: 0;
}

.property-map-link {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.property-header-facts {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  margin: 0;
  padding: 16px 4px;
}

.property-header-facts > div {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 5px;
  padding: 0 14px;
}

.property-header-facts > div:first-child { border-left: 0; }
.property-header-facts dt,
.property-capital-snapshot dt { color: var(--muted); font-size: 12px; }
.property-header-facts dd,
.property-capital-snapshot dd { font-weight: 800; margin: 0; }

.property-shell-toolbar {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 16px;
}

.property-capital-snapshot {
  display: flex;
  flex: 0 0 auto;
  margin: 0;
}

.property-capital-snapshot > div {
  display: grid;
  gap: 3px;
  min-width: 105px;
  padding: 0 16px;
}

.property-capital-snapshot > div + div { border-left: 1px solid var(--line); }

.property-summary-view {
  display: grid;
  gap: 16px;
}

.property-summary-kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(155px, 1fr));
}

.property-summary-kpi {
  text-align: left;
}

.property-summary-kpi .dashboard-kpi-heading > span:last-child {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.property-summary-kpi > strong {
  font-size: 22px;
}

.property-summary-insights {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: 1.05fr 1fr 1.15fr;
}

.property-insight-card {
  min-height: 315px;
  padding: 18px;
}

.property-card-heading {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.property-card-heading > div {
  align-items: center;
  display: flex;
  gap: 9px;
}

.property-card-heading h3 { margin: 0; }

.property-health-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.property-health-items > div {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 45px;
  padding: 8px 6px;
}

.property-health-items strong,
.property-health-items span:last-child { font-size: 12px; }
.good-text { color: var(--green); }
.warning-text { color: var(--gold); }

.property-check-dot {
  border: 2px solid #9aabbc;
  border-radius: 50%;
  display: inline-block;
  height: 14px;
  width: 14px;
}

.property-check-dot.complete { background: #1a9c4a; border-color: #1a9c4a; box-shadow: inset 0 0 0 3px #fff; }
.property-check-dot.attention { background: var(--gold); border-color: var(--gold); }
.property-check-dot.pending { background: #fff; }

.property-readiness-track {
  background: #e7ebef;
  border-radius: 999px;
  display: block;
  height: 9px;
  margin: 14px 0 10px;
  overflow: hidden;
}

.property-readiness-track > span {
  background: #1a9c4a;
  border-radius: inherit;
  display: block;
  height: 100%;
}

.property-launch-list {
  display: grid;
}

.property-launch-list button {
  align-items: center;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 9px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 38px;
  padding: 7px 2px;
  text-align: left;
}

.property-launch-list button > span:nth-child(3) {
  color: var(--muted);
  font-size: 11px;
}

.property-upcoming-card .dashboard-card-link {
  margin-top: 12px;
}

.property-placeholder-view {
  min-height: 180px;
}

.property-details-view .business-profile-section:first-of-type {
  border-top: 1px solid var(--line);
}

.business-property-tab-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 16px;
  margin-top: 14px;
  padding-top: 18px;
}

.business-property-tab-panel > h4,
.business-property-tab-panel > div > h4 {
  margin: 0 0 5px;
}

.property-document-area .business-empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 22px;
}

.business-property-operation-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.business-property-operation-list li {
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
}

.str-checklist {
  display: grid;
  gap: 8px;
}

.str-checklist details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
}

.str-checklist summary {
  cursor: pointer;
  font-weight: 700;
}

.str-checklist ul {
  margin-bottom: 2px;
}

.business-property-form-section {
  display: grid;
  gap: 12px;
}

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

.business-property-form-section h4 {
  margin: 0;
}

.business-property-image-preview {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  margin-bottom: 7px;
  overflow: hidden;
}

.business-property-image-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.business-property-selector {
  display: grid;
  gap: 6px;
  max-width: 360px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.requirements-table th,
.requirements-table td {
  white-space: normal;
}

.business-form-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.business-parent-editor {
  display: flex;
  align-items: end;
  gap: 10px;
  max-width: 560px;
}

.business-parent-editor label {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}

.business-parent-editor select {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

.business-parent-guidance {
  margin: 8px 0 0;
  max-width: 680px;
}

@media (max-width: 1200px) {
  .property-shell-header .business-property-profile-hero {
    grid-template-columns: minmax(180px, 230px) 1fr;
  }

  .property-header-facts {
    grid-column: 1 / -1;
  }

  .property-summary-kpis {
    grid-template-columns: repeat(3, minmax(155px, 1fr));
  }

  .property-summary-insights {
    grid-template-columns: 1fr;
  }
}

.business-danger-zone p {
  max-width: 760px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .business-header-row,
  .business-section-heading,
  .business-profile-heading,
  .business-list-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .business-header-meta {
    width: 100%;
    justify-content: space-between;
  }

  .business-summary-grid {
    grid-template-columns: 1fr;
  }

  .business-property-profile-hero,
  .business-property-financial-grid,
  .business-property-financial-grid.compact,
  .business-property-operation-list {
    grid-template-columns: 1fr;
  }

  .property-shell-header .business-property-profile-hero,
  .property-summary-kpis,
  .property-summary-insights,
  .property-health-items {
    grid-template-columns: 1fr;
  }

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

  .property-header-facts > div:nth-child(3) {
    border-left: 0;
  }

  .property-header-facts > div:nth-child(n+3) {
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }

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

  .property-capital-snapshot {
    justify-content: space-between;
  }

  .property-capital-snapshot > div {
    min-width: 0;
    padding: 0 10px;
  }

  .business-parent-editor {
    align-items: stretch;
    flex-direction: column;
  }
}

.classification-form h4 {
  margin: 0 0 4px;
}

.selected-file-control {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

.selected-file-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

.correction-summary {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
  padding: 10px;
  margin: 12px 0;
}

.correction-summary.error {
  background: #fff1f1;
  border-color: #f1a4a4;
  color: #8f1f1f;
}

.correction-summary.error-summary {
  background: #fff1f1;
  border-color: #f1a4a4;
  color: #8f1f1f;
}

.compact-form {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.hidden-fields {
  display: none;
}

.status-chip,
.source-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 700;
  background: #e8f7f7;
  color: var(--blue);
}

.status-chip.review,
.status-chip.error,
.status-chip.ambiguous {
  background: #fff3dd;
  color: #8a5b00;
}

.status-chip.matched {
  background: #e9f5ef;
  color: var(--green);
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 11px;
  cursor: pointer;
}

.settings-tab.active {
  background: var(--nav);
  color: #fff;
  border-color: var(--nav);
}

.settings-section {
  display: none;
  margin-top: 18px;
}

.active-settings-section {
  display: block;
}

.brand-preview {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-preview img {
  width: 104px;
  height: 69px;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

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

.brand-preview strong {
  font-size: 24px;
}

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

.theme-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.theme-swatch {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.theme-swatch span:first-child {
  width: 42px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.rule-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(130px, 0.8fr)) auto;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.add-item-button {
  justify-self: end;
  padding: 8px 11px;
  color: var(--blue);
  font-weight: 800;
}

.inline-error {
  color: #8a2c1b;
  font-size: 12px;
  margin-top: 6px;
  max-width: 220px;
}

.inline-review-add-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-width: 330px;
}

.inline-review-add-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 8px;
  font: inherit;
}

.inline-review-add-form .inline-error {
  grid-column: 1 / -1;
  margin-top: 0;
}

.payment-source-row,
.payment-source-delete-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fff;
}

.payment-source-summary {
  display: grid;
  gap: 3px;
}

.payment-source-summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.payment-source-actions,
.payment-source-edit-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.payment-source-edit-form {
  width: 100%;
}

.payment-source-edit-form input {
  flex: 1;
  min-width: 0;
}

.payment-source-actions button,
.payment-source-edit-form button {
  padding: 7px 10px;
}

.payment-source-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 680px) {
  .payment-source-row,
  .payment-source-delete-confirm,
  .payment-source-edit-form {
    align-items: stretch;
    flex-direction: column;
  }

  .payment-source-actions {
    justify-content: flex-end;
  }
}

.rule-view-tabs {
  margin: 10px 0 12px;
}

.rule-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.compact-metric {
  padding: 12px;
}

.compact-metric strong {
  font-size: 22px;
}

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

.rules-layout.detail-open {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
}

.rules-table {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rule-card {
  cursor: pointer;
}

.expense-rule-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr 0.7fr 1fr 0.8fr 0.7fr;
  gap: 10px;
  align-items: start;
}

.expense-rule-row div {
  min-width: 0;
}

.expense-rule-row span:first-child {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.expense-rule-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.rule-card:hover {
  border-color: var(--accent);
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.mapping-table th,
.mapping-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.mapping-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7faf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mapping-table tbody tr {
  cursor: pointer;
}

.mapping-table tbody tr:hover {
  background: #f5fbfa;
}

.mapping-table tbody tr.draft-row {
  background: #e8f7f7;
}

.mapping-table tbody tr.draft-row:hover {
  background: #def1f2;
}

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

.rule-action-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  min-height: 28px;
  padding: 7px 9px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rule-action-button:hover {
  border-color: var(--accent);
  background: #f5fbfa;
}

.rule-action-button:focus-visible {
  outline: 2px solid rgba(35, 148, 160, 0.35);
  outline-offset: 2px;
}

.rule-action-save {
  border-color: var(--nav);
  background: var(--nav);
  color: #fff;
}

.rule-action-save:hover {
  background: #17445f;
  color: #fff;
}

.rule-action-activate {
  border-color: #4f8a68;
  background: #e8f5ee;
  color: #24563b;
}

.rule-action-warning {
  border-color: #d59b42;
  background: #fff8ec;
  color: #8a5a12;
}

.rule-action-danger {
  border-color: #b65a47;
  background: #fff1ed;
  color: #8a2c1b;
}

.table-sort-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.table-sort-button span {
  color: var(--accent);
  font-size: 10px;
}

.rule-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rule-card small,
.rule-detail small {
  color: var(--muted);
}

.rule-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
  min-height: 260px;
  overflow-wrap: anywhere;
}

.rule-detail dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  margin: 10px 0 0;
}

.rule-detail dt {
  color: var(--muted);
}

.rule-detail dd {
  margin: 0;
}

.compact-list {
  margin: 0;
  padding-left: 16px;
}

.rule-detail-section {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.rule-detail-section h4 {
  font-size: 13px;
  margin: 0 0 8px;
}

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

.compact-record-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 8px;
}

.compact-record-row span {
  color: var(--muted);
}

.advanced-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.advanced-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.rule-test-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(300px, 1.2fr);
  gap: 12px;
  margin-bottom: 12px;
}

.rule-test-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

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

.config-model div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.property-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.property-card:hover {
  border-color: rgba(15, 111, 136, 0.55);
}

.property-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(15, 111, 136, 0.16), 0 12px 24px rgba(16, 36, 62, 0.08);
  transform: translateY(-1px);
}

.property-card.selected::after {
  content: "Selected";
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 8px;
}

.property-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.property-card div {
  padding: 12px;
}

.property-card strong {
  display: block;
  margin-bottom: 4px;
}

.badge {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 999px;
  background: #e9f5ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.property-detail-body {
  display: grid;
  gap: 16px;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.property-section {
  display: grid;
  gap: 10px;
}

.property-section h4,
.property-section p {
  margin: 0;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

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

.invoice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fff;
}

.invoice-row strong,
.invoice-row span {
  display: block;
}

.invoice-row > div span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.payment-note {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfdfb;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: auto;
    overflow-y: visible;
  }

  .metric-grid,
  .content-grid,
  .upload-layout,
  .section-grid,
  .rules-layout,
  .rule-toolbar,
  .rule-test-grid,
  .compact-form {
    grid-template-columns: 1fr;
  }
}

.workspace-status-panel {
  margin: 18px 0;
}

.workspace-status-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.workspace-status-card strong {
  font-size: 16px;
}

.workspace-status-card p {
  margin: 0;
  color: var(--muted);
}

.workspace-status-card.ready {
  border-color: #bcded0;
  background: #f4fbf7;
}

.workspace-status-card.needs-setup {
  border-color: #ecd8a8;
  background: #fffaf0;
}

.workspace-inline-status {
  display: grid;
  gap: 8px;
  border: 1px solid #ecd8a8;
  border-radius: 8px;
  padding: 12px;
  background: #fffaf0;
  margin: 12px 0;
}

.workspace-inline-status span {
  color: var(--muted);
}


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

.material-hero {
  display: grid;
  gap: 14px;
}

.material-summary-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.material-summary-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fff;
}

.material-summary-grid article > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.material-summary-grid strong {
  display: grid;
  gap: 6px;
}

.material-goal-display {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.material-goal-form {
  display: grid;
  gap: 7px;
}

.material-goal-status {
  color: var(--muted);
  font-size: 12px;
}

.material-goal-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 8px;
  font: inherit;
}

.material-goal-form > div {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.material-summary-grid article.goal-good {
  border-color: #bcded0;
  background: #e9f5ef;
}

.material-summary-grid article.goal-good strong {
  color: var(--green);
}

.material-summary-grid article.goal-close {
  border-color: #ecd8a8;
  background: #fff8e8;
}

.material-summary-grid article.goal-close strong {
  color: var(--gold);
}

.material-summary-grid article.goal-off-track {
  border-color: #efc6c1;
  background: #fff2f0;
}

.material-summary-grid article.goal-off-track strong {
  color: var(--red);
}

.material-goal-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.material-goal-progress progress {
  width: min(360px, 100%);
}

.material-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.material-toolbar-context {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.material-toolbar-context select {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 30px 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.material-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.material-filters {
  margin-bottom: 14px;
}

.material-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.material-pagination > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.material-import-result {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.material-import-result.success {
  border-color: #bcded0;
  background: #e9f5ef;
}

.material-import-result.review {
  border-color: #ecd8a8;
  background: #fff8e8;
}

.material-import-result.error {
  border-color: #efc6c1;
  background: #fff2f0;
  color: var(--red);
}

.material-import-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.material-import-summary .ghost-button {
  margin-left: auto;
}

.material-import-review-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

.material-import-review {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
}

.material-import-review th,
.material-import-review td {
  padding: 8px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.material-import-review tr.warning td {
  background: #fff8e8;
}

.material-import-review tr.error td {
  background: #fff2f0;
}

.stacked-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.material-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.material-table-wrap.empty {
  padding: 16px;
  color: var(--muted);
}

.material-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.material-log-table {
  min-width: 1100px;
}

.material-log-table th:nth-child(1),
.material-log-table td:nth-child(1) {
  min-width: 150px;
}

.material-log-table th:nth-child(2),
.material-log-table td:nth-child(2) {
  min-width: 145px;
}

.material-log-table th:nth-child(3),
.material-log-table td:nth-child(3),
.material-log-table th:nth-child(4),
.material-log-table td:nth-child(4) {
  min-width: 125px;
}

.material-log-table th:nth-child(5),
.material-log-table td:nth-child(5) {
  min-width: 190px;
}

.material-log-table th:nth-child(6),
.material-log-table td:nth-child(6) {
  min-width: 280px;
  max-width: 520px;
}

.material-log-table th:nth-child(7),
.material-log-table td:nth-child(7) {
  min-width: 90px;
}

.material-log-table td:nth-child(3),
.material-log-table td:nth-child(4),
.material-log-table td:nth-child(7) {
  white-space: nowrap;
}

.material-table th,
.material-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.material-table th {
  font-size: 13px;
  color: var(--muted);
  background: #f8fbfa;
}

.material-log-table .table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

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

.material-table tbody tr {
  cursor: pointer;
}

.material-log-table tbody tr[data-material-row] td {
  font-size: 14px;
  line-height: 1.3;
}

.material-table tbody tr:hover,
.material-table tbody tr.selected {
  background: #f0f8f7;
}

.permission-access-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.permission-access-table {
  width: 100%;
  border-collapse: collapse;
}

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

.permission-access-table thead th {
  color: var(--muted);
  font-size: 13px;
  background: #f8fbfa;
}

.permission-access-table tbody th {
  width: 50%;
  font-size: 14px;
}

.permission-access-table select {
  width: 100%;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

.permission-access-table tr:last-child th,
.permission-access-table tr:last-child td {
  border-bottom: 0;
}

.permission-access-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.material-inline-editor,
.material-inline-details {
  background: #f0f8f7;
}

.material-inline-editor,
.material-inline-details,
.material-inline-editor:hover,
.material-inline-details:hover {
  cursor: default;
}

.material-inline-editor input,
.material-inline-editor select,
.material-inline-details input,
.material-inline-details select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.material-inline-editor td {
  vertical-align: middle;
}

.material-inline-editor td:nth-child(2),
.material-inline-editor td:nth-child(3),
.material-inline-editor td:nth-child(4) {
  width: auto;
}

.material-inline-editor td:nth-child(7) {
  width: 110px;
}

.material-category-select {
  border-radius: 999px !important;
  background: #edf1f2 !important;
}

.material-inline-details > td {
  padding-top: 5px;
  padding-bottom: 9px;
}

.material-inline-details-content,
.material-inline-advanced,
.material-meal-context,
.material-meal-fields,
.material-inline-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.material-inline-details-content {
  flex-wrap: wrap;
}

.material-inline-more summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.material-inline-more[open] {
  flex-basis: 100%;
}

.material-inline-advanced {
  margin-top: 8px;
}

.material-inline-details label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.material-meal-context {
  flex-wrap: wrap;
}

.material-inline-actions {
  margin-left: 12px;
}

.material-inline-status {
  color: var(--muted);
  font-size: 13px;
}

.error-text {
  color: #922a1f;
}

.member-name-editor {
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-name-editor input {
  min-width: 150px;
}

.disabled-panel {
  opacity: 0.72;
}

.disabled-panel .panel-header p::after {
  content: " Logging is waiting for this workspace to be connected.";
}

.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.small-button {
  padding: 7px 10px;
  font-size: 13px;
}

.records-view,
.financials-view {
  display: grid;
  gap: 16px;
}

.records-hero,
.financials-hero,
.calendar-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.records-hero h3,
.financials-hero h3,
.calendar-hero h3 {
  margin: 3px 0 6px;
  font-size: 26px;
}

.records-intro p {
  margin: 0;
}

#calendar {
  gap: 16px;
}

.calendar-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.calendar-filters {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.calendar-tabs {
  align-items: center;
}

.calendar-table {
  min-width: 860px;
}

.calendar-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.calendar-placeholder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.calendar-placeholder-card strong {
  display: block;
  margin: 8px 0 4px;
}

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

.records-layout.with-detail {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.records-filters {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-top: 14px;
}

.records-date-range-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.records-date-range-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-segmented-control {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.segmented-button.active {
  background: var(--nav);
  border-color: var(--nav);
  color: #fff;
}

.records-custom-date-range {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}

.records-custom-date-range label {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: var(--muted);
  font-size: 13px;
}

.records-custom-date-range input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.records-date-error {
  flex-basis: 100%;
  color: var(--danger);
  font-size: 13px;
}

.financials-filters {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.financials-tabs {
  align-items: center;
}

.financials-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.financials-content {
  display: grid;
  gap: 16px;
}

.financials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.financials-metric-panel {
  display: grid;
  gap: 12px;
}

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

.financials-metric-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.financials-metric-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.financials-metric-list strong {
  display: block;
  margin-top: 4px;
}

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

.records-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.records-table-wrap.empty {
  padding: 16px;
  color: var(--muted);
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.records-table th,
.records-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.records-table th {
  font-size: 13px;
  color: var(--muted);
  background: #f8fbfa;
}

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

.records-table tbody tr {
  cursor: pointer;
}

.records-table tbody tr:hover,
.records-table tbody tr.selected {
  background: #f0f8f7;
}

.records-detail-panel {
  position: sticky;
  top: 18px;
}

.record-detail {
  display: grid;
  gap: 14px;
}

.record-context-grid {
  display: grid;
  gap: 8px;
}

.record-context-grid div,
.record-source-context {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.record-context-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.record-source-context p {
  margin: 6px 0 0;
  color: var(--muted);
}

.record-edit-form textarea {
  min-height: 82px;
  resize: vertical;
}

.inline-button {
  margin-left: 8px;
  padding: 6px 9px;
}


.material-setup-panel {
  display: grid;
  gap: 14px;
  border: 1px solid #ecd8a8;
  border-radius: 8px;
  padding: 16px;
  margin: 14px 0;
  background: #fffaf0;
}

.material-setup-panel[hidden] {
  display: none;
}

.material-setup-panel h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.material-setup-panel p {
  margin: 0;
  color: var(--muted);
}

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

.setup-columns ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text);
}

.setup-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.setup-result.success {
  border-color: #bcded0;
  background: #f4fbf7;
}

.setup-result.error {
  border-color: #f0b4aa;
  background: #fff5f3;
  color: #922a1f;
}

@media (max-width: 760px) {
  .workspace-switcher {
    min-width: 0;
  }

  .records-hero,
  .financials-hero,
  .records-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .records-detail-panel {
    position: static;
  }

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

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

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

  .material-toolbar-actions > button {
    flex: 1 1 auto;
  }

  .material-inline-details-content,
  .material-meal-context,
  .material-meal-fields,
  .material-inline-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .material-inline-actions {
    margin-left: 0;
  }

  .material-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .material-pagination > div {
    justify-content: space-between;
  }
}
