:root {
  /* FGP CI tokens — must match fulcrum.css */
  --fg-primary: #22849c;
  --fg-secondary: #c5494d;
  --fg-tertiary: #37beca; /* graphic teal-green / cyan */
  --fg-teal: var(--fg-primary);
  --fg-teal-dark: #176579;
  --fg-teal-soft: rgba(34, 132, 156, 0.12);
  --fg-cyan: var(--fg-tertiary);
  --fg-cyan-soft: color-mix(in srgb, var(--fg-tertiary) 16%, #ffffff);
  --fg-cyan-soft-strong: color-mix(in srgb, var(--fg-tertiary) 24%, #ffffff);
  --fg-crimson: var(--fg-secondary);
  --fg-orange: #ff8c64;
  --fg-salmon: #f2af9d;
  --fg-grey: #b2b2b2;
  --fg-grey-mid: #7f7f7f;
  --fg-grey-deep: #555555;
  --fg-rich-black: #1a1a1a;
  --fg-paper: #f5f8fa;
  --fg-elevated: #eef5f7;
  --fg-white: #ffffff;
  --fg-ink: var(--fg-rich-black);
  --fg-muted: var(--fg-grey-mid);
  --fg-line: #d8dfdf;
  --fg-line-strong: color-mix(in srgb, var(--fg-grey) 55%, #d8dfdf);
  --fg-danger: var(--fg-crimson);
  --fg-radius: 8px;
  --fg-radius-sm: 4px;
  --fg-shadow: 0 8px 20px rgba(34, 132, 156, 0.1);
  --fg-shadow-lg: 0 14px 32px rgba(34, 132, 156, 0.16);
  --fg-shadow-focus: 0 0 0 3px var(--fg-teal-soft);

  /* Project brand accent (override per project via --project-accent) */
  --project-accent: var(--fg-primary);
  --project-accent-soft: color-mix(in srgb, var(--project-accent) 16%, transparent);
  --project-accent-dim: color-mix(in srgb, var(--project-accent) 55%, transparent);

  --bg: var(--fg-paper);
  --bg-banner: rgba(255, 255, 255, 0.94);
  --bg-tabs: #ffffff;
  --bg-panel: #ffffff;
  --bg-elevated: var(--fg-elevated);
  --bg-glass: rgba(255, 255, 255, 0.78);
  --text: var(--fg-ink);
  --text-muted: var(--fg-muted);
  --gold: var(--project-accent);
  --gold-dim: var(--project-accent-dim);
  --gold-glow: var(--project-accent-soft);
  --border: var(--fg-line);
  --on-accent: #ffffff;
  --radius: var(--fg-radius);
  --radius-sm: var(--fg-radius-sm);
  --banner-h: 64px;
  --tabs-h: 48px;
  /* FGP CI: Red Hat Display — Thin (300) body / Regular (400) headings */
  --font-serif: "Red Hat Display", Arial, Helvetica, sans-serif;
  --font-sans: "Red Hat Display", Arial, Helvetica, sans-serif;
  --overlay-rgb: 26, 35, 48;

  /* Media / immersive surfaces stay dark (scoped onto .dive etc.) */
  --media-bg: #0a0c10;
  --media-panel: #0c0e14;
  --media-text: #f5f7f8;
  --media-muted: rgba(245, 247, 248, 0.82);
  --media-border: rgba(55, 190, 202, 0.28);
  --media-overlay-rgb: 8, 28, 36;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  background-color: var(--fg-paper);
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  font-weight: 300; /* FGP CI: Thin for body text */
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Fulcrum library pages (Why Thailand, Projects) load main.css for tool modals
   but must keep document scroll. Toolkit shells keep overflow:hidden above.
   !important beats the toolkit body { overflow:hidden } rule when both sheets load. */
body.fg-body {
  height: auto !important;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y manipulation;
}

/* Standalone / Add to Home Screen — letterbox matches Fulcrum paper */
@media (display-mode: standalone) {
  html,
  body {
    background-color: var(--fg-paper);
  }

  .app-shell {
    padding-top: max(20px, env(safe-area-inset-top, 0px));
  }
}

img { max-width: 100%; display: block; }
a { color: var(--fg-teal-dark); text-decoration: none; }

.eyebrow {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.62rem;
  color: var(--gold);
  margin: 0 0 0.4rem;
}

/* ── Shell ── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  background: var(--bg);
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Project workspace: Fulcrum-light chrome + tools rail */
.project-shell {
  display: grid;
  grid-template-columns: 5.05rem minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

/*
  Project toolkit sits under Marketing Studio .fg-topbar (and used to also
  claim 100dvh). That pushed .app-main + tiles past the physical viewport.
  Lock the body and let .project-shell fill the remaining flex space.
*/
body.fg-body.project-workspace {
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

body.fg-body.project-workspace > .fg-topbar {
  flex-shrink: 0;
}

body.fg-body.project-workspace > .fg-footer {
  display: none;
}

/* Direct child (no outer tools ribbon) */
body.fg-body.project-workspace > .project-shell {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
}

/* Outer tools ribbon must sit as a LEFT column beside the workspace —
   not stacked above it (block + padding-left left an empty top band). */
body.fg-body.project-workspace > .fg-agent-shell.has-tools-rail {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  min-height: 0 !important;
  height: auto !important;
  max-height: none;
  align-items: stretch;
  overflow: hidden;
  padding-left: 0;
  box-sizing: border-box;
}

body.fg-body.project-workspace > .fg-agent-shell.has-tools-rail > .fg-library-tools-rail {
  position: relative;
  top: 0;
  left: auto;
  bottom: auto;
  flex: 0 0 var(--fg-tools-rail-w, 4.75rem);
  width: var(--fg-tools-rail-w, 4.75rem);
  align-self: stretch;
  height: auto;
  max-height: none;
  z-index: 5;
}

body.fg-body.project-workspace > .fg-agent-shell.has-tools-rail > .fg-agent-shell-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.fg-body.project-workspace .project-shell {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: none;
}

body.fg-body.project-workspace .project-main.app-shell {
  /* Studio topbar already owns safe-area; don't double-pad */
  padding-top: 0;
  height: 100%;
  min-height: 0;
}

/* Marketing Studio: no sales-agent tools rail — full-width main */
.project-shell.project-shell-no-tools-rail {
  grid-template-columns: minmax(0, 1fr);
}

.project-tools-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.35rem;
  padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
  /* Distinct tools chrome vs page paper */
  background:
    linear-gradient(180deg, rgba(34, 133, 157, 0.16) 0%, rgba(34, 133, 157, 0.08) 55%, rgba(26, 106, 124, 0.1) 100%),
    #cfe3ea;
  border-right: 1px solid #9ec5d0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.45);
  z-index: 50;
  overflow-y: auto;
}

.project-tools-rail .rail-home,
.project-tools-rail .rail-btn {
  width: 4.15rem;
  min-height: 3.9rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.12;
  padding: 0.4rem 0.15rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  text-align: center;
  text-decoration: none;
  flex-shrink: 0;
}

.project-tools-rail .rail-home {
  background: var(--fg-teal-soft);
  border-color: #b7d6de;
  color: var(--fg-teal-dark);
  margin-bottom: 0.25rem;
}

.project-tools-rail .rail-btn:hover,
.project-tools-rail .rail-home:hover {
  color: var(--fg-teal-dark);
  border-color: #b7d6de;
  background: var(--fg-teal-soft);
}

.project-tools-rail .rail-btn:focus-visible,
.project-tools-rail .rail-home:focus-visible {
  outline: 2px solid var(--fg-teal);
  outline-offset: 2px;
}

.project-tools-rail .rail-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
  background: currentColor;
  opacity: 0.9;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.project-tools-rail .rail-icon-lib {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19.5V6.5A2.5 2.5 0 0 1 6.5 4H20v15.5a2.5 2.5 0 0 0-2.5-2.5H6.5A2.5 2.5 0 0 0 4 19.5z'/%3E%3Cpath d='M8 8h8M8 12h6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19.5V6.5A2.5 2.5 0 0 1 6.5 4H20v15.5a2.5 2.5 0 0 0-2.5-2.5H6.5A2.5 2.5 0 0 0 4 19.5z'/%3E%3Cpath d='M8 8h8M8 12h6'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-chat {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-hold {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 10.5 12 3l9 7.5V21a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 10.5 12 3l9 7.5V21a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-visit {
  /* Storefront / sales-gallery entrance (not a photo/camera glyph) */
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l2-5h14l2 5'/%3E%3Cpath d='M3 9v12h18V9'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M9 21v-8h6v8'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l2-5h14l2 5'/%3E%3Cpath d='M3 9v12h18V9'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M9 21v-8h6v8'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-call {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M15 10a3 3 0 1 0-6 0'/%3E%3Cpath d='M12 2a8 8 0 0 0-8 8v1a3 3 0 0 0 3 3h1l2 5h4l2-5h1a3 3 0 0 0 3-3v-1a8 8 0 0 0-8-8z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M15 10a3 3 0 1 0-6 0'/%3E%3Cpath d='M12 2a8 8 0 0 0-8 8v1a3 3 0 0 0 3 3h1l2 5h4l2-5h1a3 3 0 0 0 3-3v-1a8 8 0 0 0-8-8z'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-home {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-support {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-country {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a15 15 0 0 1 0 18M12 3a15 15 0 0 0 0 18'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a15 15 0 0 1 0 18M12 3a15 15 0 0 0 0 18'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-price {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M8 13h8M8 17h5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M8 13h8M8 17h5'/%3E%3C/svg%3E");
}
.project-tools-rail .rail-icon-pm-hold {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

.project-tools-rail .rail-spacer { flex: 1 1 auto; min-height: 0.5rem; }

.project-tools-rail .banner-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
}

.project-tools-rail .rail-btn {
  position: relative;
}

.project-tools-rail .rail-btn-accent {
  background: var(--project-accent-soft);
  border-color: color-mix(in srgb, var(--project-accent) 40%, transparent);
  color: var(--project-accent);
}

.project-tools-rail .rail-btn-accent:hover {
  background: color-mix(in srgb, var(--project-accent) 22%, transparent);
  color: var(--fg-ink);
}

.project-main.app-shell {
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* Narrow phones: top tools strip (never right). iPad keeps left column. */
@media (max-width: 767px) {
  .project-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .project-tools-rail {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.35rem;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid #9ec5d0;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.55);
    padding: 0.45rem 0.55rem;
    -webkit-overflow-scrolling: touch;
  }

  .project-tools-rail .rail-home,
  .project-tools-rail .rail-btn {
    width: auto;
    min-width: 4.25rem;
    min-height: 2.75rem;
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.72rem;
  }

  .project-tools-rail .rail-spacer { display: none; }
  .project-tools-rail .rail-home { margin-bottom: 0; }
}

.app-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--bg-banner);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index: 40;
  flex-wrap: wrap;
}

.banner-auth {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  min-width: 0;
}

.banner-signin {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.banner-signin-input {
  width: 5.25rem;
  min-height: 2rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--fg-white);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
}

.banner-signin-input::placeholder {
  color: var(--text-muted);
}

.btn-banner-auth {
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.7rem;
  white-space: nowrap;
}

.banner-agent-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.banner-agent-label strong,
.banner-signin-error {
  color: var(--gold);
  font-size: 0.68rem;
  white-space: nowrap;
}

.banner-signout-form {
  margin: 0;
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.banner-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem 0.65rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-left: auto;
}

.banner-fg-brand {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--fg-ink);
  margin-right: 0.15rem;
}

.banner-fg-lockup {
  display: block;
  height: 2.15rem;
  width: auto;
  max-width: 9.5rem;
  object-fit: contain;
  object-position: left center;
}

.banner-fg-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 7px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
  object-position: center;
  padding: 0.18rem;
  box-sizing: border-box;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(26, 35, 48, 0.08);
}

.banner-fg-word {
  display: none;
}

@media (min-width: 900px) {
  .banner-fg-word { display: inline; }
}

.banner-library-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 7.75rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid #b7d6de;
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
  color: var(--fg-teal-dark, #176579);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.banner-library-link-soft {
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
  font-weight: 600;
}

.banner-library-link:hover,
.banner-library-link:focus-visible,
.banner-library-link-soft:hover,
.banner-library-link-soft:focus-visible {
  border-color: var(--fg-teal, #22849c);
  color: var(--fg-ink, #1a2330);
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
  outline: none;
}

.call-origin-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
  border: 1px solid #b7d6de;
  color: var(--fg-teal-dark, #176579);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
}

.tool-context-fields {
  display: grid;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.tool-context-fields label,
.res-unit-select-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #5c6570);
}

.tool-context-fields select,
.res-unit-select-label select,
.stack-form select,
.tool-project-select {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text, #1a2330);
  /* Custom chevron inset so the arrow isn’t flush with the right border */
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.5rem;
  background-color: var(--fg-white, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235a6a7a' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}

.tool-context-fields select:focus,
.res-unit-select-label select:focus,
.stack-form select:focus,
.tool-project-select:focus {
  border-color: var(--gold);
  outline: 2px solid var(--gold);
  outline-offset: 0;
}

.res-unit-select-label {
  margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
  .tool-context-fields {
    grid-template-columns: 1fr 1fr;
  }

  .tool-context-fields-project,
  .tool-context-fields .tool-project-field {
    grid-column: 1 / -1;
  }
}

.tool-context-fields-project {
  margin-bottom: 0.25rem;
}

.stack-form .tool-project-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #5c6570);
  margin-bottom: 0.35rem;
}

.stack-form .tool-project-field select {
  /* Inherits shared tool select / chevron styles above */
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 500;
}

.chat-thread-origin {
  display: block;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  margin-top: 0.1rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
  border: 1px solid #b7d6de;
  color: var(--fg-teal-dark, #176579);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner-logo {
  height: 3.35rem;
  width: auto;
  max-width: min(22rem, 52vw);
  object-fit: contain;
  object-position: left center;
  flex-shrink: 1;
  opacity: 1;
}

.banner-text {
  min-width: 0;
}

.banner-eyebrow {
  font-size: 0.55rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.banner-title {
  /* Fulcrum Global display face (Red Hat Display) — typed project name */
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell:not(.is-agent):not(.is-admin):not(.is-pm) .banner-actions {
  display: none !important;
}

.banner-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  flex-shrink: 0;
  width: min(34rem, 46vw);
  overflow: visible;
  padding-top: 0.35rem;
}

.btn-banner {
  width: 100%;
  min-width: 0;
  min-height: 2.35rem;
  padding: 0.4rem 0.35rem;
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  position: relative;
}

.banner-actions-single {
  grid-template-columns: 1fr;
  width: min(9rem, 22vw);
}

.banner-actions-single .btn-banner {
  font-size: 0.72rem;
}

.banner-notify-tag {
  position: absolute;
  top: -0.55rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: #ff2d2d;
  color: #fff;
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(255, 45, 45, 0.55);
  animation: badge-pop 0.9s ease-in-out infinite;
  z-index: 4;
}

.banner-btn-badge.has-notification {
  border: 2px solid #ff3b3b !important;
  background: rgba(255, 59, 59, 0.22) !important;
  color: #fff !important;
  animation: banner-attention 1s ease-in-out infinite;
  z-index: 2;
}

.banner-btn-badge.has-notification::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 12px;
  border: 2px solid rgba(255, 80, 80, 0.55);
  animation: banner-ring 1.2s ease-out infinite;
  pointer-events: none;
}

.banner-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #ff2d2d;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.55rem;
  text-align: center;
  box-shadow:
    0 0 0 3px rgba(255, 45, 45, 0.45),
    0 0 18px rgba(255, 45, 45, 0.75);
  animation: badge-pop 0.9s ease-in-out infinite;
  z-index: 3;
}

.banner-btn-badge.has-notification .banner-badge:not(.hidden) {
  display: block;
}

@keyframes banner-attention {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.55), 0 0 12px rgba(255, 59, 59, 0.35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 59, 59, 0.12), 0 0 24px rgba(255, 59, 59, 0.55);
  }
}

@keyframes banner-ring {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.12); opacity: 0; }
}

@keyframes badge-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.btn {
  border: 0;
  border-radius: var(--radius-sm, 10px);
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-transform: capitalize;
}

.btn-gold {
  background: var(--gold);
  color: var(--on-accent);
}

.btn-gold:active {
  background: var(--gold-dim);
}

.btn-outline {
  background: var(--fg-white);
  border: 1px solid var(--fg-line-strong, #b7d6de);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--fg-teal, #22849c);
  color: var(--fg-teal-dark, #176579);
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--fg-line-strong, #b7d6de);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--fg-line-strong, #b7d6de);
  color: var(--text-muted);
  padding: 0.45rem 0.55rem;
  font-size: 0.9rem;
}

.btn-block { width: 100%; }

/* Reusable in-progress feedback for async toolkit buttons */
.btn.is-loading,
.btn[aria-busy="true"] {
  cursor: wait;
  pointer-events: none;
  color: #fff;
  background: var(--fg-teal, #22849c);
  border-color: var(--fg-teal, #22849c);
  animation: btn-busy-pulse 1.15s ease-in-out infinite;
}

.btn.is-loading::before,
.btn[aria-busy="true"]::before {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.btn.btn-outline.is-loading,
.btn.btn-outline[aria-busy="true"],
.btn.btn-secondary.is-loading,
.btn.btn-secondary[aria-busy="true"] {
  color: #fff;
  border-color: var(--fg-teal-dark, #176579);
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

@keyframes btn-busy-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.78; }
}

@media (prefers-reduced-motion: reduce) {
  .btn.is-loading,
  .btn[aria-busy="true"] {
    animation: none;
  }
  .btn.is-loading::before,
  .btn[aria-busy="true"]::before {
    animation: none;
    border-color: #fff;
    opacity: 0.85;
  }
}

/* ── Tabs ── */
.app-tabs {
  flex-shrink: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  background: var(--bg-tabs);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.app-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1;
  min-width: max-content;
  padding: 0.85rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
  color: var(--fg-teal-dark);
  border-bottom-color: var(--project-accent);
  font-weight: 600;
}

/* ── Main ── */
.app-main {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--bg);
  scroll-behavior: smooth;
}

.dive-body,
.modal-panel,
.dive-gallery-stage,
.dive-thumbs {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  .app-main,
  .dive-body,
  .modal-panel,
  .dive-gallery-stage,
  .dive-thumbs { scroll-behavior: auto; }
}

/* ── Tab panel layout ── */
.tab-panel-layout {
  display: flex;
  flex-direction: column;
  min-height: min-content;
}

.tab-aside { flex-shrink: 0; }

.tab-content { flex: 1; min-height: 0; width: 100%; min-width: 0; }

/* Price Cards: page can scroll; field catalog table scrolls inside a capped box */
#panel-price_cards.tab-panel.active {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 110, 110, 0.45) rgba(15, 110, 110, 0.08);
}

#panel-price_cards.tab-panel.active::-webkit-scrollbar {
  width: 10px;
}

#panel-price_cards.tab-panel.active::-webkit-scrollbar-track {
  background: rgba(15, 110, 110, 0.06);
}

#panel-price_cards.tab-panel.active::-webkit-scrollbar-thumb {
  background: rgba(15, 110, 110, 0.4);
  border-radius: 999px;
}

#panel-price_cards .tab-panel-layout-price-cards,
#panel-price_cards .price-cards-tab {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

#panel-price_cards .pm-field-catalog {
  display: flex;
  flex-direction: column;
  height: auto !important;
  max-height: none !important;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#panel-price_cards .pm-field-catalog .it-field-catalog-scroll {
  flex: 0 1 auto !important;
  min-height: 10rem !important;
  max-height: min(38vh, 20rem) !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 110, 110, 0.45) rgba(15, 110, 110, 0.08);
}

#panel-price_cards .pm-field-catalog .it-field-catalog-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#panel-price_cards .pm-field-catalog .it-field-catalog-scroll::-webkit-scrollbar-thumb {
  background: rgba(15, 110, 110, 0.4);
  border-radius: 999px;
}

#panel-price_cards .pm-field-catalog .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 110, 110, 0.12);
}

.tab-panel-layout-tiles-only {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: 100%;
  min-width: 0;
}

.tab-panel-layout-tiles-only .tab-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.tab-panel-layout-tiles-only .tab-summary {
  display: none !important;
}

/* Tiles-only tabs: fill the panel */
.tab-panel-layout-tiles-only .tile-grid {
  flex: 1 1 auto;
  display: grid;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0.75rem 1rem 1.5rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  grid-template-columns: repeat(var(--tile-cols, 2), minmax(0, 1fr));
  grid-auto-rows: minmax(160px, auto);
  align-content: start;
  overflow: visible;
}

.tab-panel-layout-tiles-only .explore-tile,
.tab-panel-layout-tiles-only .explore-tile-featured {
  grid-column: span 1 !important;
  grid-row: span 1 !important;
}

/* Horizontal: equal columns for complete packs — fill the panel height */
@media (orientation: landscape) and (min-width: 520px) {
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="2"],
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="3"],
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="4"],
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="6"],
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="9"],
  #panel-project .tile-grid-hero-align[data-tile-count="4"] {
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    align-content: stretch !important;
  }

  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="2"] .explore-tile,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="3"] .explore-tile,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="4"] .explore-tile,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="6"] .explore-tile,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="9"] .explore-tile,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="2"] .explore-tile-featured,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="3"] .explore-tile-featured,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="4"] .explore-tile-featured,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="6"] .explore-tile-featured,
  .tab-panel-layout-tiles-only .tile-grid[data-tile-count="9"] .explore-tile-featured,
  #panel-project .tile-grid-hero-align[data-tile-count="4"] .explore-tile,
  #panel-project .tile-grid-hero-align[data-tile-count="4"] .explore-tile-featured {
    aspect-ratio: unset !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  .tile-grid[data-tile-count="2"] {
    --tile-cols: 2;
    --tile-rows: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }

  .tile-grid[data-tile-count="3"] {
    --tile-cols: 3;
    --tile-rows: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }

  /* Project Vision (and any 4-tile pack): always 2×2 in landscape tablets */
  .tile-grid[data-tile-count="4"],
  #panel-project .tile-grid-hero-align[data-tile-count="4"],
  .tile-grid-hero-align[data-tile-count="4"] {
    --tile-cols: 2 !important;
    --tile-rows: 2 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  }

  .tile-grid[data-tile-count="6"] {
    --tile-cols: 3;
    --tile-rows: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  }

  .tile-grid[data-tile-count="9"] {
    --tile-cols: 3;
    --tile-rows: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
  }

  /* Facilities: force 3×2 fill on iPad / tablet landscape */
  #panel-facilities .tab-panel-layout-tiles-only .tile-grid,
  #panel-facilities .tile-grid.tile-grid-fill {
    --tile-cols: 3 !important;
    --tile-rows: 2 !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    width: 100% !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
    align-content: stretch !important;
    justify-content: stretch !important;
    overflow: hidden !important;
  }

  #panel-facilities .tab-panel-layout-tiles-only .explore-tile,
  #panel-facilities .tab-panel-layout-tiles-only .explore-tile-featured,
  #panel-facilities .tile-grid .explore-tile,
  #panel-facilities .tile-grid .explore-tile-featured {
    aspect-ratio: unset !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    width: 100% !important;
    align-self: stretch !important;
    justify-self: stretch !important;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }

  /* Layouts: 3×2 fill; extra tiles scroll inside the visible panel */
  #panel-layouts .tab-panel-layout-tiles-only .tile-grid,
  #panel-layouts .tile-grid.tile-grid-fill {
    --tile-cols: 3 !important;
    --tile-rows: 2 !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    width: 100% !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    grid-auto-rows: minmax(0, 1fr);
    align-content: start !important;
    justify-content: stretch !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #panel-layouts .tab-panel-layout-tiles-only .explore-tile,
  #panel-layouts .tab-panel-layout-tiles-only .explore-tile-featured,
  #panel-layouts .tile-grid .explore-tile,
  #panel-layouts .tile-grid .explore-tile-featured {
    aspect-ratio: unset !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    width: 100% !important;
    align-self: stretch !important;
    justify-self: stretch !important;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
}

/* Vertical / portrait (phones + all iPads/tablets): readable stacked tiles */
@media (orientation: portrait), (max-width: 767px) {
  .tab-panel-layout-tiles-only .tile-grid,
  .tile-grid[data-tile-count],
  .tile-grid.tile-grid-fill,
  .tile-grid-hero-align {
    --tile-cols: 1 !important;
    --tile-rows: auto;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    grid-auto-rows: minmax(180px, auto) !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
    align-content: start !important;
  }

  .tab-panel-layout-tiles-only .explore-tile,
  .tab-panel-layout-tiles-only .explore-tile-featured,
  .tile-grid[data-tile-count] .explore-tile,
  .tile-grid[data-tile-count] .explore-tile-featured,
  .tile-grid.tile-grid-fill .explore-tile,
  .tile-grid.tile-grid-fill .explore-tile-featured,
  .tile-grid-hero-align .explore-tile,
  .tile-grid-hero-align .explore-tile-featured {
    aspect-ratio: 16 / 11 !important;
    height: auto !important;
    min-height: 180px !important;
    max-height: none !important;
  }

  /* Facilities + Layouts portrait: single stack column (phone + tablet vertical) */
  @media (min-width: 600px) {
    #panel-facilities .tab-panel-layout-tiles-only .tile-grid,
    #panel-facilities .tile-grid.tile-grid-fill,
    #panel-layouts .tab-panel-layout-tiles-only .tile-grid,
    #panel-layouts .tile-grid.tile-grid-fill {
      --tile-cols: 1 !important;
      grid-template-columns: minmax(0, 1fr) !important;
      grid-template-rows: none !important;
      height: auto !important;
      max-height: none !important;
      flex: 0 0 auto !important;
      overflow: visible !important;
      align-content: start !important;
      gap: 0.55rem !important;
    }

    #panel-facilities .tab-panel-layout-tiles-only .explore-tile,
    #panel-facilities .tab-panel-layout-tiles-only .explore-tile-featured,
    #panel-facilities .tile-grid .explore-tile,
    #panel-facilities .tile-grid .explore-tile-featured {
      aspect-ratio: unset !important;
      width: 100% !important;
      /* Equal height set in JS */
      align-self: stretch !important;
      grid-column: span 1 !important;
      grid-row: span 1 !important;
      overflow: hidden !important;
    }

    #panel-layouts .tab-panel-layout-tiles-only .explore-tile,
    #panel-layouts .tab-panel-layout-tiles-only .explore-tile-featured,
    #panel-layouts .tile-grid .explore-tile,
    #panel-layouts .tile-grid .explore-tile-featured {
      aspect-ratio: unset !important;
      width: 100% !important;
      /* Height set in JS to match Project Vision hero */
      align-self: stretch !important;
      grid-column: span 1 !important;
      grid-row: span 1 !important;
    }
  }

  .tab-panel.active {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .tab-panel-layout,
  .tab-panel-layout-tiles-only,
  .tab-panel-layout-hero-tiles {
    --portrait-stack-gap: 0.7rem;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    gap: var(--portrait-stack-gap) !important;
  }

  .tab-content,
  .tab-aside {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
  }

  .tab-aside > .tab-hero,
  .tab-hero {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
  }
}

.tab-panel-layout-tiles-only .explore-tile {
  aspect-ratio: 16 / 11;
  height: auto;
  min-height: 160px;
  width: 100%;
}

.tab-panel { display: none; }
.tab-panel[hidden],
.tab-panel:not(.active) {
  /* Keep inactive tabs fully suppressed even if JS left inline layout styles. */
  display: none !important;
}
.tab-panel.active {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: min-content;
  height: auto;
  animation: fadeUp 0.35s ease;
}

/* Landscape tiles-only tabs: fill .app-main while the tab is active */
@media (orientation: landscape) and (min-width: 600px) {
  #panel-design.tab-panel.active,
  #panel-facilities.tab-panel.active,
  #panel-layouts.tab-panel.active,
  #panel-brochure.tab-panel.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
  }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tablet/desktop: opacity only — translateY pushes the panel (and tiles) past the
   viewport bottom during the animation, which reads as tiles “flying off-screen”. */
@media (min-width: 768px) {
  .tab-panel.active {
    animation: fadeInPanel 0.28s ease;
  }

  @keyframes fadeInPanel {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* ── Tab hero ──
   Clear photo first: no full-bleed white/light washes.
   Readability via FGP ink/teal type + optional subtle dark text-shadow. */
.tab-hero {
  position: relative;
  min-height: 220px;
  padding: 1.5rem 1.25rem 1rem;
  color: var(--fg-rich-black, #1a1a1a);
  background: var(--hero-img) center / cover no-repeat;
}

/* NFT: keep full tower facade in frame (building sits left in cover photo) */
.project-shell[data-slug="nft"] #panel-project .tab-hero {
  background-position: 22% center;
}

/* NSL: keep tower facade in frame (building sits far right in cover photo) */
.project-shell[data-slug="nsl"] #panel-project .tab-hero {
  background-position: 70% center;
}

/* NSL 360 tile: official tour preview is a wide aerial — bias to the tower */
.project-shell[data-slug="nsl"] #panel-design .explore-tile[data-dive="panorama-360"] .explore-tile-img {
  object-position: 78% center;
}

/* NFT Exterior tile: keep tower facade in frame (subject sits left in source) */
.project-shell[data-slug="nft"] #panel-design .explore-tile[data-dive="renderings"] .explore-tile-img {
  object-position: 32% center;
}

.tab-hero::before,
.tab-hero::after {
  content: none;
  display: none;
}

.tab-hero-compact { min-height: 140px; }

.tab-hero-inner {
  position: relative;
  z-index: 1;
  max-width: min(26rem, 100%);
}

.tab-hero-branded .tab-hero-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  gap: 0.15rem;
  width: 100%;
  max-width: min(36rem, 100%);
  text-align: left;
}

.tab-hero.tab-hero-branded .eyebrow,
.tab-hero.tab-hero-branded .tab-hero-inner h2 {
  text-align: left;
  width: 100%;
}

.tab-hero.tab-hero-branded .tab-hero-tag {
  text-align: justify;
  text-align-last: left;
  width: 100%;
  max-width: none;
}

.tab-hero-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  margin-bottom: 0.35rem;
  opacity: 0.98;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

/* Project logos on busy photo heroes — force white for readability across all projects */
.tab-hero-logo.is-on-photo,
.tab-hero .tab-hero-logo {
  filter: brightness(0) invert(1) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  opacity: 0.96;
}

/* Already-white transparent logos — skip invert (match *-logo-white* paths only;
   do not match filenames like Logo_Black_on_White.png). */
.tab-hero-logo.is-on-photo[src*="logo-white"],
.tab-hero .tab-hero-logo[src*="logo-white"],
.tab-hero-logo.is-on-photo[src*="banner-logo-white"],
.tab-hero .tab-hero-logo[src*="banner-logo-white"],
.tab-hero-logo.is-on-photo[src*="developer-logo-white"],
.tab-hero .tab-hero-logo[src*="developer-logo-white"] {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  opacity: 0.98;
}

.tab-hero-inner h2 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0;
  line-height: 1.05;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.tab-hero .eyebrow {
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.tab-hero-tag {
  margin: 0.35rem 0 0;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  max-width: 36rem;
}

/* Project Vision hero: logo scales with tile; copy stays clear below */
.tab-hero.tab-hero-branded {
  container-type: size;
  container-name: project-hero;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(0.5rem, 1.5vw, 0.85rem);
  isolation: isolate;
  min-height: 0;
}

.tab-hero.tab-hero-branded .tab-hero-logo {
  position: absolute;
  top: clamp(0.55rem, 2.8cqh, 1rem);
  left: clamp(0.55rem, 3.2cqw, 1.05rem);
  z-index: 2;
  margin-bottom: 0;
  width: auto;
  height: auto;
  max-width: min(48cqw, 9.5rem);
  max-height: min(14cqh, 3.25rem);
  object-fit: contain;
  object-position: left top;
}

.tab-hero.tab-hero-branded::after {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 28%,
    rgba(0, 0, 0, 0.28) 58%,
    rgba(0, 0, 0, 0.58) 100%
  );
}

.tab-hero.tab-hero-branded .tab-hero-inner,
.tab-hero.tab-hero-branded .hero-stats {
  position: relative;
  z-index: 1;
}

.tab-hero.tab-hero-branded .tab-hero-inner {
  flex: 1 1 auto;
  min-height: 0;
  justify-content: flex-end;
  overflow: hidden;
  /* Keep title block below the responsive logo band */
  padding-top: clamp(3rem, 18cqh, 4.75rem);
}

.tab-hero.tab-hero-branded .hero-stats {
  flex: 0 0 auto;
  flex-grow: 0;
  flex-shrink: 0;
  height: fit-content;
  max-height: none;
  margin-top: 0;
  margin-bottom: 0;
  align-self: stretch;
  align-content: end;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: clamp(0.3rem, 1vw, 0.5rem);
  align-items: stretch;
  align-content: end;
  width: 100%;
  height: fit-content;
  margin-top: 1.25rem;
  position: relative;
  z-index: 1;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  min-width: 0;
  min-height: 0;
  height: auto;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(34, 132, 156, 0.22);
  border-radius: clamp(0.45rem, 1.2vw, 0.75rem);
  /* Hug text — keep chips compact so the hero photo stays visible */
  padding: 0.45em 0.55em;
  text-align: center;
  color: var(--fg-rich-black, #1a1a1a);
  box-shadow: 0 4px 16px rgba(8, 28, 36, 0.1);
}

.hero-stat-value {
  display: block;
  max-width: 100%;
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--fg-primary, #22849c);
}

.hero-stat-label {
  display: block;
  max-width: 100%;
  font-size: clamp(0.62rem, 1.25vw, 0.72rem);
  font-weight: 500;
  color: #5a5a5a;
  text-transform: none;
  letter-spacing: 0.02em;
  line-height: 10pt;
}

.hero-stat-detail {
  display: block;
  max-width: 100%;
  font-size: clamp(0.55rem, 1.1vw, 0.62rem);
  line-height: 1.3;
  color: #5a5a5a;
  text-transform: none;
  letter-spacing: normal;
}

/* ── Insight strip ── */
.insight-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

.insight-pill {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem;
  background: var(--fg-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(26, 35, 48, 0.04);
}

.insight-icon { font-size: 1.25rem; line-height: 1; }

.insight-pill strong {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 0.15rem;
}

.insight-pill span {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ── Explore tiles ── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  padding: 0.85rem 1rem 2rem;
  overflow: visible; /* let tile lift/shadow paint outside cells */
}

.explore-tile {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 4/5;
  border: 1px solid color-mix(in srgb, var(--fg-primary, #22849c) 26%, var(--fg-line, #d8dfdf));
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background-color: var(--bg-panel);
  text-align: left;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 6px 16px rgba(34, 132, 156, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

.explore-tile-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  filter: brightness(1.12) saturate(1.08);
  background-color: var(--bg-panel);
}

.explore-tile:not(:has(.explore-tile-img)) {
  background: linear-gradient(145deg, var(--bg-panel), rgba(255, 255, 255, 0.04));
}

/* Pointer devices: lift + clearer edge on hover */
@media (hover: hover) and (pointer: fine) {
  .explore-tile:hover {
    transform: translateY(-4px) scale(1.012);
    border-color: var(--fg-primary, #22849c);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.85) inset,
      0 14px 28px rgba(34, 132, 156, 0.18);
  }
}

.explore-tile:focus-visible {
  outline: 2px solid var(--fg-tertiary, #37beca);
  outline-offset: 2px;
  border-color: var(--fg-primary, #22849c);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 12px 24px rgba(34, 132, 156, 0.16),
    0 0 0 3px color-mix(in srgb, var(--fg-tertiary, #37beca) 28%, transparent);
}

/* Touch / click press — always available */
.explore-tile:active {
  transform: translateY(-1px) scale(0.992);
  border-color: var(--fg-primary, #22849c);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 8px 18px rgba(34, 132, 156, 0.14);
}

.explore-tile-featured {
  /* Equal grid cells — do not span; layoutTileGrid sets columns by orientation */
  grid-column: span 1;
  aspect-ratio: 16/9;
}

@media (prefers-reduced-motion: reduce) {
  .explore-tile,
  .fg-project-card {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .explore-tile:hover,
  .explore-tile:active,
  .explore-tile:focus-visible,
  .fg-project-card:hover,
  .fg-project-card:active,
  .fg-project-card:focus-within {
    transform: none;
  }
}

.tile-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  /* Soft dark bottom scrim for title legibility — no fade-to-white wash */
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 58%,
    rgba(8, 20, 28, 0.22) 78%,
    rgba(8, 20, 28, 0.55) 100%
  );
  color: #fff;
}

.tile-overlay h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 0;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.tile-overlay p {
  margin: 0.2rem 0 0.5rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.tile-cta {
  display: none;
}

.tile-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -80%);
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.95);
  color: #ffffff;
  font-size: 0.9rem;
  padding-left: 0.15rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.tile-pano {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.tile-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tab-summary {
  display: none !important;
}

.layout-unit-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.layout-unit-chip {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 12, 16, 0.35);
  color: rgba(245, 247, 248, 0.88);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
}

.layout-unit-chip:hover {
  border-color: color-mix(in srgb, var(--project-accent) 55%, #fff);
}

.layout-unit-chip.is-active {
  background: color-mix(in srgb, var(--project-accent) 70%, #0a0c10);
  border-color: transparent;
  color: #fff;
}

.explore-tile.is-unit-filtered-out {
  display: none;
}

/* ── Deep dive viewer ── */
/* Fill the content well only — top banner + left tools rail stay visible. */
.dive {
  position: fixed;
  inset: auto;
  top: calc(var(--fg-topbar-h, 4rem) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: center;
  /* Media surfaces keep Noble dark tokens regardless of light shell */
  --bg: var(--media-bg);
  --bg-panel: var(--media-panel);
  --bg-glass: rgba(15, 18, 24, 0.82);
  --text: var(--media-text);
  --text-muted: var(--media-muted);
  --border: var(--media-border);
  --overlay-rgb: var(--media-overlay-rgb);
  color: var(--media-text);
  color-scheme: dark;
}

.project-shell.has-tools-rail > .dive,
.fg-agent-shell.has-tools-rail > .dive {
  left: var(--fg-tools-rail-w, 4.75rem);
}

@media (max-width: 767px) {
  .project-shell.has-tools-rail > .dive,
  .fg-agent-shell.has-tools-rail > .dive {
    left: 0;
  }
}

.dive.hidden { display: none; }

.dive-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(8px);
}

.dive-shell {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  z-index: 1;
}

.dive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: linear-gradient(180deg, var(--bg-panel), transparent);
  flex-shrink: 0;
}

.dive-header-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.dive-header-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.95;
}

.dive-header-logo.is-on-dark {
  /* Prefer white asset when available; CSS fallback for dark bronze marks */
  filter: none;
}

.dive-header-logo.is-on-dark:not([src*="white"]) {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.dive-header-logo.is-watermark {
  height: 28px;
  opacity: 0.55;
}

.dive-header-logo.is-broken {
  display: none !important;
}

.dive-header h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 0;
  line-height: 1.15;
}

.dive-header p {
  margin: 0.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.dive-close {
  border: 0;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.dive-body {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 0 1rem 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  min-height: 0;
}

.dive-intro {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  max-width: 52rem;
}

.dive-vision {
  margin: 0 auto 1.25rem;
  padding: 1.25rem 1.5rem;
  max-width: 40rem;
  text-align: center;
  border: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.dive-vision-headline {
  margin: 0 0 0.65rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.35;
  color: var(--gold);
  font-style: italic;
}

.dive-vision-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
}

.dive-cards-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dive-shell-cards .dive-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: block;
  padding: 3.5rem 1rem 1rem;
}

.dive-shell-cards .dive-cards-page .dive-intro {
  margin: 0 auto 1rem;
  text-align: center;
  max-width: 44rem;
  font-size: 0.88rem;
}

.dive-shell-cards .dive-cards-page .dive-vision {
  margin-top: 0;
}

.dive-talking-points {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  line-height: 1.5;
}

.dive-talking-points li {
  margin-bottom: 0.35rem;
}

.dive-gallery-preface {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 0.75rem 1.25rem 0.5rem;
  background: linear-gradient(180deg, rgba(var(--overlay-rgb), 0.75) 0%, rgba(var(--overlay-rgb), 0.35) 70%, transparent 100%);
  pointer-events: none;
}

.dive-gallery-preface .dive-intro {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dive-map-section {
  flex-shrink: 0;
  padding: 0 0 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.dive-shell-location {
  width: 100%;
  max-width: none;
}

.dive-shell-location .dive-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 0.5rem 1rem 1.5rem;
  background: linear-gradient(180deg, rgba(var(--overlay-rgb), 0.95) 0%, rgba(var(--overlay-rgb), 0.5) 70%, transparent 100%);
  pointer-events: none;
}

.dive-shell-location .dive-close {
  pointer-events: auto;
}

.dive-shell-location .dive-body {
  padding: 3.5rem max(1rem, env(safe-area-inset-right)) 1.5rem max(1rem, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dive-location-page {
  max-width: 56rem;
  margin: 0 auto;
}

.dive-location-page .dive-intro {
  margin-top: 0;
}

.dive-location-page .dive-talking-points {
  margin-bottom: 1.25rem;
}

.dive-location-brochure {
  margin-top: 1rem;
}

.dive-section-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--gold);
  margin: 0 0 0.5rem;
}

.dive-location-map-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-panel);
}

.dive-facts-block {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.25rem;
  padding-top: 0.25rem;
}

.dive-shell-location .dive-embed-map {
  aspect-ratio: 16 / 9;
  max-height: none;
  min-height: 260px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.dive-map-headline {
  font-family: var(--font-serif);
  font-size: 1rem;
  margin: 0 0 0.25rem;
  color: var(--gold);
  line-height: 1.25;
}

.dive-map-tagline {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dive-embed-map {
  aspect-ratio: 21 / 9;
  max-height: 36vh;
  border-radius: var(--radius);
}

.dive-map-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.dive-map-link:hover {
  text-decoration: underline;
}

.dive-shell-immersive .dive-body:has(.dive-map-section) {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.dive-body:has(.dive-map-section) .dive-gallery {
  flex: 1;
  min-height: 220px;
  height: auto;
}

.dive-shell-narrative .dive-body {
  padding: 0.75rem 1rem 1rem;
}

.dive-shell-narrative.dive-shell-immersive .dive-body {
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
  display: block;
}

/* Immersive viewer — header overlays content, no wasted chrome */
.dive-shell-immersive {
  width: 100%;
  max-width: none;
}

.dive-shell-immersive .dive-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  padding: 0.4rem 0.85rem 2.4rem;
  background: linear-gradient(
    180deg,
    rgba(var(--overlay-rgb), 0.94) 0%,
    rgba(var(--overlay-rgb), 0.62) 48%,
    transparent 100%
  );
  pointer-events: none;
}

.dive-shell-immersive .dive-header .dive-close {
  pointer-events: auto;
  position: relative;
  z-index: 7;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.dive-shell-immersive .dive-header h2 {
  font-size: 0.95rem;
  color: #ffffff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.dive-shell-immersive .dive-header p {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.dive-shell-immersive .dive-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

/* Dive content types */
.dive-hero-img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.dive-gallery {
  position: relative;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.dive-gallery-fill {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.dive-gallery-stage {
  position: absolute;
  inset: 0;
  background: #0a0c10;
}

/* iPad / tablet: swipe + edge-tap slide navigation */
.dive-gallery-stage-gestures {
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  cursor: grab;
}

.dive-gallery-stage-gestures:active {
  cursor: grabbing;
}

@media (pointer: coarse) {
  .dive-gallery-stage-gestures::before,
  .dive-gallery-stage-gestures::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 4.75rem;
    width: min(22%, 6rem);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .dive-gallery-stage-gestures::before {
    left: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent);
  }

  .dive-gallery-stage-gestures::after {
    right: 0;
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.08), transparent);
  }

  .dive-gallery-stage-gestures:active::before,
  .dive-gallery-stage-gestures:active::after {
    opacity: 1;
  }
}

.dive-media-deck-gestures {
  touch-action: pan-y;
}

.dive-slide {
  display: none;
}

.dive-slide.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dive-gallery-stage .dive-slide {
  position: absolute;
  inset: 0;
}

.dive-slide img {
  width: 100%;
  height: 100%;
  max-height: none;
  /* Show the full photo/plan in the popup — letterbox on black instead of cropping */
  object-fit: contain;
  object-position: center center;
  border-radius: 0;
  background: #0a0c10;
}

/* Maps & floor plans keep full image visible */
.dive-location-map-img,
.dive-unit-plan-img,
.dive-plan-preview-img,
.dive-stack-img {
  object-fit: contain;
}

/*
 * Marketing Studio project dives: show floor/unit plans in full (no cover crop).
 * Price Card may still use pc-layout-trim / server crop for margin control.
 *
 * Absolute .dive-slide children ignore stage padding — inset plan slides
 * so the drawing sits in the clear area under the black tabs banner and
 * above the bottom gallery footer.
 */
.dive-shell-unit-layout .dive-gallery-stage,
.dive-shell-layout-plans .dive-gallery-stage {
  padding: 0;
  box-sizing: border-box;
  background: #0a0c10;
}

.dive-shell-unit-layout .dive-gallery-stage .dive-slide-plan,
.dive-shell-layout-plans .dive-gallery-stage .dive-slide-plan,
.dive-shell-unit-layout .dive-gallery-stage .dive-slide:has(img.dive-unit-plan-img),
.dive-shell-layout-plans .dive-gallery-stage .dive-slide:has(img.dive-unit-plan-img) {
  /* Keep plan sheet fully above the gallery footer (counter + caption + arrows). */
  inset: 0.4rem 0.75rem clamp(8.75rem, 26vh, 11.5rem);
}

.dive-shell-unit-layout .dive-slide-plan,
.dive-shell-layout-plans .dive-slide-plan,
.dive-shell-unit-layout .dive-slide:has(img.dive-unit-plan-img),
.dive-shell-layout-plans .dive-slide:has(img.dive-unit-plan-img) {
  background: #0a0c10;
  border-radius: 2px;
  overflow: hidden;
}

/* Plan sheets only — Photos tab keeps cover fill (no black letterbox). */
.dive-shell-unit-layout .dive-slide-plan img,
.dive-shell-layout-plans .dive-slide-plan img,
.dive-shell-unit-layout .dive-slide:has(img.dive-unit-plan-img) img,
.dive-shell-layout-plans .dive-slide:has(img.dive-unit-plan-img) img,
.dive-shell-unit-layout .dive-plan-fit img,
.dive-shell-layout-plans .dive-plan-fit img,
img.dive-unit-plan-img {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
}

/* Factsheets / brochure pages: fill dive width (override plan-fit contain rules) */
.dive-shell-unit-layout .dive-plan-fit.dive-plan-fit-width img,
.dive-shell-layout-plans .dive-plan-fit.dive-plan-fit-width img,
.dive-plan-fit.dive-plan-fit-width img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: top center !important;
}

/* Plan sheets: black letterbox around contain-fit drawings */
.dive-slide-plan img,
img.dive-unit-plan-img {
  background: #0a0c10;
}

.dive-shell-unit-layout .dive-media-tabs,
.dive-shell-layout-plans .dive-media-tabs {
  padding-top: max(2.6rem, calc(env(safe-area-inset-top) + 1.75rem));
  background: #0a0c10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.dive-shell-layout-plans .dive-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0a0c10;
}

.dive-shell-layout-plans .dive-header {
  background: linear-gradient(180deg, #0a0c10 0%, #0a0c10 72%, transparent 100%);
}

.dive-gallery-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 2rem 0.85rem max(0.5rem, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(var(--overlay-rgb), 0.95) 0%, rgba(var(--overlay-rgb), 0.55) 65%, transparent 100%);
}

.dive-shell-unit-layout .dive-gallery-footer,
.dive-shell-layout-plans .dive-gallery-footer {
  padding: 0.65rem 0.85rem max(0.45rem, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(10, 12, 16, 0.97) 0%, rgba(10, 12, 16, 0.78) 72%, transparent 100%);
}

.dive-caption {
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.78rem;
  margin: 0 0 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.dive-slide-counter {
  text-align: center;
  color: var(--fg-tertiary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0 0 0.25rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.dive-gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.dive-gallery-controls > button {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-radius: 8px;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.dive-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.dive-nav button {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font: inherit;
}

.dive-dots {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  max-width: min(420px, 70vw);
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0.1rem;
}

.dive-dots::-webkit-scrollbar {
  height: 3px;
}

.dive-dot {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  transform: none;
}

.dive-dot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.dive-dot.active {
  border-color: var(--gold);
  background: transparent;
  transform: none;
  box-shadow: 0 0 0 1px rgba(201, 169, 98, 0.55);
}

.dive-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.dive-shell-immersive .dive-embed {
  flex: 1;
  height: 100%;
  aspect-ratio: unset;
  border-radius: 0;
}

.dive-embed-note {
  position: absolute;
  top: max(3.25rem, calc(env(safe-area-inset-top) + 2.75rem));
  left: 1rem;
  right: 1rem;
  z-index: 2;
  margin: 0;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
}

.dive-embed-video video,
.dive-embed-immersive video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.dive-embed-immersive:not(.dive-embed-panorama) iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* Multi-media dive deck (video / gallery switcher) — underline tabs like app-tabs */
.dive-media-deck {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.dive-media-tabs {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0;
  flex-shrink: 0;
  padding: max(3.1rem, calc(env(safe-area-inset-top) + 2.4rem)) 1rem 0;
  background: #0a0c10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 2;
  pointer-events: auto;
}

.dive-media-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #ffffff;
  border-radius: 0;
  padding: 0.55rem 1.15rem;
  margin-bottom: -1px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.dive-media-tab:hover {
  color: #ffffff;
}

.dive-media-tab.active {
  /* Brighter tint of project accent — readable on the dark dive chrome */
  --dive-tab-active: color-mix(
    in srgb,
    var(--project-accent, #37beca) 42%,
    #ffffff
  );
  border-color: transparent;
  border-bottom-color: var(--dive-tab-active);
  color: var(--dive-tab-active);
  background: transparent;
  font-weight: 600;
}

.dive-media-panel {
  display: none;
  flex: 1;
  min-height: 0;
  position: relative;
  flex-direction: column;
}

.dive-media-panel.active {
  display: flex;
}

.dive-media-panel .dive-gallery,
.dive-media-panel .dive-embed,
.dive-media-panel .dive-plan-fit,
.dive-media-panel .dive-pdf-wrap {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.dive-media-panel .dive-pdf-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem 0.85rem;
}

.dive-media-panel .dive-pdf {
  flex: 1;
  height: 100%;
  min-height: 0;
}

.dive-plan-fit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: #0a0c10;
}

.dive-plan-fit img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Factsheets / brochure pages: fill dive width and scroll vertically */
.dive-plan-fit.dive-plan-fit-width {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
}

.dive-plan-fit.dive-plan-fit-width .dive-zoom-viewport {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.dive-plan-fit.dive-plan-fit-width .dive-zoom-stage {
  width: 100%;
  min-height: min-content;
}

.dive-plan-fit.dive-plan-fit-width img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

.dive-plan-fit.dive-plan-fit-width.is-zoomed .dive-zoom-viewport {
  overflow: hidden;
}

/* —— Dive image zoom / pan (galleries, factsheets, maps) —— */
/* Do NOT force position:relative on every host — .dive-gallery-stage must stay
   position:absolute (inset:0). Relative + only-absolute children → height 0. */
.dive-plan-fit.dive-zoom-host,
.dive-location-map-zoom.dive-zoom-host {
  position: relative;
}

.dive-gallery-stage.dive-zoom-host {
  position: absolute !important;
}

.dive-zoom-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.dive-plan-fit .dive-zoom-viewport {
  position: relative;
  inset: auto;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.dive-location-map-zoom {
  position: relative;
  width: 100%;
  min-height: 12rem;
}

.dive-location-map-zoom .dive-zoom-viewport {
  position: relative;
  inset: auto;
  overflow: hidden;
  width: 100%;
  min-height: 12rem;
}

.dive-location-map-zoom .dive-location-map-img {
  display: block;
  width: 100%;
  height: auto;
}

.dive-zoom-stage {
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.dive-gallery-stage .dive-zoom-viewport,
.dive-gallery-stage .dive-zoom-stage {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
}

.dive-zoom-viewport.is-zoomed {
  touch-action: none;
  cursor: grab;
}

.dive-zoom-viewport.is-panning {
  cursor: grabbing;
}

.dive-zoom-controls {
  position: absolute;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: auto;
}

.dive-gallery .dive-zoom-controls {
  /* sit above the gallery footer strip */
  bottom: max(5.25rem, calc(4.5rem + env(safe-area-inset-bottom)));
}

.dive-zoom-btn {
  appearance: none;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.55rem;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: 600 1.25rem/1 inherit;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}

.dive-zoom-btn:hover,
.dive-zoom-btn:focus-visible {
  background: rgba(201, 169, 98, 0.45);
  outline: none;
}

.dive-zoom-btn:active {
  transform: translateY(1px);
}

.dive-zoom-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.dive-fs-btn {
  position: absolute;
  left: max(0.85rem, env(safe-area-inset-left));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.dive-fs-btn:hover,
.dive-fs-btn:focus-visible {
  background: rgba(201, 169, 98, 0.4);
  outline: none;
}

.dive-embed:fullscreen,
.dive-embed:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
}

.dive-embed:fullscreen .dive-fs-btn,
.dive-embed:-webkit-full-screen .dive-fs-btn {
  display: none;
}

.dive-embed-panorama.dive-embed-immersive {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.dive-embed-panorama {
  position: absolute;
  inset: 0;
}

.dive-shell-panorama .dive-body {
  padding: 0;
  overflow: hidden;
}

.dive-panorama-view {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dive-panorama-view .dive-embed-panorama {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  inset: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.dive-panorama-view .dive-open-full {
  z-index: 5;
}

.dive-embed-panorama iframe {
  touch-action: none;
  position: relative;
  inset: auto;
  border: 0;
  background: #000;
  flex-shrink: 0;
}

.dive-open-full {
  position: absolute;
  right: 0.85rem;
  bottom: max(0.65rem, env(safe-area-inset-bottom));
  z-index: 4;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.04em;
  pointer-events: auto;
}

.dive-embed:not(.dive-embed-panorama) iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.dive-pdf {
  width: 100%;
  height: min(85vh, 900px);
  min-height: 60vh;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
}

.dive-pdf-wrap,
.dive-pdf-bundle {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.dive-shell-immersive .dive-pdf-wrap {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.dive-shell-immersive .dive-pdf {
  flex: 1;
  height: 100%;
  min-height: 70vh;
}

.dive-pdf-wrap-compact .dive-pdf {
  height: min(40vh, 400px);
}

/* Unit layout — multi-media deck (walkthrough / photos / plan) */
.dive-shell-unit-layout .dive-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dive-unit-layout-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.dive-unit-layout-page .dive-gallery-preface {
  display: none;
}

.dive-floor-plan-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 169, 98, 0.45);
  background: rgba(0, 0, 0, 0.45);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.dive-floor-plan-chip:hover {
  background: rgba(201, 169, 98, 0.15);
}

.dive-pdf-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(201, 169, 98, 0.2);
}

.dive-pdf-brand img {
  height: 30px;
  width: auto;
  object-fit: contain;
  opacity: 0.92;
}

.dive-pdf-brand span {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Floor plan library — six category tiles + portrait PDF reader */
.plan-library-intro {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.82);
  flex-shrink: 0;
}

.plan-library {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.plan-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  flex: 1;
  align-content: start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 720px) {
  .plan-library-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.plan-library-tile {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.plan-library-tile:hover {
  border-color: rgba(201, 169, 98, 0.55);
}

.plan-library-tile-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--bg-panel);
  overflow: hidden;
}

.plan-library-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.plan-library-tile-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.plan-library-tile-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.65rem 0.65rem;
}

.plan-library-tile-label strong {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  line-height: 1.2;
}

.plan-library-tile-label span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.plan-pdf-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  background: #0c0c0c;
}

.plan-pdf-fullscreen[hidden] {
  display: none !important;
}

.plan-pdf-close {
  position: absolute;
  top: max(0.65rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.plan-pdf-close:hover {
  background: rgba(201, 169, 98, 0.35);
}

.plan-pdf-frame-full {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.plan-pdf-page-nav {
  position: absolute;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.plan-pdf-page-nav[hidden] {
  display: none !important;
}

.plan-pdf-page-nav button {
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

.plan-pdf-page-nav button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.plan-pdf-page-nav span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  min-width: 3.5rem;
  text-align: center;
}

.dive.plan-pdf-mode .dive-header,
.dive.plan-pdf-mode .dive-backdrop {
  visibility: hidden;
  pointer-events: none;
}

.dive-shell-plans .dive-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.65rem 1rem 0.75rem;
  min-height: 0;
}

.dive-shell-plans .dive-intro,
.dive-shell-plans .plan-library-intro {
  display: none;
}

/* Floor plans — thumbnail grid + selected viewer (legacy pdf-bundle) */
.dive-plan-bundle {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dive-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  justify-content: start;
  align-content: start;
}

@media (min-width: 720px) {
  .dive-plan-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.dive-plan-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
  max-width: 100%;
}

.dive-plan-card:hover,
.dive-plan-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(201, 169, 98, 0.25);
}

.dive-plan-card-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  width: 100%;
  background: var(--bg-panel);
  overflow: hidden;
}

.dive-plan-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dive-plan-card-title {
  padding: 0 0.55rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.9);
}

.dive-plan-viewer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem;
}

.dive-plan-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.dive-plan-viewer-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--gold);
  line-height: 1.25;
}

.dive-plan-open {
  flex-shrink: 0;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.dive-plan-open:hover {
  text-decoration: underline;
}

.dive-plan-viewer-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 280px;
  max-height: min(55vh, 560px);
  background: var(--bg);
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
}

.dive-plan-preview-img,
.dive-plan-pdf {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.dive-plan-preview-img {
  object-fit: contain;
  background: var(--bg);
}

.dive-plan-pdf {
  background: #fff;
}

.dive-plan-toggle-pdf {
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.dive-plan-toggle-pdf:hover {
  color: var(--text);
  border-color: rgba(201, 169, 98, 0.45);
}

.dive-section-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--gold);
}

.dive-stack-plans {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.dive-stack-hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
}

.dive-stack-viewer {
  margin: 0 auto 0.65rem;
  max-width: 42rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}

.dive-stack-img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: var(--bg);
}

.dive-stack-caption {
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

.dive-stack-thumbs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.dive-stack-thumb {
  position: relative;
  flex: 0 0 88px;
  width: 88px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-panel);
  aspect-ratio: 3 / 4;
}

.dive-stack-thumb.active {
  border-color: var(--gold);
}

.dive-stack-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dive-pdf-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dive-pdf-section-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--gold);
}

.dive-open-full {
  align-self: flex-start;
  color: var(--gold);
  font-size: 0.85rem;
  text-decoration: none;
}

.dive-open-full:hover {
  text-decoration: underline;
}

.dive-shell-immersive .dive-pdf {
  flex: 1;
  height: 100%;
  min-height: 70vh;
  border-radius: 0;
}

.dive-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}

.dive-stat {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.dive-stat .val {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--gold);
  display: block;
}

.dive-stat .lbl {
  font-size: 0.8rem;
  display: block;
  margin-top: 0.25rem;
}

.dive-stat .note {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: block;
}

.dive-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.65rem;
}

.dive-card-grid-full {
  flex: 1;
  min-height: 0;
  align-content: start;
}

/* Developer dive: center the brand card(s) in the immersive shell */
.dive-shell-cards .dive-card-grid,
.dive-shell-cards .dive-card-grid-full {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: start;
  gap: 0.85rem;
}

.dive-shell-cards .dive-card {
  width: min(100%, 18.5rem);
  flex: 0 0 auto;
}

.dive-shell-immersive .dive-body:has(.dive-card-grid-full) {
  display: flex;
  flex-direction: column;
  padding-top: 0.5rem;
}

.dive-shell-cards .dive-body:has(.dive-card-grid-full) {
  padding-top: 3.5rem;
}

.dive-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

.dive-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.dive-card div {
  padding: 0.75rem;
  text-align: center;
}

.dive-card strong {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  display: block;
}

.dive-card span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dive-steps {
  display: grid;
  gap: 0.65rem;
}

.dive-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.dive-step-num {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--gold);
  line-height: 1;
}

.dive-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.dive-fact-pill {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(8, 28, 36, 0.72);
  border: 1px solid rgba(55, 190, 202, 0.45);
  color: #ffffff;
  font-size: 0.78rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.dive-cta-wrap {
  margin: 1.25rem 0 0;
  text-align: center;
}

.dive-cta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  background: var(--fg-primary);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(34, 132, 156, 0.28);
}

.dive-cta-link:hover {
  background: var(--fg-teal-dark);
}

/* ── Modals ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
}

.modal-panel {
  position: relative;
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--fg-shadow-lg, 0 18px 48px rgba(26, 35, 48, 0.18));
}

.modal-panel-wide { width: min(900px, 100%); }

.modal-panel-compact {
  width: min(360px, 100%);
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
}

.modal-lead-only {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  margin: 0.5rem 0 1.25rem;
}

.modal-panel-compact .action-link-btn {
  margin: 0;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-lead { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 0.75rem; }

.ai-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.ai-prompt-btn {
  border: 1px solid var(--border);
  background: var(--fg-white);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.ai-prompt-btn:active {
  background: var(--project-accent-soft);
  border-color: var(--gold);
  color: var(--gold);
}

.ai-chat {
  min-height: 140px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.ai-msg {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.ai-msg-user {
  color: var(--gold);
  font-weight: 600;
}

.ai-msg-bot {
  color: var(--text);
}

.ai-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ai-input-row input {
  flex: 1;
  margin-top: 0;
}

.call-room-row { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.call-room-row input { flex: 1; }

.action-link-btn {
  margin: 0.75rem 0 0.5rem;
  font-size: 1rem;
  padding: 0.85rem 1rem;
}

.action-links-admin {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 1080px;
  margin: 0 auto 1rem;
}

.action-links-admin h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
}

.action-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.action-links-grid h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

@media (max-width: 800px) {
  .action-links-grid { grid-template-columns: 1fr; }
}

.admin-section { margin-bottom: 1.25rem; }

.request-state-panel {
  margin-bottom: 1rem;
}

.gallery-pending-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.request-pending-card,
.request-response-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
}

/* Soft amber/teal tint so pending visits read as status, not the booking form */
.request-pending-card {
  border-color: rgba(196, 149, 58, 0.45);
  background: rgba(232, 180, 90, 0.12);
}

.request-pending-title {
  color: #9a6b1a;
}

.request-pending-title,
.request-response-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.request-response-label {
  color: var(--gold);
}

.request-pending-detail,
.request-response-message {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.request-response-card.is-confirmed {
  border-color: rgba(143, 212, 155, 0.45);
  background: rgba(143, 212, 155, 0.06);
}

.request-response-card.is-alternative {
  border-color: rgba(232, 180, 90, 0.45);
  background: rgba(232, 180, 90, 0.06);
}

.request-response-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.request-new-btn { margin-top: 0.75rem; }

.request-history {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.request-history-title {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.request-history-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.request-history-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.request-history-item p {
  margin: 0;
  font-size: 0.85rem;
}

.inbox-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.inbox-column h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inbox-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e04545;
  color: #fff;
  font-size: 0.75rem;
}

.inbox-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

.inbox-card-done { opacity: 0.45; }

.inbox-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}

.inbox-card-head span { color: var(--text-muted); white-space: nowrap; }

.inbox-meta {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
}

.inbox-meta div {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.inbox-meta dt {
  margin: 0;
  color: var(--text-muted);
}

.inbox-meta dd { margin: 0; }

.inbox-respond-form label { margin-bottom: 0.65rem; }

.inbox-recent {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.inbox-recent h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.gallery-admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.gallery-admin-tab {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: 999px;
  background: var(--fg-white, #fff);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.gallery-admin-tab.active {
  color: #fff;
  border-color: var(--fg-teal, var(--gold));
  background: var(--fg-teal, var(--gold));
}

.gallery-admin-tab-count {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.gallery-admin-tab .gallery-cal-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--project-accent) 22%, transparent);
  color: var(--project-accent);
  font-size: 0.72rem;
  font-weight: 600;
}

.gallery-admin-panel-hint {
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.gallery-other-pending-hint {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--project-accent, #22849c);
  background: color-mix(in srgb, var(--project-accent, #22849c) 12%, transparent);
  font-size: 0.85rem;
}

.gallery-other-pending-hint.hidden {
  display: none;
}

.gallery-admin-panel { display: none; }
.gallery-admin-panel.active { display: block; }

/*
  Gallery visits month calendar — scoped under #gallery-cal-root so chat/admin
  layout rules cannot collapse the 7-column grid (regression: weekdays/days
  went inline and nav wrapped into three lines when display:grid/flex was lost).
*/
#gallery-cal-root.gallery-cal-layout,
#gallery-panel-calendar .gallery-cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.85fr);
  gap: 1rem;
  align-items: start;
  width: 100%;
}

#gallery-cal-root .gallery-cal-main {
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: var(--radius, 12px);
  padding: 0.85rem;
  background: var(--fg-white, #fff);
  box-shadow: var(--fg-shadow, none);
  min-width: 0;
}

/* prev | title | next | Today — grid avoids flex-wrap splitting the month nav */
#gallery-cal-root .gallery-cal-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem 0.5rem;
  margin-bottom: 0.75rem;
}

#gallery-cal-root .gallery-cal-title {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  min-width: 0;
  line-height: 1.2;
}

#gallery-cal-root .gallery-cal-nav-btn {
  min-width: 2.25rem;
  padding: 0.35rem 0.55rem;
  justify-self: start;
}

#gallery-cal-root .gallery-cal-today-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  justify-self: end;
}

#gallery-cal-root .gallery-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 100%;
}

#gallery-cal-root .gallery-cal-weekdays > span {
  display: block;
  min-width: 0;
}

#gallery-cal-root .gallery-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  width: 100%;
}

#gallery-cal-root .gallery-cal-day {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--fg-line, var(--border));
  border-radius: 10px;
  background: var(--fg-elevated, #f7fafb);
  color: inherit;
  min-height: 4.5rem;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  box-sizing: border-box;
}

#gallery-cal-root .gallery-cal-day.is-blank {
  background: transparent;
  border-color: transparent;
  pointer-events: none;
  min-height: 4.5rem;
  cursor: default;
}

#gallery-cal-root .gallery-cal-day:hover:not(.is-blank) {
  border-color: color-mix(in srgb, var(--project-accent, var(--fg-teal, #22849c)) 35%, transparent);
  background: var(--project-accent-soft, var(--fg-teal-soft, rgba(55, 190, 202, 0.14)));
}

#gallery-cal-root .gallery-cal-day.is-today {
  border-color: color-mix(in srgb, var(--project-accent, var(--fg-teal, #22849c)) 55%, transparent);
}

#gallery-cal-root .gallery-cal-day.is-selected {
  border-color: var(--gold, var(--fg-teal, #22849c));
  background: var(--gold-glow, var(--fg-teal-soft, rgba(55, 190, 202, 0.14)));
}

#gallery-cal-root .gallery-cal-day.has-visits .gallery-cal-day-num {
  color: var(--project-accent, var(--fg-teal, #22849c));
  font-weight: 700;
}

#gallery-cal-root .gallery-cal-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

#gallery-cal-root .gallery-cal-day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

#gallery-cal-root .gallery-cal-day-dots i {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--project-accent, var(--fg-teal, #22849c));
  display: block;
  flex: 0 0 auto;
}

#gallery-cal-root .gallery-cal-day-preview {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

#gallery-cal-root .gallery-cal-side {
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: var(--radius, 12px);
  padding: 0.85rem;
  background: var(--fg-white, #fff);
  box-shadow: var(--fg-shadow, none);
  min-height: 12rem;
  min-width: 0;
}

#gallery-cal-root .gallery-cal-side-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

#gallery-cal-root .gallery-cal-side-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

#gallery-cal-root .gallery-cal-event {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--fg-elevated, #f7fafb);
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

#gallery-cal-root .gallery-cal-event:hover,
#gallery-cal-root .gallery-cal-event:focus-visible {
  border-color: var(--gold, var(--fg-teal, #22849c));
  background: var(--gold-glow, var(--fg-teal-soft, rgba(55, 190, 202, 0.14)));
  outline: none;
}

#gallery-cal-root .gallery-cal-event strong {
  font-size: 0.9rem;
}

#gallery-cal-root .gallery-cal-event span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#gallery-cal-root .gallery-cal-event-meta {
  font-size: 0.75rem !important;
}

#gallery-cal-root .gallery-cal-detail {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--fg-line, var(--border));
}

#gallery-cal-root .gallery-cal-detail h4 {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  #gallery-cal-root.gallery-cal-layout,
  #gallery-panel-calendar .gallery-cal-layout {
    grid-template-columns: 1fr;
  }

  #gallery-cal-root .gallery-cal-day {
    min-height: 3.4rem;
  }

  #gallery-cal-root .gallery-cal-day-preview {
    display: none;
  }
}

.request-inbox > h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.request-inbox {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 1080px;
  margin: 0 auto 1rem;
}

@media (max-width: 800px) {
  .inbox-columns { grid-template-columns: 1fr; }
}

.admin-section { margin-bottom: 1.25rem; }

.expert-call-admin {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 1080px;
  margin: 0 auto 1rem;
}

.expert-call-admin h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
}

.modal-panel-expert {
  width: min(440px, 100%);
  max-width: 100%;
}

.modal-panel-expert.is-in-call {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding:
    max(0.35rem, env(safe-area-inset-top))
    max(0.35rem, env(safe-area-inset-right))
    max(0.35rem, env(safe-area-inset-bottom))
    max(0.35rem, env(safe-area-inset-left));
  overflow: hidden;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.modal-panel-expert.is-in-call .expert-call-intro {
  display: none;
}

.modal-panel-expert.is-in-call .expert-call-in-call-bar {
  display: block;
  flex-shrink: 0;
}

.expert-call-in-call-bar {
  margin: 0 0 0.35rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
}

.expert-call-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 220px;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.75rem;
}

.modal-panel-expert.is-in-call .expert-call-video-wrap {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: unset;
  height: auto;
  margin-top: 0;
  border-radius: 10px;
}

.modal:has(.modal-panel-expert.is-in-call) {
  padding: 0;
  place-items: stretch;
}

.modal:has(.modal-panel-expert.is-in-call) .modal-backdrop {
  background: #000;
}

.modal-panel-expert.is-in-call .modal-close {
  z-index: 2;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.expert-call-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.expert-call-fallback {
  margin-top: 0.75rem;
}

.expert-call-note {
  margin-top: 0.65rem;
  font-size: 0.8rem;
}

.expert-calls-inbox {
  margin-bottom: 1rem;
}

.expert-calls-inbox h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.expert-calls-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.expert-calls-badge {
  animation: expert-calls-badge-pulse 1.1s ease-in-out infinite;
}

.admin-tab.has-waiting-calls:not(.active) {
  border-color: #e04545;
  color: #f5b0b0;
  animation: expert-calls-tab-glow 1.4s ease-in-out infinite;
}

@keyframes expert-calls-badge-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(224, 69, 69, 0.55);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 0 5px rgba(224, 69, 69, 0);
  }
}

@keyframes expert-calls-tab-glow {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 2px rgba(224, 69, 69, 0.35); }
}

.expert-calls-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.expert-calls-item > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

input, select, textarea {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--fg-white);
  color: var(--text);
  font: inherit;
}

label { display: block; margin-bottom: 0.75rem; font-size: 0.85rem; }

.hint,
.muted { color: var(--text-muted); font-size: 0.8rem; }
.form-status.success { color: #1f8a4c; }
.form-status.error { color: var(--fg-danger, #d14343); }
.hidden { display: none !important; }

/* Admin */
.admin-page { padding: 2rem 1rem; max-width: 1080px; margin: 0 auto; }
.admin-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.upload-form, .upload-history {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.site-header { padding: 1rem; border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1080px; margin: 0 auto; display: flex; justify-content: space-between; }
.brand-name { font-family: var(--font-serif); }

@media (max-width: 640px) {
  .tile-grid { grid-template-columns: 1fr; }
  .explore-tile-featured { grid-column: span 1; aspect-ratio: 16/10; }
  .banner-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .banner-actions .btn-banner {
    min-height: 40px;
    font-size: 0.68rem;
  }
  .insight-strip { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}

/* ── Phones / narrow (not tablet — tablet uses min-width:768 containment) ── */
@media (max-width: 767px) {
  .tab-panel-layout {
    gap: 0;
  }

  .tile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    padding: 0.55rem;
    overflow: visible;
  }

  .dive-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab-hero {
    min-height: 180px;
  }

  .tab-hero-inner h2 {
    font-size: clamp(1.55rem, 5.5vw, 2.15rem);
  }

  .app-main {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
}

/* ══════════════════════════════════════════
   TABLET + DESKTOP — iPad portrait/landscape
   (768×1024+, 820×1180, 1024×768, 1180×820)
   Panels fill .app-main; never calc(100dvh - chrome).
   ══════════════════════════════════════════ */
/* Wide screens — iPad + desktop Safari */
@media (min-width: 768px) {
  :root {
    --banner-h: 56px;
    --tabs-h: 46px;
  }

  .app-banner {
    padding: 0.45rem 1.5rem;
    min-height: var(--banner-h);
  }

  .banner-title { font-size: clamp(1.2rem, 2.1vw, 1.45rem); }
  .banner-logo {
    height: 3.75rem;
    max-width: min(26rem, 48vw);
  }

  .banner-actions {
    gap: 0.3rem;
    width: min(36rem, 48vw);
  }

  .banner-signin-input {
    width: 6.5rem;
    font-size: 0.75rem;
  }

  .btn-banner-auth {
    min-height: 2.25rem;
    font-size: 0.75rem;
  }

  .banner-actions .btn-banner {
    min-height: 40px;
    padding: 0.35rem 0.3rem;
    font-size: 0.68rem;
  }

  .btn:not(.btn-banner) {
    min-height: 44px;
    padding: 0.55rem 1.15rem;
    font-size: 0.88rem;
  }

  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }

  .tab-btn {
    min-height: var(--tabs-h);
    font-size: 0.82rem;
    padding: 0 0.85rem;
    letter-spacing: 0.01em;
  }

  .app-main {
    /* Fill under banner + tabs; panels size to this box (not 100dvh) */
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    display: flex;
    flex-direction: column;
  }

  .tab-panel.active {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  /*
    CRITICAL: size panels to .app-main (height:100%), NOT calc(100dvh - chrome).
    The latter sits BELOW banner+tabs and pushes tiles past the physical viewport.
  */
  .tab-panel-layout {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(280px, 34%) 1fr;
    gap: 0.7rem;
    padding: 0.55rem 0.85rem 0.7rem;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    max-width: none;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
    overflow: hidden;
  }

  .tab-panel-layout-tiles-only {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    max-width: none;
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 0.55rem 0.85rem 0.7rem;
    box-sizing: border-box;
    overflow: hidden;
  }

  .tab-panel-layout-tiles-only .tab-content {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tab-panel-layout-tiles-only .tab-summary {
    display: none !important;
  }

  .tab-panel-layout-tiles-only .tile-grid,
  .tile-grid.tile-grid-fill {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto !important;
    gap: 0.7rem;
    padding: 0;
    overflow: hidden;
    align-content: stretch;
    justify-content: stretch;
    align-items: stretch;
    justify-items: stretch;
    grid-template-columns: repeat(var(--tile-cols, 2), minmax(0, 1fr));
    grid-template-rows: repeat(var(--tile-rows, 1), minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    min-height: 0;
    max-height: 100%;
    height: 100% !important;
  }

  .tab-panel-layout-tiles-only .explore-tile,
  .tile-grid.tile-grid-fill .explore-tile,
  .tab-panel-layout-tiles-only .explore-tile-featured,
  .tile-grid.tile-grid-fill .explore-tile-featured {
    aspect-ratio: unset !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    width: 100% !important;
    min-width: 0;
    align-self: stretch !important;
    justify-self: stretch !important;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    border: 1px solid var(--border, #d5dde3);
    border-radius: 14px;
    box-shadow: none;
  }

  .tab-panel-layout-tiles-only .explore-tile-img,
  .tile-grid.tile-grid-fill .explore-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .tab-aside {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    align-self: stretch;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  .tab-aside > .tab-hero {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    border: 1px solid var(--border, #d5dde3);
    border-radius: 14px;
  }

  .tab-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    gap: 0.3rem;
    height: 100%;
  }

  .tab-hero {
    min-height: 0;
    flex: 1 1 auto;
    padding: 0.85rem 0.95rem 0.75rem;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.55rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* No white fade overlays — photo only */
    background-image: var(--hero-img);
  }

  .project-shell[data-slug="nft"] #panel-project .tab-hero {
    background-position: 22% center;
  }

  .project-shell[data-slug="nsl"] #panel-project .tab-hero {
    background-position: 70% center;
  }

  .project-shell[data-slug="nsl"] #panel-design .explore-tile[data-dive="panorama-360"] .explore-tile-img {
    object-position: 78% center;
  }

  .project-shell[data-slug="nft"] #panel-design .explore-tile[data-dive="renderings"] .explore-tile-img {
    object-position: 32% center;
  }

  .tab-hero-inner {
    flex: 0 0 auto;
  }

  .tab-hero-compact {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  .tab-hero-inner h2 {
    font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  }

  .tab-hero-tag {
    font-size: 0.82rem;
    margin-top: 0.2rem;
    line-height: 1.35;
  }

  .hero-stats {
    margin-top: 0;
    flex: 0 0 auto;
    width: 100%;
  }

  .insight-strip {
    grid-template-columns: 1fr 1fr;
    padding: 0;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .insight-pill {
    padding: 0.45rem 0.55rem;
  }

  .insight-pill strong { font-size: 0.76rem; }
  .insight-pill span { font-size: 0.68rem; }

  .tile-grid {
    flex: 1 1 auto;
    display: grid;
    gap: 0.7rem;
    padding: 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-height: 100%;
    height: 100%;
    grid-template-columns: repeat(var(--tile-cols, 2), minmax(0, 1fr));
    grid-template-rows: repeat(var(--tile-rows, 2), minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    align-content: stretch;
    justify-content: stretch;
    align-items: stretch;
    justify-items: stretch;
    overflow: hidden;
  }

  /* Uniform tile chrome — fill grid cells */
  .explore-tile,
  .explore-tile-featured {
    aspect-ratio: unset !important;
    width: 100% !important;
    min-width: 0;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    align-self: stretch !important;
    justify-self: stretch !important;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    border: 1px solid var(--border, #d5dde3);
    border-radius: 14px;
  }

  .explore-tile-featured {
    grid-column: span 1;
    grid-row: span 1;
  }

  .explore-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  #panel-project .tile-grid,
  #panel-thailand .tile-grid {
    overflow: hidden;
    align-content: stretch;
    gap: 0.5rem;
  }

  #panel-project .explore-tile,
  #panel-thailand .explore-tile {
    aspect-ratio: auto !important;
    height: auto !important;
    min-height: 0;
    align-self: stretch;
  }

  #panel-project .tile-grid {
    grid-template-columns: repeat(var(--tile-cols, 2), minmax(0, 1fr));
  }

  /* Project Vision: stretch 2×2 tiles flush with left hero (top + bottom) */
  #panel-project.tab-panel.active {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  #panel-project .tab-panel-layout-hero-tiles,
  .tab-panel-layout-hero-tiles {
    align-items: stretch;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  #panel-project .tab-panel-layout-hero-tiles .tab-content,
  .tab-panel-layout-hero-tiles .tab-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    align-self: stretch;
    overflow: hidden;
  }

  #panel-project .tile-grid-hero-align,
  .tile-grid-hero-align {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(var(--tile-cols, 2), minmax(0, 1fr));
    grid-template-rows: repeat(var(--tile-rows, 2), minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 0.7rem;
    align-content: stretch;
    justify-content: stretch;
    align-items: stretch;
    justify-items: stretch;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  #panel-project .tile-grid-hero-align .explore-tile,
  #panel-project .tile-grid-hero-align .explore-tile-featured,
  .tile-grid-hero-align .explore-tile,
  .tile-grid-hero-align .explore-tile-featured {
    aspect-ratio: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    width: 100% !important;
    align-self: stretch !important;
    justify-self: stretch !important;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }

  #panel-project .tab-hero-branded .tab-hero-inner {
    gap: 0.12rem;
    flex: 1 1 auto;
    min-height: 0;
    justify-content: flex-end;
  }

  #panel-project .tab-hero-branded .eyebrow {
    margin-bottom: 0.1rem;
  }

  #panel-project .tab-hero-branded {
    justify-content: flex-end;
    gap: clamp(0.5rem, 1.5vw, 0.75rem);
    background-image: var(--hero-img);
  }

  #panel-project .hero-stats {
    flex: 0 0 auto;
    flex-grow: 0;
    height: fit-content;
    margin-top: 0;
    align-self: stretch;
    width: 100%;
  }

  #panel-thailand .tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab-panel-layout-price-cards {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 0.4rem 0.65rem 0.5rem;
    overflow: visible;
    box-sizing: border-box;
  }

  .price-cards-tab {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 0 0 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    padding: 0;
    overflow: visible;
    box-sizing: border-box;
  }

  .pm-field-catalog {
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border, #d5dde3);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
  }

  .pm-field-catalog .it-field-catalog-remarks {
    flex-shrink: 0;
    margin-top: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border, #d5dde3);
  }

  .pm-field-catalog .pm-remarks-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border, #d5dde3);
    border-radius: 10px;
    background: rgba(15, 110, 110, 0.04);
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
  }

  .pm-field-catalog .pm-remarks-toggle:hover {
    background: rgba(15, 110, 110, 0.08);
  }

  .pm-field-catalog .pm-remarks-toggle:hover .it-field-catalog-remarks-title,
  .pm-field-catalog .pm-remarks-toggle:hover .pm-remarks-toggle-hint {
    color: var(--fg-teal, #0f6e6e);
  }

  .pm-field-catalog .it-field-catalog-remarks-title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
    color: inherit;
  }

  .pm-field-catalog .pm-remarks-toggle-hint {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .pm-field-catalog .it-field-catalog-remarks.is-open .pm-remarks-toggle {
    border-color: rgba(15, 110, 110, 0.28);
    background: rgba(15, 110, 110, 0.07);
  }

  .pm-field-catalog .it-field-catalog-remarks-body {
    margin-top: 0.45rem;
    max-height: min(28vh, 12rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pm-field-catalog .it-field-catalog-remarks.is-collapsed .it-field-catalog-remarks-body {
    display: none;
  }

  .pm-field-catalog .it-field-catalog-remarks-lead {
    margin: 0 0 0.55rem;
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .pm-field-catalog .it-field-catalog-remarks-list {
    margin: 0;
    display: grid;
    gap: 0.35rem;
  }

  .pm-field-catalog .it-field-catalog-remarks-list > div {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.35rem 0.65rem;
    align-items: start;
    font-size: 0.78rem;
  }

  .pm-field-catalog .it-field-catalog-remarks-list dt {
    margin: 0;
  }

  .pm-field-catalog .it-field-catalog-remarks-list dt code {
    font-size: 0.72rem;
    padding: 0.08rem 0.3rem;
    background: rgba(34, 132, 156, 0.1);
    border-radius: 4px;
  }

  .pm-field-catalog .it-field-catalog-remarks-list dd {
    margin: 0;
    color: var(--text-muted, #555);
  }

  .pm-field-catalog .it-field-catalog-remarks-examples {
    margin: 0.55rem 0 0;
    font-size: 0.75rem;
  }

  .pm-field-catalog .it-field-catalog-remarks-examples code {
    font-size: 0.72rem;
    padding: 0.06rem 0.28rem;
    background: rgba(34, 132, 156, 0.08);
    border-radius: 4px;
  }

  .pm-field-catalog .it-field-catalog-head {
    flex-shrink: 0;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border, #d5dde3);
  }

  .pm-field-catalog .it-field-catalog-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem 1rem;
  }

  .pm-field-catalog-title {
    margin: 0;
    font-size: 1rem;
  }

  .pm-field-catalog-lead {
    margin: 0.3rem 0 0;
    font-size: 0.78rem;
  }

  .pm-field-catalog .it-field-catalog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .pm-field-catalog .it-field-catalog-meta {
    margin: 0;
    font-size: 0.75rem;
  }

  .pm-field-catalog .it-field-catalog-head,
  .pm-field-catalog .it-field-catalog-meta,
  .pm-field-catalog .it-field-catalog-remarks,
  .pm-field-catalog .price-card-template-status {
    flex-shrink: 0;
  }

  .pm-field-catalog .it-field-catalog-scroll {
    flex: 0 1 auto;
    min-height: 10rem;
    max-height: min(38vh, 20rem);
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 110, 110, 0.45) rgba(15, 110, 110, 0.08);
  }

  .pm-field-catalog .it-field-catalog-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  .pm-field-catalog .it-field-catalog-scroll::-webkit-scrollbar-thumb {
    background: rgba(15, 110, 110, 0.4);
    border-radius: 999px;
  }

  .pm-field-catalog .data-table {
    width: max(100%, 52rem);
    border-collapse: collapse;
    font-size: 0.8rem;
  }

  .pm-field-catalog .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 0 1px 0 rgba(15, 110, 110, 0.12);
  }

  .pm-field-catalog .data-table th,
  .pm-field-catalog .data-table td {
    padding: 0.35rem 0.4rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border, #e4eaee);
  }

  .pm-field-catalog .it-field-sample {
    max-width: 14rem;
  }

  .pm-field-catalog .it-field-source {
    font-size: 0.72rem;
    word-break: break-all;
  }

  .pm-field-catalog .it-field-rule {
    display: inline-block;
    margin: 0 0.15rem 0.15rem 0;
    padding: 0.08rem 0.3rem;
    font-size: 0.68rem;
    background: rgba(15, 110, 110, 0.08);
    border-radius: 4px;
  }

  .pm-field-catalog .it-fc-input,
  .pm-field-catalog .fg-it-inline-input,
  .pm-field-catalog .fg-it-inline-select {
    width: 100%;
    min-width: 4rem;
    box-sizing: border-box;
    font: inherit;
    padding: 0.25rem 0.35rem;
  }

  .pm-field-catalog .fg-it-slug {
    font-size: 0.78rem;
  }

  .price-cards-tab-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
  }

  .price-cards-tab-actions .btn.is-disabled,
  .price-cards-tab-actions a.btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
  }

  .price-card-template-status {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.78rem;
  }

  .price-card-template-status.is-error {
    color: var(--fg-secondary, #c5494d);
  }

  .price-cards-embed {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 22rem;
    height: min(52vh, 30rem);
    border: 1px solid var(--border, #d5dde3);
    border-radius: 14px;
    overflow: hidden;
    box-sizing: border-box;
    background: #fff;
  }

  .tab-empty {
    grid-column: 1 / -1;
    padding: 1rem 0.25rem;
    margin: 0;
  }

  #panel-thailand .tab-hero {
    background:
      linear-gradient(
        115deg,
        rgba(8, 28, 36, 0.78) 0%,
        rgba(8, 28, 36, 0.48) 40%,
        rgba(8, 28, 36, 0.2) 62%,
        transparent 82%
      ),
      linear-gradient(180deg, rgba(8, 28, 36, 0.28) 0%, rgba(8, 28, 36, 0.45) 55%, var(--bg) 100%),
      var(--hero-img) center / cover no-repeat;
  }

  #panel-thailand .explore-tile-img {
    filter: brightness(1.08) saturate(1.05);
  }

  #panel-thailand .explore-tile .tile-overlay {
    background: linear-gradient(
      180deg,
      rgba(8, 28, 36, 0) 0%,
      rgba(8, 28, 36, 0.28) 42%,
      rgba(6, 22, 30, 0.82) 100%
    );
  }

  #panel-thailand .explore-tile-featured {
    grid-row: auto;
    grid-column: auto;
    aspect-ratio: 4/5;
  }

  #panel-thailand .insight-strip {
    max-height: none;
  }

  #panel-thailand .insight-pill span {
    display: block;
    line-height: 1.35;
  }

  .tile-overlay {
    padding: 0.85rem 1rem;
  }

  .tile-overlay h3 { font-size: 1.15rem; }

  .tile-play {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1rem;
  }

  /* Deep dive — full-screen immersive on iPad landscape */
  .dive-shell {
    width: 100%;
    max-width: none;
  }

  .dive-shell-immersive .dive-header {
    padding: 0.45rem 1.25rem 2.25rem;
    padding-top: max(0.45rem, env(safe-area-inset-top));
  }

  .dive-shell-immersive .dive-header h2 { font-size: 1.05rem; }

  .dive-gallery-controls > button {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.1rem;
  }

  .dive-hero-img {
    max-height: 200px;
  }

  .dive-embed-map {
    max-height: 32vh;
    aspect-ratio: 16 / 7;
  }

  .dive-map-section {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .dive-shell-location .dive-body {
    padding-top: max(3.5rem, calc(env(safe-area-inset-top) + 2.5rem));
  }

  .dive-shell-location .dive-embed-map {
    min-height: 300px;
  }

  .dive-dot {
    width: 48px;
    height: 48px;
  }

  .dive-stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .dive-shell-cards .dive-body {
    padding-top: max(3.75rem, calc(env(safe-area-inset-top) + 2.75rem));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .dive-vision-headline {
    font-size: 1.5rem;
  }

  .dive-card-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .dive-plan-grid {
    gap: 0.55rem;
  }

  .dive-plan-card {
    min-height: 0;
  }

  .dive-plan-viewer-stage {
    max-height: min(32vh, 300px);
  }

  .dive-stack-thumbs {
    flex-wrap: nowrap;
  }

  .dive-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Modals — landscape split layout */
  .modal-panel-wide {
    width: min(960px, 90vw);
    padding: 1.5rem;
  }

  .modal-panel {
    width: min(520px, 55vw);
    max-height: calc(100dvh - 48px);
  }

  .dive-close,
  .modal-close {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Large iPad Pro landscape */
@media (orientation: landscape) and (min-width: 1180px) {
  .tab-panel-layout {
    grid-template-columns: minmax(320px, 32%) 1fr;
    gap: 1rem;
    padding: 0.85rem 1.75rem 1.15rem;
  }

  .banner-title { font-size: clamp(1.3rem, 2vw, 1.55rem); }
  .banner-logo {
    height: 4.15rem;
    max-width: min(28rem, 42vw);
  }
  .tab-hero-logo { height: 60px; }
  .tab-hero.tab-hero-branded .tab-hero-logo {
    height: auto;
    max-height: min(14cqh, 3.25rem);
  }

  .tab-btn { font-size: 0.95rem; padding: 0 1.75rem; }

  .tile-overlay h3 { font-size: 1.3rem; }
}

/* Short landscape (iPad split-screen) */
@media (orientation: landscape) and (min-width: 768px) and (max-height: 700px) {
  .tab-aside > .tab-hero {
    min-height: 160px;
  }

  .tab-hero.tab-hero-branded .tab-hero-logo {
    max-width: min(42cqw, 7.5rem);
    max-height: min(12cqh, 2.5rem);
  }

  .tab-hero.tab-hero-branded .tab-hero-inner {
    padding-top: clamp(2.25rem, 16cqh, 3.25rem);
  }

  .insight-strip {
    grid-template-columns: repeat(4, 1fr);
  }

  .insight-pill span { display: none; }
}

/* ── Admin desk ── */
.admin-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-banner);
}

.admin-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

.admin-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-tab {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--fg-line-strong, #b7d6de);
  background: var(--fg-white, #fff);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  min-height: 2.5rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: none;
  line-height: 1.2;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.admin-tab:hover {
  border-color: var(--fg-teal, #22849c);
  color: var(--fg-teal-dark, #176579);
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
}

.admin-tab.active {
  color: #fff;
  border-color: var(--fg-teal, #22849c);
  background: var(--fg-teal, #22849c);
  box-shadow: var(--fg-shadow, 0 10px 28px rgba(26, 106, 124, 0.07));
}

/* Knowledge base: misc/settings accent — distinct from teal operational inbox tabs */
.admin-tab.admin-tab-knowledge {
  margin-left: auto;
  color: #5c5346;
  border-color: #c4a574;
  background: #faf6ef;
}

.admin-tab.admin-tab-knowledge:hover {
  color: #1a2330;
  border-color: #a8894f;
  background: #f3ead9;
}

.admin-tab.admin-tab-knowledge.active {
  color: #faf6ef;
  border-color: #2a3140;
  background: #2a3140;
  box-shadow: inset 0 0 0 1px rgba(196, 165, 116, 0.35);
}

.admin-panel { display: none; }
.admin-panel.active { display: block; }

/*
  Chat tab: lock the Fulcrum support page into the viewport.
  Prior bug: panel used height: calc(100dvh - 14.5rem) while sitting BELOW
  topbar + intro + tabs, so compose was clipped below the fold and page
  scroll (or overflow:hidden ancestors) made Send unreachable.
*/
body.fg-body.admin-chat-open {
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

body.fg-body.admin-chat-open > .fg-topbar {
  flex-shrink: 0;
}

body.fg-body.admin-chat-open > .admin-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.fg-body.admin-chat-open > .fg-footer {
  display: none;
}

body.fg-body.admin-chat-open .admin-page {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 0.85rem;
  padding-bottom: 0.65rem;
}

body.fg-body.admin-chat-open .admin-page-intro,
body.fg-body.admin-chat-open .admin-tabs {
  flex-shrink: 0;
}

body.fg-body.admin-chat-open .admin-page-intro {
  margin-bottom: 0.45rem;
}

body.fg-body.admin-chat-open .admin-tabs {
  margin-bottom: 0.55rem;
}

@media (max-width: 800px) {
  /* Reclaim vertical space so compose stays in the iPhone viewport */
  body.fg-body.admin-chat-open .admin-page {
    padding-top: 0.5rem;
    padding-bottom: 0.35rem;
  }

  body.fg-body.admin-chat-open .admin-page-intro {
    margin-bottom: 0.3rem;
    gap: 0.35rem;
  }

  body.fg-body.admin-chat-open .admin-page-intro h1 {
    font-size: 1.15rem;
  }

  body.fg-body.admin-chat-open .admin-page-intro .muted,
  body.fg-body.admin-chat-open #admin-panel-chat .admin-panel-head > .muted {
    display: none;
  }

  body.fg-body.admin-chat-open .admin-project-switch {
    max-width: none;
    width: 100%;
  }

  body.fg-body.admin-chat-open .admin-tabs {
    margin-bottom: 0.35rem;
    gap: 0.3rem;
  }

  body.fg-body.admin-chat-open .admin-tab {
    padding: 0.4rem 0.7rem;
    min-height: 2.1rem;
    font-size: 0.78rem;
  }

  body.fg-body.admin-chat-open #admin-panel-chat .admin-panel-head {
    margin-bottom: 0.25rem;
  }

  body.fg-body.admin-chat-open #admin-panel-chat .admin-export-row {
    margin-top: 0.15rem;
  }

  body.fg-body.admin-chat-open #admin-panel-chat .admin-export-row .btn {
    min-height: 1.75rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
  }

  body.fg-body.admin-chat-open #admin-ai-status {
    display: none;
  }
}

#admin-panel-chat.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: hidden;
}

#admin-panel-chat .admin-panel-head {
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}

#admin-panel-chat .admin-panel-head h2 {
  margin-bottom: 0.1rem;
  font-size: 1.1rem;
}

#admin-panel-chat .admin-panel-head > .muted {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#admin-panel-chat .admin-export-row {
  margin-top: 0.3rem;
}

#admin-panel-chat .admin-chat-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
}

.admin-panel-head {
  margin-bottom: 1rem;
}

.admin-panel-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-card {
  background: var(--bg-panel);
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 520px;
  box-shadow: var(--fg-shadow, none);
}

.admin-chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
  min-height: 0;
  align-items: stretch;
}

.admin-chat-layout > * {
  min-height: 0;
}

.chat-threads {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: var(--radius);
  padding: 0.65rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 106, 122, 0.55) transparent;
  box-shadow: var(--fg-shadow, none);
}

.chat-threads-empty {
  margin: 0;
  padding: 1.35rem 0.85rem;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.45;
}

.chat-thread-btn {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--fg-line, var(--border));
  background: var(--fg-white, #fff);
  color: var(--text);
  text-align: left;
  padding: 0.75rem 0.8rem;
  border-radius: var(--radius-sm, 10px);
  box-shadow: inset 0 0 0 0 transparent;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-thread-btn:hover {
  background: var(--fg-elevated, #eef5f7);
  border-color: var(--fg-line-strong, #b7d6de);
}

.chat-thread-btn.is-active {
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
  border-color: #9fc5cf;
  box-shadow: inset 3px 0 0 var(--fg-teal, #22849c);
}

.chat-thread-btn.is-active:hover {
  background: rgba(34, 133, 157, 0.16);
  border-color: #9fc5cf;
}

.chat-thread-btn:focus-visible {
  outline: 2px solid var(--fg-teal, #22849c);
  outline-offset: 1px;
}

.chat-thread-avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
  border: 1px solid var(--fg-line-strong, #b7d6de);
  color: var(--fg-teal-dark, #176579);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.chat-thread-btn.is-active .chat-thread-avatar {
  background: rgba(34, 133, 157, 0.2);
  border-color: var(--fg-teal, #22849c);
}

.chat-thread-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.22rem;
  flex: 1;
  min-width: 0;
}

.chat-thread-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  min-width: 0;
}

.chat-thread-top .inbox-count {
  flex-shrink: 0;
}

.chat-thread-identity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.4rem;
  min-width: 0;
  flex: 1;
}

.chat-thread-name {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text, #1a2330);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.35;
}

.chat-thread-agency {
  color: var(--text-muted);
}

.chat-main {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-main-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}

.chat-main-active {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-main-head {
  flex-shrink: 0;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chat-main-head-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

/* Attach | messages (scroll) | suggestions — footer is compose only */
.chat-main-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(8.5rem, 10rem) minmax(0, 1fr) minmax(9.5rem, 12rem);
  align-items: stretch;
  overflow: hidden;
}

.chat-main-body > .desk-chat-thread {
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-column: 2;
}

/* Reclaim space when no suggestions are shown */
.chat-main-body:not(:has(.chat-suggestions:not(.hidden))) {
  grid-template-columns: minmax(8.5rem, 10rem) minmax(0, 1fr);
}

.chat-main-body:not(:has(.chat-suggestions:not(.hidden))) .chat-suggest-sidebar {
  display: none;
}

.chat-attach-sidebar {
  grid-column: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.45rem;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: rgba(34, 133, 157, 0.04);
}

.chat-suggest-sidebar {
  grid-column: 3;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.4rem 0.55rem;
  border-left: 1px solid var(--border);
  overflow: hidden;
  background: rgba(168, 146, 92, 0.04);
}

.chat-suggest-sidebar .chat-suggestions {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  background: transparent;
}

.chat-suggest-sidebar .chat-suggestions.hidden {
  display: none;
}

.chat-suggest-sidebar .chat-suggestion-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  flex-direction: column;
  flex-wrap: nowrap;
  overflow-y: auto;
  overflow-x: hidden;
  gap: 0.35rem;
  padding-bottom: 0.15rem;
}

.chat-suggest-sidebar .chat-suggestion-chip {
  max-width: none;
  width: 100%;
  padding: 0.4rem 0.5rem;
}

.chat-suggest-sidebar .chat-suggestion-text {
  -webkit-line-clamp: 3;
  max-width: none;
  font-size: 0.7rem;
  line-height: 1.3;
}

.chat-suggest-sidebar .chat-suggestion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
  font-size: 0.6rem;
  color: var(--text-muted);
}

.chat-attach-sidebar .chat-dropzone {
  margin: 0;
  padding: 0.45rem 0.5rem;
  max-height: none;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.35rem;
  text-align: left;
  font-size: 0.68rem;
  line-height: 1.3;
  overflow: visible;
}

.chat-attach-sidebar .chat-dropzone-label {
  margin: 0;
}

.chat-attach-sidebar .chat-optimize-option {
  margin: 0;
  font-size: 0.64rem;
  gap: 0.3rem;
  align-items: flex-start;
}

.chat-attach-sidebar .chat-optimize-option span {
  line-height: 1.25;
}

.chat-attach-sidebar #chat-file-browse {
  align-self: stretch;
  min-height: 1.85rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.7rem;
}

.chat-attach-sidebar .chat-dropzone-status,
.chat-attach-sidebar .chat-pending-attachment {
  margin-top: 0;
}

.desk-chat-thread {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.desk-chat-log,
#admin-chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 1rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 106, 122, 0.55) transparent;
}

.desk-chat-log::-webkit-scrollbar,
#admin-chat-log::-webkit-scrollbar {
  width: 10px;
}

.desk-chat-log::-webkit-scrollbar-thumb,
#admin-chat-log::-webkit-scrollbar-thumb {
  background: rgba(90, 106, 122, 0.4);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.desk-chat-log::-webkit-scrollbar-track,
#admin-chat-log::-webkit-scrollbar-track {
  background: transparent;
}

#admin-chat-log {
  flex: 1 1 0;
}

#admin-chat-log .desk-chat-bubble {
  min-width: 0;
}

#admin-chat-log img {
  max-height: 8rem;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.chat-jump-latest {
  position: absolute;
  bottom: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(26, 35, 48, 0.12);
  min-height: 2.25rem;
  white-space: nowrap;
}

.chat-jump-latest:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.chat-jump-latest.hidden {
  display: none;
}

/* Compact tool-modal headers — Chat / Book / Video / Gallery */
#book-unit-modal .modal-panel > .eyebrow,
#gallery-visit-modal .modal-panel > .eyebrow,
#expert-call-modal .expert-call-intro .eyebrow,
#desk-chat-modal .desk-chat-header .eyebrow {
  font-size: 0.52rem;
  letter-spacing: 0.16em;
  margin: 0 0 0.12rem;
  line-height: 1.2;
}

#book-unit-modal .modal-panel > h2,
#gallery-visit-modal .modal-panel > h2,
#expert-call-modal .expert-call-intro h2,
#desk-chat-modal .desk-chat-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

#book-unit-modal .modal-panel > .modal-lead,
#gallery-visit-modal .modal-panel > .modal-lead,
#expert-call-modal .expert-call-intro .modal-lead,
#desk-chat-modal .desk-chat-header .modal-lead {
  margin: 0.12rem 0 0.85rem;
  font-size: 0.74rem;
  line-height: 1.35;
}

#expert-call-modal .expert-call-intro {
  margin-bottom: 0.15rem;
  padding-right: 2.25rem;
}

/* Agent desk chat: sidebar (topic + attach) | full-height transcript + compose.
   Height must fit inside .modal padding or the header + X clip off-screen. */
#desk-chat-modal .modal-panel {
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  height: min(calc(100dvh - 1.5rem), 54rem);
  max-height: calc(100dvh - 1.5rem);
  overflow: hidden;
  padding: 0.7rem 1rem 0;
}

#desk-chat-modal .modal-close {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-panel, #fff) 88%, #1a2330);
  color: var(--text, #1a2330);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#desk-chat-modal .desk-chat-header {
  flex-shrink: 0;
  padding-right: 2.5rem;
  margin-bottom: 0.4rem;
}

#desk-chat-modal .desk-chat-header .modal-lead {
  margin: 0.1rem 0 0;
}

#desk-chat-modal .desk-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

#desk-chat-modal .desk-chat-sidebar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

#desk-chat-modal .desk-chat-sidebar .tool-context-fields {
  margin: 0;
  min-width: 0;
}

#desk-chat-modal .desk-chat-sidebar .tool-context-fields-project {
  margin-bottom: 0;
}

#desk-chat-modal .desk-chat-sidebar .tool-project-field {
  gap: 0.2rem;
  font-size: 0.72rem;
}

#desk-chat-modal .desk-chat-sidebar .tool-project-select {
  min-height: 2.35rem;
  font-size: 0.88rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  padding-right: 2.25rem;
  background-size: 12px 12px;
  background-position: right 10px center;
}

#desk-chat-modal .desk-chat-sidebar .chat-dropzone {
  margin: 0;
  padding: 0.45rem 0.55rem;
  max-height: none;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.35rem;
  font-size: 0.68rem;
  line-height: 1.25;
  text-align: left;
  min-height: 0;
}

#desk-chat-modal .desk-chat-sidebar .chat-dropzone-label {
  margin: 0;
  min-width: 0;
}

#desk-chat-modal .desk-chat-sidebar .chat-optimize-option {
  margin: 0;
  font-size: 0.64rem;
  gap: 0.3rem;
}

#desk-chat-modal .desk-chat-sidebar #agent-chat-file-browse {
  align-self: flex-start;
  min-height: 1.85rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.7rem;
}

#desk-chat-modal .desk-chat-sidebar .chat-dropzone-status,
#desk-chat-modal .desk-chat-sidebar .chat-pending-attachment {
  margin-top: 0;
}

#desk-chat-modal .desk-chat-main {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#desk-chat-modal .desk-chat-thread {
  flex: 1 1 auto;
  min-height: 0; /* shrink first so header/close/compose never clip */
}

#desk-chat-modal .desk-chat-log {
  padding: 0.45rem 0.15rem 0.85rem;
  gap: 0.4rem;
}

#desk-chat-modal .desk-chat-compose {
  flex-shrink: 0;
  padding: 0.45rem 0 max(0.55rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border, #e2e6ea);
  gap: 0.4rem;
}

#desk-chat-modal .desk-chat-compose textarea {
  min-height: 2.25rem;
  font-size: 0.88rem;
}

/* Wide / landscape: topic + dropzone in left sidebar; transcript uses full height */
@media (min-width: 720px) {
  #desk-chat-modal .desk-chat-body {
    flex-direction: row;
    align-items: stretch;
    gap: 0.75rem;
  }

  #desk-chat-modal .desk-chat-sidebar {
    flex: 0 0 13.5rem;
    width: 13.5rem;
    padding-right: 0.65rem;
    border-right: 1px solid var(--border, #e2e6ea);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #desk-chat-modal .desk-chat-sidebar .chat-dropzone {
    flex: 1 1 auto;
    justify-content: center;
  }

  #desk-chat-modal .desk-chat-main {
    flex: 1 1 auto;
  }
}

/* Narrow / iPad portrait: compact stacked controls above the transcript */
@media (max-width: 719px) {
  #desk-chat-modal .desk-chat-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.4rem 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border, #e2e6ea);
  }

  #desk-chat-modal .desk-chat-sidebar .tool-context-fields {
    flex: 1 1 100%;
  }

  #desk-chat-modal .desk-chat-sidebar .chat-dropzone {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.45rem;
    padding: 0.35rem 0.5rem;
  }

  #desk-chat-modal .desk-chat-sidebar .chat-dropzone-label {
    flex: 1 1 8rem;
  }

  #desk-chat-modal .desk-chat-sidebar .chat-optimize-option {
    flex: 1 1 100%;
  }

  #desk-chat-modal .desk-chat-sidebar .chat-dropzone-status,
  #desk-chat-modal .desk-chat-sidebar .chat-pending-attachment {
    flex: 1 1 100%;
  }
}

.desk-chat-empty {
  margin: auto;
  text-align: center;
}

.desk-chat-msg {
  display: flex;
}

.desk-chat-msg-agent { justify-content: flex-end; }
.desk-chat-msg-admin { justify-content: flex-start; }

.desk-chat-bubble {
  max-width: 85%;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.35;
}

#desk-chat-modal .desk-chat-bubble {
  padding: 0.35rem 0.55rem;
  border-radius: 9px;
  font-size: 0.78rem;
  line-height: 1.35;
}

#desk-chat-modal .desk-chat-bubble p {
  margin: 0 0 0.2rem;
}

#desk-chat-modal .desk-chat-time {
  margin-top: 0.15rem;
  font-size: 0.62rem;
}

.desk-chat-msg-agent .desk-chat-bubble {
  background: var(--project-accent-soft);
  border: 1px solid color-mix(in srgb, var(--project-accent) 35%, transparent);
}

.desk-chat-msg-admin .desk-chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.desk-chat-bubble p { margin: 0 0 0.35rem; }
.desk-chat-time {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.desk-chat-attach {
  display: block;
  margin-top: 0.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  font-size: 0.8rem;
  word-break: break-all;
}

.desk-chat-attach-img img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 6px;
}

.desk-chat-compose {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem 0.65rem;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-main-footer {
  flex: 0 0 auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
}

.chat-main-footer .desk-chat-compose {
  flex: 0 0 auto;
  flex-shrink: 0;
}

.desk-chat-compose textarea {
  flex: 1;
  margin: 0;
  resize: none;
  min-height: 2.35rem;
  max-height: 4.5rem;
}

.desk-chat-profile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.chat-dropzone {
  margin: 0.5rem 1rem 0;
  padding: 0.65rem 0.75rem;
  border: 2px dashed color-mix(in srgb, var(--project-accent) 35%, transparent);
  border-radius: 10px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
  max-height: 7rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  background: var(--fg-white);
}

.chat-dropzone > * {
  pointer-events: none;
}

.chat-dropzone .chat-pending-attachment,
.chat-dropzone .chat-attach-clear,
.chat-dropzone #chat-file-browse,
.chat-dropzone #chat-file-input {
  pointer-events: auto;
}

.chat-dropzone .chat-optimize-option,
#desk-chat-modal .chat-optimize-option {
  pointer-events: auto;
}

.chat-optimize-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.chat-optimize-option input {
  accent-color: var(--gold);
}

.chat-dropzone.is-dragover {
  border-color: var(--gold);
  background: var(--project-accent-soft);
  color: var(--text);
}

.chat-dropzone.is-uploading {
  border-color: var(--gold);
  background: var(--project-accent-soft);
  color: var(--text);
  pointer-events: none;
}

.chat-dropzone p { margin: 0; }

.chat-dropzone-status {
  margin-top: 0.35rem !important;
  color: var(--gold);
  font-weight: 500;
}

.desk-chat-attach-file {
  display: inline-block;
  max-width: 100%;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  background: rgba(168, 146, 92, 0.12);
  word-break: break-word;
}

.desk-chat-attach-open {
  border: 0;
  font: inherit;
  color: var(--gold);
  cursor: pointer;
  text-align: left;
}

.desk-chat-attach-open:active {
  opacity: 0.85;
}

.chat-attach-viewer {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: #0a0c10;
}

.chat-attach-viewer[hidden] {
  display: none !important;
}

body.chat-attach-open {
  overflow: hidden;
}

.chat-attach-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding:
    max(0.75rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    0.75rem
    max(1rem, env(safe-area-inset-left));
  background: #0a0c10;
  border-bottom: 1px solid var(--border);
}

.chat-attach-back {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0 1rem;
  border: 1px solid rgba(168, 146, 92, 0.45);
  border-radius: 999px;
  background: rgba(168, 146, 92, 0.15);
  color: var(--gold);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chat-attach-back:active {
  background: rgba(201, 169, 98, 0.35);
}

.chat-attach-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-attach-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #111;
}

.chat-attach-body.is-image {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: #0a0c10;
}

.chat-attach-body.is-video {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: #0a0c10;
}

.chat-attach-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.chat-attach-frame[hidden],
.chat-attach-image[hidden],
.chat-attach-video[hidden] {
  display: none !important;
}

.chat-attach-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  touch-action: pan-x pan-y pinch-zoom;
}

.chat-attach-video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #000;
}

.desk-chat-attach-video {
  border-color: rgba(168, 146, 92, 0.35);
}

#desk-chat-modal .chat-dropzone > * {
  pointer-events: none;
}

#desk-chat-modal .chat-pending-attachment,
#desk-chat-modal #agent-chat-file-browse,
#desk-chat-modal #agent-chat-file-input,
#desk-chat-modal .chat-attach-clear,
#desk-chat-modal .chat-optimize-option {
  pointer-events: auto;
}

#desk-chat-modal .chat-pending-attachment .desk-chat-attach-img img {
  max-height: 2.5rem;
}

button.desk-chat-attach-img {
  border: 0;
  padding: 0;
  margin-top: 0.35rem;
  background: transparent;
  cursor: pointer;
  display: block;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.chat-attach-footer {
  flex: 0 0 auto;
  padding:
    0.75rem
    max(1rem, env(safe-area-inset-right))
    max(0.85rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: #0a0c10;
  border-top: 1px solid var(--border);
}

.chat-attach-footer .btn {
  min-height: 3rem;
  font-size: 1rem;
  touch-action: manipulation;
}

.chat-pending-attachment {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
}

.chat-pending-attachment .desk-chat-attach {
  margin-top: 0;
  min-width: 0;
}

.chat-pending-attachment .desk-chat-attach-img img {
  max-height: 3.5rem;
  max-width: min(10rem, 100%);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.chat-attach-clear {
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  cursor: pointer;
}

@media (max-width: 800px) {
  .admin-chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .desk-chat-profile { grid-template-columns: 1fr; }

  .chat-threads {
    max-height: 5.5rem;
    flex: 0 0 auto;
  }

  /* When a thread is open, shrink the list so transcript + compose get the viewport */
  .admin-chat-layout:has(#chat-main-active:not(.hidden)) .chat-threads {
    max-height: 3rem;
  }

  .chat-main {
    min-height: 0;
    height: auto;
    flex: 1 1 auto;
  }

  .chat-main-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(10rem, 1fr) auto;
    flex: 1 1 auto;
    min-height: 0;
  }

  .chat-main-body > .desk-chat-thread {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 10rem;
  }

  .chat-attach-sidebar {
    grid-column: 1;
    grid-row: 2;
    width: auto;
    max-height: 5.5rem;
    border-right: 0;
    border-top: 1px solid var(--border);
    padding: 0.35rem;
    overflow: auto;
  }

  .chat-suggest-sidebar {
    grid-column: 2;
    grid-row: 2;
    max-height: 5.5rem;
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    padding: 0.35rem;
  }

  .chat-attach-sidebar .chat-dropzone {
    flex: 0 0 auto;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem;
    max-height: none;
  }

  .chat-attach-sidebar .chat-dropzone-label {
    font-size: 0.62rem;
  }

  .chat-attach-sidebar .chat-optimize-option {
    display: none;
  }

  .chat-attach-sidebar #chat-file-browse {
    min-height: 1.5rem;
    padding: 0.12rem 0.35rem;
    font-size: 0.62rem;
  }

  .chat-suggest-sidebar .chat-suggestion-list {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: 4rem;
  }

  .chat-suggest-sidebar .chat-suggestion-chip {
    width: auto;
    max-width: 9rem;
  }

  .chat-suggest-sidebar .chat-suggestion-text {
    -webkit-line-clamp: 2;
  }

  .chat-suggest-sidebar .chat-suggestion-meta {
    display: none;
  }

  .chat-main-body:not(:has(.chat-suggestions:not(.hidden))) {
    grid-template-columns: 1fr;
  }

  .chat-main-body:not(:has(.chat-suggestions:not(.hidden))) .chat-attach-sidebar {
    grid-column: 1 / -1;
  }

  .chat-main-footer {
    max-height: none;
  }

  .desk-chat-compose {
    padding: 0.35rem 0.65rem max(0.45rem, env(safe-area-inset-bottom));
  }

  .desk-chat-compose textarea {
    min-height: 2.1rem;
    max-height: 3.5rem;
  }

  .chat-main-footer .desk-chat-compose {
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom));
  }
}

/* Agent login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
  background: var(--bg);
}

.login-card {
  width: min(400px, 100%);
  padding: 1.75rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.login-logo {
  max-height: 3rem;
  margin: 0 auto 1rem;
  display: block;
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  font-size: 1.5rem;
}

.login-lead {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 1.25rem;
}

.login-form {
  display: grid;
  gap: 0.85rem;
  text-align: left;
}

.login-hint {
  margin: 1rem 0 0;
  font-size: 0.75rem;
}

.login-hint code {
  color: var(--gold);
}

.agent-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 1rem;
  background: rgba(168, 146, 92, 0.08);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.agent-bar-label strong {
  color: var(--gold);
}

.agent-logout-form {
  margin: 0;
}

.agent-logout-form .btn {
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
}

.admin-export-row {
  margin: 0.75rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.admin-ai-status {
  font-size: 0.78rem;
}

.admin-shell {
  min-height: 0;
  background: transparent;
}

/* Page title under shared Fulcrum topbar (matches portal/PM section heads) */
.admin-page-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.85rem;
}

.admin-page-intro-text {
  min-width: 0;
}

.admin-page-intro h1 {
  margin: 0;
  font-family: var(--font-serif, var(--fg-display, inherit));
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text, var(--fg-ink));
  line-height: 1.2;
}

.admin-page-intro .muted {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.admin-project-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
  margin: 0;
  max-width: 28rem;
}

.admin-project-switch label {
  flex: 1 1 12rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.admin-project-switch select {
  margin-top: 0.25rem;
  min-height: 2.35rem;
}

#admin-panel-knowledge.active {
  display: block;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

.knowledge-form-card h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.knowledge-topic-field {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.knowledge-topic-field select,
.knowledge-project-select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}

.knowledge-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.knowledge-list-head h3 {
  margin: 0;
}

.knowledge-filter-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.knowledge-filter-field select {
  min-width: 10rem;
  font-size: 0.82rem;
}

.knowledge-topic-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #2a3140;
  background: #ebe4d6;
  border: 1px solid #c4a574;
}

.knowledge-topic-chip.is-general {
  color: #5c5346;
  background: #faf6ef;
  border-color: #d4c4a8;
}

.knowledge-dropzone {
  margin-bottom: 1.25rem;
  padding: 1.5rem 1.25rem;
  border: 2px dashed rgba(168, 146, 92, 0.4);
  border-radius: 12px;
  text-align: center;
  background: rgba(168, 146, 92, 0.04);
  transition: border-color 0.15s, background 0.15s;
}

.knowledge-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.knowledge-dropzone-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 0.15rem;
  opacity: 0.85;
}

.knowledge-dropzone-label {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.knowledge-dropzone-hint {
  margin: 0;
  font-size: 0.78rem;
}

.knowledge-dropzone-status {
  margin: 0.25rem 0 0 !important;
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 500;
}

.knowledge-dropzone.is-dragover {
  border-color: var(--gold);
  background: rgba(168, 146, 92, 0.12);
}

.knowledge-dropzone.is-uploading {
  border-color: var(--gold);
  background: rgba(168, 146, 92, 0.15);
  pointer-events: none;
  opacity: 0.9;
}

.knowledge-dropzone #knowledge-dropzone-browse,
.knowledge-dropzone #knowledge-file-input {
  pointer-events: auto;
}

#knowledge-dropzone-browse {
  margin-top: 0.5rem;
}

.knowledge-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.knowledge-form input,
.knowledge-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
}

.knowledge-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.knowledge-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.knowledge-import-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.knowledge-folder-path {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  word-break: break-all;
}

.knowledge-list-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
}

.knowledge-list-panel h3,
.knowledge-list-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.knowledge-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
}

.knowledge-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.knowledge-item-head strong {
  font-size: 0.88rem;
  line-height: 1.35;
}

.knowledge-delete {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.knowledge-delete:hover {
  color: #e88;
}

.knowledge-item-body {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.knowledge-item-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.knowledge-tag {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(168, 146, 92, 0.15);
  color: var(--gold);
}

.knowledge-item-link {
  font-size: 0.75rem;
  color: var(--gold);
}

.knowledge-scan-results {
  margin-top: 0.75rem;
}

.knowledge-scan-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 12rem;
  overflow-y: auto;
}

.knowledge-scan-add {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.25rem;
  cursor: pointer;
  border-radius: 6px;
}

.knowledge-scan-add:hover {
  background: rgba(168, 146, 92, 0.1);
  color: var(--gold);
}

.chat-suggestions {
  padding: 0.35rem 0.85rem 0;
  border-top: 0;
  background: rgba(168, 146, 92, 0.04);
  flex-shrink: 1;
  min-height: 0;
}

.chat-suggestions-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

.chat-suggestions-label {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.btn-suggest-refresh {
  min-height: 1.5rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.68rem;
}

.chat-suggestion-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-height: 3.85rem; /* ~2 chip rows */
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.chat-suggestion-chip {
  flex: 0 1 auto;
  max-width: 14rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  text-align: left;
  padding: 0.28rem 0.65rem;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chat-suggestion-chip:hover {
  border-color: var(--gold);
  background: rgba(168, 146, 92, 0.08);
}

.chat-suggestion-text {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
  max-width: 12rem;
}

.chat-suggestion-meta {
  display: none; /* single-line chips; source applied on select */
}

.chat-suggestion-link {
  color: var(--gold);
  margin-left: 0.35rem;
}

@media (max-width: 900px) {
  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  .knowledge-list-panel {
    max-height: none;
  }
}

.chat-thread-user {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  flex-shrink: 0;
}

/* ── Reservation wizard (iPad) ── */
.reservation-wizard-panel {
  width: min(640px, 100%);
  /* Fit inside .modal padding so the header + X are not clipped off-screen. */
  max-height: calc(100dvh - 2rem);
}

/* Always-visible close control — sticky so it stays reachable while scrolling;
   solid hit target for iPad (no hover-only affordance). Matches desk-chat X. */
#book-unit-modal .modal-close {
  position: sticky;
  float: right;
  top: 0.15rem;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  margin: 0 0 0.35rem 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-panel, #fff) 88%, #1a2330);
  color: var(--text, #1a2330);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#book-unit-modal .modal-close:active,
#book-unit-modal .modal-close:focus-visible {
  background: color-mix(in srgb, var(--bg-panel, #fff) 72%, #1a2330);
  outline: 2px solid var(--gold, #c4a35a);
  outline-offset: 2px;
}

#book-unit-modal .modal-panel > .eyebrow,
#book-unit-modal .modal-panel > h2,
#book-unit-modal .modal-panel > .modal-lead {
  padding-right: 3rem;
}

.res-wizard-progress {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  margin: 0.75rem 0 1rem;
}

.res-wizard-progress[hidden] {
  display: none;
}

.res-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--border);
}

.res-step-dot.active,
.res-step-dot.done {
  background: var(--gold);
  border-color: var(--gold);
}

.res-wizard-templates {
  margin-bottom: 0.75rem;
}

.res-template-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.res-template-label {
  font-size: 0.8rem;
  margin: 0;
}

.res-step-heading {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.res-type-choices {
  display: grid;
  gap: 0.75rem;
}

.res-type-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1rem 1.1rem;
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--fg-white);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

.res-type-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.res-type-card span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.res-type-card.is-selected {
  border-color: var(--gold);
  background: var(--project-accent-soft);
}

.res-search-label input {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  margin-top: 0.35rem;
}

.res-unit-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.res-unit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  width: 100%;
  min-height: 56px;
  padding: 0.75rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.res-unit-row:last-child {
  border-bottom: 0;
}

.res-unit-row:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.res-unit-row.is-selected {
  background: rgba(212, 184, 122, 0.15);
}

.res-unit-code {
  font-weight: 600;
  font-size: 1.05rem;
}

.res-unit-meta {
  flex: 1;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.res-unit-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.res-unit-empty {
  padding: 1rem;
  text-align: center;
}

.res-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.75rem;
}

.res-form-grid .res-full-width {
  grid-column: 1 / -1;
}

.res-form-grid input,
.res-form-grid textarea,
.res-payment-fields input {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  margin-top: 0.35rem;
}

.res-capture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.res-capture-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}

.res-capture-label {
  font-weight: 500;
  margin: 0 0 0.5rem;
}

.res-capture-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 140px;
  cursor: pointer;
  touch-action: manipulation;
}

.res-capture-preview {
  margin-bottom: 0.5rem;
}

.res-capture-preview img {
  max-width: 100%;
  max-height: 120px;
  border-radius: 6px;
  object-fit: cover;
}

.res-capture-preview span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.res-file-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

.res-payment-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.75rem;
}

.res-signature-wrap {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  margin-top: 0.5rem;
}

#res-signature-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.res-sig-clear {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  min-height: 40px;
}

.res-review-list {
  margin: 0 0 1rem;
}

.res-review-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.res-review-list dt {
  color: var(--text-muted);
  font-weight: 400;
}

.res-review-list dd {
  margin: 0;
  text-align: right;
}

.res-wizard-nav {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.res-wizard-nav .btn {
  min-height: 48px;
  min-width: 100px;
  touch-action: manipulation;
}

.res-hold-countdown {
  font-size: 1.1rem;
  text-align: center;
  margin-top: 0.5rem;
}

.res-admin-status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.res-status-hold {
  color: #d4b87a;
}

.res-status-booked {
  color: #8fd49b;
}

.res-admin-attachments {
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.res-admin-attachments a {
  color: var(--gold);
}

.res-admin-countdown {
  font-weight: 500;
  margin: 0.25rem 0 0.5rem;
}

.res-agent-holds {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--fg-teal-soft, rgba(34, 133, 157, 0.08));
}

.res-holds-heading {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.res-holds-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.res-holds-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.65rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.res-holds-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.65rem;
  flex: 1;
  min-width: 0;
}

.res-holds-unit {
  font-variant-numeric: tabular-nums;
}

.res-holds-status {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-teal, #22849c);
}

.res-holds-status.is-booked {
  color: var(--muted, #6b7280);
}

.res-holds-expiry {
  font-size: 0.8rem;
}

.res-hold-release {
  min-height: 40px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.res-terms-scroll {
  max-height: 38vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.75rem 0;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
  line-height: 1.45;
}

.res-terms-title {
  text-align: center;
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  text-decoration: underline;
  letter-spacing: 0.04em;
}

.res-terms-clause {
  margin: 0 0 0.65rem;
}

.res-terms-num {
  font-weight: 600;
}

.res-terms-acceptance {
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.res-terms-accept {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
}

.res-terms-accept input {
  margin-top: 0.2rem;
  min-width: 20px;
  min-height: 20px;
}

.res-terms-accept.hidden {
  display: none;
}

.res-terms-sign-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.res-preview-pages {
  margin: 0 0 0.75rem 1.1rem;
  padding: 0;
  font-size: 0.85rem;
}

.res-terms-scroll-hint {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
}

.res-holds-item:last-child {
  border-bottom: 0;
}

.res-unit-detail-card {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(212, 184, 122, 0.08);
}

.res-unit-detail-title {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--gold);
}

.res-unit-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.88rem;
}

.res-unit-detail-grid dt {
  color: var(--text-muted);
  font-weight: 400;
}

.res-unit-detail-grid dd {
  margin: 0;
}

.res-capture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.res-capture-actions.hidden {
  display: none;
}

.res-capture-retake {
  margin-top: 0.5rem;
  width: 100%;
  min-height: 44px;
  touch-action: manipulation;
}

.res-capture-single {
  margin-bottom: 0.75rem;
}

.res-booking-ref {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.res-form-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 50vh;
  overflow-y: auto;
}

.res-form-preview-inner h3 {
  margin: 0.25rem 0;
  font-size: 1.1rem;
}

.res-form-preview-sig img {
  max-width: 100%;
  max-height: 120px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 0.35rem;
}

.res-hold-summary {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.res-status-pending {
  color: #7eb8e8;
}

.res-admin-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.res-admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.res-admin-tab {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--fg-line-strong, var(--border));
  border-radius: 999px;
  background: var(--fg-white, #fff);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.res-admin-tab.active {
  color: #fff;
  border-color: var(--fg-teal, var(--gold));
  background: var(--fg-teal, var(--gold));
}

.res-admin-tab-count {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.res-admin-panel-hint {
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.res-admin-edit-form {
  margin: 0.75rem 0 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.res-admin-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
}

.res-admin-edit-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
}

.res-admin-edit-grid input,
.res-admin-edit-grid textarea {
  font: inherit;
  font-size: 0.88rem;
}

.res-admin-edit-notes {
  grid-column: 1 / -1;
}

.res-admin-section h3 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  color: var(--text-muted);
}

.res-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.res-admin-booked-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.res-admin-booked-bar .res-admin-attachments {
  margin: 0;
  flex: 1 1 14rem;
}

.res-admin-actions.res-admin-submit-wrap {
  flex-direction: column;
  align-items: flex-end;
  margin-top: 0;
  max-width: 18rem;
}

.res-admin-submit-processing {
  border-color: var(--fg-teal, #22849c);
  color: var(--fg-teal-dark, #176579);
  background: #fff;
}

.res-admin-submit-processing:hover:not(:disabled),
.res-admin-submit-processing:focus-visible:not(:disabled) {
  background: var(--fg-teal-soft, rgba(55, 190, 202, 0.14));
  border-color: var(--fg-teal-dark, #176579);
  outline: none;
}

.res-admin-submit-processing:disabled {
  opacity: 0.75;
  cursor: default;
}

.res-admin-submit-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: right;
}

@media (max-width: 540px) {
  .res-form-grid,
  .res-capture-grid,
  .res-payment-fields,
  .res-admin-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════
   Agent pages — iPad / touch primary
   ══════════════════════════════════════════ */
@media (hover: none), (pointer: coarse) {
  .explore-tile:hover {
    transform: none;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.7) inset,
      0 6px 16px rgba(34, 132, 156, 0.1);
    border-color: color-mix(in srgb, var(--fg-primary, #22849c) 26%, var(--fg-line, #d8dfdf));
  }

  .explore-tile:active {
    transform: translateY(-1px) scale(0.992);
    border-color: var(--fg-primary, #22849c);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.55) inset,
      0 10px 22px rgba(34, 132, 156, 0.16);
  }

  .fg-guide-card:hover,
  .fg-project-card:hover {
    transform: none;
  }

  .fg-project-card:active {
    transform: translateY(-1px) scale(0.995);
    border-color: var(--fg-primary, #22849c);
    box-shadow: var(--fg-shadow-lg);
  }

  .tab-btn {
    min-height: 48px;
    padding: 0 1rem;
    font-size: 0.88rem;
  }

  .tile-overlay {
    padding: 1rem 1.05rem 1.1rem;
  }

  .tile-overlay h3 {
    font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  }

  .tile-overlay p {
    font-size: 0.86rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.82);
  }

  .tile-cta {
    font-size: 0.78rem;
    margin-top: 0.15rem;
  }

  .tile-play {
    width: 3.75rem;
    height: 3.75rem;
  }

  .project-tools-rail .rail-home,
  .project-tools-rail .rail-btn {
    min-height: 4rem;
    width: 4.35rem;
  }

  .banner-title {
    font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  }
}


/* Wide landscape tablets / custom sizes — keep 4-tile packs as 2×2 */
@media (orientation: landscape) and (min-width: 600px) {
  .tile-grid[data-tile-count="4"],
  #panel-project .tile-grid-hero-align[data-tile-count="4"],
  .tile-grid-hero-align[data-tile-count="4"] {
    --tile-cols: 2 !important;
    --tile-rows: 2 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Unit / floor plans on iPad & tablets — maximize fit-to-screen stage */
@media (min-width: 600px) and (max-width: 1400px) {
  .dive-shell-unit-layout .dive-media-tabs,
  .dive-shell-layout-plans .dive-media-tabs {
    padding-top: max(2.2rem, calc(env(safe-area-inset-top) + 1.35rem));
  }

  .dive-shell-unit-layout .dive-gallery-stage .dive-slide-plan,
  .dive-shell-layout-plans .dive-gallery-stage .dive-slide-plan,
  .dive-shell-unit-layout .dive-gallery-stage .dive-slide:has(img.dive-unit-plan-img),
  .dive-shell-layout-plans .dive-gallery-stage .dive-slide:has(img.dive-unit-plan-img) {
    inset: 0.35rem 0.85rem clamp(8.25rem, 24vh, 10.75rem);
  }

  .dive-shell-unit-layout .dive-gallery-footer,
  .dive-shell-layout-plans .dive-gallery-footer {
    padding-top: 0.55rem;
  }

  .dive-shell-unit-layout .dive-slide-plan img,
  .dive-shell-layout-plans .dive-slide-plan img,
  .dive-shell-unit-layout .dive-slide:has(img.dive-unit-plan-img) img,
  .dive-shell-layout-plans .dive-slide:has(img.dive-unit-plan-img) img,
  img.dive-unit-plan-img {
    object-fit: contain !important;
    max-width: 100% !important;
    max-height: 100% !important;
  }
}

@media (orientation: landscape) and (min-width: 600px) and (max-height: 900px) {
  .dive-shell-unit-layout .dive-gallery-stage .dive-slide-plan,
  .dive-shell-layout-plans .dive-gallery-stage .dive-slide-plan,
  .dive-shell-unit-layout .dive-gallery-stage .dive-slide:has(img.dive-unit-plan-img),
  .dive-shell-layout-plans .dive-gallery-stage .dive-slide:has(img.dive-unit-plan-img) {
    inset: 0.25rem 1rem clamp(7.75rem, 28vh, 9.75rem);
  }

  .dive-shell-unit-layout .dive-media-tabs,
  .dive-shell-layout-plans .dive-media-tabs {
    padding-top: max(1.85rem, calc(env(safe-area-inset-top) + 1.1rem));
  }
}

/* All iPad / tablet landscape toolkit (with left rail) */
@media (orientation: landscape) and (min-width: 600px) and (max-width: 1400px) {
  .project-shell {
    grid-template-columns: 5.4rem minmax(0, 1fr);
  }

  .project-tools-rail {
    gap: 0.45rem;
    padding: 0.55rem 0.3rem;
  }

  .project-tools-rail .rail-home,
  .project-tools-rail .rail-btn {
    width: 4.35rem;
    min-height: 3.55rem;
    font-size: 0.68rem;
  }

  /* 4-tile packs (Project Vision): 2×2, never a 1×4 strip */
  .tile-grid[data-tile-count="4"],
  #panel-project .tile-grid-hero-align[data-tile-count="4"],
  .tile-grid-hero-align[data-tile-count="4"] {
    --tile-cols: 2 !important;
    --tile-rows: 2 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  }

  .app-banner {
    padding: 0.5rem 1.1rem;
  }

  .app-tabs {
    padding: 0 0.35rem;
  }

  .tab-panel-layout {
    grid-template-columns: minmax(250px, 30%) minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.6rem 0.95rem 0.85rem;
  }

  .tab-panel-layout-tiles-only {
    padding: 0.55rem 0.85rem 0.8rem;
  }

  .tab-panel-layout-tiles-only .tile-grid {
    gap: 0.55rem;
    overflow: hidden;
  }

  .tab-panel-layout-tiles-only .explore-tile {
    border-radius: 14px;
  }

  #panel-project .tile-grid,
  #panel-thailand .tile-grid {
    gap: 0.55rem;
  }

  .explore-tile {
    border-radius: 14px;
  }
}

/* All iPad / tablet portrait — stack tiles with matched readable heights */
@media (orientation: portrait) and (min-width: 600px) {
  .project-shell {
    grid-template-columns: 5.05rem minmax(0, 1fr);
  }

  .project-tools-rail {
    flex-direction: column;
    width: auto;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid #9ec5d0;
    border-bottom: 0;
    padding: 0.55rem 0.3rem;
    gap: 0.4rem;
  }

  .project-tools-rail .rail-home,
  .project-tools-rail .rail-btn {
    width: 4.15rem;
    min-width: 0;
    min-height: 3.9rem;
    flex-direction: column;
    padding: 0.35rem 0.15rem;
    font-size: 0.58rem;
  }

  .tab-panel.active {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .tab-panel-layout,
  .tab-panel-layout-tiles-only,
  .tab-panel-layout-hero-tiles {
    --portrait-stack-gap: 0.7rem;
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    gap: var(--portrait-stack-gap) !important;
    padding: 0.55rem 0.75rem 0.85rem;
  }

  .tab-aside,
  .tab-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .tab-aside > .tab-hero,
  .tab-hero {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
  }

  #panel-project .tab-hero.tab-hero-branded,
  .tab-hero.tab-hero-branded {
    container-type: inline-size !important;
    overflow: hidden !important;
    aspect-ratio: 16 / 11 !important;
    min-height: 180px !important;
    margin: 0 !important;
    padding: 0.75rem 0.85rem 0.85rem !important;
    gap: 0.45rem !important;
    border-radius: 14px !important;
  }

  #panel-project .tab-hero.tab-hero-branded .tab-hero-inner,
  .tab-hero.tab-hero-branded .tab-hero-inner {
    flex: 0 0 auto !important;
    overflow: hidden !important;
    padding-top: clamp(2.5rem, 12cqh, 3.75rem) !important;
  }

  #panel-project .hero-stats,
  .tab-hero.tab-hero-branded .hero-stats {
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: 42% !important;
    overflow: hidden !important;
    gap: 0.35rem !important;
  }

  .tile-grid,
  .tile-grid.tile-grid-fill,
  .tile-grid-hero-align,
  .tab-panel-layout-tiles-only .tile-grid {
    --tile-cols: 1 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    grid-auto-rows: minmax(180px, auto) !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    gap: var(--portrait-stack-gap, 0.7rem) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    align-content: start !important;
  }

  .explore-tile,
  .explore-tile-featured,
  .tab-panel-layout-tiles-only .explore-tile,
  .tile-grid.tile-grid-fill .explore-tile,
  .tile-grid-hero-align .explore-tile,
  .tile-grid-hero-align .explore-tile-featured {
    aspect-ratio: 16 / 11 !important;
    min-height: 180px !important;
    max-height: none !important;
    height: auto !important;
    align-self: stretch !important;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    border-radius: 14px;
  }

  /* Facilities + Layouts portrait: stack column (overrides any fill leftovers) */
  #panel-facilities .tile-grid,
  #panel-facilities .tile-grid.tile-grid-fill,
  #panel-facilities .tab-panel-layout-tiles-only .tile-grid,
  #panel-layouts .tile-grid,
  #panel-layouts .tile-grid.tile-grid-fill,
  #panel-layouts .tab-panel-layout-tiles-only .tile-grid {
    --tile-cols: 1 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
    align-content: start !important;
    gap: 0.55rem !important;
  }

  #panel-facilities .explore-tile,
  #panel-facilities .explore-tile-featured,
  #panel-facilities .tab-panel-layout-tiles-only .explore-tile {
    aspect-ratio: unset !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  #panel-layouts .explore-tile,
  #panel-layouts .explore-tile-featured,
  #panel-layouts .tab-panel-layout-tiles-only .explore-tile {
    aspect-ratio: unset !important;
    width: 100% !important;
  }

  .app-tabs {
    gap: 0.15rem;
  }

  .tab-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 0.65rem;
  }
}

/* Project workspace — price list modal + PM multi-unit holds */
.price-list-latest {
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid rgba(34, 133, 157, 0.18);
  border-radius: 12px;
  background: rgba(34, 133, 157, 0.04);
}
.price-list-upload {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
}
.price-list-upload-heading {
  margin: 0.5rem 0 0;
  font-size: 1rem;
}
.price-list-file-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.price-list-file-label input[type="file"] {
  max-width: 100%;
}
.price-list-history-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.price-list-history-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
}
.pm-hold-section-label {
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.pm-hold-active {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.pm-hold-list,
.pm-hold-unit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  max-height: min(240px, 32vh);
  overflow: auto;
}
.pm-hold-unit-list {
  max-height: min(320px, 40vh);
  margin: 0.5rem 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 0.35rem;
}
.pm-hold-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(34, 133, 157, 0.06);
}
.pm-hold-item-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.65rem;
  align-items: baseline;
}
.pm-hold-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.pm-hold-toolbar input[type="search"] {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
}
.pm-hold-unit-row {
  display: grid;
  grid-template-columns: auto minmax(4rem, auto) 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}
.pm-hold-unit-row:hover { background: rgba(34, 133, 157, 0.06); }
.pm-hold-unit-row.is-selected { background: rgba(55, 190, 202, 0.14); }
.pm-hold-unit-row.is-blocked {
  opacity: 0.55;
  cursor: not-allowed;
}
.pm-hold-unit-code { font-weight: 600; }
.pm-hold-unit-meta {
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
}
.pm-hold-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}
.pm-hold-form {
  display: grid;
  gap: 0.65rem;
}
.pm-hold-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
}
.pm-hold-form input[type="text"],
.pm-hold-form select {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
}
.app-shell.is-pm .banner-actions-single .btn-banner {
  white-space: nowrap;
}

.app-shell.is-pm .banner-close-editor {
  border-color: rgba(26, 35, 48, 0.28);
  color: var(--fg-ink, #1a2330);
  background: var(--fg-white, #fff);
  font-weight: 600;
}

.app-shell.is-pm .banner-close-editor:hover,
.app-shell.is-pm .banner-close-editor:focus-visible {
  border-color: var(--fg-teal-dark, #176579);
  color: var(--fg-teal-dark, #176579);
  background: var(--fg-teal-soft, rgba(34, 133, 157, 0.1));
}

/* Quiet offline pack control on project workspace (not a page banner) */
.offline-pack-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin: 0.35rem auto 0;
  max-width: 1080px;
  padding: 0.15rem 0.15rem 0;
}
.offline-pack-bar .offline-pack-download {
  min-height: 1.85rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  flex: 0 0 auto;
}
.offline-pack-status {
  margin: 0;
  font-size: 0.72rem;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.offline-pack-status:empty {
  display: none;
}
.offline-pack-clear {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.35rem 0.55rem;
  margin: 0;
  min-height: 44px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #9b2c2c;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  flex: 0 0 auto;
  /* Always visible when not [hidden] — not hover-only */
  opacity: 1;
  pointer-events: auto;
}
.offline-pack-clear:hover,
.offline-pack-clear:focus-visible {
  color: #7a1f1f;
}
.offline-pack-clear[hidden] {
  display: none !important;
}
.offline-pack-clear.is-cancel {
  color: #1a6f84;
}
.offline-pack-bar.is-busy .offline-pack-status {
  color: #1a6f84;
  animation: btn-busy-pulse 1.15s ease-in-out infinite;
}
.offline-pack-bar.is-ready .offline-pack-status {
  color: #1a6f84;
}
.offline-pack-bar.is-error .offline-pack-status {
  color: #9b2c2c;
}
@media (prefers-reduced-motion: reduce) {
  .offline-pack-bar.is-busy .offline-pack-status {
    animation: none;
  }
}
@media (max-width: 720px) {
  .offline-pack-bar {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }
}

/* Final portrait safety net — all phones, iPads, and tablets in vertical layout */
@media (orientation: portrait), (max-width: 767px) {
  :root {
    --portrait-stack-gap: 0.7rem;
  }

  /* Vertical stack is taller than the viewport — scroll inside .app-main */
  .project-main.app-shell,
  .app-shell {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .app-main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
  }

  body.fg-body.project-workspace > .fg-agent-shell.has-tools-rail > .fg-agent-shell-main {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.fg-body.project-workspace .app-main {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .tab-panel.active,
  .tab-panel-layout,
  .tab-panel-layout-hero-tiles,
  .tab-panel-layout-tiles-only,
  .tab-aside,
  .tab-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* One stack gap everywhere: hero ↔ tiles == tile ↔ tile */
  .tab-panel-layout,
  .tab-panel-layout-tiles-only,
  #panel-project .tab-panel-layout-hero-tiles,
  .tab-panel-layout-hero-tiles {
    --portrait-stack-gap: 0.7rem;
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    align-content: start !important;
    align-items: stretch !important;
    gap: var(--portrait-stack-gap) !important;
    row-gap: var(--portrait-stack-gap) !important;
    column-gap: var(--portrait-stack-gap) !important;
  }

  #panel-project .tab-aside,
  #panel-project .tab-content,
  .tab-aside,
  .tab-content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  /*
    Match Project Vision hero to explore tiles:
    same 16/11 ratio; no extra margins (gap owns spacing).
  */
  #panel-project .tab-hero.tab-hero-branded,
  .tab-hero.tab-hero-branded {
    container-type: inline-size !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    aspect-ratio: 16 / 11 !important;
    height: auto !important;
    min-height: 180px !important;
    max-height: none !important;
    overflow: hidden !important;
    justify-content: flex-end !important;
    margin: 0 !important;
    padding: 0.75rem 0.85rem 0.85rem !important;
    gap: 0.4rem !important;
    border-radius: 14px !important;
    box-sizing: border-box !important;
  }

  #panel-project .tab-hero.tab-hero-branded .tab-hero-logo,
  .tab-hero.tab-hero-branded .tab-hero-logo {
    max-width: min(42cqw, 8rem) !important;
    max-height: min(12cqh, 2.75rem) !important;
  }

  #panel-project .tab-hero.tab-hero-branded .tab-hero-inner,
  .tab-hero.tab-hero-branded .tab-hero-inner {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding-top: clamp(2.5rem, 12cqh, 3.75rem) !important;
    gap: 0.15rem !important;
  }

  #panel-project .tab-hero.tab-hero-branded .tab-hero-inner h2 {
    font-size: clamp(1.25rem, 3.6cqw, 1.7rem) !important;
    line-height: 1.15 !important;
  }

  #panel-project .tab-hero.tab-hero-branded .tab-hero-tag {
    font-size: clamp(0.72rem, 2.2cqw, 0.85rem) !important;
    line-height: 1.3 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #panel-project .tab-hero.tab-hero-branded .hero-stats,
  .tab-hero.tab-hero-branded .hero-stats,
  #panel-project .hero-stats {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(0, 1fr) !important;
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: 40% !important;
    overflow: hidden !important;
    margin: 0 !important;
    gap: 0.35rem !important;
  }

  #panel-project .hero-stat,
  .hero-stat {
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0.35em 0.45em !important;
    gap: 0.2em !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(8, 28, 36, 0.08) !important;
  }

  #panel-project .hero-stat-value {
    font-size: clamp(0.82rem, 2.4cqw, 1.05rem) !important;
  }

  #panel-project .hero-stat-label {
    font-size: clamp(0.58rem, 1.7cqw, 0.68rem) !important;
    line-height: 1.2 !important;
  }

  .tab-aside > .tab-hero,
  .tab-hero {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .tile-grid,
  .tile-grid.tile-grid-fill,
  .tile-grid-hero-align,
  #panel-project .tile-grid-hero-align,
  .tab-panel-layout-tiles-only .tile-grid {
    --tile-cols: 1 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    grid-auto-rows: auto !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
    align-content: start !important;
    gap: var(--portrait-stack-gap, 0.7rem) !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .explore-tile,
  .explore-tile-featured,
  .tile-grid-hero-align .explore-tile,
  .tile-grid-hero-align .explore-tile-featured {
    aspect-ratio: 16 / 11 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 180px !important;
    max-height: none !important;
    margin: 0 !important;
  }

  /* Facilities + Layouts portrait: stack column (final override) */
  @media (min-width: 600px) {
    #panel-facilities .tile-grid,
    #panel-facilities .tile-grid.tile-grid-fill,
    #panel-facilities .tab-panel-layout-tiles-only .tile-grid,
    #panel-layouts .tile-grid,
    #panel-layouts .tile-grid.tile-grid-fill,
    #panel-layouts .tab-panel-layout-tiles-only .tile-grid {
      --tile-cols: 1 !important;
      grid-template-columns: minmax(0, 1fr) !important;
      grid-template-rows: none !important;
      height: auto !important;
      max-height: none !important;
      flex: 0 0 auto !important;
      overflow: visible !important;
      align-content: start !important;
      gap: 0.55rem !important;
    }

    #panel-facilities .explore-tile,
    #panel-facilities .explore-tile-featured {
      aspect-ratio: unset !important;
      width: 100% !important;
      overflow: hidden !important;
    }

    #panel-layouts .explore-tile,
    #panel-layouts .explore-tile-featured {
      aspect-ratio: unset !important;
      width: 100% !important;
    }
  }
}
