:root {
  color: #14213d;
  background: #f3f5f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 20rem;
}

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgb(37 99 235 / 14%), transparent 34rem),
    #f3f5f8;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: min(100%, 28rem);
  border: 1px solid #dbe3ef;
  border-radius: 1rem;
  background: #fff;
  padding: 2rem;
  box-shadow: 0 18px 50px rgb(15 23 42 / 12%);
}

.auth-card h1 {
  font-size: clamp(1.7rem, 6vw, 2.25rem);
}

.auth-description,
.auth-account-line {
  color: #64748b;
}

.auth-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.auth-form[hidden] {
  display: none;
}

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

.auth-account-line {
  margin-bottom: 0;
}

.auth-account-line strong {
  color: #14213d;
}

.auth-notice {
  min-height: 1.35rem;
  margin: 1rem 0 0;
  color: #b91c1c;
  font-size: 0.86rem;
  font-weight: 700;
}

button,
input,
textarea {
  font: inherit;
}

button,
label,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
.table-scroll:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.page-shell {
  margin: 0 auto;
  max-width: 78rem;
  padding: 2rem 1rem 4rem;
}

.app-card {
  overflow: clip;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 18px 50px rgb(15 23 42 / 8%);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.25rem 2.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.account-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#account-username {
  color: #475569;
  font-size: 0.9rem;
  font-weight: 800;
}

.user-management-dialog {
  width: min(46rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 1rem;
  padding: 0;
  color: #14213d;
  box-shadow: 0 24px 70px rgb(15 23 42 / 28%);
}

.user-management-dialog::backdrop {
  background: rgb(15 23 42 / 48%);
  backdrop-filter: blur(2px);
}

.user-management-card {
  padding: 1.5rem;
}

.user-management-header,
.user-management-toolbar,
.managed-user-selection,
.managed-user-add-panel form {
  display: flex;
  align-items: center;
}

.user-management-header {
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1rem;
}

.user-management-header h2 {
  font-size: 1.35rem;
}

.dialog-close {
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.6rem;
  background: #fff;
  color: #475569;
  font-size: 1.5rem;
}

.user-management-toolbar {
  gap: 0.5rem;
  padding: 1rem 0;
}

.user-management-toolbar span {
  margin-left: 0.35rem;
  color: #64748b;
  font-size: 0.85rem;
}

.managed-user-add-panel {
  margin-bottom: 1rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.75rem;
  background: #f8fbff;
  padding: 1rem;
}

.managed-user-add-panel form {
  align-items: end;
  gap: 0.75rem;
}

.managed-user-add-panel .field {
  flex: 1;
}

.managed-user-add-panel p {
  margin: 0.65rem 0 0;
  color: #64748b;
  font-size: 0.82rem;
}

.managed-users-table-scroll {
  overflow-x: auto;
  border: 1px solid #dbe3ef;
  border-radius: 0.75rem;
}

.managed-users-table {
  min-width: 34rem;
}

.managed-users-table tr.is-selected td {
  background: #eff6ff;
}

.managed-user-selection {
  gap: 0.65rem;
}

.managed-user-status {
  display: inline-block;
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.managed-user-status.is-active {
  background: #dcfce7;
  color: #166534;
}

.managed-user-status.is-password_setup_required {
  background: #fef3c7;
  color: #92400e;
}

.managed-users-empty {
  padding: 1.5rem;
  text-align: center;
  color: #64748b;
}

.managed-users-notice {
  min-height: 1.3rem;
  margin: 0.8rem 0 0;
  font-size: 0.86rem;
  font-weight: 750;
}

.managed-users-notice.is-success {
  color: #166534;
}

.managed-users-notice.is-error {
  color: #b91c1c;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0.55rem;
  color: #10213f;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0.25rem;
  color: #14213d;
  font-size: 1.08rem;
}

h3 {
  margin-bottom: 0.65rem;
  color: #1e3a5f;
  font-size: 0.95rem;
}

.page-intro,
.section-heading p,
.field-help,
.acceptance-note,
.strategy-card small,
.split-toggle small {
  color: #64748b;
}

.page-intro,
.section-heading p {
  margin-bottom: 0;
}

.form-section {
  padding: 1.75rem 2.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.section-heading {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.section-number {
  display: inline-grid;
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  place-items: center;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

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

.identity-defaults-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 0.8fr) minmax(0, 2.2fr);
  gap: 1.25rem;
  align-items: start;
}

.defaults-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 1rem;
  align-items: end;
}

.save-defaults-field {
  align-self: end;
}

.save-defaults-field .button {
  min-height: 2.65rem;
  white-space: nowrap;
}

.portfolio-field {
  position: relative;
  min-width: 0;
}

.portfolio-picker {
  display: flex;
  width: 100%;
  min-height: 2.65rem;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  color: #14213d;
  padding: 0.6rem 0.7rem;
  text-align: left;
}

.portfolio-picker:hover,
.portfolio-picker[aria-expanded="true"] {
  border-color: #60a5fa;
}

#portfolio-selection {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-picker-arrow {
  flex: 0 0 auto;
  color: #64748b;
}

.portfolio-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.45rem);
  left: 0;
  width: min(32rem, calc(100vw - 2rem));
  border: 1px solid #cbd5e1;
  border-radius: 0.7rem;
  background: #fff;
  padding: 0.75rem;
  box-shadow: 0 18px 36px rgb(15 23 42 / 20%);
}

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

.portfolio-toolbar,
.portfolio-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.portfolio-toolbar {
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.portfolio-tool-button {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 0.4rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 1.2rem;
  font-weight: 800;
}

.portfolio-remove-button {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

.portfolio-tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.portfolio-table-scroll {
  max-height: 18rem;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.portfolio-table {
  min-width: 0;
}

.portfolio-table th,
.portfolio-table td {
  padding: 0.45rem 0.55rem;
}

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

.portfolio-table tbody tr:hover,
.portfolio-table tbody tr.is-selected {
  background: #eff6ff;
}

.portfolio-table tbody tr.is-selected td {
  color: #1d4ed8;
  font-weight: 750;
}

.portfolio-row-select {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.portfolio-empty-row {
  color: #64748b;
  text-align: center;
}

.portfolio-add-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: end;
  margin-top: 0.7rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.7rem;
}

.portfolio-add-fields[hidden] {
  display: none;
}

.portfolio-add-fields .button {
  min-height: 2.65rem;
}

.portfolio-notice {
  margin-bottom: 0;
}

@media (min-width: 761px) {
  .staff-field > label,
  .defaults-grid > .field > label {
    display: flex;
    min-height: 2.1rem;
    align-items: flex-end;
  }
}

.defaults-notice {
  min-height: 1.05rem;
}

.defaults-notice.is-error {
  color: #b91c1c;
  font-weight: 700;
}

.defaults-notice.is-success {
  color: #166534;
  font-weight: 700;
}

.field label,
.paste-panel > label,
.strategy-fieldset > legend {
  display: block;
  margin-bottom: 0.45rem;
  color: #1e293b;
  font-size: 0.86rem;
  font-weight: 750;
}

input[type="text"],
input:not([type]),
textarea,
.table-input,
.field input {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #fff;
  color: #14213d;
  padding: 0.6rem 0.7rem;
}

textarea {
  min-height: 5.8rem;
  resize: vertical;
}

input:hover,
textarea:hover {
  border-color: #94a3b8;
}

.field-help {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.paste-panel {
  max-width: 54rem;
  margin-bottom: 1rem;
}

.inline-actions,
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.inline-actions {
  margin-top: 0.7rem;
}

.button {
  min-height: 2.55rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.55rem 0.85rem;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

.button-primary {
  border-color: #1d4ed8;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 6px 14px rgb(37 99 235 / 22%);
}

.button-primary:hover {
  background: #1d4ed8;
}

.button-secondary {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.button-secondary:hover {
  background: #dbeafe;
}

.button-quiet {
  border-color: #cbd5e1;
  background: #fff;
  color: #334155;
}

.button-danger {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

.button-icon {
  min-width: 2.25rem;
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

.bulk-toolbar,
.strategy-fieldset {
  margin: 1rem 0;
  border: 1px solid #dbeafe;
  border-radius: 0.7rem;
  background: #f8fbff;
  padding: 0.9rem 1rem 1rem;
}

.bulk-toolbar .field-help {
  flex: 1 1 20rem;
  margin: 0;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.7rem;
}

table {
  width: 100%;
  min-width: 62rem;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.65rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

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

.table-input {
  min-width: 8rem;
  min-height: 2.3rem;
}

.table-input[aria-invalid="true"] {
  border-color: #dc2626;
  background: #fff8f8;
}

.cell-error {
  display: block;
  margin-top: 0.28rem;
  color: #b91c1c;
  font-size: 0.75rem;
  line-height: 1.25;
}

.empty-table {
  padding: 1.8rem;
  color: #64748b;
  text-align: center;
}

.strategy-fieldset {
  padding: 1rem;
}

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

.strategy-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.55rem;
  align-items: start;
  min-height: 7rem;
  border: 2px solid #cbd5e1;
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.9rem;
}

.strategy-card:has(input:checked),
.strategy-card.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #bfdbfe;
}

.strategy-card span {
  color: #1e3a5f;
  font-size: 0.92rem;
  font-weight: 800;
}

.strategy-card small {
  grid-column: 2;
  line-height: 1.35;
}

.strategy-card input {
  width: 1rem;
  height: 1rem;
  margin: 0.1rem 0 0;
}

.split-toggle {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.65rem;
}

.split-toggle input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.16rem;
}

.split-toggle strong,
.split-toggle small {
  display: block;
}

.split-toggle small {
  margin-top: 0.22rem;
  line-height: 1.4;
}

.validation-summary {
  border: 1px solid #bfdbfe;
  border-radius: 0.7rem;
  background: #f8fbff;
  padding: 0.85rem 1rem;
}

.validation-summary.is-valid {
  border-color: #86efac;
  background: #f0fdf4;
}

.validation-summary.is-invalid {
  border-color: #fecaca;
  background: #fff8f8;
}

.validation-summary p {
  margin-bottom: 0;
  color: #1e3a5f;
  font-weight: 750;
}

.validation-summary.is-valid p {
  color: #166534;
}

.validation-summary.is-invalid p,
.validation-summary li {
  color: #b91c1c;
}

.validation-summary ul {
  margin: 0.6rem 0 0;
  padding-left: 1.25rem;
}

.validation-summary li + li {
  margin-top: 0.25rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}

.metrics-grid > div,
.preview-card {
  border: 1px solid #dbeafe;
  border-radius: 0.65rem;
  background: #f8fbff;
  padding: 0.85rem;
}

.metrics-grid dt {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
}

.metrics-grid dd {
  margin: 0.3rem 0 0;
  color: #1e3a5f;
  font-size: 1.08rem;
  font-weight: 800;
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(14rem, 1fr);
  gap: 0.8rem;
}

.preview-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.preview-list .muted {
  color: #64748b;
  font-family: inherit;
}

.split-budget-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.split-budget-list li {
  color: #334155;
  font-size: 0.8rem;
  line-height: 1.45;
}

.split-budget-list .muted {
  color: #64748b;
}

.acceptance-note {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  justify-content: space-between;
  border-top: 1px solid #dbeafe;
  background: rgb(255 255 255 / 96%);
  padding: 1rem 2.25rem;
  backdrop-filter: blur(10px);
}

.action-bar > div {
  min-height: 1.5rem;
}

#progress-state {
  margin: 0;
  color: #334155;
  font-size: 0.88rem;
}

#progress-state.is-success {
  color: #166534;
  font-weight: 750;
}

#progress-state.is-error {
  color: #b91c1c;
  font-weight: 750;
}

.download-link {
  display: inline-block;
  margin-top: 0.25rem;
  color: #166534;
  font-weight: 800;
}

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

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

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

@media (max-width: 760px) {
  .page-shell {
    padding: 0;
  }

  .app-card {
    border: 0;
    border-radius: 0;
  }

  .page-header,
  .form-section,
  .action-bar {
    padding-right: 1rem;
    padding-left: 1rem;
  }

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

  .account-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .managed-user-add-panel form {
    align-items: stretch;
    flex-direction: column;
  }

  .identity-defaults-layout,
  .defaults-grid,
  .strategy-grid,
  .metrics-grid,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  #save-defaults {
    width: 100%;
  }

  .portfolio-panel {
    position: fixed;
    top: 1rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }

  .portfolio-table-scroll {
    max-height: 50vh;
  }

  .portfolio-add-fields {
    grid-template-columns: 1fr;
  }

  .strategy-card {
    min-height: 0;
  }

  .action-bar {
    align-items: stretch;
  }

  .action-bar .button-primary {
    width: 100%;
  }
}
