/* Bridge: multi-user pages + search on top of original site.css */

.wos-hidden { display: none !important; }

/* ===== Reading progress (articles) ===== */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: transparent;
}
.read-progress.is-on { opacity: 1; }
.read-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), hsl(220, 70%, 50%));
  box-shadow: 0 0 8px var(--primary-alpha-40);
  transition: width 0.08s linear;
}

/* ===== Skeleton loaders ===== */
@keyframes skShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.sk-line,
.sk-block,
.sk-btn {
  background: linear-gradient(
    90deg,
    var(--muted) 0%,
    rgba(255, 255, 255, 0.7) 45%,
    var(--muted) 90%
  );
  background-size: 200% 100%;
  animation: skShimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}
.sk-line { height: 0.85rem; margin-bottom: 0.75rem; }
.sk-h-lg { height: 1.6rem; }
.sk-w-30 { width: 30%; }
.sk-w-40 { width: 40%; }
.sk-w-70 { width: 70%; }
.sk-w-80 { width: 80%; }
.sk-w-85 { width: 85%; }
.sk-w-90 { width: 90%; }
.sk-page { padding: 0.5rem 0 2rem; max-width: 48rem; }
.sk-panel { height: 12rem; margin-top: 1.25rem; border-radius: var(--radius-2xl); }
.sk-home { padding: 0.5rem 0; }
.sk-hero {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 2rem;
  align-items: center;
}
.sk-portrait {
  aspect-ratio: 3/4;
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius-2xl);
}
.sk-btns { display: flex; gap: 0.6rem; margin-top: 1rem; }
.sk-btn { width: 7rem; height: 2.4rem; border-radius: 999px; }
.sk-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  padding: 0.5rem 0;
}
.sk-card {
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
}
.sk-img {
  height: 10rem;
  border-radius: var(--radius);
  margin-bottom: 0.85rem;
}
@media (max-width: 900px) {
  .sk-hero { grid-template-columns: 1fr; }
  .sk-portrait { max-width: 240px; margin: 0 auto; }
  .sk-cards { grid-template-columns: 1fr; }
}

/* Related articles under detail */
.related-articles {
  width: 100%;
  max-width: min(1320px, 100%);
  margin: 2.5rem auto 1rem;
  padding-top: 0.5rem;
}
.related-articles .grid-3 {
  margin-top: 0.25rem;
}

/* Inline CTA band */
.portal-cta-inline {
  margin-top: 2rem;
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius-2xl);
  background: linear-gradient(135deg, var(--primary-alpha-10), var(--muted));
  border: 1px solid var(--border-alpha-50);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.portal-cta-inline p {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  max-width: 28rem;
}

/* Action bar subtle elevation when scrolled */
.action-bar.is-scrolled {
  box-shadow: var(--shadow-md);
}

/* ===== Full-width content layout fixes ===== */
body {
  /* sidebar right space + balanced left so content isn't stuck to one side */
  padding-right: 5.5rem !important;
  padding-left: 1.25rem !important;
}

#pageRoot.page-container,
.page-container {
  max-width: min(1320px, 100%) !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: clamp(1rem, 3vw, 2rem) !important;
  padding-right: clamp(1rem, 3vw, 2rem) !important;
  box-sizing: border-box;
}

.app-content {
  width: 100%;
  max-width: 100%;
}

.hero-section,
.hero-grid,
.border-section,
.logo-slider-section,
.mission-section,
.grid-3,
.grid-2,
.services-grid {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Soften portrait white wash / reflection */
.hero-portrait-gradient {
  background: linear-gradient(
    to top,
    rgba(243, 246, 249, 0.22) 0%,
    rgba(243, 246, 249, 0.06) 35%,
    transparent 58%
  ) !important;
}

/* Soften card image white overlay (atrajensiya) */
.card-img-overlay {
  background: linear-gradient(
    to top,
    rgba(249, 251, 253, 0.55) 0%,
    rgba(249, 251, 253, 0.18) 38%,
    transparent 72%
  ) !important;
}
.card-project .card-img-overlay {
  background: linear-gradient(
    to top,
    rgba(249, 251, 253, 0.4) 0%,
    rgba(249, 251, 253, 0.12) 32%,
    transparent 68%
  ) !important;
}

/* Slightly less heavy portrait frames */
.hero-portrait-frame-outer {
  border-color: rgba(44, 90, 160, 0.14) !important;
}
.hero-portrait-frame-inner {
  border-color: rgba(44, 90, 160, 0.08) !important;
}

/* Inner pages: use full content column */
.page-wrap,
.app-content > .section-card,
.app-content > .section-header,
.app-content > .section-header-row {
  width: 100%;
  max-width: 100%;
}

/* Section cards for work/services/connect when site.css lacks them */
.section-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  box-sizing: border-box;
}
.section-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--fg);
}
.section-card h3 {
  font-size: 1.05rem;
  margin: 1rem 0 0.4rem;
  color: var(--fg);
}
.section-card p,
.section-card li {
  color: var(--muted-fg);
  line-height: 1.7;
  font-size: 0.95rem;
}

.page-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.service-grid,
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}
.service-card,
.project-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.service-card:hover,
.project-card:hover {
  border-color: var(--primary-alpha-30);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.service-card h3,
.project-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}
.service-card p,
.project-card p {
  font-size: 0.9rem;
  color: var(--muted-fg);
  line-height: 1.55;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
  width: 100%;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  width: 100%;
}
.stat-box {
  text-align: center;
  padding: 0.9rem 0.6rem;
  background: var(--muted);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius);
}
.stat-box strong {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--primary);
}
.stat-box span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-fg);
  font-weight: 600;
}
.page-portrait {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-alpha-50);
}
.about-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  width: 100%;
  align-items: start;
}
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  width: 100%;
  margin-top: 0.85rem;
}
.process-item {
  padding: 1rem;
  background: var(--muted);
  border-radius: var(--radius);
  border: 1px solid var(--border-alpha-50);
}
.process-item .num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.timeline { position: relative; padding-left: 1.4rem; width: 100%; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.35rem;
  top: 0.4rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 0 2px var(--primary-alpha-20);
}
.timeline-period {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.timeline-role {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  margin: 0.15rem 0;
}
.timeline-company {
  font-size: 0.9rem;
  color: var(--muted-fg);
  margin-bottom: 0.35rem;
}
.cv-header-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}
.cv-contact-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: right;
}
.cv-contact-block a { color: var(--primary); text-decoration: none; }
.cv-highlights { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.cv-highlights li { font-size: 0.88rem; color: var(--muted-fg); margin-bottom: 0.35rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--primary-alpha-10);
  color: var(--primary);
}
.social-links, .social-icons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.social-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none !important;
}
.social-icon-link:hover {
  border-color: var(--primary-alpha-30);
  background: var(--primary-alpha-10);
  color: var(--primary);
}
.info-block {
  padding: 1rem;
  background: var(--muted);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.info-block h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.info-block p { font-size: 0.875rem; color: var(--muted-fg); line-height: 1.55; }
.contact-grid .form-group { margin-bottom: 0.75rem; }
.contact-grid label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-fg);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.contact-grid input,
.contact-grid textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font: inherit;
  outline: none;
  box-sizing: border-box;
}
.contact-grid input:focus,
.contact-grid textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha-20);
}
.contact-grid textarea { min-height: 7.5rem; resize: vertical; }
.page-sub { color: var(--muted-fg); line-height: 1.65; }
.page-overline {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.4rem;
}
.page-name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 0.5rem;
}
.page-cta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

@media (max-width: 900px) {
  body {
    padding-right: 4.25rem !important;
    padding-left: 0.75rem !important;
  }
  .service-grid,
  .project-grid,
  .contact-grid,
  .about-grid,
  .process-grid {
    grid-template-columns: 1fr !important;
  }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  body {
    padding-right: 4rem !important;
    padding-left: 0.5rem !important;
  }
}
@media (max-width: 520px) {
  .stats-row { grid-template-columns: 1fr; }
}

.portal-search {
  margin-top: 4.5rem;
}
.portal-search .page-container {
  max-width: min(1320px, 100%) !important;
}
.wos-search-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-fg);
  margin-bottom: 0.5rem;
}
.portal-search-row {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.portal-search-row select {
  border: none;
  border-right: 1px solid var(--border);
  padding: 0 0.9rem;
  background: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  min-width: 8rem;
}
.portal-search-row input {
  flex: 1;
  border: none;
  padding: 0.85rem 1rem;
  outline: none;
  font-size: 0.95rem;
  background: transparent;
  min-width: 0;
}
.portal-search-row button {
  border: none;
  border-radius: 0;
  padding: 0 1.25rem;
}

/* Insights list using site cards */
.portal-insights-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.portal-side {
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 5.5rem;
}
.portal-side-head {
  padding: 0.85rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-fg);
  border-bottom: 1px solid var(--border-alpha-50);
  background: var(--muted);
}
.portal-side-body { padding: 0.5rem; }
.portal-filter {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
}
.portal-filter:hover { background: var(--secondary-alpha-60); }
.portal-filter.active {
  background: var(--primary-alpha-10);
  color: var(--primary);
  font-weight: 600;
}
.portal-main {
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.portal-main-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-alpha-50);
}
.portal-main-head h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--fg);
}
.portal-main-meta { font-size: 0.875rem; color: var(--muted-fg); }
.portal-main-meta strong { color: var(--fg); }
.portal-pager {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem;
  border-top: 1px solid var(--border-alpha-50);
}
.portal-pager button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary);
  font-family: inherit;
}
.portal-pager button:disabled { opacity: 0.4; cursor: default; }

/* HTML pages list */
.html-page-list { display: flex; flex-direction: column; gap: 0.75rem; }
.html-page-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
}
.html-page-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
  color: var(--fg);
}
.html-page-card-meta {
  font-size: 0.8rem;
  color: var(--muted-fg);
  margin-bottom: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.html-page-card-path {
  font-family: ui-monospace, monospace;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.html-page-card-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted-fg);
  line-height: 1.55;
}

/* Auth pages when using site.css */
.wos-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.wos-auth-card {
  width: min(440px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.wos-auth-head {
  background: linear-gradient(135deg, var(--primary), hsl(220, 70%, 50%));
  color: var(--primary-fg);
  padding: 1.5rem 1.5rem 1.25rem;
}
.wos-auth-head h1 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.wos-auth-head p { opacity: 0.9; font-size: 0.9rem; }
.wos-auth-body { padding: 1.5rem; }
.wos-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  background: var(--muted);
  padding: 0.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.1rem;
}
.wos-tab {
  border: none;
  background: transparent;
  padding: 0.6rem;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted-fg);
  font-family: inherit;
}
.wos-tab.active {
  background: var(--card-bg);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}
.wos-field { margin-bottom: 0.9rem; }
.wos-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-fg);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wos-field input, .wos-field textarea, .wos-field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font: inherit;
  outline: none;
}
.wos-field input:focus, .wos-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha-20);
}
.wos-otp-input {
  text-align: center;
  letter-spacing: 0.3em;
  font-size: 1.35rem !important;
  font-weight: 700;
}
.wos-alert {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 0.9rem;
}
.wos-alert-error { background: #fdecea; color: #8a1f11; }
.wos-alert-ok { background: #e8f6ee; color: #145a32; }
.wos-alert-info { background: var(--primary-alpha-10); color: var(--primary); }
.wos-help { font-size: 0.8rem; color: var(--muted-fg); margin-top: 0.5rem; }
.wos-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.wos-btn-primary, .wos-btn-blue {
  background: var(--primary);
  color: var(--primary-fg);
}
.wos-btn-outline, .wos-btn-ghost {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--fg);
}
.wos-btn-block { width: 100%; }
.wos-btn-sm { padding: 0.45rem 0.8rem; font-size: 0.8rem; }

/* Lightbox minimal */
body.lb-open { overflow: hidden; }
.img-zoomable { cursor: zoom-in; }
.img-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  opacity: 0; visibility: hidden; pointer-events: none; transition: 0.28s;
}
.img-lightbox.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
.img-lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 25, 40, 0.72);
  backdrop-filter: blur(10px);
}
.img-lightbox-stage {
  position: relative; z-index: 1; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 1rem;
}
.img-lightbox-panel { margin: 0; max-width: min(960px, 94vw); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.img-lightbox-frame { position: relative; pointer-events: auto; border-radius: 1rem; overflow: hidden; max-width: 100%; box-shadow: var(--shadow-xl); }
.img-lightbox-img { display: block; max-width: min(94vw, 960px); max-height: 75vh; object-fit: contain; background: #111; }
.img-lightbox-spinner { display: none; }
.img-lightbox-caption { margin-top: 0.75rem; color: #fff; font-size: 0.9rem; text-align: center; pointer-events: none; }
.img-lightbox-caption[hidden] { display: none !important; }
.img-lightbox-hint { margin-top: 0.75rem; color: rgba(255,255,255,0.55); font-size: 0.75rem; pointer-events: none; }
.img-lightbox-close {
  position: fixed; top: 1rem; right: 1rem; z-index: 3;
  width: 2.5rem; height: 2.5rem; border: none; border-radius: 50%;
  background: #fff; cursor: pointer; box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
}

/* Cabinet */
.cab-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.25rem;
}
.cab-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.cab-stat {
  background: var(--card-bg);
  border: 1px solid var(--border-alpha-50);
  border-radius: var(--radius-2xl);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.cab-stat strong { display: block; font-size: 1.5rem; color: var(--primary); font-family: 'Playfair Display', serif; }
.cab-stat span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-fg); font-weight: 600; }
.cab-toolbar { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.cab-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; background: var(--card-bg); border-radius: var(--radius-2xl); overflow: hidden; border: 1px solid var(--border-alpha-50); }
.cab-table th, .cab-table td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border-alpha-50); text-align: left; }
.cab-table th { background: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-fg); }
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; }
.badge-green { background: #e5f6ec; color: #1a7a34; }
.badge-gray { background: var(--muted); color: var(--muted-fg); }
.badge-orange { background: var(--primary-alpha-10); color: var(--primary); }

.wos-toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  background: var(--fg); color: var(--bg);
  padding: 0.7rem 1.25rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600;
  opacity: 0; transition: 0.28s; z-index: 9999; pointer-events: none;
}
.wos-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Article detail — centered full readable column ===== */
.app-content.article-view,
.article-view {
  width: 100% !important;
  max-width: min(820px, 100%) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box;
  display: block;
}

.article-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  background: none;
  color: var(--muted-fg);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0.35rem 0;
}
.back-link:hover { color: var(--primary); }
.back-link svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-pill {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-fg);
}

.article-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--fg);
  margin-bottom: 0.75rem;
  width: 100%;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: 0.9rem;
  color: var(--muted-fg);
  margin-bottom: 0.5rem;
  width: 100%;
}
.article-meta-item strong { color: var(--fg); font-weight: 600; }

.featured-img {
  width: 100%;
  aspect-ratio: 21/9;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin: 1.5rem 0 2rem;
  background: var(--secondary);
}
.featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-prose,
.article-view .body,
.article-prose.body {
  width: 100% !important;
  max-width: 100% !important;
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--fg);
  box-sizing: border-box;
}
.article-prose p,
.article-view .body p {
  margin-bottom: 1.25rem;
  max-width: none;
}
.article-prose img,
.article-view .body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-2xl);
  margin: 1.25rem 0;
  display: block;
}
.article-prose h2,
.article-view .body h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--fg);
  margin: 2rem 0 0.75rem;
}
.article-prose h3,
.article-view .body h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--fg);
  margin: 1.5rem 0 0.5rem;
}
.article-prose a,
.article-view .body a { color: var(--primary); }
.article-prose blockquote,
.article-view .body blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  background: var(--primary-alpha-5);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}

.article-share-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-alpha-50);
  width: 100%;
}
.article-share-footer p {
  font-size: 0.9rem;
  color: var(--muted-fg);
  margin-bottom: 0.75rem;
}

/* ===== Theme toggle icons ===== */
#themeToggle .theme-icon-sun,
#themeToggle .theme-icon-moon {
  width: 1.15rem;
  height: 1.15rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Article engage: like / print / share ===== */
.article-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.article-engage {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 2rem 0 1.5rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--border-alpha-50);
  border-bottom: 1px solid var(--border-alpha-50);
}
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.12s;
}
.like-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.like-btn strong {
  font-weight: 700;
  color: var(--primary);
}
.like-btn:hover {
  border-color: var(--primary-alpha-40);
  background: var(--primary-alpha-5);
  transform: translateY(-1px);
}
.like-btn.is-liked {
  border-color: hsl(0, 70%, 55%);
  background: hsla(0, 70%, 55%, 0.08);
  color: hsl(0, 65%, 42%);
}
.like-btn.is-liked svg { fill: currentColor; stroke: currentColor; }
.like-btn.is-liked strong { color: hsl(0, 65%, 42%); }

/* ===== Comments ===== */
.comments-section {
  margin: 2rem 0 1rem;
  width: 100%;
}
.comments-count {
  font-weight: 500;
  color: var(--muted-fg);
  font-size: 0.9em;
}
.comment-form {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  padding: 1.15rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-alpha-50);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.comment-form .form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted-fg);
  margin-bottom: 0.35rem;
}
.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  resize: vertical;
}
.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha-10);
}
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.comment-item {
  padding: 0.95rem 1.05rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-alpha-50);
  background: var(--muted-alpha-30);
}
.comment-item.is-new {
  border-color: var(--primary-alpha-30);
  background: var(--primary-alpha-5);
}
.comment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.comment-head strong { color: var(--fg); font-size: 0.95rem; }
.comment-head time { font-size: 0.75rem; color: var(--muted-fg); }
.comment-body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--fg);
  white-space: pre-wrap;
}
.comments-empty {
  color: var(--muted-fg);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* ===== Newsletter ===== */
.newsletter-block {
  margin: 2.5rem 0 1rem;
}
.newsletter-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.6rem;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-alpha-50);
  background:
    linear-gradient(135deg, var(--primary-alpha-5), transparent 55%),
    var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.newsletter-inner h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
  color: var(--fg);
}
.newsletter-inner p {
  margin: 0;
  color: var(--muted-fg);
  font-size: 0.9rem;
  max-width: 36rem;
}
.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: min(100%, 320px);
  flex: 1 1 280px;
  justify-content: flex-end;
}
.newsletter-form input[type="email"] {
  flex: 1 1 180px;
  min-width: 0;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.newsletter-form input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha-10);
}
.newsletter-form .btn { border-radius: 999px; white-space: nowrap; }

/* ===== Print / PDF ===== */
@media print {
  .sidebar,
  .action-bar,
  .mail-fab,
  .toast,
  .portal-search,
  .read-progress,
  .no-print,
  .related-articles,
  .newsletter-block,
  .comments-section,
  .article-engage,
  .article-toolbar {
    display: none !important;
  }
  body {
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }
  .page-container {
    max-width: 100% !important;
    padding: 0.5rem !important;
    margin: 0 !important;
  }
  .article-view {
    max-width: 100% !important;
    margin: 0 !important;
  }
  .article-title { color: #000 !important; }
  .article-prose, .article-view .body {
    color: #111 !important;
    font-size: 11pt !important;
    line-height: 1.55 !important;
  }
  .article-prose a, .article-view .body a {
    color: #000 !important;
    text-decoration: underline;
  }
  .featured-img img { max-height: 280px; object-fit: cover; }
  .print-source {
    margin-top: 1.5rem;
    font-size: 9pt;
    color: #444;
    word-break: break-all;
  }
  a[href]::after { content: none !important; }
  .ai-fab { display: none !important; }
}

/* ============================================================
   Jude — Claude-inspired chat + logo mark (starburst + J)
   ============================================================ */

.jude-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--s, 28px);
  height: var(--s, 28px);
  flex-shrink: 0;
  vertical-align: middle;
}
.jude-mark-rays {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--myai-accent, #c96442);
  opacity: 0.42;
}
.jude-mark-core {
  position: relative;
  z-index: 1;
  width: 48%;
  height: 48%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--myai-surface, #faf9f5);
  border: 1.5px solid var(--myai-accent, #c96442);
  box-shadow: 0 1px 2px rgba(20, 20, 19, 0.06);
}
.jude-mark-j {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: calc(var(--s, 28px) * 0.34);
  line-height: 1;
  color: var(--myai-accent, #c96442);
  letter-spacing: -0.03em;
  transform: translateY(0.5px);
}
.jude-mark-nav {
  --s: 1.15rem;
  color: inherit;
}
.sidebar-link .jude-mark-nav .jude-mark-rays {
  color: currentColor;
  opacity: 0.45;
}
.sidebar-link .jude-mark-nav .jude-mark-core {
  background: var(--glass-bg, #fff);
  border-color: currentColor;
}
.sidebar-link .jude-mark-nav .jude-mark-j {
  color: currentColor;
  font-size: 0.55rem;
}
.sidebar-link.active .jude-mark-nav .jude-mark-j,
.sidebar-link:hover .jude-mark-nav .jude-mark-j {
  color: var(--primary, #2c5aa0);
}
.ai-fab-core .jude-mark {
  --s: 32px;
}
.ai-fab-core .jude-mark-rays {
  opacity: 0.55;
  color: var(--myai-accent, #c96442);
}
.ai-fab-core .jude-mark-core {
  background: #fff;
  border-width: 1.5px;
}
[data-theme="dark"] .ai-fab-core .jude-mark-core,
[data-theme="dark"] .jude-mark-core {
  background: var(--myai-surface-2, #242421);
}
.myai-brand-mark {
  background: transparent !important;
  width: auto !important;
  height: auto !important;
  padding: 0;
}
.myai-brand-mark .jude-mark { --s: 28px; }
.myai-welcome-orb {
  background: transparent !important;
  box-shadow: none !important;
  width: auto !important;
  height: auto !important;
  animation: none !important;
}
.myai-welcome-orb .jude-mark { --s: 56px; }
.myai-welcome-orb .jude-mark-rays { opacity: 0.5; }
.ai-msg-label .jude-mark { --s: 16px; margin-right: 0.15rem; }
.ai-msg-label .jude-mark-j { font-size: calc(var(--s) * 0.36); }

:root {
  --myai-accent: #c96442;
  --myai-accent-soft: rgba(201, 100, 66, 0.12);
  --myai-accent-mid: rgba(201, 100, 66, 0.22);
  --myai-surface: #faf9f5;
  --myai-surface-2: #f3f1ea;
  --myai-ink: #141413;
  --myai-ink-soft: #5e5d59;
  --myai-line: rgba(20, 20, 19, 0.08);
  --myai-user-bg: #e8e6dc;
  --myai-shadow: 0 1px 2px rgba(20, 20, 19, 0.04), 0 8px 28px rgba(20, 20, 19, 0.06);
}

[data-theme="dark"] {
  --myai-accent: #e08a6a;
  --myai-accent-soft: rgba(224, 138, 106, 0.14);
  --myai-accent-mid: rgba(224, 138, 106, 0.28);
  --myai-surface: #1a1a18;
  --myai-surface-2: #242421;
  --myai-ink: #f5f4ef;
  --myai-ink-soft: #a8a69e;
  --myai-line: rgba(245, 244, 239, 0.09);
  --myai-user-bg: #2c2c28;
  --myai-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 12px 32px rgba(0, 0, 0, 0.28);
}

/* ----- FAB bottom-left ----- */
.ai-fab {
  position: fixed;
  bottom: 1.65rem;
  left: 1.15rem;
  z-index: 55;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.ai-fab-waves {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ai-fab-wave {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--myai-accent);
  opacity: 0;
  animation: aiWave 3s cubic-bezier(0.2, 0.7, 0.2, 1) infinite;
}
.ai-fab-wave:nth-child(2) { animation-delay: 1s; }
.ai-fab-wave:nth-child(3) { animation-delay: 2s; }
@keyframes aiWave {
  0%   { transform: scale(0.92); opacity: 0.5; }
  100% { transform: scale(2.5); opacity: 0; }
}
.ai-fab-core {
  position: relative;
  z-index: 2;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--myai-surface);
  border: 1px solid var(--myai-line);
  box-shadow: var(--myai-shadow), 0 0 0 4px var(--myai-accent-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.ai-fab-core svg {
  width: 1.45rem;
  height: 1.45rem;
  color: var(--myai-accent);
}
.ai-fab-label {
  position: absolute;
  left: calc(100% + 0.65rem);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  opacity: 0;
  pointer-events: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--myai-surface);
  color: var(--myai-ink);
  border: 1px solid var(--myai-line);
  box-shadow: var(--myai-shadow);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ai-fab:hover .ai-fab-core {
  transform: scale(1.05);
  background: #fff;
  box-shadow: var(--myai-shadow), 0 0 0 6px var(--myai-accent-mid);
}
[data-theme="dark"] .ai-fab:hover .ai-fab-core { background: var(--myai-surface-2); }
.ai-fab:hover .ai-fab-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
body.myai-open .ai-fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ----- Full-page Claude chat ----- */
body.myai-open {
  background: var(--myai-surface) !important;
}
body.myai-open #pageRoot.page-container {
  max-width: 100%;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}
body.myai-open .action-bar,
body.myai-open .mail-fab {
  opacity: 0;
  pointer-events: none;
}

.myai-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  background: var(--myai-surface);
  color: var(--myai-ink);
  position: relative;
}

.myai-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: color-mix(in srgb, var(--myai-surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}
.myai-shell.has-messages .myai-topbar {
  border-bottom-color: var(--myai-line);
}
.myai-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.myai-brand-mark {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.45rem;
  display: grid;
  place-items: center;
  color: var(--myai-accent);
  background: var(--myai-accent-soft);
}
.myai-brand-mark svg { width: 1.05rem; height: 1.05rem; }
.myai-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}
.myai-brand-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--myai-ink);
}
.myai-brand-sub {
  font-size: 0.72rem;
  color: var(--myai-ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(42vw, 16rem);
}
.myai-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ai-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding-left: 0.1rem;
}
.ai-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--myai-line);
  background: transparent;
  color: var(--myai-ink-soft);
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ai-act-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ai-act-btn:hover:not(:disabled) {
  background: var(--myai-surface-2);
  color: var(--myai-ink);
  border-color: color-mix(in srgb, var(--myai-ink) 14%, transparent);
}
.ai-act-btn.is-liked {
  color: #c96442;
  border-color: rgba(201, 100, 66, 0.35);
  background: rgba(201, 100, 66, 0.08);
}
.ai-act-btn.is-liked svg { fill: currentColor; }
.ai-act-btn:disabled { opacity: 0.45; cursor: default; }
.ai-like-count {
  font-weight: 700;
  font-size: 0.72rem;
  min-width: 0.5rem;
}
@media (max-width: 720px) {
  .myai-top-actions .myai-icon-btn span { display: none; }
  .myai-top-actions .myai-icon-btn { padding: 0.45rem 0.55rem; }
}
.myai-top-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.myai-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--myai-line);
  background: transparent;
  color: var(--myai-ink-soft);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.myai-icon-btn:hover {
  background: var(--myai-surface-2);
  color: var(--myai-ink);
  border-color: color-mix(in srgb, var(--myai-ink) 14%, transparent);
}
.myai-icon-btn svg {
  width: 0.95rem;
  height: 0.95rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.myai-banner {
  max-width: 48rem;
  width: calc(100% - 2rem);
  margin: 0.5rem auto 0;
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  background: var(--myai-accent-soft);
  color: var(--myai-ink);
  font-size: 0.88rem;
  line-height: 1.45;
  border: 1px solid var(--myai-accent-mid);
}

.myai-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.myai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  scroll-behavior: smooth;
}
.myai-thread {
  max-width: 48rem;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding-bottom: 0.5rem;
}

.myai-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.25rem 2rem;
  max-width: 40rem;
  margin: 0 auto;
  width: 100%;
  min-height: min(58vh, 520px);
}
.myai-welcome-orb {
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1.5rem;
  border-radius: 0.85rem;
  display: grid;
  place-items: center;
  color: var(--myai-accent);
  background: var(--myai-accent-soft);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--myai-accent) 6%, transparent);
  animation: myaiOrb 4s ease-in-out infinite;
}
@keyframes myaiOrb {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--myai-accent) 6%, transparent);
  }
  50% {
    transform: translateY(-3px);
    box-shadow: 0 0 0 14px color-mix(in srgb, var(--myai-accent) 4%, transparent);
  }
}
.myai-welcome-orb svg { width: 1.55rem; height: 1.55rem; }
.myai-welcome h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 0.65rem;
  color: var(--myai-ink);
}
.myai-welcome-sub {
  margin: 0 0 1.75rem;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--myai-ink-soft);
  max-width: 28rem;
}
.myai-hints {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  width: 100%;
  max-width: 26rem;
}
@media (min-width: 560px) {
  .myai-hints {
    grid-template-columns: 1fr 1fr;
    max-width: 32rem;
  }
  .myai-hints .myai-hint:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
.myai-hint {
  text-align: left;
  border: 1px solid var(--myai-line);
  background: color-mix(in srgb, var(--myai-surface) 70%, #fff);
  color: var(--myai-ink);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
[data-theme="dark"] .myai-hint {
  background: var(--myai-surface-2);
}
.myai-hint:hover {
  border-color: var(--myai-accent-mid);
  background: var(--myai-accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--myai-shadow);
}

.ai-msg {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  animation: aiMsgIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 100%;
}
@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.ai-msg-user { align-items: flex-end; }
.ai-msg-assistant { align-items: flex-start; }
.ai-msg-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--myai-ink-soft);
}
.ai-msg-assistant .ai-msg-label { color: var(--myai-accent); }
.ai-msg-label svg {
  width: 0.9rem;
  height: 0.9rem;
}
.ai-bubble {
  max-width: min(100%, 42rem);
  font-size: 1.02rem;
  line-height: 1.72;
  color: var(--myai-ink);
  word-break: break-word;
  letter-spacing: 0.005em;
}
.ai-msg-user .ai-bubble {
  background: var(--myai-user-bg);
  padding: 0.85rem 1.15rem;
  border-radius: 1.35rem 1.35rem 0.4rem 1.35rem;
  font-size: 0.98rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ai-msg-assistant .ai-bubble {
  background: transparent;
  padding: 0.2rem 0 0.35rem;
  max-width: 100%;
}

/* Structured answer prose */
.ai-prose {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.ai-prose > *:first-child { margin-top: 0; }
.ai-prose > *:last-child { margin-bottom: 0; }
.ai-p {
  margin: 0;
  line-height: 1.75;
}
.ai-h {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0.35rem 0 0;
  color: var(--myai-ink);
}
h3.ai-h { font-size: 1.22rem; }
h4.ai-h { font-size: 1.1rem; }
h5.ai-h { font-size: 1.02rem; font-family: inherit; font-weight: 650; }
.ai-ul,
.ai-ol {
  margin: 0.1rem 0 0.15rem;
  padding: 0.15rem 0 0.15rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ai-ul { list-style: disc; }
.ai-ol { list-style: decimal; }
.ai-ul li,
.ai-ol li {
  margin: 0;
  padding-left: 0.15rem;
  line-height: 1.65;
}
.ai-ul li::marker,
.ai-ol li::marker {
  color: var(--myai-accent);
}
.ai-quote {
  margin: 0.15rem 0;
  padding: 0.7rem 0.95rem;
  border-left: 3px solid var(--myai-accent);
  background: var(--myai-accent-soft);
  border-radius: 0 0.75rem 0.75rem 0;
  color: var(--myai-ink);
  font-style: normal;
  line-height: 1.65;
}
.ai-hr {
  border: none;
  height: 1px;
  margin: 0.35rem 0;
  background: var(--myai-line);
}
.ai-link {
  color: var(--myai-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ai-link:hover { opacity: 0.85; }
.ai-prose strong {
  font-weight: 650;
  color: var(--myai-ink);
}
.ai-prose em { font-style: italic; }

.ai-code {
  margin: 0.15rem 0;
  padding: 0.95rem 1.05rem;
  border-radius: 0.9rem;
  background: var(--myai-surface-2);
  border: 1px solid var(--myai-line);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.ai-code code {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}
.ai-inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.12em 0.4em;
  border-radius: 0.35rem;
  background: var(--myai-surface-2);
  border: 1px solid var(--myai-line);
}
.ai-msg-user .ai-inline-code {
  background: color-mix(in srgb, var(--myai-ink) 6%, transparent);
  border-color: transparent;
}

.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0;
  color: var(--myai-ink-soft);
}
.ai-typing-dots {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
}
.ai-typing-dots span {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--myai-accent);
  animation: aiDot 1.2s ease-in-out infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
.ai-typing em {
  font-style: normal;
  font-size: 0.88rem;
  color: var(--myai-ink-soft);
}
@keyframes aiDot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.myai-composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 0 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--myai-surface) 28%);
}
.myai-composer {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem 0.65rem 1.05rem;
  border-radius: 1.65rem;
  background: #fff;
  border: 1px solid var(--myai-line);
  box-shadow: var(--myai-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
[data-theme="dark"] .myai-composer {
  background: var(--myai-surface-2);
}
.myai-composer:focus-within {
  border-color: color-mix(in srgb, var(--myai-accent) 45%, var(--myai-line));
  box-shadow: var(--myai-shadow), 0 0 0 3px var(--myai-accent-soft);
}
.myai-composer textarea {
  flex: 1;
  min-height: 1.5rem;
  max-height: 160px;
  resize: none;
  border: none;
  background: transparent;
  padding: 0.55rem 0.25rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--myai-ink);
  outline: none;
}
.myai-composer textarea::placeholder {
  color: color-mix(in srgb, var(--myai-ink-soft) 80%, transparent);
}
.myai-send {
  width: 2.45rem;
  height: 2.45rem;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--myai-accent);
  color: #fff;
  transition: transform 0.12s, opacity 0.12s, background 0.15s;
}
.myai-send svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.myai-send:hover:not(:disabled) {
  transform: scale(1.05);
  background: color-mix(in srgb, var(--myai-accent) 88%, #000);
}
.myai-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.myai-footnote {
  text-align: center;
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: var(--myai-ink-soft);
  opacity: 0.85;
}

@media (max-width: 640px) {
  .ai-fab { bottom: 1.2rem; left: 0.85rem; width: 3.2rem; height: 3.2rem; }
  .ai-fab-core { width: 3.2rem; height: 3.2rem; }
  .myai-topbar { padding: 0.75rem 0.9rem; }
  .myai-messages { padding: 0.75rem 0.9rem 1rem; }
  .myai-composer-wrap { padding-left: 0.85rem; padding-right: 0.85rem; }
  .myai-welcome { padding-top: 2rem; min-height: min(50vh, 420px); }
  .myai-welcome h2 { font-size: 1.55rem; }
  .ai-msg-user .ai-bubble { max-width: 92%; }
}

/* legacy record (if any) — also centered */
.wos-record {
  width: 100%;
  max-width: min(820px, 100%);
  margin: 0 auto;
  padding: 0.5rem 0 2rem;
  box-sizing: border-box;
}
.wos-record-title { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 0.75rem; }
.wos-record-meta {
  font-size: 0.9rem;
  color: var(--muted-fg);
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--muted);
  border-radius: var(--radius);
}
.wos-record-meta strong { color: var(--fg); }
.wos-record-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--fg);
  width: 100%;
  max-width: 100%;
}
.wos-record-body p { margin-bottom: 1rem; }
.wos-record-body img {
  border-radius: var(--radius-2xl);
  margin: 1rem 0;
  max-width: 100%;
  height: auto;
}
.wos-record-cover {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: var(--radius-2xl);
  margin-bottom: 1.25rem;
}
.wos-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.wos-loading, .loading { padding: 4rem 1rem; text-align: center; color: var(--muted-fg); }
.wos-empty { padding: 3rem 1rem; text-align: center; color: var(--muted-fg); }

@media (max-width: 900px) {
  .portal-insights-shell, .cab-layout { grid-template-columns: 1fr; }
  .portal-side { position: static; }
  .portal-search-row { flex-wrap: wrap; }
  .portal-search-row select { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 0.75rem; }
  .portal-search-row button { width: 100%; padding: 0.75rem; }
  .html-page-card { flex-direction: column; align-items: stretch; }
}
