/* U3: additive user-portal styles. Existing portal functions and selectors remain untouched. */
.cdk-acquire-entry-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  max-width: 220px;
  padding: 8px 14px;
  border: 1px solid rgba(80, 137, 232, .52);
  border-radius: 12px;
  background: linear-gradient(135deg, #2f78e8 0%, #245fd4 100%);
  color: #fff;
  box-shadow: 0 7px 18px rgba(31, 94, 196, .22);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.cdk-acquire-entry-button:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(31, 94, 196, .3);
  filter: saturate(1.08);
}
.cdk-acquire-entry-button:focus-visible {
  outline: 3px solid rgba(90, 153, 255, .28);
  outline-offset: 2px;
}
.cdk-acquire-entry-button[hidden] { display: none !important; }
html[data-theme="light"] .cdk-acquire-entry-button {
  border-color: #4f8fe8;
  background: linear-gradient(135deg, #347fe9, #2a68d1);
  color: #fff;
}
@media (max-width: 760px) {
  .portal-topbar-actions { gap: 7px; }
  .cdk-acquire-entry-button { max-width: 140px; padding-inline: 10px; }
}
@media (max-width: 560px) {
  .cdk-acquire-entry-button { min-height: 36px; max-width: 112px; border-radius: 10px; font-size: 11px; }
}

/* ======================================================================
 * IC U4 user portal visual alignment
 * Keeps every existing Protocol user function and control intact.
 * ====================================================================== */
html[data-portal-ui-release="u4"] {
  --u4p-bg: #eef3fb;
  --u4p-surface: #ffffff;
  --u4p-surface-2: #f6f9fe;
  --u4p-surface-3: #edf4ff;
  --u4p-line: #d9e3f0;
  --u4p-line-strong: #c3d0e2;
  --u4p-text: #14233b;
  --u4p-muted: #6a7890;
  --u4p-primary: #2c66df;
  --u4p-primary-soft: #eaf1ff;
  --u4p-shadow: 0 14px 38px rgba(37, 58, 91, .09);
}
html[data-theme="dark"][data-portal-ui-release="u4"],
html[data-portal-theme="dark"][data-portal-ui-release="u4"] {
  --u4p-bg: #071225;
  --u4p-surface: #0e1a2e;
  --u4p-surface-2: #121f35;
  --u4p-surface-3: #162741;
  --u4p-line: #293a55;
  --u4p-line-strong: #3a4e6b;
  --u4p-text: #e9f1ff;
  --u4p-muted: #92a4bf;
  --u4p-primary: #6d9fff;
  --u4p-primary-soft: #1b3154;
  --u4p-shadow: 0 18px 48px rgba(0,0,0,.28);
}
html[data-portal-ui-release="u4"] body {
  background: linear-gradient(145deg, var(--u4p-bg), color-mix(in srgb, var(--u4p-bg) 88%, #fff 12%));
  color: var(--u4p-text);
}
html[data-portal-ui-release="u4"] .portal-sidebar {
  background: linear-gradient(180deg, var(--u4p-surface), var(--u4p-surface-2));
  border-right: 1px solid var(--u4p-line);
}
html[data-portal-ui-release="u4"] .sidebar-nav-item,
html[data-portal-ui-release="u4"] .sidebar-user-card,
html[data-portal-ui-release="u4"] .sidebar-collapse { border-radius: 11px; }
html[data-portal-ui-release="u4"] .sidebar-nav-item.active {
  background: var(--u4p-primary-soft);
  color: var(--u4p-primary);
  box-shadow: inset 3px 0 0 var(--u4p-primary);
}
html[data-portal-ui-release="u4"] .portal-topbar {
  min-height: 82px;
  background: color-mix(in srgb, var(--u4p-surface) 91%, transparent);
  border-bottom: 1px solid var(--u4p-line);
  backdrop-filter: blur(14px);
}
html[data-portal-ui-release="u4"] .portal-content {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 20px clamp(14px, 2vw, 28px) 50px;
}
html[data-portal-ui-release="u4"] .panel,
html[data-portal-ui-release="u4"] .metric-card,
html[data-portal-ui-release="u4"] .shortcut-card,
html[data-portal-ui-release="u4"] .security-box,
html[data-portal-ui-release="u4"] .account-card {
  border-color: var(--u4p-line);
  background: var(--u4p-surface);
  box-shadow: 0 5px 18px rgba(37,58,91,.055);
  border-radius: 16px;
}
html[data-portal-ui-release="u4"] .panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--u4p-line);
}
html[data-portal-ui-release="u4"] input,
html[data-portal-ui-release="u4"] select,
html[data-portal-ui-release="u4"] textarea {
  border-color: var(--u4p-line-strong);
  background: var(--u4p-surface);
}
html[data-portal-ui-release="u4"] .table-wrap {
  border: 1px solid var(--u4p-line);
  border-radius: 13px;
  overflow: auto;
}
html[data-portal-ui-release="u4"] table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--u4p-surface-2);
  color: var(--u4p-muted);
}
html[data-portal-ui-release="u4"] .cdk-acquire-entry-button {
  background: linear-gradient(135deg, var(--u4p-primary), #628cf0);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(37,99,235,.22);
}
html[data-portal-ui-release="u4"] .pill { border-color: var(--u4p-line); background: var(--u4p-surface-2); }
html[data-portal-ui-release="u4"] .auth-card {
  border-color: var(--u4p-line);
  background: color-mix(in srgb, var(--u4p-surface) 96%, transparent);
  box-shadow: var(--u4p-shadow);
  border-radius: 24px;
}
@media (max-width: 760px) {
  html[data-portal-ui-release="u4"] .portal-content { padding: 14px 12px 36px; }
  html[data-portal-ui-release="u4"] .portal-topbar-actions { gap: 6px; }
  html[data-portal-ui-release="u4"] .cdk-acquire-entry-button { padding: 7px 10px; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* IC U4.1R1 presentation safety marker: prevent page-level horizontal spill. */
html[data-portal-ui-release="u4"],html[data-portal-ui-release="u4"] body{max-width:100%;overflow-x:hidden}

/* IC PN1 20260902: temporary client notice + platform notice image gallery. */
html[data-portal-ui-release="u4"] .temporary-notice-banner{width:min(calc(100% - 48px),1624px);margin:14px auto 0;padding:14px 16px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:13px;align-items:start;border:1px solid color-mix(in srgb,var(--u4p-primary) 34%,var(--u4p-line));border-radius:15px;background:linear-gradient(135deg,color-mix(in srgb,var(--u4p-primary) 9%,var(--u4p-surface)),var(--u4p-surface));box-shadow:0 8px 22px rgba(37,58,91,.08)}
html[data-portal-ui-release="u4"] .temporary-notice-banner[hidden]{display:none}
html[data-portal-ui-release="u4"] .temporary-notice-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:10px;background:var(--u4p-primary);color:white;font-weight:950;font-size:16px}
html[data-portal-ui-release="u4"] .temporary-notice-body{min-width:0;display:grid;gap:7px}
html[data-portal-ui-release="u4"] .temporary-notice-head{display:flex;align-items:center;gap:12px;justify-content:space-between}
html[data-portal-ui-release="u4"] .temporary-notice-head strong{font-size:14px}
html[data-portal-ui-release="u4"] .temporary-notice-head .muted{font-size:11px;white-space:nowrap}
html[data-portal-ui-release="u4"] .temporary-notice-message{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65;color:var(--text)}
html[data-portal-ui-release="u4"] .temporary-notice-dismiss{align-self:start;white-space:nowrap}
html[data-portal-ui-release="u4"] .notice-image-gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:4px 0 12px}
html[data-portal-ui-release="u4"] .notice-image-gallery[hidden]{display:none}
html[data-portal-ui-release="u4"] .notice-image-gallery a{display:block;min-width:0;border:1px solid var(--u4p-line);border-radius:12px;overflow:hidden;background:var(--u4p-surface-2)}
html[data-portal-ui-release="u4"] .notice-image-gallery img{display:block;width:100%;max-height:360px;object-fit:contain;background:var(--u4p-surface-2)}
html[data-portal-ui-release="u4"] .notice-modal-images{margin:0 0 14px}
html[data-portal-ui-release="u4"] .temporary-notice-images{margin:2px 0 0;grid-template-columns:repeat(4,minmax(0,180px));justify-content:start}
html[data-portal-ui-release="u4"] .temporary-notice-images img{height:100px;max-height:100px}
@media(max-width:760px){html[data-portal-ui-release="u4"] .temporary-notice-banner{width:calc(100% - 24px);grid-template-columns:auto minmax(0,1fr);margin-top:10px;padding:12px}html[data-portal-ui-release="u4"] .temporary-notice-dismiss{grid-column:2;width:100%}html[data-portal-ui-release="u4"] .temporary-notice-head{align-items:flex-start;flex-direction:column;gap:3px}html[data-portal-ui-release="u4"] .temporary-notice-head .muted{white-space:normal}html[data-portal-ui-release="u4"] .notice-image-gallery,html[data-portal-ui-release="u4"] .temporary-notice-images{grid-template-columns:1fr 1fr}html[data-portal-ui-release="u4"] .notice-image-gallery img{max-height:260px}}
@media(max-width:480px){html[data-portal-ui-release="u4"] .notice-image-gallery,html[data-portal-ui-release="u4"] .temporary-notice-images{grid-template-columns:1fr}}

/* PX2 user self-service proxy pool */
.self-proxy-summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:12px}.self-proxy-route-card{display:grid;gap:5px;padding:14px 15px;border:1px solid var(--line);border-radius:12px;background:var(--panel2)}.self-proxy-route-card>span{font-size:11px;color:var(--muted);font-weight:700}.self-proxy-route-card>strong{font-size:16px;overflow-wrap:anywhere}.self-proxy-route-card>small{color:var(--muted);overflow-wrap:anywhere}.self-proxy-import-grid{display:grid;grid-template-columns:minmax(0,2.2fr) minmax(220px,.8fr);gap:12px;align-items:start}.self-proxy-import-grid label{display:grid;gap:7px}.self-proxy-text-label textarea{min-height:150px;resize:vertical;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.self-proxy-preview-table-wrap,.self-proxy-pool-table-wrap{margin-top:12px;max-height:430px;overflow:auto}.self-proxy-preview-table-wrap th,.self-proxy-pool-table-wrap th{position:sticky;top:0;z-index:2}.self-proxy-pool-table-wrap code,.self-proxy-preview-table-wrap code{overflow-wrap:anywhere}.self-proxy-pool-table-wrap .pill{margin-left:7px}.self-proxy-pool-table-wrap .actions{display:flex;gap:6px;flex-wrap:wrap}
html[data-theme="light"] .self-proxy-route-card{background:#f6f9fd;border-color:#d6e1ee}
@media(max-width:900px){.self-proxy-summary-grid{grid-template-columns:1fr 1fr}.self-proxy-import-grid{grid-template-columns:1fr}}
@media(max-width:560px){.self-proxy-summary-grid{grid-template-columns:1fr}.self-proxy-preview-table-wrap,.self-proxy-pool-table-wrap{max-height:360px}}

/* ======================================================================
 * IC Protocol CUI1 viewport shell / 20260903
 * Mirrors the stable admin U4.1R2 shell: sidebar and topbar remain in
 * dedicated viewport regions; only the portal information pane scrolls.
 * This fixes document-level scrolling that could crop the sticky sidebar.
 * ====================================================================== */
html[data-portal-ui-shell="u4.1r2c1"] {
  --p412-shell-border: color-mix(in srgb, var(--u4p-line, var(--line)) 92%, transparent);
}

html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active {
  height: 100dvh;
  min-height: 0;
  overflow: hidden !important;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .shell,
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active #appView {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-app {
  height: 100dvh;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

/* Sidebar owns its viewport column. It no longer depends on document sticky. */
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-sidebar {
  position: relative;
  inset: auto;
  top: auto;
  height: auto;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .sidebar-brand,
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .sidebar-user-wrap,
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .sidebar-foot {
  flex: 0 0 auto;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* Main area is two fixed viewport rows: topbar + independent content scroller. */
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-main {
  width: 100%;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-topbar {
  position: relative;
  inset: auto;
  top: auto;
  z-index: 50;
  width: 100%;
  flex: 0 0 auto;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .p412-content-scroll {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-top: 12px;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .p412-content-scroll > .portal-content {
  min-width: 0;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .p412-content-scroll > [hidden] {
  display: none !important;
}

/* Keep top controls usable at narrower desktop widths instead of letting them
   enlarge the fixed header beyond the viewport. */
@media (max-width: 1180px) {
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-topbar {
    gap: 12px;
  }
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-topbar-actions {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 900px) {
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-app,
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-app.sidebar-collapsed {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-sidebar,
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-main {
    height: 100dvh;
    min-height: 0;
  }
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-topbar {
    min-height: 76px;
  }
}

@media (max-width: 560px) {
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .portal-topbar {
    height: auto;
    min-height: 70px;
  }
  html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .p412-content-scroll {
    scrollbar-gutter: auto;
  }
}

/* ======================================================================
 * IC Protocol CUI1R1 compact sidebar / 20260903
 * Keep CUI1's viewport-owned sidebar, but stop CSS Grid from stretching
 * navigation rows to fill all remaining vertical space.
 * ====================================================================== */
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .sidebar-nav {
  align-content: start;
  grid-auto-rows: minmax(46px, auto);
  gap: 6px;
  padding-bottom: 8px;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .sidebar-nav-item {
  min-height: 46px;
  padding: 8px 10px;
  line-height: 1.25;
}
html[data-portal-ui-shell="u4.1r2c1"] body.p412-app-active .sidebar-nav-item .nav-icon {
  line-height: 1;
}
/* CUI1R1 marker: u4.1r2-client-sidebar-compact-20260903 */
