:root {
  color-scheme: light;
  --paper: #f1f3f1;
  --paper-deep: #e5e8f1;
  --surface: #fafbf8;
  --surface-strong: #ffffff;
  --ink: #1b1c35;
  --ink-soft: #454866;
  --muted: #64677c;
  --line: #d9dbe5;
  --line-strong: #b7bacb;
  --rail: #141248;
  --rail-soft: #292665;
  --brand: #2016b5;
  --brand-deep: #0e0c52;
  --accent: #e98615;
  --accent-soft: #fff0da;
  --jade: #2f6d5b;
  --jade-soft: #dfeae5;
  --verm: #a44732;
  --verm-soft: #f3e1db;
  --amber: #9a681f;
  --shadow: 0 22px 70px rgba(15, 16, 66, 0.12);
  --radius: 14px;
  --sidebar: 246px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

::selection {
  background: #dcd9f6;
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

* {
  scrollbar-color: #9ca79f transparent;
  scrollbar-width: thin;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 50;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Login surface */

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 12%, rgba(32, 22, 181, 0.1), transparent 32%),
    linear-gradient(115deg, var(--paper) 0 58%, #e8e8f4 58% 100%);
}

.login-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-rings {
  position: absolute;
  right: -16vw;
  top: -22vw;
  width: 62vw;
  aspect-ratio: 1;
  border: 1px solid rgba(32, 22, 181, 0.18);
  border-radius: 50%;
}

.login-rings::before,
.login-rings::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(233, 134, 21, 0.18);
  border-radius: inherit;
  inset: 9%;
}

.login-rings::after {
  inset: 20%;
}

.login-rule {
  position: absolute;
  left: 0;
  right: 0;
  top: 68%;
  border-top: 1px solid rgba(31, 42, 37, 0.09);
}

.login-shell {
  position: relative;
  width: min(1180px, calc(100% - 64px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  gap: clamp(48px, 8vw, 120px);
  align-items: center;
  padding: 64px 0;
}

.brand-lockup,
.rail-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--verm);
  color: var(--verm);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-logo {
  display: block;
  width: min(318px, 70vw);
  height: auto;
}

.login-intro h1 {
  max-width: 10em;
  margin: 54px 0 26px;
  font-size: clamp(46px, 6vw, 82px);
  line-height: 1.08;
  letter-spacing: -0.055em;
  font-weight: 650;
  text-wrap: balance;
}

.login-intro > p {
  max-width: 58ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.login-principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 620px;
  margin: 56px 0 0;
  padding: 0;
  border-top: 1px solid var(--line-strong);
  list-style: none;
}

.login-principles li {
  position: relative;
  padding: 18px 18px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.login-principles li + li {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.login-principles span {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.login-action {
  justify-self: end;
  width: min(100%, 460px);
}

.login-card {
  position: relative;
  padding: clamp(32px, 5vw, 54px);
  background: rgba(251, 250, 245, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  top: -5px;
  right: -5px;
  background: var(--accent);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 42px;
  color: var(--jade);
  font-size: 12px;
}

.status-line i,
.system-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(47, 109, 91, 0.1);
}

.login-card h2 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.login-card > p {
  margin: 0 0 30px;
  color: var(--muted);
}

.primary-action {
  min-height: 48px;
  border: 0;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--brand-deep);
  color: #fffdf8;
  cursor: pointer;
  text-decoration: none;
  font-weight: 650;
  transition: background 160ms ease, transform 160ms ease;
}

.primary-action:hover {
  background: var(--brand);
}

.primary-action:active {
  transform: translateY(1px);
}

.primary-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.login-card .primary-action {
  width: 100%;
}

.login-footnote {
  margin-top: 32px;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

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

.login-help {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

/* Application shell */

.app-page {
  min-height: 100vh;
}

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

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  background: var(--rail);
  color: #edf3ef;
}

.rail-brand {
  padding: 0 4px 28px;
  color: inherit;
  text-decoration: none;
}

.rail-logo {
  display: block;
  width: 208px;
  max-width: 100%;
  height: auto;
}

.rail-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #b9cbc2;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

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

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 2px;
  background: var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.rail-identity {
  margin-top: auto;
  padding: 18px 8px 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbe8e1;
  color: var(--rail);
  font-weight: 700;
}

.avatar.large {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.rail-user {
  min-width: 0;
}

.rail-user strong,
.rail-user small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-user strong {
  font-size: 13px;
}

.rail-user small {
  color: #9cb4a8;
  font-size: 11px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.rail-logout {
  color: #b9cbc2;
}

.workspace {
  min-width: 0;
  padding: 32px clamp(24px, 4vw, 64px) 64px;
}

.workspace-header {
  min-height: 76px;
  padding-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-strong);
}

.page-context {
  margin: 0 0 4px;
  color: #b5680d;
  font-size: 11px;
  letter-spacing: 0.16em;
}

.workspace-header h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--jade);
  font-size: 12px;
  white-space: nowrap;
}

.system-state.is-degraded {
  color: var(--verm);
}

.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  transition: border-color 160ms ease, background 160ms ease;
}

.secondary-button:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.secondary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-button.danger {
  color: var(--verm);
  border-color: #d2aa9d;
}

.secondary-button.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.view {
  display: none;
  padding-top: 30px;
}

.view.is-active {
  display: block;
}

.identity-chain {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.2fr) minmax(160px, 0.5fr);
  gap: 32px;
  align-items: end;
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--line);
}

.chain-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.chain-lead strong {
  display: block;
  font-size: 27px;
  line-height: 1.35;
  letter-spacing: -0.03em;
}

.chain-lead > span:last-child {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.chain-track {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chain-node {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.chain-node::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  vertical-align: 1px;
}

.chain-node.is-complete {
  color: var(--jade);
}

.chain-node.is-complete::before {
  background: var(--jade);
}

.chain-node.is-active {
  color: var(--ink);
  font-weight: 650;
}

.chain-node.is-active::before {
  background: var(--verm);
  border-color: var(--verm);
}

.chain-line {
  min-width: 28px;
  flex: 1;
  border-top: 1px solid var(--line-strong);
}

.chain-foot {
  text-align: right;
}

.chain-foot span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.chain-foot code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--ink-soft);
}

.metric-ledger {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.metric-ledger > div {
  min-height: 88px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-ledger > div + div {
  border-left: 1px solid var(--line);
}

.metric-ledger span {
  color: var(--muted);
  font-size: 11px;
}

.metric-ledger strong {
  margin-top: 3px;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 28px;
  margin-top: 28px;
}

.sheet {
  min-width: 0;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.sheet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.sheet-heading h2 {
  margin: 0 0 4px;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.sheet-heading p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.count-chip,
.format-chip {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.app-ledger {
  border-top: 1px solid var(--line);
}

.app-row {
  min-height: 82px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 20px;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 160ms ease, padding 160ms ease;
}

.app-row:hover {
  background: var(--surface-strong);
  padding: 0 12px;
}

.app-index {
  color: var(--line-strong);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.app-copy strong {
  display: block;
  font-size: 15px;
}

.app-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.app-arrow {
  color: var(--muted);
  transition: transform 160ms ease;
}

.app-row:hover .app-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.app-row.is-pending {
  color: var(--muted);
  background: rgba(86, 100, 93, 0.025);
  cursor: default;
}

.app-row.is-pending:hover {
  padding: 0;
  background: rgba(86, 100, 93, 0.045);
}

.app-row.is-pending .app-copy strong {
  color: var(--ink-soft);
}

.app-code {
  color: var(--jade);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.activity-list li {
  padding: 14px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.activity-list time,
.activity-list small {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.activity-list strong {
  display: block;
  font-size: 12px;
}

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

.skeleton-row {
  height: 76px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, transparent, rgba(47, 109, 91, 0.045), transparent);
  background-size: 240px 100%;
  animation: sweep 1.2s linear infinite;
}

@keyframes sweep {
  from { background-position: -240px 0; }
  to { background-position: calc(100% + 240px) 0; }
}

/* Tables */

.table-heading {
  align-items: center;
}

.search-field {
  min-width: min(320px, 100%);
  min-height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
}

.search-field svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  padding: 11px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(47, 109, 91, 0.035);
}

.person-cell strong,
.person-cell span {
  display: block;
}

.person-cell span {
  color: var(--muted);
  font-size: 11px;
}

.app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.app-tag,
.state-tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid #c9d8d1;
  color: #2b5f50;
  background: #edf4f0;
  font-size: 11px;
  white-space: nowrap;
}

.state-tag.is-disabled {
  border-color: #e0c6bd;
  color: var(--verm);
  background: var(--verm-soft);
}

.row-action {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--jade);
  cursor: pointer;
  font-size: 12px;
}

.row-action:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.loading-cell {
  height: 150px;
  color: var(--muted);
  text-align: center;
}

/* Import */

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 28px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  font-size: 12px;
  font-weight: 600;
}

.field input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
}

.drop-zone {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(31, 42, 37, 0.04) 50%, transparent 50.2%),
    var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--jade);
  background: #f4f8f5;
}

.drop-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-zone svg {
  width: 28px;
  height: 28px;
  color: var(--jade);
}

.drop-zone strong {
  color: var(--ink);
  font-size: 14px;
}

.drop-zone span {
  font-size: 11px;
}

.import-form .primary-action {
  justify-self: start;
}

.preview-result {
  margin-top: 22px;
  padding: 20px;
  border-top: 2px solid var(--jade);
  background: #f5f8f5;
}

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

.preview-grid div {
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.preview-grid div:last-child {
  border-right: 0;
}

.preview-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.preview-grid strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.preview-footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.preview-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.import-errors {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--verm);
  font-size: 11px;
}

.import-errors p {
  margin: 4px 0 0;
}

.history-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.history-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.history-item strong {
  font-size: 12px;
}

.history-item time,
.history-item p {
  color: var(--muted);
  font-size: 11px;
}

.history-item p {
  margin: 4px 0 0;
}

/* Dialog */

.side-dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px 16px 16px auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: -24px 0 80px rgba(24, 42, 34, 0.16);
}

.side-dialog::backdrop {
  background: rgba(20, 30, 25, 0.32);
  backdrop-filter: blur(2px);
}

.dialog-frame {
  padding: 28px;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.dialog-heading h2 {
  margin: 2px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.dialog-kicker {
  color: var(--verm);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.dialog-heading .icon-button:hover {
  background: var(--paper);
}

.dialog-identity {
  padding: 22px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.dialog-identity strong,
.dialog-identity span {
  display: block;
}

.dialog-identity span {
  color: var(--muted);
  font-size: 11px;
}

.app-options {
  margin: 24px 0;
  padding: 0;
  border: 0;
}

.app-options legend {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
}

.app-check {
  min-height: 58px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.app-check:last-child {
  border-bottom: 1px solid var(--line);
}

.app-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--jade);
}

.app-check strong,
.app-check span {
  display: block;
}

.app-check strong {
  font-size: 13px;
}

.app-check span {
  color: var(--muted);
  font-size: 11px;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.dialog-actions .secondary-button {
  flex: 1;
  min-height: 38px;
  padding: 0 10px;
  font-size: 11px;
}

.dialog-submit {
  padding-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
}

/* Toasts */

.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 260px;
  max-width: 420px;
  padding: 13px 15px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(31, 42, 37, 0.18);
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  background: var(--verm);
}

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

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

  .login-intro h1 {
    max-width: 12em;
    font-size: clamp(42px, 9vw, 68px);
  }

  .login-action {
    justify-self: stretch;
    width: 100%;
  }

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

  .side-rail {
    position: static;
    height: auto;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
  }

  .rail-brand {
    padding: 0;
  }

  .rail-logo {
    width: 154px;
  }

  .rail-nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .rail-identity {
    margin: 0;
    padding: 0;
    border: 0;
    grid-template-columns: 36px;
  }

  .rail-user {
    display: none;
  }

  .rail-logout {
    display: none;
  }

  .dashboard-layout,
  .import-layout {
    grid-template-columns: 1fr;
  }

  .identity-chain {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .chain-foot {
    text-align: left;
  }
}

@media (max-width: 680px) {
  .login-page {
    background: var(--paper);
  }

  .login-shell {
    width: min(100% - 32px, 520px);
    padding: 28px 0;
  }

  .brand-logo {
    width: min(260px, 82vw);
  }

  .login-intro h1 {
    margin-top: 36px;
    font-size: 43px;
  }

  .login-principles {
    display: none;
  }

  .login-card {
    padding: 30px 24px;
  }

  .workspace {
    padding: 22px 16px 44px;
  }

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

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

  .metric-ledger {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-ledger > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .metric-ledger > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .sheet {
    padding: 20px 16px;
  }

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

  .search-field {
    width: 100%;
  }

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

  .preview-grid div {
    border-right: 0;
  }

  .preview-footer,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .side-dialog {
    width: calc(100vw - 16px);
    margin: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
