:root {
  --ink: #172226;
  --muted: #5d6b71;
  --line: #d8e0df;
  --panel: #ffffff;
  --page: #eef3f1;
  --green: #1f7a5f;
  --blue: #2868a8;
  --red: #ad4c42;
  --gold: #b8872d;
  --soft-green: #dcefe8;
  --soft-blue: #e1ebf6;
  --soft-gold: #f5ead3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #172226;
  color: #f5f8f6;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #f4c765;
  color: #172226;
  font-weight: 900;
}

.brand span,
.tenant span {
  display: block;
  color: #aebabd;
  font-size: 0.84rem;
}

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

.nav-item {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  color: #d9e2df;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  color: #172226;
  background: #f5f8f6;
}

.tenant {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

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

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.actions,
.panel-head,
.segmented,
.panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary,
.icon-button,
.text-button,
.segmented button,
.record-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary {
  padding: 0 16px;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  background: white;
  color: var(--ink);
  font-size: 1.25rem;
}

.text-button {
  padding: 0 10px;
  color: var(--blue);
  background: transparent;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metrics article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(23, 34, 38, 0.07);
}

.metrics article {
  padding: 18px;
}

.metrics span,
.metrics em {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: normal;
}

.metrics strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 2rem;
}

.split,
.directory,
.portal-preview {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-tools {
  justify-content: flex-end;
}

.flow {
  display: grid;
  gap: 10px;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.flow-step span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #edf2f1;
  font-weight: 900;
}

.flow-step.done span {
  color: white;
  background: var(--green);
}

.flow-step.current {
  border-color: var(--gold);
  background: var(--soft-gold);
}

.watch-list,
.record-list,
.list-page {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.watch-list li,
.record,
.tax-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.watch-list b,
.watch-list span,
.record span {
  display: block;
}

.watch-list span,
.record span,
.status {
  color: var(--muted);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  background: #f5f8f6;
  font-size: 0.82rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 800;
}

.segmented {
  padding: 4px;
  border-radius: 8px;
  background: #edf2f1;
}

.segmented button {
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
}

.segmented .selected {
  background: white;
  box-shadow: 0 2px 12px rgba(23, 34, 38, 0.08);
}

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

.record .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

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

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

.record-button {
  width: 100%;
  color: inherit;
  text-align: left;
}

.record-button:hover {
  border-color: rgba(31, 122, 95, 0.45);
  background: #f4faf7;
}

.record-button:focus-visible {
  outline: 3px solid rgba(40, 104, 168, 0.28);
  outline-offset: 2px;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfc;
}

.search-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

#openPayrollButton[hidden] {
  display: none;
}

.search-control input {
  width: min(260px, 36vw);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.search-control input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(40, 104, 168, 0.16);
}

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

.detail-form fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-form legend {
  padding: 0 8px;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 900;
}

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

.detail-form input,
.detail-form select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.detail-form input:focus,
.detail-form select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(40, 104, 168, 0.16);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.tax-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.tax-card dl {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
}

.tax-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.tax-card dt {
  color: var(--muted);
}

.phone {
  display: grid;
  justify-self: center;
  width: min(360px, 100%);
  min-height: 620px;
  padding: 18px;
  border-radius: 32px;
  background: #172226;
}

.phone-top {
  justify-self: center;
  width: 110px;
  height: 22px;
  border-radius: 0 0 14px 14px;
  background: #0d1518;
}

.portal-card {
  align-self: stretch;
  margin-top: 14px;
  padding: 22px;
  border-radius: 22px;
  background: #f5f8f6;
}

.pill {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--soft-green);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 900;
}

.full {
  width: 100%;
  margin: 8px 0 18px;
}

.stub-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.control-list {
  display: grid;
  gap: 12px;
}

.control-list label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

  .sidebar {
    position: static;
  }

  nav,
  .metrics,
  .split,
  .directory,
  .portal-preview,
  .tax-grid,
  .list-page,
  .detail-form fieldset {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  main,
  .sidebar {
    padding: 18px;
  }

  .actions,
  .panel-head,
  .panel-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .primary {
    width: 100%;
  }

  .search-control {
    width: 100%;
  }

  .search-control input {
    flex: 1;
    width: auto;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
