.demo-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.mobile-brand {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.mobile-brand .demo-label {
  max-width: 225px;
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-picker {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 8px 3px 4px;
  border: 1px solid #bfd3d0;
  border-radius: 999px;
  background: #f8fbfa;
}

.role-avatar,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--amsa-green);
  color: var(--white);
  font-weight: 850;
  letter-spacing: 0.02em;
}

.role-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 9px;
}

.role-picker select {
  max-width: 198px;
  min-height: 26px;
  padding: 0 22px 0 1px;
  border: 0;
  background: transparent;
  color: var(--amsa-ink);
  font-size: 12px;
  font-weight: 750;
}

.nav-button {
  position: relative;
  min-height: 58px;
  padding: 18px 12px 15px;
  border: 0;
  background: transparent;
  color: var(--amsa-ink);
  font-weight: 680;
  white-space: nowrap;
}

.nav-button:hover {
  background: #f5f8f8;
}

.nav-button[aria-current="page"] {
  font-weight: 800;
}

.nav-button[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 6px;
  left: 8px;
  height: 4px;
  background: var(--amsa-gold);
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--amsa-ink);
  font-weight: 760;
  text-decoration: none;
}

.button:hover {
  border-color: #94afb5;
  background: #fbfcfc;
}

.button.primary {
  border-color: var(--amsa-green);
  background: var(--amsa-green);
  color: var(--white);
}

.button.primary:hover {
  border-color: var(--amsa-green-dark);
  background: var(--amsa-green-dark);
}

.button.danger {
  border-color: var(--amsa-red);
  color: #8e3641;
}

.button.small {
  min-height: 34px;
  padding-inline: 11px;
  font-size: 12px;
}

.button.icon-only {
  width: 42px;
  padding: 0;
}

.button.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--amsa-green);
}

.button.link-button:hover {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.panel,
.kpi,
.notice,
.rule-card {
  border: 1px solid var(--line);
  background: var(--surface);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel.flush {
  padding: 0;
  overflow: hidden;
}

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

.panel-head {
  margin-bottom: 16px;
}

.section-head {
  min-height: 58px;
  align-items: center;
}

.panel-head p,
.section-head p,
.subtle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.kpi {
  min-height: 118px;
  padding: 17px 16px 15px;
  border-top: 4px solid var(--tone, var(--amsa-ink));
}

.kpi > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.kpi > strong {
  display: block;
  margin: 10px 0 4px;
  color: var(--amsa-ink);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.045em;
}

.kpi > small {
  color: var(--muted);
  font-size: 11px;
}

.notice {
  min-height: 56px;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 12px 14px 12px 0;
}

.notice::before {
  content: "";
  align-self: stretch;
  background: var(--tone, var(--amsa-gold));
}

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

.notice strong {
  color: var(--amsa-ink);
}

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

.status,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-teal);
  color: #155d54;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tag {
  border-radius: 2px;
}

.tag.gold,
.status.gold {
  background: var(--surface-gold);
  color: #796500;
}

.tag.orange,
.status.orange {
  background: var(--surface-orange);
  color: #9b451f;
}

.tag.red,
.status.red {
  background: var(--surface-red);
  color: #903742;
}

.tag.blue,
.status.blue {
  background: var(--surface-blue);
  color: #2d6772;
}

.tag.violet,
.status.violet {
  background: var(--surface-violet);
  color: #5f507c;
}

.tag.muted,
.status.muted {
  background: #edf1f2;
  color: #60757b;
}

.filters {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-group,
.form-control {
  display: grid;
  gap: 6px;
}

.filter-group {
  min-width: 150px;
}

.filter-group.grow {
  min-width: 220px;
  flex: 1 1 260px;
}

.filter-group label,
.form-control label,
.field-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 41px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

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

.input::placeholder,
.textarea::placeholder {
  color: #8da0a5;
}

.input-search {
  padding-left: 36px;
  background:
    linear-gradient(45deg, transparent 47%, var(--muted) 48% 53%, transparent 54%) 23px 23px / 8px 8px no-repeat,
    radial-gradient(circle, transparent 48%, var(--muted) 50% 61%, transparent 63%) 13px 11px / 12px 12px no-repeat,
    var(--surface);
}

.segmented {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
}

.segment-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 740;
}

.segment-button:last-child {
  border-right: 0;
}

.segment-button[aria-selected="true"] {
  background: var(--amsa-ink);
  color: var(--white);
}

.table-shell {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  scrollbar-color: var(--amsa-teal) var(--surface-soft);
  scrollbar-width: thin;
}

.table-scroll-hint {
  display: none;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.data-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 12px;
}

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

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

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

.data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eaf0f1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: #fbfdfd;
}

.data-table tbody tr.is-highlighted {
  background: #fffaf0;
}

.data-table .sticky-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
  box-shadow: 1px 0 var(--line);
}

.data-table th.sticky-cell {
  z-index: 4;
  background: #eaf0f1;
}

.cell-title,
.cell-meta {
  display: block;
}

.cell-title {
  color: var(--amsa-ink);
  font-weight: 800;
}

.cell-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.app-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(86vh, 840px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  box-shadow: var(--shadow-dialog);
}

.app-dialog::backdrop {
  background: rgba(4, 41, 50, 0.62);
}

.dialog-head,
.dialog-body,
.dialog-foot {
  padding: 18px 20px;
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 4px solid var(--amsa-ink);
  background: var(--surface);
}

.dialog-head h2 {
  font-size: 20px;
}

.dialog-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--amsa-ink);
  font-size: 23px;
  line-height: 1;
}

.dialog-body {
  background: var(--surface);
}

.dialog-foot {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

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

.form-control.full {
  grid-column: 1 / -1;
}

.validation-box {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.validation-box .validation-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--surface-teal);
  color: var(--amsa-green);
  font-weight: 900;
}

.validation-box.error {
  border-color: #e5bcc1;
  background: var(--surface-red);
}

.validation-box.error .validation-icon {
  background: #f5d8dc;
  color: var(--amsa-red);
}

.validation-box.warning {
  border-color: #e9d9a3;
  background: var(--surface-gold);
}

.validation-box.warning .validation-icon {
  background: #eee3b7;
  color: #7a6500;
}

.validation-box strong,
.validation-box small {
  display: block;
}

.validation-box small {
  margin-top: 3px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 39;
  width: min(360px, calc(100% - 32px));
  display: none;
  grid-template-columns: 31px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 13px 15px;
  background: var(--amsa-ink);
  color: var(--white);
  box-shadow: 0 16px 42px rgba(4, 38, 46, 0.24);
}

.toast.show {
  display: grid;
  animation: toast-in 160ms ease-out both;
}

.toast-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--amsa-gold);
  color: var(--amsa-ink);
  font-weight: 900;
}

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

.toast small {
  margin-top: 2px;
  color: #c8dadd;
}

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