:root {
    color-scheme: light;
    --portal-ink: #182129;
    --portal-muted: #5b6670;
    --portal-line: #d8dee3;
    --portal-line-strong: #b8c3cc;
    --portal-surface: #ffffff;
    --portal-background: #f4f6f7;
    --portal-sidebar: #eef2f3;
    --portal-accent: #17647a;
    --portal-accent-dark: #104a5b;
    --portal-green: #176b45;
    --portal-green-bg: #e7f5ed;
    --portal-amber: #805b13;
    --portal-amber-bg: #fff3d6;
    --portal-red: #9b2c2c;
    --portal-red-bg: #fdecec;
    font-family: "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--portal-ink);
    background: var(--portal-background);
}

a {
    color: var(--portal-accent);
}

.portal-header {
    border-bottom: 1px solid var(--portal-line);
    background: var(--portal-surface);
}

.portal-header-inner,
.portal-shell,
.portal-footer {
    width: min(1440px, 100%);
    margin: 0 auto;
}

.portal-header-inner {
    min-height: 3.75rem;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.portal-name {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--portal-ink);
    font-size: 1.02rem;
    font-weight: 700;
    text-decoration: none;
}

.portal-mark {
    width: 2rem;
    height: 2rem;
    display: inline-grid;
    place-items: center;
    border-radius: 0.25rem;
    color: #fff;
    background: var(--portal-accent);
    font-weight: 750;
}

.session-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--portal-muted);
    font-size: 0.88rem;
}

.session-controls form {
    margin: 0;
}

.portal-shell {
    min-height: calc(100vh - 7.25rem);
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
}

.portal-sidebar {
    padding: 1.25rem 1rem;
    border-right: 1px solid var(--portal-line);
    background: var(--portal-sidebar);
}

.portal-sidebar nav {
    display: grid;
    gap: 0.25rem;
}

.portal-sidebar nav a {
    min-height: 2.5rem;
    padding: 0.6rem 0.7rem;
    display: flex;
    align-items: center;
    border-radius: 0.25rem;
    color: var(--portal-ink);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
}

.portal-sidebar nav a:hover {
    background: #dde6e9;
}

.sidebar-navigation-group > summary {
    min-height: 2.5rem;
    padding: 0.6rem 0.7rem;
    display: flex;
    align-items: center;
    border-radius: 0.25rem;
    color: var(--portal-ink);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.sidebar-navigation-group > summary::-webkit-details-marker {
    display: none;
}

.sidebar-navigation-group > summary::after {
    margin-left: auto;
    content: "\203A";
    font-size: 1.2rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 120ms ease-in-out;
}

.sidebar-navigation-group[open] > summary::after {
    transform: rotate(90deg);
}

.sidebar-navigation-group > summary:hover {
    background: #dde6e9;
}

.sidebar-navigation-subpages {
    margin: 0.15rem 0 0.25rem 0.7rem;
    padding-left: 0.45rem;
    border-left: 2px solid var(--portal-line-strong);
    display: grid;
    gap: 0.15rem;
}

.portal-sidebar nav .sidebar-navigation-subpages a {
    min-height: 2.2rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.86rem;
}

.sidebar-state {
    margin-top: 2rem;
    padding: 0.8rem 0.7rem;
    border-top: 1px solid var(--portal-line-strong);
    display: grid;
    gap: 0.2rem;
    color: var(--portal-muted);
    font-size: 0.78rem;
}

.sidebar-state strong {
    color: var(--portal-green);
    font-size: 0.9rem;
}

.portal-main {
    min-width: 0;
    padding: 1.75rem 2rem 3rem;
    background: var(--portal-surface);
}

.portal-main-auth {
    width: min(1080px, calc(100% - 2rem));
    min-height: calc(100vh - 7.25rem);
    margin: 0 auto;
}

.portal-footer {
    padding: 0.9rem 1.25rem 1.25rem;
    border-top: 1px solid var(--portal-line);
    color: var(--portal-muted);
    background: var(--portal-surface);
    font-size: 0.78rem;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.35rem;
    font-size: 1.55rem;
    font-weight: 700;
}

h2 {
    margin-bottom: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

p {
    color: var(--portal-muted);
}

.page-heading,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.page-heading {
    min-height: 4.2rem;
    margin-bottom: 1.25rem;
}

/* The right-hand column of a page heading, so links can sit under the status badge rather
   than beside it. */
.heading-status {
    display: grid;
    justify-items: end;
    gap: 0.4rem;
}

/* Stripe Dashboard links, given their own row beneath whatever Portal actions precede them.
   A block container rather than inline buttons, so "below" does not depend on wrapping. */
.dashboard-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.heading-actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.form-actions-open {
    border-top: 0;
    padding-top: 0;
}

.command-form {
    max-width: 760px;
    display: grid;
    justify-items: start;
    gap: 0.8rem;
}

.check-row {
    display: grid;
    grid-template-columns: 1.15rem minmax(0, 1fr);
    align-items: start;
    gap: 0.55rem;
}

.check-row input {
    width: 1rem;
    height: 1rem;
    margin-top: 0.1rem;
}

.registration-target-card {
  border: 1px solid var(--border-color, #d6dce5);
  border-radius: 0.5rem;
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
}

.registration-actions,
.registration-actions form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.registration-actions form {
  border-top: 1px solid var(--border-color, #d6dce5);
  padding-top: 0.75rem;
  width: 100%;
}

.registration-actions label {
  display: grid;
  gap: 0.25rem;
  min-width: min(100%, 15rem);
}

.key-text {
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
  width: 100%;
}

.sensitive-panel code {
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .registration-actions,
  .registration-actions form,
  .registration-actions label,
  .registration-actions input,
  .registration-actions select,
  .registration-actions button {
    width: 100%;
  }
}

.role-selection {
    margin: 0 0 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--portal-line);
    border-radius: 0.25rem;
}

.role-selection legend {
    padding: 0 0.25rem;
    color: #34414b;
    font-size: 0.82rem;
    font-weight: 700;
}

.role-selection .check-row {
    width: 100%;
    margin-bottom: 0.55rem;
}

.role-selection .check-row:last-child {
    margin-bottom: 0;
}

.invitation-output {
    margin-top: 1rem;
    max-width: 980px;
    padding: 0.9rem;
    border-left: 3px solid var(--portal-green);
    background: var(--portal-green-bg);
}

.copy-line {
    margin: 0.35rem 0 0.55rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

.compact-note,
.invitation-output p {
    margin: 0.55rem 0 0;
    font-size: 0.82rem;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.breadcrumb-line {
    margin-bottom: 0.25rem;
    color: var(--portal-muted);
    font-size: 0.78rem;
}

.page-subtitle {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.mode-chip,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--portal-line-strong);
    border-radius: 0.2rem;
    color: var(--portal-muted);
    background: #f8fafb;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-ready {
    border-color: #9ed1b8;
    color: var(--portal-green);
    background: var(--portal-green-bg);
}

.status-review,
.status-draft {
    border-color: #e0c47e;
    color: var(--portal-amber);
    background: var(--portal-amber-bg);
}

.status-blocked {
    border-color: #e0a6a6;
    color: var(--portal-red);
    background: var(--portal-red-bg);
}

.status-muted {
    color: var(--portal-muted);
    background: #edf0f2;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.metric-card {
    min-height: 5.75rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--portal-line);
    border-radius: 0.35rem;
    display: grid;
    align-content: space-between;
    background: #fafbfb;
}

.metric-card span {
    color: var(--portal-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.metric-card strong {
    font-size: 1.65rem;
    font-weight: 700;
}

.dashboard-section,
.source-section,
.form-section,
.detail-band {
    padding: 1.25rem 0;
    border-top: 1px solid var(--portal-line);
}

.dashboard-section .section-heading,
.source-section .section-heading,
.form-section .section-heading,
.detail-band .section-heading {
    margin-bottom: 0.9rem;
}

.source-search,
.list-toolbar {
    display: grid;
    gap: 0.4rem;
    max-width: 860px;
}

.list-toolbar {
    margin-bottom: 1.1rem;
}

.merchant-selector {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.merchant-selector fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.9rem;
    border: 1px solid var(--portal-line);
}

.merchant-selector fieldset[disabled] {
    opacity: 0.55;
}

.merchant-selector > .button-primary {
    justify-self: start;
}

.snapshot-summary {
    color: var(--portal-muted);
    font-size: 0.86rem;
}

.search-command {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

.address-command {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.event-inbox-filter-grid {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filter-command {
    margin-top: 0.35rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.pager {
    margin-top: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.pager-actions {
    display: flex;
    gap: 0.5rem;
}

.pager-summary {
    margin: 0.25rem 0;
    color: var(--portal-muted);
    font-size: 0.86rem;
    font-weight: 650;
}

.source-results {
    margin-top: 1rem;
}

.selected-source-line,
.status-message,
.empty-state {
    margin: 0.75rem 0;
    padding: 0.75rem 0.85rem;
    border-left: 3px solid var(--portal-accent);
    color: var(--portal-muted);
    background: #f1f7f9;
    font-size: 0.86rem;
}

.merchant-form {
    max-width: 1120px;
}

.form-grid {
    max-width: 1120px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.field-group {
    min-width: 0;
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

.form-span-two {
    grid-column: span 2;
}

.inline-form {
    display: inline;
    margin: 0;
}

.field-grid {
    display: grid;
    gap: 0 1rem;
}

.field-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-span-two {
    grid-column: span 2;
}

.field-row {
    min-width: 0;
    display: grid;
    gap: 0.35rem;
    margin: 0 0 0.9rem;
}

.field-row-inline {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.form-actions {
    padding-top: 1.1rem;
    border-top: 1px solid var(--portal-line);
}

label {
    color: #34414b;
    font-size: 0.82rem;
    font-weight: 650;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 2.45rem;
    padding: 0.52rem 0.62rem;
    border: 1px solid #9eabb5;
    border-radius: 0.22rem;
    color: var(--portal-ink);
    background: #fff;
    font: inherit;
    font-size: 0.9rem;
}

textarea {
    min-height: 6rem;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
    outline: 3px solid rgba(23, 100, 122, 0.24);
    outline-offset: 2px;
}

.button-primary,
.button-secondary {
    min-height: 2.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: 0.22rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.button-primary {
    border: 1px solid var(--portal-accent-dark);
    color: #fff;
    background: var(--portal-accent);
}

.button-primary:hover {
    color: #fff;
    background: var(--portal-accent-dark);
}

.button-secondary {
    border: 1px solid var(--portal-line-strong);
    color: var(--portal-ink);
    background: #fff;
}

.button-secondary:hover {
    color: var(--portal-ink);
    background: #edf2f4;
}

.button-small {
    min-height: 2rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
}

.button-link {
    padding: 0;
    border: 0;
    color: var(--portal-accent);
    background: transparent;
    text-decoration: underline;
}

.inline-command {
    margin: 0;
    white-space: nowrap;
}

.table-secondary {
    color: var(--portal-muted);
    font-size: 0.76rem;
}

.requirement-details {
    margin-top: 0.4rem;
    max-width: 28rem;
}

.requirement-details summary {
    color: var(--portal-accent);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.requirement-details ul {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
}

.requirement-details li {
    margin-bottom: 0.5rem;
}

.requirement-details li > span {
    color: var(--portal-muted);
    display: block;
    font-size: 0.76rem;
    overflow-wrap: anywhere;
}

.requirement-details .requirement-error {
    color: var(--portal-red);
}

.mono-value {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.78rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--portal-line);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

th,
td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--portal-line);
    text-align: left;
    vertical-align: top;
}

th {
    color: #46535d;
    background: #f2f5f6;
    font-size: 0.73rem;
    font-weight: 750;
    text-transform: uppercase;
}

td span {
    color: var(--portal-muted);
    font-size: 0.78rem;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: #fafcfc;
}

.empty-cell {
    padding: 1.5rem;
    color: var(--portal-muted);
    text-align: center;
}

.detail-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.detail-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid div {
    min-width: 0;
}

.detail-grid dt {
    margin-bottom: 0.2rem;
    color: var(--portal-muted);
    font-size: 0.74rem;
    font-weight: 650;
}

.detail-grid dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
}

.detail-span-two {
    grid-column: span 2;
}

.preserve-lines {
    white-space: pre-wrap;
}

.preserve-spaces {
    white-space: pre-wrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.merchant-subnav {
    margin: -0.45rem 0 1.25rem;
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--portal-line);
}

.merchant-subnav a {
    padding: 0.65rem 0.8rem;
    border-bottom: 3px solid transparent;
    color: var(--portal-muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.merchant-subnav a:hover {
    color: var(--portal-ink);
    background: #f8fafb;
}

.merchant-subnav a.active {
    border-bottom-color: var(--portal-accent);
    color: var(--portal-accent-dark);
}

.terminal-location-list .table-wrap {
    max-height: 70vh;
}

.terminal-location-list table {
    min-width: 1500px;
}

.terminal-account-id {
    display: block;
    max-width: 13rem;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}

.terminal-address-cell {
    min-width: 15rem;
    max-width: 22rem;
}

/* Locations listed beneath the Stripe LIVE account they belong to. The rule is indented and
   shares the account row's cell, so the two column sets stay independent. */
.stripe-live-location-row > td {
    padding-top: 0;
}

.stripe-live-locations {
    margin-left: 2rem;
    padding-left: 1rem;
    border-left: 3px solid var(--portal-line-strong);
}

.stripe-live-locations > table {
    width: 100%;
}

.stripe-live-locations > p {
    margin: 0.25rem 0;
}

/* Brief confirmation that a link was copied. Fixed so it is visible wherever the account list is
   scrolled to when the button is pressed. */
.copy-notice {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 20;
    max-width: 28rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid #9ed1b8;
    border-radius: 0.25rem;
    color: var(--portal-green);
    background: var(--portal-green-bg);
    box-shadow: 0 2px 6px rgba(24, 33, 41, 0.18);
    overflow-wrap: anywhere;
}

/* Progress dialog. Raised while a list is retrieved from Stripe, and portal-wide by any action
   button that posts a form. */
.loading-dialog {
    max-width: 26rem;
    text-align: center;
}

.loading-dialog-body {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
}

.loading-dialog-body h2 {
    margin: 0;
    font-size: 1.05rem;
}

.loading-dialog-body p {
    margin: 0;
    color: var(--portal-muted);
}

.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 0.3rem solid var(--portal-line);
    border-top-color: var(--portal-accent);
    border-radius: 50%;
    animation: portal-spin 0.9s linear infinite;
}

@keyframes portal-spin {
    to { transform: rotate(360deg); }
}

/* Respect a reduced-motion preference: the dialog still reports progress, it just pulses
   instead of spinning. */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: portal-pulse 1.6s ease-in-out infinite;
    }

    @keyframes portal-pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.35; }
    }
}

.terminal-create-error {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #e0a6a6;
    border-left: 4px solid var(--portal-red);
    border-radius: 0.25rem;
    background: var(--portal-red-bg);
}

.terminal-create-error .section-heading {
    margin-bottom: 0.75rem;
}

.terminal-create-error p {
    color: var(--portal-red);
}

.portal-dialog {
    width: min(980px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    border: 1px solid var(--portal-line-strong);
    border-radius: 0.35rem;
    color: var(--portal-ink);
    background: var(--portal-surface);
    box-shadow: 0 1.25rem 3rem rgba(24, 33, 41, 0.24);
}

.portal-dialog::backdrop {
    background: rgba(24, 33, 41, 0.56);
}

.portal-dialog-form {
    max-height: calc(100vh - 2rem);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.portal-dialog-header,
.portal-dialog-footer {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #f8fafb;
}

.portal-dialog-header {
    border-bottom: 1px solid var(--portal-line);
}

.portal-dialog-header p {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
}

.portal-dialog-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--portal-line);
}

.portal-dialog-body {
    padding: 0 1.25rem 1.25rem;
    overflow-y: auto;
}

/* A confirmation dialog carries no header band, so its body supplies the top padding the header
   would otherwise have provided. */
.portal-dialog-body:first-child {
    padding-top: 1.25rem;
}

.portal-dialog-body:first-child h2 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.dialog-close-button {
    min-height: 2rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--portal-line-strong);
    border-radius: 0.22rem;
    color: var(--portal-ink);
    background: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
}

.dialog-section {
    padding-top: 1.1rem;
    border-top: 1px solid var(--portal-line);
}

.dialog-section:first-of-type {
    border-top: 0;
}

.dialog-section > h3,
.dialog-section .section-heading {
    margin-bottom: 0.85rem;
}

.dialog-section h3 {
    margin-top: 0;
    font-size: 0.95rem;
}

.dialog-section .section-heading p {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
}

.field-help {
    color: var(--portal-muted);
    font-size: 0.76rem;
}

.selected-gp-contact {
    margin: -0.15rem 0 0.9rem;
    padding: 0.65rem 0.75rem;
    border-left: 3px solid var(--portal-accent);
    background: #f1f7f9;
    font-size: 0.84rem;
}

.selected-gp-contact .field-help {
    display: block;
    margin-top: 0.2rem;
}

input[readonly] {
    background: #edf0f2;
}

.metadata-editor {
    display: grid;
    gap: 0.6rem;
}

.metadata-row {
    padding: 0.75rem;
    border: 1px solid var(--portal-line);
    border-radius: 0.25rem;
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto;
    align-items: end;
    gap: 0.75rem;
    background: #fafbfb;
}

.metadata-row .field-group {
    margin-bottom: 0;
}

.metadata-remove-button {
    margin-bottom: 0.7rem;
}

.lookup-shell {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 1.5rem;
}

.auth-panel {
    width: min(400px, 100%);
    margin-top: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--portal-line);
    border-radius: 0.35rem;
    background: var(--portal-surface);
}

.auth-links {
    margin-top: 1rem;
    font-size: 0.88rem;
}

.validation-summary,
.field-validation-error {
    color: var(--portal-red);
    font-size: 0.8rem;
}

.validation-summary:empty,
.field-validation-error:empty {
    display: none;
}

@media (max-width: 900px) {
    .portal-shell {
        grid-template-columns: 1fr;
    }

    .portal-sidebar {
        padding: 0.65rem 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--portal-line);
    }

    .portal-sidebar nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .portal-sidebar nav a {
        justify-content: center;
    }

    .sidebar-state {
        display: none;
    }

    .metric-grid,
    .field-grid-three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .portal-header-inner {
        align-items: flex-start;
        flex-direction: column;
        padding-top: 0.7rem;
        padding-bottom: 0.7rem;
    }

    .session-controls {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .portal-main {
        padding: 1.25rem 1rem 2rem;
    }

    .portal-sidebar nav {
        grid-template-columns: 1fr;
    }

    .page-heading,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid,
    .field-grid-two,
        .field-grid-three,
    .event-inbox-filter-grid,
        .form-grid,
        .detail-grid,
        .detail-grid-three,
        .search-command,
        .address-command,
        .copy-line {
        grid-template-columns: 1fr;
    }

    .field-span-two,
    .form-span-two,
    .detail-span-two {
        grid-column: auto;
    }

    .form-actions,
    .heading-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .button-primary,
    .button-secondary {
        width: 100%;
    }

    .merchant-subnav {
        overflow-x: auto;
    }

    .merchant-subnav a {
        white-space: nowrap;
    }

    .portal-dialog {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }

    .portal-dialog-form {
        max-height: calc(100vh - 1rem);
    }

    .portal-dialog-header,
    .portal-dialog-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-dialog-footer .button-primary,
    .portal-dialog-footer .button-secondary {
        width: 100%;
    }

    .metadata-row {
        grid-template-columns: 1fr;
    }

    .metadata-remove-button {
        justify-self: start;
        margin-bottom: 0;
    }

    .lookup-shell {
        padding: 1rem;
    }
}
