:root {
  --ink: #25122a;
  --ink-soft: #684d68;
  --magenta: #9f0a8b;
  --magenta-deep: #750465;
  --magenta-soft: #fbe8f8;
  --orange: #ef8b18;
  --orange-deep: #c96d08;
  --orange-soft: #fff0dc;
  --violet-soft: #f4ebff;
  --blue: #264f8d;
  --blue-deep: #16325d;
  --surface: #fffaff;
  --surface-soft: #fff5fc;
  --page: #fcf7fb;
  --line: #ead8e8;
  --success: #197a4b;
  --success-soft: #e8f8ef;
  --warning: #a55013;
  --danger: #b41f4f;
  --danger-soft: #fff0f5;
  --shadow: 0 18px 42px rgb(68 17 61 / 0.11);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

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

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

button,
input,
select {
  font: inherit;
}

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

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

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

.eyebrow {
  margin: 0 0 10px;
  color: rgb(255 255 255 / 0.82);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-magenta {
  color: var(--magenta);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.68rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 760;
  line-height: 1.15;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button:active,
.text-button:active,
.table-button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.text-button:focus-visible,
.table-button:focus-visible,
.portal-link:focus-visible,
.nav-admin-link:focus-visible,
.dashboard-callout:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgb(239 139 24 / 0.42);
  outline-offset: 3px;
}

.button-primary {
  color: #fffdfd;
  background: var(--magenta);
  box-shadow: 0 8px 18px rgb(159 10 139 / 0.22);
}

.button-primary:hover {
  background: var(--magenta-deep);
  box-shadow: 0 11px 22px rgb(159 10 139 / 0.28);
}

.button-secondary {
  color: var(--magenta-deep);
  background: var(--surface);
  border-color: #d9bdd5;
}

.button-secondary:hover {
  border-color: var(--magenta);
  background: var(--magenta-soft);
}

/* Public portal */
.portal-hero {
  position: relative;
  isolation: isolate;
  min-height: 430px;
  overflow: hidden;
  color: #fffdfd;
  background: var(--blue-deep);
}

.hero-image,
.hero-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image {
  z-index: -2;
  object-fit: cover;
  object-position: center 56%;
}

.hero-scrim {
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(18 29 61 / 0.92) 0%, rgb(31 26 71 / 0.74) 48%, rgb(25 17 55 / 0.36) 100%),
    linear-gradient(180deg, rgb(27 21 78 / 0.25), rgb(27 21 78 / 0.72));
}

.portal-nav,
.hero-content,
.portal-main,
.site-footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.portal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding-block: 14px;
}

.brand-lockup {
  display: block;
  width: min(310px, 54vw);
}

.brand-lockup img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 16px rgb(0 0 0 / 0.22));
}

.nav-admin-link {
  padding: 0.55rem 0.82rem;
  border: 1px solid rgb(255 255 255 / 0.5);
  border-radius: var(--radius-sm);
  color: #fffdfd;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.nav-admin-link:hover {
  border-color: #fffdfd;
  background: rgb(255 255 255 / 0.14);
}

.hero-content {
  max-width: 760px;
  padding: 80px 0 86px;
}

.hero-content h1,
.login-panel h1,
.admin-intro h1,
.dashboard-head h1 {
  margin: 0;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero-content h1 {
  max-width: 660px;
  font-size: clamp(2.35rem, 5vw, 4.55rem);
}

.hero-content > p:last-child {
  max-width: 600px;
  margin: 20px 0 0;
  color: rgb(255 255 255 / 0.91);
  font-size: clamp(1rem, 2vw, 1.14rem);
}

.portal-main {
  padding: 66px 0 32px;
}

.section-heading,
.admin-intro,
.dashboard-head,
.table-heading {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
}

.section-heading h2,
.admin-intro h1,
.dashboard-head h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.65rem);
}

.section-heading h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.section-note {
  max-width: 210px;
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: right;
}

.link-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.portal-link {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 25px rgb(78 31 77 / 0.06);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.portal-link:hover {
  transform: translateY(-2px);
  border-color: rgb(159 10 139 / 0.42);
  box-shadow: var(--shadow);
}

.portal-link:nth-child(3n + 2) .link-initials {
  color: var(--orange-deep);
  background: var(--orange-soft);
}

.portal-link:nth-child(3n) .link-initials {
  color: #5c2c91;
  background: var(--violet-soft);
}

.link-initials {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--magenta-deep);
  background: var(--magenta-soft);
  font-size: 0.82rem;
  font-weight: 840;
}

.link-copy {
  min-width: 0;
}

.link-copy strong,
.link-copy small {
  display: block;
}

.link-copy strong {
  font-size: 1rem;
}

.link-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-arrow {
  color: var(--magenta);
  font-size: 0.85rem;
  font-weight: 760;
}

.empty-state {
  margin-top: 28px;
  padding: 48px 24px;
  border: 1px dashed #d4b2ce;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-align: center;
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
}

.empty-state p {
  margin: 8px 0 0;
}

.portal-information {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-top: 38px;
  padding: 26px 28px;
  border-radius: var(--radius);
  color: #fffdfd;
  background: linear-gradient(110deg, var(--magenta-deep), var(--magenta));
}

.portal-information strong,
.portal-information p,
.dashboard-callout span,
.dashboard-callout small {
  display: block;
}

.portal-information p {
  max-width: 640px;
  margin: 5px 0 0;
  color: rgb(255 255 255 / 0.86);
  font-size: 0.91rem;
}

.dashboard-callout {
  flex: 0 0 auto;
  min-width: 178px;
  padding: 13px 15px;
  border: 1px solid rgb(255 255 255 / 0.48);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.08);
  color: #fffdfd;
  text-decoration: none;
  transition: background-color 160ms ease;
}

.dashboard-callout:hover {
  background: rgb(255 255 255 / 0.18);
}

.dashboard-callout small {
  margin-top: 2px;
  color: rgb(255 255 255 / 0.78);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 34px;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.site-footer p {
  margin: 0;
}

/* Login and administration */
.admin-page {
  overflow-x: hidden;
  background: #f8f4f8;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  min-height: 100dvh;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
  padding: 54px clamp(28px, 6vw, 88px);
  margin-inline: auto;
}

.login-brand {
  display: block;
  width: min(310px, 100%);
  margin-bottom: 56px;
}

.text-brand {
  display: grid;
  gap: 3px;
  color: var(--magenta-deep);
  line-height: 1.15;
  text-decoration: none;
}

.text-brand span {
  font-size: 0.8rem;
  font-weight: 760;
}

.text-brand strong {
  color: var(--ink);
  font-size: 1.06rem;
  letter-spacing: -0.03em;
}

.login-panel h1 {
  max-width: 410px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.login-panel > p:not(.eyebrow):not(.demo-notice) {
  margin: 14px 0 0;
  color: var(--ink-soft);
}

.stack-form {
  display: grid;
  gap: 18px;
  margin-top: 34px;
}

.stack-form label,
.link-editor label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 720;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.72rem;
  border: 1px solid #d9c6d8;
  border-radius: 9px;
  color: var(--ink);
  background: #fffdfd;
}

input::placeholder {
  color: #927d91;
}

input:hover,
select:hover {
  border-color: #bd8bb5;
}

.form-error {
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 0.87rem;
}

.demo-notice {
  margin: 21px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.login-image {
  position: relative;
  overflow: hidden;
  background: var(--blue-deep);
}

.login-image::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(135deg, rgb(85 0 80 / 0.52), rgb(20 36 83 / 0.44));
}

.login-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-shell {
  min-height: 100dvh;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 75px;
  padding: 10px max(24px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.admin-brand {
  width: min(230px, 46vw);
}

.admin-header nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

.admin-header nav a,
.text-button {
  color: var(--magenta-deep);
  font-size: 0.92rem;
  font-weight: 750;
  text-decoration: none;
}

.text-button {
  padding: 0;
  border: 0;
  cursor: pointer;
  background: transparent;
}

.admin-content {
  width: min(1200px, calc(100% - 48px));
  padding: 58px 0;
  margin-inline: auto;
}

.admin-intro {
  margin-bottom: 32px;
}

.admin-intro h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.admin-intro p:not(.eyebrow) {
  max-width: 560px;
  margin: 12px 0 0;
  color: var(--ink-soft);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.45fr);
  gap: 24px;
  align-items: start;
}

.link-editor,
.link-table-section {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 26px rgb(68 17 61 / 0.05);
}

.link-editor {
  display: grid;
  gap: 17px;
}

.link-editor h2,
.link-table-section h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.switch-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px !important;
}

.switch-row input {
  width: 18px;
  min-height: auto;
  height: 18px;
  accent-color: var(--magenta);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-heading {
  align-items: center;
  margin-bottom: 16px;
}

.count-label {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid #f0e3ef;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

td strong,
td small {
  display: block;
}

td strong {
  font-size: 0.91rem;
}

td small {
  max-width: 265px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-cell {
  width: 100px;
}

.order-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.order-actions button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #ddc7da;
  border-radius: 6px;
  cursor: pointer;
  color: var(--magenta-deep);
  background: #fffdfd;
}

.order-actions button:disabled {
  cursor: default;
  opacity: 0.34;
}

.order-actions span {
  min-width: 14px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-align: center;
}

.status {
  display: inline-flex;
  padding: 0.32rem 0.5rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 780;
  white-space: nowrap;
}

.status-active {
  color: var(--success);
  background: var(--success-soft);
}

.status-inactive {
  color: var(--ink-soft);
  background: #f2edf2;
}

.row-actions {
  white-space: nowrap;
}

.table-button {
  padding: 0;
  border: 0;
  cursor: pointer;
  color: var(--magenta-deep);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 760;
}

.table-button + .table-button {
  margin-left: 11px;
}

.table-button-danger {
  color: var(--danger);
}

/* Dashboard */
.dashboard-page {
  background: #f7f7fb;
}

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

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  padding: 25px 18px;
  color: #fffdfd;
  background: linear-gradient(180deg, var(--magenta-deep), #9c167e 68%, #8a146f);
}

.dashboard-sidebar .admin-brand {
  width: 100%;
  padding: 7px 2px 28px;
}

.dashboard-sidebar .text-brand {
  color: rgb(255 255 255 / 0.75);
}

.dashboard-sidebar .text-brand strong {
  color: #fffdfd;
  font-size: 1rem;
}

.sidebar-label {
  margin: 0 0 9px;
  color: rgb(255 255 255 / 0.72);
  font-size: 0.7rem;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav a {
  padding: 0.74rem 0.75rem;
  border-radius: 9px;
  color: rgb(255 255 255 / 0.83);
  font-size: 0.91rem;
  font-weight: 660;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a[aria-current="page"] {
  color: #fffdfd;
  background: rgb(255 255 255 / 0.17);
}

.sidebar-info {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.09);
}

.sidebar-info strong,
.sidebar-info small {
  display: block;
}

.sidebar-info strong {
  font-size: 0.86rem;
}

.sidebar-info small {
  margin-top: 5px;
  color: rgb(255 255 255 / 0.76);
  font-size: 0.77rem;
}

.dashboard-main {
  min-width: 0;
  padding: 34px clamp(22px, 4vw, 54px) 50px;
}

.dashboard-head {
  align-items: center;
}

.dashboard-head h1 {
  font-size: clamp(1.9rem, 3.2vw, 2.85rem);
}

.dashboard-head p {
  margin: 7px 0 0;
  color: var(--ink-soft);
}

.dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-filters label {
  display: grid;
  gap: 5px;
  min-width: 144px;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 760;
}

.dashboard-filters select {
  min-height: 40px;
  padding: 0.45rem 0.58rem;
  color: var(--ink);
  font-size: 0.88rem;
}

.dashboard-demo-notice {
  margin: 26px 0 0;
  padding: 10px 13px;
  border: 1px solid #f3d6ad;
  border-radius: 9px;
  color: var(--warning);
  background: #fff8ec;
  font-size: 0.86rem;
}

.dashboard-demo-notice[data-state="live"] {
  border-color: #bfe1ca;
  color: #236842;
  background: #f0faf3;
}

.dashboard-demo-notice[data-state="error"] {
  border-color: #efc8d5;
  color: #9a214f;
  background: #fff3f6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.metric-card,
.dashboard-panel {
  border: 1px solid #e5e2ed;
  border-radius: 13px;
  background: #fffdfd;
  box-shadow: 0 9px 22px rgb(51 38 83 / 0.045);
}

.metric-card {
  min-height: 198px;
  padding: 18px;
}

.metric-card.is-unavailable {
  background: #fbfafc;
}

.metric-card.is-unavailable .metric-value {
  color: #9b90a0;
}

.metric-card-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.metric-number {
  display: grid;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 8px;
  color: #fffdfd;
  background: var(--magenta);
  font-size: 0.82rem;
  font-weight: 820;
}

.metric-card:nth-child(2) .metric-number {
  background: #6b3c9f;
}

.metric-card:nth-child(3) .metric-number {
  background: #c3266b;
}

.metric-card:nth-child(4) .metric-number {
  background: var(--orange);
}

.metric-card h2 {
  margin: 0;
  font-size: 0.97rem;
}

.metric-card p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.metric-value {
  margin-top: 20px;
  font-size: clamp(1.85rem, 2.7vw, 2.35rem);
  font-weight: 820;
  letter-spacing: -0.06em;
  line-height: 1;
}

.metric-unit {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.metric-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 18px;
}

.metric-meta div {
  padding-top: 8px;
  border-top: 1px solid #eee8f1;
}

.metric-meta span,
.metric-meta strong {
  display: block;
}

.metric-meta span {
  color: var(--ink-soft);
  font-size: 0.69rem;
}

.metric-meta strong {
  margin-top: 2px;
  font-size: 0.84rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(320px, 0.76fr);
  gap: 16px;
  margin-top: 17px;
}

.dashboard-panel {
  padding: 20px;
}

.dashboard-panel h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.panel-description {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.chart-wrap {
  width: 100%;
  min-height: 290px;
  margin-top: 12px;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.dashboard-empty-state {
  display: grid;
  min-height: 252px;
  place-items: center;
  border: 1px dashed #dcd2df;
  border-radius: 10px;
  color: var(--ink-soft);
  background: #fbf9fc;
  text-align: center;
  font-size: 0.84rem;
}

.chart-axis-label {
  fill: #745f76;
  font-size: 11px;
}

.chart-grid-line {
  stroke: #eee7f0;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 2.6;
}

.chart-point {
  stroke: #fffdfd;
  stroke-width: 2;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.chart-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.summary-table {
  width: 100%;
  min-width: 0;
  margin-top: 12px;
}

.summary-table th,
.summary-table td {
  padding: 10px 5px;
}

.summary-table th {
  font-size: 0.68rem;
}

.summary-table td {
  font-size: 0.81rem;
}

.summary-table td:first-child {
  min-width: 120px;
  font-weight: 720;
}

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

.summary-average td {
  color: var(--magenta-deep);
  font-weight: 820;
}

.summary-empty {
  padding: 28px 8px !important;
  color: var(--ink-soft);
  text-align: center;
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(290px, 0.75fr);
  gap: 16px;
  margin-top: 16px;
}

.dashboard-bottom ul {
  padding-left: 18px;
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.dashboard-bottom li + li {
  margin-top: 6px;
}

.source-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.source-list div {
  padding: 10px;
  border-radius: 8px;
  background: #f9f5fa;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.source-list strong {
  color: var(--ink);
}

/* Responsive */
@media (max-width: 1050px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .login-image {
    display: none;
  }

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

  .dashboard-sidebar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 16px 20px;
  }

  .dashboard-sidebar .admin-brand {
    width: min(205px, 55vw);
    padding: 0;
  }

  .sidebar-label,
  .sidebar-info {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 5px;
  }

  .sidebar-nav a {
    padding: 0.5rem 0.58rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 660px) {
  .portal-nav,
  .hero-content,
  .portal-main,
  .site-footer {
    width: min(100% - 32px, 1120px);
  }

  .portal-hero {
    min-height: 410px;
  }

  .portal-nav {
    min-height: 69px;
  }

  .brand-lockup {
    width: 205px;
  }

  .nav-admin-link {
    padding: 0.45rem 0.58rem;
    font-size: 0.78rem;
  }

  .hero-content {
    padding: 73px 0 58px;
  }

  .portal-main {
    padding-top: 42px;
  }

  .section-heading,
  .admin-intro,
  .dashboard-head {
    display: block;
  }

  .section-note {
    max-width: none;
    margin-top: 9px;
    text-align: left;
  }

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

  .portal-information {
    display: grid;
    gap: 18px;
    padding: 22px;
  }

  .dashboard-callout {
    width: 100%;
  }

  .site-footer {
    display: grid;
    gap: 5px;
  }

  .login-panel {
    padding: 42px 24px;
  }

  .login-brand {
    margin-bottom: 42px;
  }

  .admin-header {
    gap: 12px;
    align-items: flex-start;
    padding: 10px 16px;
  }

  .admin-header .admin-brand {
    width: auto;
    max-width: 158px;
  }

  .admin-header nav {
    gap: 12px;
    padding-top: 4px;
    white-space: nowrap;
  }

  .admin-header nav a,
  .admin-header .text-button {
    font-size: 0.82rem;
  }

  .admin-content {
    width: min(100% - 32px, 1200px);
    padding: 39px 0;
  }

  .admin-intro .button {
    width: 100%;
    margin-top: 20px;
  }

  .link-editor,
  .link-table-section {
    padding: 18px;
  }

  .admin-grid {
    gap: 18px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .link-table-section .table-wrap {
    overflow: visible;
  }

  .link-table-section table {
    display: block;
    min-width: 0;
  }

  .link-table-section thead {
    display: none;
  }

  .link-table-section tbody {
    display: grid;
    gap: 12px;
  }

  .link-table-section tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }

  .link-table-section td {
    padding: 0;
    border: 0;
  }

  .link-table-section td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .link-table-section td.order-cell {
    grid-column: 1;
    grid-row: 2;
    width: auto;
  }

  .link-table-section td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .link-table-section td.row-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    grid-row: 3;
    padding-top: 12px;
    border-top: 1px solid #f0e3ef;
  }

  .link-table-section .order-actions button {
    width: 34px;
    height: 34px;
  }

  .link-table-section .table-button {
    min-height: 40px;
    padding: 0.62rem 0.55rem;
    border: 1px solid #dfc7db;
    border-radius: 8px;
    background: #fffdfd;
    text-align: center;
  }

  .link-table-section .table-button-danger {
    border-color: #efc8d5;
    background: var(--danger-soft);
  }

  .link-table-section .table-button + .table-button {
    margin-left: 0;
  }

  .dashboard-main {
    padding: 25px 16px 36px;
  }

  .dashboard-filters {
    margin-top: 18px;
  }

  .dashboard-filters label {
    flex: 1 1 145px;
  }

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

  .metric-card {
    min-height: 176px;
  }

  .dashboard-sidebar {
    display: block;
    padding: 15px 16px;
  }

  .dashboard-sidebar .admin-brand {
    margin-bottom: 10px;
  }

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

  .sidebar-nav a {
    flex: 0 0 auto;
  }
}

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