/* ============================================================
   Lending Portal — design tokens + product layer
   Ported from the partner-portal design package
   (colors_and_type.css + portal.css), adapted for MudBlazor.
   Loaded after MudBlazor.min.css so it can override.
   ============================================================ */

/* ---------- Design-system tokens ---------- */
:root {
  --font-sans: 'Barlow', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

  --leading-tight:   1.25;
  --leading-normal:  1.5;
  --leading-relaxed: 1.625;

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  --tracking-tight: -0.025em;

  --radius:      0.625rem;
  --radius-sm:   calc(var(--radius) - 4px);
  --radius-md:   calc(var(--radius) - 2px);
  --radius-lg:   var(--radius);
  --radius-xl:   calc(var(--radius) + 4px);
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-sm-up: 0 -1px 3px 0 rgb(0 0 0 / 0.08), 0 -1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08);
  --shadow-ring: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --background:           oklch(1 0 0);
  --foreground:           oklch(0.145 0 0);
  --card:                 oklch(1 0 0);
  --card-foreground:      oklch(0.145 0 0);
  --popover:              oklch(1 0 0);
  --popover-foreground:   oklch(0.145 0 0);
  --secondary:            oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted:                oklch(0.97 0 0);
  --muted-foreground:     oklch(0.556 0 0);
  --accent:               oklch(0.97 0 0);
  --accent-foreground:    oklch(0.205 0 0);
  --destructive:          oklch(0.577 0.245 27.325);
  --border:               oklch(0.922 0 0);
  --input:                oklch(0.922 0 0);
  --ring:                 oklch(0.708 0 0);

  --success:            #16a34a;
  --success-foreground: #ffffff;
  --success-bg:         #dcfce7;
  --success-fg:         #166534;
  --warning:            #f59e0b;
  --warning-bg:         #fef3c7;
  --warning-fg:         #92400e;
  --warning-deep-bg:    #fffbeb;
  --error-bg:           #fee2e2;
  --error-fg:           #991b1b;

  --fg:        var(--foreground);
  --fg-muted:  var(--muted-foreground);
  --fg-invert: var(--primary-foreground);
  --bg:        var(--background);
  --bg-card:   var(--card);
  --bg-muted:  var(--muted);
  --bg-accent: var(--accent);
  --line:      var(--border);

  /* ---------- Product layer ---------- */
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --link: #2563eb;
  --link-hover: #1d4ed8;

  --portal-sidebar-top: #ffffff;
  --portal-sidebar-bottom: #e9f7ee;
  --portal-sidebar-line: #16a34a;
  --portal-nav-active-bg: #e8eaed;
  --portal-nav-hover-bg: #00000008;
  --portal-group-label: #8a9099;

  --portal-avatar-from: #2dd4bf;
  --portal-avatar-to: #16a34a;

  --portal-badge: #ef4444;

  --portal-sidebar-w: 280px;
  --portal-topbar-h: 72px;
  --portal-page-gutter: 40px;
}

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

.muted { color: var(--fg-muted); }
.meta  { font-size: var(--text-xs); color: var(--fg-muted); }
.stat-number { font-size: var(--text-3xl); font-weight: var(--weight-bold); line-height: 1; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

.focus-ring:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: var(--shadow-ring);
}

.switch:focus-within,
.checkbox:focus-within {
  border-color: var(--ring);
  box-shadow: var(--shadow-ring);
}

/* ---------- Sidebar ---------- */
.sidebar__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 16px 18px;
}

.sidebar__waves {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 320px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 0;
  margin-bottom: 30px;
}
.brand__mark { width: 38px; height: 38px; color: #111; flex-shrink: 0; }
.brand__word {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.05;
  color: #111;
}

.nav-group { margin-bottom: 8px; }
.nav-group__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--portal-group-label);
  text-transform: uppercase;
  padding: 14px 10px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #1c2024;
  cursor: pointer;
  text-align: left;
  transition: background-color .15s, color .15s;
}
.nav-item:hover { background: var(--portal-nav-hover-bg); }
.nav-item--active {
  background: var(--portal-nav-active-bg);
  font-weight: 600;
}
.nav-item__icon { width: 21px; height: 21px; flex-shrink: 0; color: #2c3137; }
.nav-item__label { flex: 1; }
.nav-item__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  background: var(--portal-badge);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.sidebar__footer {
  margin-top: auto;
  padding: 18px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.sidebar__footer a {
  font-size: 13px;
  color: #3a4047;
  text-decoration: none;
}
.sidebar__footer a:hover { color: var(--link); }
.sidebar__copy {
  margin-top: 6px;
  font-size: 11px;
  color: #9aa0a6;
}

/* ---------- Top bar ---------- */
.crumbs {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #6b7280;
  text-transform: uppercase;
}
.crumbs__sep { color: #c7ccd1; }
.crumbs__current { color: #1c2024; }
.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
}
.bell {
  position: relative;
  display: inline-flex;
  border: none;
  background: transparent;
  color: #4b5158;
  cursor: pointer;
  padding: 6px;
  border-radius: 9999px;
}
.bell:hover { background: var(--accent); }
.bell__badge {
  position: absolute;
  top: -2px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--portal-badge);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.account {
  display: flex;
  align-items: center;
  gap: 11px;
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 4px 6px 4px 4px;
  border-radius: 9999px;
}
.account__avatar {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--portal-avatar-from), var(--portal-avatar-to));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}
.account__name { font-size: 15px; font-weight: 600; color: #1c2024; }
.account__chev { color: #6b7280; }

/* ---------- Page body ---------- */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.page__inner {
  width: 100%;
  max-width: 1680px;
  margin-inline: auto;
  padding: 8px var(--portal-page-gutter) 56px;
}
.page__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 28px 0 26px;
}
.page__title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #16181b;
  margin: 0;
}
.page__actions { display: flex; align-items: center; gap: 12px; padding-top: 4px; }

.filters {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.filters__search { width: 360px; max-width: 100%; flex: 1 1 240px; }
.filters__field { display: flex; flex-direction: column; gap: 7px; }
.filters__select { width: 300px; max-width: 100%; }
.filters__label { font-size: 14px; font-weight: 600; color: #16181b; }

/* ---------- Table ---------- */
.tablecard {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tablecard__scroll {
  overflow-x: auto;
  border-radius: inherit;
}
table.ptable { width: 100%; border-collapse: collapse; }
.ptable thead th {
  background: #f7f8f9;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: #16181b;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ptable thead th.sortable { cursor: pointer; user-select: none; }
.ptable thead th .th-inner { display: inline-flex; align-items: center; gap: 7px; }
.ptable thead th.num { text-align: right; }
.sort-arrow { color: #16181b; opacity: 0; transition: opacity .12s; }
.sort-arrow--on { opacity: 1; }
.ptable tbody td {
  padding: 18px 22px;
  font-size: 14px;
  color: #1c2024;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ptable tbody tr:last-child td { border-bottom: none; }
.ptable tbody tr { transition: background-color .12s; }
.ptable tbody tr:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); }
.ptable td.num { text-align: right; font-variant-numeric: tabular-nums; }

.cell-link {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 500;
  word-break: break-word;
}
.cell-link:hover { color: var(--link-hover); }
.domain__sub { color: #1c2024; }
.domain__rest { color: #6b7280; }
.muted-cell { color: #6b7280; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
}
.pill--active { background: var(--success-bg); color: var(--success-fg); }
.pill--inactive { background: #e5e7eb; color: #374151; }

.rowact {
  border: none;
  background: transparent;
  color: #4b5158;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
}
.rowact:hover { background: var(--accent); color: #16181b; }

.tablefoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-top: 18px;
  font-size: 14px;
  color: #6b7280;
}
.tablefoot__right { display: flex; align-items: center; gap: 16px; }
.rpp { display: flex; align-items: center; gap: 8px; }
.rpp__select {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  padding: 5px 28px 5px 10px;
  min-height: 24px;
  cursor: pointer;
  color: #1c2024;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.pager { display: flex; gap: 8px; }
.pager button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #4b5158;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pager button:hover:not(:disabled) { background: var(--accent); color: #16181b; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

.empty {
  padding: 64px 24px;
  text-align: center;
  color: #6b7280;
}
.empty__title { font-size: 16px; font-weight: 600; color: #16181b; margin-bottom: 6px; }

/* ---------- Lending search (combined records list) ---------- */
.page__sub {
  font-size: 15px;
  color: #6b7280;
  margin: 6px 0 0;
}

.filters2 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filters2__search { width: 360px; max-width: 100%; }
.filters2__partner { width: 210px; max-width: 100%; }
.filters2__spacer { flex: 1; }

.seg {
  display: inline-flex;
  background: #f1f3f5;
  border: none;
  border-radius: 9999px;
  padding: 2px;
  gap: 2px;
}
.seg .mud-button-root.seg__btn {
  min-width: 0;
  gap: 7px;
  padding: 7px 15px;
  border-radius: 9999px;
  background: transparent;
  box-shadow: none;
  font-size: 13.5px;
  font-weight: 600;
  color: #6b7280;
  transition: background-color .12s, color .12s, box-shadow .12s;
}
.seg .mud-button-root.seg__btn:hover { background: transparent; color: #1c2024; }
.seg .mud-button-root.seg__btn--on,
.seg .mud-button-root.seg__btn--on:hover {
  background: #fff;
  color: #16181b;
  box-shadow: var(--shadow-xs);
}
.seg__count {
  font-size: 12px;
  font-weight: 700;
  color: #9aa0a6;
  font-variant-numeric: tabular-nums;
}
.seg__btn--on .seg__count { color: var(--primary); }

.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px;
  border: 1px solid transparent;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.stage-chip__dot { width: 7px; height: 7px; border-radius: 9999px; }

.idnum {
  font-size: 13.5px;
  font-weight: 500;
  color: #3a4047;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rec-name { font-size: 15px; font-weight: 600; color: #16181b; }
.metric { font-variant-numeric: tabular-nums; }
.metric-strong { font-weight: 600; color: #16181b; }

.th-sort {
  display: inline-flex;
  align-items: center;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.th-sort:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.sort-arrow--desc { transform: rotate(180deg); }

.pager__label {
  align-self: center;
  padding: 0 4px;
  font-size: 14px;
  color: #6b7280;
}
.pager .mud-icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #4b5158;
}
.pager .mud-icon-button:hover:not(:disabled) { background: var(--accent); color: #16181b; }
.pager .mud-icon-button:disabled { opacity: 0.4; cursor: not-allowed; }

/* MudTable skinned to the design's .ptable */
.tablecard .mud-table { background: transparent; box-shadow: none; }
.tablecard .mud-table-container { border-radius: inherit; }
.tablecard .mud-table-root { width: 100%; border-collapse: collapse; }
.tablecard .mud-table-head th {
  background: #f7f8f9;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a9099;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tablecard .mud-table-body td {
  padding: 18px 22px;
  font-size: 14px;
  color: #1c2024;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tablecard .mud-table-body tr:last-child td { border-bottom: none; }
.tablecard th.num,
.tablecard td.num { text-align: right; }
.tablecard .mud-table-body td .empty { padding: 64px 24px; }

/* ---------- Detail page (tabs + forms) ---------- */
.page--detail {
  display: flex;
  flex-direction: column;
}
.page--detail .page__inner { padding-bottom: 0; }
.page__title--detail { font-weight: 700; }

.detail-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 26px;
}
.detail-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #8a9099;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.detail-tab:hover { color: #4b5158; background: var(--portal-nav-hover-bg); }
.detail-tab--active { background: var(--portal-nav-active-bg); color: #16181b; font-weight: 600; }
.detail-tab__icon { display: inline-flex; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.detail-col { display: flex; flex-direction: column; gap: 24px; }

.scard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 26px 30px 30px;
}
.scard + .scard { margin-top: 22px; }
.scard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.scard__title { font-size: 21px; font-weight: 600; color: #16181b; margin: 0; }

.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #3a4047;
  margin-bottom: 7px;
}
.req { color: var(--destructive); margin-left: 2px; }
.finput, .fselect {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: #1c2024;
  font-family: inherit;
  font-size: 15px;
  padding: 0 14px;
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.finput:focus, .fselect:focus { border-color: var(--ring); box-shadow: var(--shadow-ring); }
.finput::placeholder { color: #9aa0a6; }
.finput:disabled, .finput[readonly] {
  background: #eef0f2;
  color: #6b7280;
  cursor: not-allowed;
}
.fselect {
  appearance: none;
  cursor: pointer;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.fselect:disabled { background-color: #eef0f2; color: #6b7280; cursor: not-allowed; }

.checkrow {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
  user-select: none;
}
.checkrow + .checkrow { margin-top: 12px; }
.checkbox {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  border-radius: 5px;
  border: 1.5px solid #c2c7cd;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-top: 1px;
  transition: background-color .12s, border-color .12s;
}
.checkbox--on { background: var(--primary); border-color: var(--primary); }
.checkbox--lg { width: 26px; height: 26px; border-radius: 6px; }
.checkrow__label { font-size: 14px; color: #1c2024; }
.checkrow--setting .checkrow__label { font-weight: 700; color: #16181b; font-size: 15px; }
.checkrow__desc { font-size: 14px; color: #6b7280; margin-top: 5px; line-height: 1.5; }
.gateway-input { margin: 10px 0 4px; }

.logo-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: #b3b8be;
  text-align: center;
  padding: 24px;
}
.logo-frame__name { font-size: 18px; font-weight: 700; color: #6b7280; }
.logo-frame__hint { font-size: 13px; color: #9aa0a6; }
.linklike {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--link);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}
.linklike:hover { color: var(--link-hover); text-decoration: underline; }

.colors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px 24px;
}
.color-item__label { font-size: 13px; color: #6b7280; margin-bottom: 10px; }
.color-item__row { display: flex; align-items: center; gap: 14px; }
.swatch {
  width: 46px;
  height: 46px;
  border-radius: 9999px;
  border: 1px solid rgba(0,0,0,.1);
  flex-shrink: 0;
}
.color-item__hex { font-size: 15px; color: #1c2024; margin-bottom: 4px; font-variant-numeric: tabular-nums; }

.ftable { width: 100%; border-collapse: collapse; }
.ftable thead th {
  background: #f7f8f9;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  color: #16181b;
  padding: 15px 20px;
  border: 1px solid var(--border);
  border-left: none;
}
.ftable thead th:first-child { border-left: 1px solid var(--border); border-top-left-radius: var(--radius-md); }
.ftable thead th:last-child { border-top-right-radius: var(--radius-md); }
.ftable thead th.center { text-align: center; }
.ftable thead th.right { text-align: right; }
.ftable tbody td {
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-top: none;
  border-left: none;
  vertical-align: middle;
}
.ftable tbody td:first-child { border-left: 1px solid var(--border); }
.ftable tbody td.center { text-align: center; }
.ftable tbody td.right { text-align: right; }
.trash-btn {
  border: none;
  background: transparent;
  color: var(--destructive);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
}
.trash-btn:hover { background: #fee2e2; }
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--link);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--link);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-add:hover { background: color-mix(in oklab, var(--link) 8%, #fff); }

.detailfoot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: auto;
  width: 100%;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-sm-up);
}
.detailfoot__inner {
  width: 100%;
  max-width: 1680px;
  margin-inline: auto;
  padding: 16px var(--portal-page-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.btn-pill {
  height: 46px;
  padding: 0 26px;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-pill--revert { background: #fff; border: 1px solid #c2c7cd; color: #1c2024; }
.btn-pill--revert:hover { background: var(--accent); }
.btn-pill--save { background: var(--primary); border: 1px solid var(--primary); color: #fff; }
.btn-pill--save:hover { background: var(--link-hover); border-color: var(--link-hover); }

.um-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.gw-url {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 14px;
  background: #f6f7f8;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: #1c2024;
  word-break: break-all;
}
.gw-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.switch {
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  border-radius: 9999px;
  background: #c2c7cd;
  border: none;
  padding: 0;
  position: relative;
  cursor: pointer;
  transition: background-color .15s;
}
.switch--on { background: var(--success); }
.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: left .15s;
}
.switch--on .switch__knob { left: 23px; }
.switch-label { font-size: 14px; font-weight: 600; }
.switch-label--on { color: var(--success-fg); }
.switch-label--off { color: #6b7280; }
.field-help { font-size: 13px; color: #6b7280; margin-top: 8px; line-height: 1.5; }

.scard__subtitle { font-size: 14px; color: #6b7280; margin: -10px 0 22px; line-height: 1.5; }
.feature-list { display: flex; flex-direction: column; }
.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--border);
}
.feature-row:last-child { border-bottom: none; }
.feature-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: #16181b;
  letter-spacing: -0.01em;
}
.feature-toggle { display: flex; align-items: center; gap: 12px; }

/* ============================================================
   MudBlazor shell adapters — map the design's sidebar/topbar
   onto MudDrawer / MudAppBar / MudNavMenu markup.
   ============================================================ */

.mud-drawer.ge-sidebar {
  z-index: calc(var(--mud-zindex-appbar) + 1);
  background: linear-gradient(180deg,
    var(--portal-sidebar-top) 0%,
    #f4fbf6 52%,
    var(--portal-sidebar-bottom) 100%);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.ge-sidebar .mud-drawer-content {
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
}

.ge-sidebar .mud-navmenu { position: relative; z-index: 1; }

.mud-main-content.ge-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.ge-sidebar .mud-nav-group > .mud-nav-link {
  padding: 14px 10px 8px;
  cursor: default;
  background: transparent;
}
.ge-sidebar .mud-nav-group > .mud-nav-link:hover { background: transparent; }
.ge-sidebar .mud-nav-group > .mud-nav-link .mud-nav-link-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--portal-group-label);
  text-transform: uppercase;
}

.ge-sidebar .mud-navmenu > .mud-nav-link,
.ge-sidebar .mud-collapse-container .mud-nav-link {
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: #1c2024;
  transition: background-color .15s, color .15s;
}
.ge-sidebar .mud-navmenu > .mud-nav-link:hover,
.ge-sidebar .mud-collapse-container .mud-nav-link:hover { background: var(--portal-nav-hover-bg); }
.ge-sidebar .mud-navmenu > .mud-nav-link.active,
.ge-sidebar .mud-collapse-container .mud-nav-link.active {
  background: var(--portal-nav-active-bg);
  font-weight: 600;
  color: #1c2024;
}
.ge-sidebar .mud-navmenu > .mud-nav-link .mud-nav-link-icon,
.ge-sidebar .mud-collapse-container .mud-nav-link .mud-nav-link-icon {
  width: 21px;
  height: 21px;
  color: #2c3137;
}
.ge-sidebar .mud-collapse-container .mud-navmenu { padding: 0; }

.ge-topbar.mud-appbar {
  background: #fff !important;
  color: #1c2024 !important;
  box-shadow: none !important;
  border-bottom: none;
}
.ge-topbar .mud-toolbar {
  gap: 22px;
  padding: 0 32px;
}
.ge-topbar .ge-bell {
  position: relative;
  color: #4b5158;
}

/* ============================================================
   Responsive breakpoints
   ============================================================ */
@media (max-width: 1100px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .filters {
    align-items: stretch;
  }
  .filters__search,
  .filters__field,
  .filters__select {
    width: 100%;
  }
  .ge-topbar .mud-toolbar {
    padding: 0 16px;
  }
}
